-
Notifications
You must be signed in to change notification settings - Fork 40
Enable _linalg_det
, _linalg_slogdet
and _linalg_solve_ex
related operations on xpu
#1660
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request introduces optimized XPU-specific support for determinant and sign/log-determinant operations by dispatching to dedicated XPU kernels and removing fallbacks. It also updates the test suite and skip lists accordingly to reflect the new support.
- Added YAML entries for _linalg_det and _linalg_slogdet with structured delegates and XPU-specific dispatch.
- Updated test files to include new LU-family and LU-solve tests while removing obsolete fallback tests.
- Removed fallback implementations and adjusted skip lists in test files.
Reviewed Changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
yaml/native/native_functions.yaml | Added structured function entries for _linalg_det and _linalg_slogdet with XPU dispatch support. |
test/xpu/test_linalg_xpu.py | Introduced new tests for LU-family and LU-solve operations; refactored imports and test registration. |
test/xpu/skip_list_common.py | Removed skip tests related to linalg_det and linalg_slogdet operations. |
src/ATen/native/xpu/mkl/BatchLinearAlgebra.h | Defined new MKL-based linear algebra function prototypes for XPU. |
src/ATen/native/xpu/BatchLinearAlgebra.cpp | Added XPU kernel implementations for SVD, LU solve, and LU factor with CPU fallback support. |
Files not reviewed (1)
- src/ATen/native/xpu/XPUFallback.template: Language not supported
_linalg_det
and _linalg_slogdet
related operations on xpu_linalg_det
, _linalg_slogdet
and _linalg_solve_ex
related operations on xpu
a33b0a8
to
a37b03e
Compare
yaml/native/native_functions.yaml
Outdated
- func: lu_unpack(Tensor LU_data, Tensor LU_pivots, bool unpack_data=True, bool unpack_pivots=True) -> (Tensor P, Tensor L, Tensor U) | ||
structured_delegate: lu_unpack.out | ||
variants: function | ||
|
||
- func: lu_unpack.out(Tensor LU_data, Tensor LU_pivots, bool unpack_data=True, bool unpack_pivots=True, *, Tensor(a!) P, Tensor(b!) L, Tensor(c!) U) -> (Tensor(a!) P, Tensor(b!) L, Tensor(c!) U) | ||
variants: function | ||
structured: True | ||
dispatch: | ||
CPU, CUDA: lu_unpack_out |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@huiyan2021 Some missing code, right? Found in the commit enable _linalg_det and _linalg_det.result on xpu.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a37b03e
to
aadfc3a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enables optimized XPU support for linalg determinant, sign-logdet, and solve_ex functions by registering new dispatch entries and removing legacy fallback implementations.
- Added dispatch entries with structured delegates for _linalg_det, _linalg_slogdet, and _linalg_solve_ex in yaml/native/native_functions.yaml.
- Removed corresponding fallback entries and updated the test skip list in test/xpu/skip_list_common.py to reflect that these operations are now supported on XPU.
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
yaml/native/native_functions.yaml | Introduced new dispatch entries and structured delegates for determinant, slogdet, and solve_ex operations. |
test/xpu/skip_list_common.py | Removed skip list entries for linalg_det, linalg_slogdet, and linalg_solve_ex tests. |
Files not reviewed (1)
- src/ATen/native/xpu/XPUFallback.template: Language not supported
This pull request stacks on #1563. It introduces support for
_linalg_det
,_linalg_slogdet
and_linalg_solve_ex
related operations on XPU devices:_linalg_det
&_linalg_det.result
_linalg_slogdet
&_linalg_slogdet.sign
_linalg_solve_ex.result
It also removes fallback implementations for these operations in favor of optimized XPU-specific implementations. Corresponding tests have been updated to reflect the new support.
New XPU Kernel Implementations:
Since
_linalg_det
,_linalg_slogdet
and_linalg_solve_ex
calllinalg_lu_factor_ex.out
underneath, which has been implemented in #1563, no new kernels need to be added in this pull request. Only dispatching these operations inthird_party/torch-xpu-ops/yaml/native/native_functions.yaml
would work.Removal of Fallbacks:
Removed fallback entries for
_linalg_det
,_linalg_slogdet
and_linalg_solve_ex
related operations fromthird_party/torch-xpu-ops/src/ATen/native/xpu/XPUFallback.template
. These operations now have dedicated XPU implementations.Test Adjustments:
Updated the skip list in
test/xpu/skip_list_common.py
to remove passed and removedlinalg_det
,linalg_slogdet
and_linalg_solve_ex
related UTs.Fix #1597