Skip to content

Commit 6962799

Browse files
authored
Add numthreads to disassembly output (#4484)
* add metadata on numthreads for CS, AS, and MS * add associated hlsl test file * move test hlsl file to correct location * update check values * tested each shader type separately, added breaks in switch statement * add some extra numthread checking to each separate type of shader in other existing tests
1 parent 7f8f9ac commit 6962799

7 files changed

Lines changed: 65 additions & 0 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// RUN: %dxc /T as_6_6 /E ASMain %s | FileCheck %s
2+
// CHECK: Amplification Shader
3+
// CHECK: Numthreads: (2,4,1)
4+
5+
6+
struct payloadStruct
7+
{
8+
uint myArbitraryData;
9+
};
10+
11+
[numthreads(2,4,1)]
12+
void ASMain (in uint3 groupID : SV_GroupID)
13+
{
14+
payloadStruct p;
15+
p.myArbitraryData = 3;
16+
DispatchMesh(1,1,1,p);
17+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// RUN: %dxc /T cs_6_0 /E main %s | FileCheck %s
2+
// CHECK: Compute Shader
3+
// CHECK: Numthreads: (2,2,1)
4+
5+
[NumThreads(2,2,1)]
6+
void main() {
7+
int x = 2;
8+
}
9+
10+
[NumThreads(2,4,1)]
11+
void ASMain() {
12+
int x = 2;
13+
}
14+
15+
[NumThreads(2,3,1)]
16+
void MSMain() {
17+
int x = 2;
18+
}
19+
20+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// RUN: %dxc /T ms_6_6 /E MSMain %s | FileCheck %s
2+
// CHECK: Mesh Shader
3+
// CHECK: Numthreads: (2,3,1)
4+
5+
6+
[NumThreads(2,3,1)]
7+
[OutputTopology("triangle")]
8+
void MSMain() {
9+
int x = 2;
10+
}

tools/clang/test/HLSLFileCheck/hlsl/intrinsics/atomic/atomic.hlsl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// RUN: %dxc -E main -DTYPE=uint64_t -T cs_6_6 %s | FileCheck %s
44
// RUN: %dxc -E main -DTYPE=int64_t -T cs_6_6 %s | FileCheck %s
55

6+
// CHECK: Compute Shader
7+
// CHECK: Numthreads: (8,8,1)
68
// CHECK: atomicrmw add
79
// CHECK: atomicrmw add
810
// CHECK: cmpxchg

tools/clang/test/HLSLFileCheck/shader_targets/mesh/amplification.hlsl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// RUN: %dxc -E main -T as_6_5 %s | FileCheck %s
22
// RUN: %dxc -E main -T as_6_5 %s | %D3DReflect %s | FileCheck -check-prefix=REFL %s
33

4+
// CHECK: Amplification Shader
5+
// CHECK: Numthreads: (32,1,1)
46
// CHECK: dx.op.dispatchMesh.struct.Payload
57

68
#define NUM_THREADS 32

tools/clang/test/HLSLFileCheck/shader_targets/mesh/mesh.hlsl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// RUN: %dxc -E main -T ms_6_5 %s | FileCheck %s
22
// RUN: %dxc -E main -T ms_6_5 %s | %D3DReflect %s | FileCheck -check-prefix=REFL %s
33

4+
// CHECK: Mesh Shader
5+
// CHECK: Numthreads: (32,1,1)
46
// CHECK: dx.op.getMeshPayload.struct.MeshPayload(i32 170)
57
// CHECK: dx.op.setMeshOutputCounts(i32 168, i32 32, i32 16)
68
// CHECK: dx.op.emitIndices(i32 169,

tools/clang/tools/dxcompiler/dxcdisassembler.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,6 +1294,7 @@ void PrintPipelineStateValidationRuntimeInfo(const char *pBuffer,
12941294

12951295
const unsigned offset = sizeof(unsigned);
12961296
const PSVRuntimeInfo0 *pInfo = (const PSVRuntimeInfo0 *)(pBuffer + offset);
1297+
const PSVRuntimeInfo2 *pInfo2 = (const PSVRuntimeInfo2 *)(pBuffer + offset);
12971298

12981299
switch (shaderKind) {
12991300
case DXIL::ShaderKind::Hull: {
@@ -1508,6 +1509,17 @@ void PrintPipelineStateValidationRuntimeInfo(const char *pBuffer,
15081509
<< "\n";
15091510
break;
15101511
case DXIL::ShaderKind::Compute:
1512+
OS << comment << " Compute Shader\n";
1513+
OS << comment << " Numthreads: (" << pInfo2->NumThreadsX << "," << pInfo2->NumThreadsY << "," << pInfo2->NumThreadsZ << ")\n";
1514+
break;
1515+
case DXIL::ShaderKind::Amplification:
1516+
OS << comment << " Amplification Shader\n";
1517+
OS << comment << " Numthreads: (" << pInfo2->NumThreadsX << "," << pInfo2->NumThreadsY << "," << pInfo2->NumThreadsZ << ")\n";
1518+
break;
1519+
case DXIL::ShaderKind::Mesh:
1520+
OS << comment << " Mesh Shader\n";
1521+
OS << comment << " Numthreads: (" << pInfo2->NumThreadsX << "," << pInfo2->NumThreadsY << "," << pInfo2->NumThreadsZ << ")\n";
1522+
break;
15111523
case DXIL::ShaderKind::Library:
15121524
case DXIL::ShaderKind::Invalid:
15131525
// Nothing to print for these shader kinds.

0 commit comments

Comments
 (0)