forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
xpu: test py_limited_api with SyclExtension
Commit extends existing CUDA test to cover XPU SyclExtension case for the same feature - `py_limited_api`. NOTE: THE CHANGE CAN NOT BE MERGED AS IS Change requires update of the commit pin for torch-xpu-ops. Requires: intel/torch-xpu-ops#1405 Signed-off-by: Dmitry Rogozhkin <[email protected]>
- Loading branch information
Showing
6 changed files
with
81 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
test/cpp_extensions/python_agnostic_extension/python_agnostic/csrc/ultra_norm.sycl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include <ATen/ops/_foreach_norm_native.h> | ||
#include <ATen/ops/cat_xpu_dispatch.h> | ||
#include <ATen/ops/norm_xpu_dispatch.h> | ||
#include <ATen/ops/unsqueeze.h> | ||
#include <torch/library.h> | ||
|
||
at::Tensor ultra_norm(at::TensorList inputs) { | ||
auto res = at::native::foreach_tensor_norm_xpu(inputs); | ||
std::vector<at::Tensor> unsqueezed; | ||
for (const auto& scalar_tensor : res) { | ||
unsqueezed.push_back(at::unsqueeze(scalar_tensor, 0)); | ||
} | ||
auto stacked = at::xpu::cat(unsqueezed); | ||
return at::xpu::norm(stacked, 2, at::IntArrayRef{}, false); | ||
} | ||
|
||
TORCH_LIBRARY_IMPL(python_agnostic, XPU, m) { | ||
m.impl("python_agnostic::ultra_norm", &ultra_norm); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
306a0ffb6e0cae27c5bd9a3b9cd378048c8e00e7 | ||
pr_1405 |