Skip to content

Add mkl::linalg_svd relative Ops #1511

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

Add mkl::linalg_svd relative Ops #1511

wants to merge 13 commits into from

Conversation

yucai-intel
Copy link
Contributor

@yucai-intel yucai-intel commented Mar 26, 2025

  • linalg_svd
  • linalg_svd.U

@yucai-intel
Copy link
Contributor Author

yucai-intel commented Mar 27, 2025

Test cases related to complex data types fail because onednn does not support it.
image
image

@yucai-intel yucai-intel changed the title [WIP] Add mkl::linalg_svd relative Ops Add mkl::linalg_svd relative Ops Apr 9, 2025
@yucai-intel yucai-intel requested a review from CuiYifeng April 11, 2025 01:53
Copy link
Contributor

@CuiYifeng CuiYifeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please reactivate some skipped cases such as https://github.com/intel/torch-xpu-ops/blob/main/test/xpu/skip_list_common.py#L1397. Otherwise, CI cannot test with these svd cases.

Comment on lines 1 to 17
#if defined(USE_ONEMKL)
#include <ATen/native/BatchLinearAlgebra.h>
#include <ATen/native/DispatchStub.h>
#include <ATen/native/Resize.h>
#include <ATen/native/TensorIterator.h>
#include <ATen/native/xpu/mkl/BatchLinearAlgebra.h>

#include <ATen/ops/_linalg_svd.h>
#include <ATen/ops/_linalg_svd_meta.h>
#include <ATen/ops/_linalg_svd_native.h>

namespace at::native {

REGISTER_XPU_DISPATCH(svd_stub, &native::xpu::svd_mkl);

} // namespace at::native
#endif // USE_ONEMKL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When USE_ONEMKL=OFF, how can we call linalg_svd on XPU?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yucai-intel _linalg_svd.U is registered directly instead of using stub. All svd related changes has been removed from native_functions.yaml.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For ops registered to stub, we will keep their fallback in XPUFallback.template for USE_ONEMKL=OFF.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added float64 related test cases.
Local tests are all passed or automatically skipped.

@CuiYifeng CuiYifeng force-pushed the slogdet branch 3 times, most recently from 2a0518c to 56cebb3 Compare April 25, 2025 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants