Skip to content

Make use of the SYCL queue passed to CUTLASS #3

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions torch/_inductor/codegen/xpu/gemm_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@
using coord_t = cutlass::gemm::GemmCoord::Index;
static cutlass::KernelHardwareInfo hw_info;

// TODO (SYCL) : device_id here is only used for hw info and doesn't necessarly mean
// it's linked to the SYCL queue. It's hardcoded to 0 in the CUDA version as well.
const int device_id = 0;
const int device_id = syclcompat::get_device_id(stream->get_device());

if (hw_info.sm_count == 0) {
hw_info.sm_count = cutlass::KernelHardwareInfo::query_device_multiprocessor_count(device_id);
Expand Down Expand Up @@ -75,15 +73,11 @@
#endif
#endif
{
// TODO (SYCL): Pass the SYCL queue (currently last arg of `kernel_call_signature` above)
// once supported on CUTLASS side. Variable name to respect the naming in: _EXTRA_CPP_ARGS (sycl_kernel.py)
auto status = gemm_op.initialize(arguments, workspace);
auto status = gemm_op.initialize(arguments, workspace, stream);
CUTLASS_CHECK(status);
}
{
// TODO (SYCL): Pass the SYCL queue once supported on CUTLASS side.
// Variable name to respect the naming in: _EXTRA_CPP_ARGS (sycl_kernel.py)
auto status = gemm_op.run();
auto status = gemm_op.run(stream);
CUTLASS_CHECK(status);
syclcompat::wait_and_throw();
}
Expand Down
3 changes: 1 addition & 2 deletions torch/_inductor/codegen/xpu/sycl_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,7 @@ class SYCLTemplateKernel(SYCLKernel):
Template kernels defined by SYCL / Cutlass in C++.
"""

# TODO (SYCL): The SYCL queue is not being used
_EXTRA_CPP_ARGS = "size_t* workspace_size, uint8_t* workspace, sycl::queue stream"
_EXTRA_CPP_ARGS = "size_t* workspace_size, uint8_t* workspace, sycl::queue* stream"

def __init__(
self,
Expand Down