Skip to content

Commit d4b2d04

Browse files
authored
[SM6.10] Add MatrixQueryAccLayout Builtin Tests (microsoft#8195)
Fixes microsoft#7912
1 parent 71612b9 commit d4b2d04

4 files changed

Lines changed: 195 additions & 0 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// REQUIRES: dxil-1-10
2+
// RUN: %dxc -T cs_6_10 -E main %s | FileCheck %s
3+
4+
[numthreads(1,1,1)]
5+
void main() {
6+
// CHECK-LABEL: define void @main()
7+
8+
// CHECK: call i32 @dx.op.linAlgMatrixQueryAccumulatorLayout(i32 -2147483626) ; LinAlgMatrixQueryAccumulatorLayout()
9+
uint layout = __builtin_LinAlg_MatrixQueryAccumulatorLayout();
10+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// REQUIRES: dxil-1-10
2+
// RUN: %dxc -T lib_6_10 -E main %s -ast-dump-implicit | FileCheck %s
3+
4+
// CHECK: FunctionDecl {{.*}} implicit used __builtin_LinAlg_MatrixQueryAccumulatorLayout 'unsigned int ()' extern
5+
// CHECK-NEXT: HLSLIntrinsicAttr {{.*}} Implicit "op" "" 418
6+
// CHECK-NEXT: AvailabilityAttr {{.*}} Implicit 6.10 0 0 ""
7+
8+
[shader("compute")]
9+
[numthreads(1,1,1)]
10+
void main() {
11+
uint layout = __builtin_LinAlg_MatrixQueryAccumulatorLayout();
12+
}
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
// REQUIRES: dxil-1-10
2+
// RUN: %dxc -T lib_6_10 %s -verify
3+
4+
// expected-no-diagnostics
5+
6+
RWByteAddressBuffer buf;
7+
void CallFunction()
8+
{
9+
uint layout = __builtin_LinAlg_MatrixQueryAccumulatorLayout();
10+
}
11+
12+
// --- Allowed Stages ---
13+
14+
[shader("compute")]
15+
[numthreads(4,4,4)]
16+
void mainCS(uint ix : SV_GroupIndex, uint3 id : SV_GroupThreadID) {
17+
CallFunction();
18+
}
19+
20+
struct Verts {
21+
float4 position : SV_Position;
22+
};
23+
24+
[shader("mesh")]
25+
[NumThreads(8, 8, 2)]
26+
[OutputTopology("triangle")]
27+
void mainMeS(out vertices Verts verts[32], uint ix : SV_GroupIndex) {
28+
CallFunction();
29+
SetMeshOutputCounts(32, 16);
30+
Verts v = {0.0, 0.0, 0.0, 0.0};
31+
verts[ix] = v;
32+
}
33+
34+
struct AmpPayload {
35+
float2 dummy;
36+
};
37+
38+
[numthreads(8, 1, 1)]
39+
[shader("amplification")]
40+
void mainAS()
41+
{
42+
CallFunction();
43+
AmpPayload pld;
44+
pld.dummy = float2(1.0,2.0);
45+
DispatchMesh(8, 1, 1, pld);
46+
}
47+
48+
[shader("pixel")]
49+
float4 mainPS(uint ix : SV_PrimitiveID) : SV_TARGET {
50+
CallFunction();
51+
return 1.0;
52+
}
53+
54+
[shader("vertex")]
55+
float4 mainVS(uint ix : SV_VertexID) : OUT {
56+
CallFunction();
57+
return 1.0;
58+
}
59+
60+
[shader("node")]
61+
[nodedispatchgrid(8,1,1)]
62+
[numthreads(64,2,2)]
63+
void mainNS() {
64+
CallFunction();
65+
}
66+
67+
[shader("raygeneration")]
68+
void mainRG() {
69+
CallFunction();
70+
}
71+
72+
[shader("intersection")]
73+
void mainIS() {
74+
CallFunction();
75+
}
76+
77+
struct Attribs { float2 barys; };
78+
79+
[shader("callable")]
80+
void mainCALL(inout Attribs attrs) {
81+
CallFunction();
82+
}
83+
84+
struct [raypayload] RayPayload
85+
{
86+
float elem
87+
: write(caller,closesthit,anyhit,miss)
88+
: read(caller,closesthit,anyhit,miss);
89+
};
90+
91+
[shader("anyhit")]
92+
void mainAH(inout RayPayload pld, in Attribs attrs) {
93+
CallFunction();
94+
}
95+
96+
[shader("closesthit")]
97+
void mainCH(inout RayPayload pld, in Attribs attrs) {
98+
CallFunction();
99+
}
100+
101+
[shader("miss")]
102+
void mainMS(inout RayPayload pld) {
103+
CallFunction();
104+
}
105+
106+
struct PosStruct {
107+
float4 pos : SV_Position;
108+
};
109+
110+
struct PCStruct
111+
{
112+
float Edges[3] : SV_TessFactor;
113+
float Inside : SV_InsideTessFactor;
114+
float4 test : TEST;
115+
};
116+
117+
PCStruct HSPatch(InputPatch<PosStruct, 3> ip,
118+
OutputPatch<PosStruct, 3> op,
119+
uint ix : SV_PrimitiveID)
120+
{
121+
PCStruct a;
122+
a.Edges[0] = ip[0].pos.w;
123+
a.Edges[1] = ip[0].pos.w;
124+
a.Edges[2] = ip[0].pos.w;
125+
a.Inside = ip[0].pos.w;
126+
return a;
127+
}
128+
129+
[shader("hull")]
130+
[domain("tri")]
131+
[partitioning("fractional_odd")]
132+
[outputtopology("triangle_cw")]
133+
[outputcontrolpoints(3)]
134+
[patchconstantfunc("HSPatch")]
135+
PosStruct mainHS(InputPatch<PosStruct, 3> p, uint ix : SV_OutputControlPointID)
136+
{
137+
CallFunction();
138+
PosStruct s;
139+
s.pos = p[ix].pos;
140+
return s;
141+
}
142+
143+
[shader("domain")]
144+
[domain("tri")]
145+
PosStruct mainDS(const OutputPatch<PosStruct, 3> patch,
146+
uint ix : SV_PrimitiveID)
147+
{
148+
CallFunction();
149+
PosStruct v;
150+
v.pos = patch[0].pos;
151+
return v;
152+
}
153+
154+
float4 a;
155+
156+
[shader("geometry")]
157+
[maxvertexcount(1)]
158+
void mainGS(triangle float4 array[3] : SV_Position, uint ix : SV_GSInstanceID,
159+
inout PointStream<PosStruct> OutputStream)
160+
{
161+
CallFunction();
162+
PosStruct s;
163+
s.pos = a;
164+
OutputStream.Append(s);
165+
OutputStream.RestartStrip();
166+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// RUN: %dxc -I %hlsl_headers -T cs_6_9 -E main %s -verify
2+
3+
[numthreads(4,1,1)]
4+
void main() {
5+
// expected-error@+1{{intrinsic __builtin_LinAlg_MatrixQueryAccumulatorLayout potentially used by ''main'' requires shader model 6.10 or greater}}
6+
uint layout = __builtin_LinAlg_MatrixQueryAccumulatorLayout();
7+
}

0 commit comments

Comments
 (0)