Skip to content

Commit 03b237b

Browse files
author
Zhengxing Li
committed
Address PR comments and update AttrDocs.td
1 parent 6418461 commit 03b237b

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

clang/include/clang/Basic/AttrDocs.td

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7819,9 +7819,8 @@ randomized.
78197819
def HLSLSV_GroupIDDocs : Documentation {
78207820
let Category = DocCatFunction;
78217821
let Content = [{
7822-
The ``SV_GroupID`` semantic, when applied to an input parameter, specifies a
7823-
data binding to map the group id to the specified parameter. This attribute is
7824-
only supported in compute shaders.
7822+
The ``SV_GroupID`` semantic, when applied to an input parameter, specifies which
7823+
thread group a shader is executing in. This attribute is only supported in compute shaders.
78257824

78267825
The full documentation is available here: https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/sv-groupid
78277826
}];

clang/test/CodeGenHLSL/semantics/SV_GroupID.hlsl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,14 @@ void foo(uint Idx : SV_GroupID) {}
1919
[numthreads(8,8,1)]
2020
void bar(uint2 Idx : SV_GroupID) {}
2121

22+
// CHECK: define void @test()
23+
// CHECK: %[[#ID_X:]] = call i32 @llvm.dx.group.id(i32 0)
24+
// CHECK: %[[#ID_X_:]] = insertelement <3 x i32> poison, i32 %[[#ID_X]], i64 0
25+
// CHECK: %[[#ID_Y:]] = call i32 @llvm.dx.group.id(i32 1)
26+
// CHECK: %[[#ID_XY:]] = insertelement <3 x i32> %[[#ID_X_]], i32 %[[#ID_Y]], i64 1
27+
// CHECK: %[[#ID_Z:]] = call i32 @llvm.dx.group.id(i32 2)
28+
// CHECK: %[[#ID_XYZ:]] = insertelement <3 x i32> %[[#ID_XY]], i32 %[[#ID_Z]], i64 2
29+
// CHECK: call void @{{.*}}test{{.*}}(<3 x i32> %[[#ID_XYZ]])
30+
[shader("compute")]
31+
[numthreads(8,8,1)]
32+
void test(uint3 Idx : SV_GroupID) {}

clang/test/SemaHLSL/Semantics/invalid_entry_parameter.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ struct ST2_GID {
4848
// expected-warning@+1 {{'SV_GroupID' attribute only applies to parameters and non-static data members}}
4949
static uint GID : SV_GroupID;
5050
uint s_gid : SV_GroupID;
51-
};
51+
};

0 commit comments

Comments
 (0)