Skip to content

Commit

Permalink
[SYCLomatic] Fix migration bug of dim3 with --enable-ctad. (oneapi-sr…
Browse files Browse the repository at this point in the history
…c#2149)

Signed-off-by: Tang, Jiajun [email protected]
  • Loading branch information
tangjj11 authored Jul 16, 2024
1 parent 6019a73 commit b7f0338
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
4 changes: 1 addition & 3 deletions clang/lib/DPCT/AnalysisInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5411,9 +5411,7 @@ void KernelCallExpr::printParallelFor(KernelPrinter &Printer, bool IsInSubmit) {
Printer.line("[=](" + MapNames::getClNamespace() + "nd_item<1> ",
getItemName(), ")", ExecutionConfig.SubGroupSize, " {");
} else {
DpctGlobalInfo::printCtadClass(Printer.indent(),
MapNames::getClNamespace() + "nd_range", 3)
<< "(";
Printer << MapNames::getClNamespace() + "nd_range<3>(";
if (ExecutionConfig.GroupSize == CanIgnoreRangeStr3D) {
Printer << ExecutionConfig.LocalSize;
} else if (ExecutionConfig.LocalSize == CanIgnoreRangeStr3D) {
Expand Down
16 changes: 14 additions & 2 deletions clang/test/dpct/ctad.cu
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ int main() {
// CHECK-NEXT: sycl::local_accessor<int, 1> k_acc_ct1(sycl::range(32), cgh);
// CHECK-EMPTY:
// CHECK-NEXT: cgh.parallel_for<dpct_kernel_name<class kernel_{{[a-f0-9]+}}>>(
// CHECK-NEXT: sycl::nd_range(sycl::range(1, 1, 1), sycl::range(1, 1, 1)),
// CHECK-NEXT: sycl::nd_range<3>(sycl::range(1, 1, 1), sycl::range(1, 1, 1)),
// CHECK-NEXT: [=](sycl::nd_item<3> item_ct1) {
// CHECK-NEXT: kernel(1, k_acc_ct1.get_multi_ptr<sycl::access::decorated::no>().get());
// CHECK-NEXT: });
Expand All @@ -103,12 +103,24 @@ int main() {
// CHECK-NEXT: sycl::local_accessor<int, 1> k_acc_ct1(sycl::range(32), cgh);
// CHECK-EMPTY:
// CHECK-NEXT: cgh.parallel_for<dpct_kernel_name<class kernel_{{[a-f0-9]+}}>>(
// CHECK-NEXT: sycl::nd_range(sycl::range(1, 1, NUM) * sycl::range(1, 1, NUM), sycl::range(1, 1, NUM)),
// CHECK-NEXT: sycl::nd_range<3>(sycl::range(1, 1, NUM) * sycl::range(1, 1, NUM), sycl::range(1, 1, NUM)),
// CHECK-NEXT: [=](sycl::nd_item<3> item_ct1) {
// CHECK-NEXT: kernel(1, k_acc_ct1.get_multi_ptr<sycl::access::decorated::no>().get());
// CHECK-NEXT: });
// CHECK-NEXT: });
kernel<<<NUM, NUM>>>(1);

// CHECK: q_ct1.submit(
// CHECK-NEXT: [&](sycl::handler &cgh) {
// CHECK-NEXT: sycl::local_accessor<int, 1> k_acc_ct1(sycl::range(32), cgh);
// CHECK-EMPTY:
// CHECK-NEXT: cgh.parallel_for<dpct_kernel_name<class kernel_{{[a-f0-9]+}}>>(
// CHECK-NEXT: sycl::nd_range<3>(deflt * deflt, deflt),
// CHECK-NEXT: [=](sycl::nd_item<3> item_ct1) {
// CHECK-NEXT: kernel(1, k_acc_ct1.get_multi_ptr<sycl::access::decorated::no>().get());
// CHECK-NEXT: });
// CHECK-NEXT: });
kernel<<<deflt, deflt>>>(1);
}


0 comments on commit b7f0338

Please sign in to comment.