Skip to content

Commit 9125bc1

Browse files
committed
[SYCL] reqd_work_group_size attribute is reversed (fix intel#8)
Signed-off-by: Aleksander Fadeev <[email protected]>
1 parent 245f323 commit 9125bc1

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

clang/lib/Sema/SemaDeclAttr.cpp

+8-10
Original file line numberDiff line numberDiff line change
@@ -2939,20 +2939,18 @@ static void handleWorkGroupSize(Sema &S, Decl *D, const ParsedAttr &AL) {
29392939
return;
29402940

29412941
WorkGroupAttr *Existing = D->getAttr<WorkGroupAttr>();
2942-
if (Existing && !(Existing->getXDim() == WGSize[0] &&
2943-
Existing->getYDim() == WGSize[1] &&
2944-
Existing->getZDim() == WGSize[2]))
2942+
if (Existing &&
2943+
!(Existing->getXDim() == WGSize[0] && Existing->getYDim() == WGSize[1] &&
2944+
Existing->getZDim() == WGSize[2]))
29452945
S.Diag(AL.getLoc(), diag::warn_duplicate_attribute) << AL;
29462946
if (S.getLangOpts().SYCLIsDevice)
2947-
D->addAttr(::new (S.Context)
2948-
WorkGroupAttr(S.Context, AL, WGSize[2], WGSize[1], WGSize[0]));
2949-
else
2950-
D->addAttr(::new (S.Context)
2951-
WorkGroupAttr(S.Context, AL, WGSize[0], WGSize[1], WGSize[2]));
2952-
2947+
D->addAttr(::new (S.Context) WorkGroupAttr(S.Context, AL, WGSize[2],
2948+
WGSize[1], WGSize[0]));
2949+
else
2950+
D->addAttr(::new (S.Context) WorkGroupAttr(S.Context, AL, WGSize[0],
2951+
WGSize[1], WGSize[2]));
29532952
}
29542953

2955-
29562954
// Handles intel_reqd_sub_group_size.
29572955
static void handleSubGroupSize(Sema &S, Decl *D, const ParsedAttr &AL) {
29582956
uint32_t SGSize;

clang/test/CodeGenSYCL/reqd-work-group-size.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ void bar() {
2727
kernel<class kernel_name2>(f);
2828

2929
kernel<class kernel_name3>(
30-
[]() [[cl::reqd_work_group_size(8, 8, 8)]] {});
30+
[]() [[cl::reqd_work_group_size(8, 8, 8)]]{});
3131
}
3232

3333
// CHECK: define spir_kernel void @{{.*}}kernel_name1() {{.*}} !reqd_work_group_size ![[WGSIZE32:[0-9]+]]
@@ -36,4 +36,3 @@ void bar() {
3636
// CHECK: ![[WGSIZE32]] = !{i32 16, i32 16, i32 32}
3737
// CHECK: ![[WGSIZE8]] = !{i32 1, i32 1, i32 8}
3838
// CHECK: ![[WGSIZE88]] = !{i32 8, i32 8, i32 8}
39-

0 commit comments

Comments
 (0)