Skip to content

Commit 5591738

Browse files
authored
[SM6.10] Combine LinAlg Matrix AST tests into one file (#8267)
Combines all LinAlg Matrix AST tests into one file. While this is not strictly necessary, after the other tests have been combined or transformed into a different test, each matrix op folder had just one `ast.hlsl` file remaining. So I figured it would be good to flatten these as well. Part of #8211
1 parent aff90c1 commit 5591738

17 files changed

Lines changed: 193 additions & 299 deletions

File tree

tools/clang/test/SemaHLSL/hlsl/linalg/builtins/copyconvertmatrix/ast.hlsl

Lines changed: 0 additions & 17 deletions
This file was deleted.

tools/clang/test/SemaHLSL/hlsl/linalg/builtins/fillmatrix/ast.hlsl

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
// REQUIRES: dxil-1-10
2+
// RUN: %dxc -T lib_6_10 -E main %s -ast-dump-implicit | FileCheck %s
3+
4+
RWByteAddressBuffer Buf;
5+
groupshared float SharedArr[64];
6+
7+
[shader("compute")]
8+
[numthreads(1,1,1)]
9+
void main() {
10+
__builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(1, 5, 4, 2, 2)]] mat1;
11+
__builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(4, 5, 4, 1, 2)]] mat2;
12+
__builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(1, 5, 4, 2, 2)]] mat3;
13+
14+
// CHECK: FunctionDecl {{.*}} implicit used __builtin_LinAlg_CopyConvertMatrix 'void (__builtin_LinAlgMatrix {{.*}}, __builtin_LinAlgMatrix {{.*}}, bool)' extern
15+
// CHECK-NEXT: ParmVarDecl {{.*}} ret '__builtin_LinAlgMatrix {{.*}}'
16+
// CHECK-NEXT: ParmVarDecl {{.*}} source '__builtin_LinAlgMatrix {{.*}}'
17+
// CHECK-NEXT: ParmVarDecl {{.*}} transpose 'bool'
18+
// CHECK-NEXT: HLSLIntrinsicAttr {{.*}} Implicit "op" "" 405
19+
// CHECK-NEXT: AvailabilityAttr {{.*}} Implicit 6.10 0 0 ""
20+
__builtin_LinAlg_CopyConvertMatrix(mat2, mat1, true);
21+
22+
// CHECK: FunctionDecl {{.*}} implicit used __builtin_LinAlg_FillMatrix 'void (__builtin_LinAlgMatrix & {{.*}}, unsigned int)' extern
23+
// CHECK-NEXT: ParmVarDecl {{.*}} ret '__builtin_LinAlgMatrix &&__restrict {{.*}}'
24+
// CHECK-NEXT: ParmVarDecl {{.*}} value 'unsigned int'
25+
// CHECK-NEXT: HLSLIntrinsicAttr {{.*}} Implicit "op" "" 406
26+
// CHECK-NEXT: AvailabilityAttr {{.*}} Implicit 6.10 0 0 ""
27+
__builtin_LinAlg_FillMatrix(mat1, 15);
28+
29+
// CHECK: FunctionDecl {{.*}} implicit used __builtin_LinAlg_MatrixAccumulate 'void (__builtin_LinAlgMatrix {{.*}}, __builtin_LinAlgMatrix {{.*}}, __builtin_LinAlgMatrix {{.*}})' extern
30+
// CHECK-NEXT: ParmVarDecl {{.*}} matrixC '__builtin_LinAlgMatrix {{.*}}'
31+
// CHECK-NEXT: ParmVarDecl {{.*}} matrixLHS '__builtin_LinAlgMatrix {{.*}}'
32+
// CHECK-NEXT: ParmVarDecl {{.*}} matrixRHS '__builtin_LinAlgMatrix {{.*}}'
33+
// CHECK-NEXT: HLSLIntrinsicAttr {{.*}} Implicit "op" "" 415
34+
// CHECK-NEXT: AvailabilityAttr {{.*}} Implicit 6.10 0 0 ""
35+
__builtin_LinAlg_MatrixAccumulate(mat1, mat2, mat3);
36+
37+
// CHECK: FunctionDecl {{.*}} implicit used __builtin_LinAlg_MatrixAccumulateToDescriptor 'void (__builtin_LinAlgMatrix {{.*}}, RWByteAddressBuffer, unsigned int, unsigned int, unsigned int)' extern
38+
// CHECK-NEXT: ParmVarDecl {{.*}} matrix '__builtin_LinAlgMatrix {{.*}}'
39+
// CHECK-NEXT: ParmVarDecl {{.*}} buf 'RWByteAddressBuffer'
40+
// CHECK-NEXT: ParmVarDecl {{.*}} offset 'unsigned int'
41+
// CHECK-NEXT: ParmVarDecl {{.*}} stride 'unsigned int'
42+
// CHECK-NEXT: ParmVarDecl {{.*}} layout 'unsigned int'
43+
// CHECK-NEXT: HLSLIntrinsicAttr {{.*}} Implicit "op" "" 419
44+
// CHECK-NEXT: AvailabilityAttr {{.*}} Implicit 6.10 0 0 ""
45+
__builtin_LinAlg_MatrixAccumulateToDescriptor(mat1, Buf, 1, 2, 3);
46+
47+
// CHECK: FunctionDecl {{.*}} implicit used __builtin_LinAlg_MatrixAccumulateToMemory 'void (__builtin_LinAlgMatrix {{.*}}, float const __attribute__((address_space(3))) (&)[64], unsigned int, unsigned int, unsigned int)' extern
48+
// CHECK-NEXT: ParmVarDecl {{.*}} matrix '__builtin_LinAlgMatrix {{.*}}'
49+
// CHECK-NEXT: ParmVarDecl {{.*}} memory 'float const __attribute__((address_space(3))) (&)[64]'
50+
// CHECK-NEXT: ParmVarDecl {{.*}} offset 'unsigned int'
51+
// CHECK-NEXT: ParmVarDecl {{.*}} stride 'unsigned int'
52+
// CHECK-NEXT: ParmVarDecl {{.*}} layout 'unsigned int'
53+
// CHECK-NEXT: HLSLIntrinsicAttr {{.*}} Implicit "op" "" 420
54+
// CHECK-NEXT: AvailabilityAttr {{.*}} Implicit 6.10 0 0 ""
55+
__builtin_LinAlg_MatrixAccumulateToMemory(mat1, SharedArr, 0, 0, 0);
56+
57+
// CHECK: FunctionDecl {{.*}} implicit used __builtin_LinAlg_MatrixGetCoordinate 'vector<uint, 2> (__builtin_LinAlgMatrix {{.*}}, unsigned int)' extern
58+
// CHECK-NEXT: ParmVarDecl {{.*}} matrix '__builtin_LinAlgMatrix {{.*}}'
59+
// CHECK-NEXT: ParmVarDecl {{.*}} threadLocalIndex 'unsigned int'
60+
// CHECK-NEXT: HLSLIntrinsicAttr {{.*}} Implicit "op" "" 407
61+
// CHECK-NEXT: AvailabilityAttr {{.*}} Implicit 6.10 0 0 ""
62+
uint2 coord = __builtin_LinAlg_MatrixGetCoordinate(mat1, 0);
63+
64+
// CHECK: FunctionDecl {{.*}} implicit used __builtin_LinAlg_MatrixGetElement 'void (unsigned int &, __builtin_LinAlgMatrix {{.*}}, unsigned int)' extern
65+
// CHECK-NEXT: ParmVarDecl {{.*}} ret 'unsigned int &&__restrict'
66+
// CHECK-NEXT: ParmVarDecl {{.*}} matrix '__builtin_LinAlgMatrix {{.*}}'
67+
// CHECK-NEXT: ParmVarDecl {{.*}} threadLocalIndex 'unsigned int'
68+
// CHECK-NEXT: HLSLIntrinsicAttr {{.*}} Implicit "op" "" 408
69+
// CHECK-NEXT: AvailabilityAttr {{.*}} Implicit 6.10 0 0 ""
70+
uint elem1;
71+
__builtin_LinAlg_MatrixGetElement(elem1, mat1, 3);
72+
73+
// CHECK: FunctionDecl {{.*}} implicit used __builtin_LinAlg_MatrixGetElement 'void (float &, __builtin_LinAlgMatrix {{.*}}, unsigned int)' extern
74+
// CHECK-NEXT: ParmVarDecl {{.*}} ret 'float &&__restrict'
75+
// CHECK-NEXT: ParmVarDecl {{.*}} matrix '__builtin_LinAlgMatrix {{.*}}'
76+
// CHECK-NEXT: ParmVarDecl {{.*}} threadLocalIndex 'unsigned int'
77+
// CHECK-NEXT: HLSLIntrinsicAttr {{.*}} Implicit "op" "" 408
78+
// CHECK-NEXT: AvailabilityAttr {{.*}} Implicit 6.10 0 0 ""
79+
float elem2;
80+
__builtin_LinAlg_MatrixGetElement(elem2, mat1, 4);
81+
82+
// CHECK: FunctionDecl {{.*}} implicit used __builtin_LinAlg_MatrixLength 'unsigned int (__builtin_LinAlgMatrix {{.*}})' extern
83+
// CHECK-NEXT: ParmVarDecl {{.*}} matrix '__builtin_LinAlgMatrix {{.*}}'
84+
// CHECK-NEXT: HLSLIntrinsicAttr {{.*}} Implicit "op" "" 409
85+
// CHECK-NEXT: AvailabilityAttr {{.*}} Implicit 6.10 0 0 ""
86+
__builtin_LinAlg_MatrixLength(mat1);
87+
88+
// CHECK: FunctionDecl {{.*}} implicit used __builtin_LinAlg_MatrixLoadFromDescriptor 'void (__builtin_LinAlgMatrix & {{.*}}, RWByteAddressBuffer, unsigned int, unsigned int, unsigned int)' extern
89+
// CHECK-NEXT: ParmVarDecl {{.*}} ret '__builtin_LinAlgMatrix &&__restrict {{.*}}'
90+
// CHECK-NEXT: ParmVarDecl {{.*}} buf 'RWByteAddressBuffer'
91+
// CHECK-NEXT: ParmVarDecl {{.*}} offset 'unsigned int'
92+
// CHECK-NEXT: ParmVarDecl {{.*}} stride 'unsigned int'
93+
// CHECK-NEXT: ParmVarDecl {{.*}} layout 'unsigned int'
94+
// CHECK-NEXT: HLSLIntrinsicAttr {{.*}} Implicit "op" "" 410
95+
// CHECK-NEXT: AvailabilityAttr {{.*}} Implicit 6.10 0 0 ""
96+
__builtin_LinAlg_MatrixLoadFromDescriptor(mat1, Buf, 0, 0, 0);
97+
98+
// CHECK: FunctionDecl {{.*}} implicit used __builtin_LinAlg_MatrixLoadFromMemory 'void (__builtin_LinAlgMatrix {{.*}}, float const __attribute__((address_space(3))) (&)[64], unsigned int, unsigned int, unsigned int)' extern
99+
// CHECK-NEXT: ParmVarDecl {{.*}} ret '__builtin_LinAlgMatrix {{.*}}'
100+
// CHECK-NEXT: ParmVarDecl {{.*}} memory 'float const __attribute__((address_space(3))) (&)[64]'
101+
// CHECK-NEXT: ParmVarDecl {{.*}} offset 'unsigned int'
102+
// CHECK-NEXT: ParmVarDecl {{.*}} stride 'unsigned int'
103+
// CHECK-NEXT: ParmVarDecl {{.*}} layout 'unsigned int'
104+
// CHECK-NEXT: HLSLIntrinsicAttr {{.*}} Implicit "op" "" 411
105+
// CHECK-NEXT: AvailabilityAttr {{.*}} Implicit 6.10 0 0 ""
106+
__builtin_LinAlg_MatrixLoadFromMemory(mat1, SharedArr, 0, 0, 0);
107+
108+
// CHECK: FunctionDecl {{.*}} implicit used __builtin_LinAlg_MatrixMatrixMultiply 'void (__builtin_LinAlgMatrix {{.*}}, __builtin_LinAlgMatrix {{.*}}, __builtin_LinAlgMatrix {{.*}})' extern
109+
// CHECK-NEXT: ParmVarDecl {{.*}} matrixC '__builtin_LinAlgMatrix {{.*}}'
110+
// CHECK-NEXT: ParmVarDecl {{.*}} matrixA '__builtin_LinAlgMatrix {{.*}}'
111+
// CHECK-NEXT: ParmVarDecl {{.*}} matrixB '__builtin_LinAlgMatrix {{.*}}'
112+
// CHECK-NEXT: HLSLIntrinsicAttr {{.*}} Implicit "op" "" 416
113+
// CHECK-NEXT: AvailabilityAttr {{.*}} Implicit 6.10 0 0 ""
114+
__builtin_LinAlg_MatrixMatrixMultiply(mat1, mat2, mat3);
115+
116+
// CHECK: FunctionDecl {{.*}} implicit used __builtin_LinAlg_MatrixMatrixMultiplyAccumulate 'void (__builtin_LinAlgMatrix {{.*}}, __builtin_LinAlgMatrix {{.*}}, __builtin_LinAlgMatrix {{.*}}, __builtin_LinAlgMatrix {{.*}})' extern
117+
// CHECK-NEXT: ParmVarDecl {{.*}} matrixR '__builtin_LinAlgMatrix {{.*}}'
118+
// CHECK-NEXT: ParmVarDecl {{.*}} matrixA '__builtin_LinAlgMatrix {{.*}}'
119+
// CHECK-NEXT: ParmVarDecl {{.*}} matrixB '__builtin_LinAlgMatrix {{.*}}'
120+
// CHECK-NEXT: ParmVarDecl {{.*}} matrixC '__builtin_LinAlgMatrix {{.*}}'
121+
// CHECK-NEXT: HLSLIntrinsicAttr {{.*}} Implicit "op" "" 417
122+
// CHECK-NEXT: AvailabilityAttr {{.*}} Implicit 6.10 0 0 ""
123+
__builtin_LinAlg_MatrixMatrixMultiplyAccumulate(mat1, mat2, mat3, mat1);
124+
125+
// CHECK: FunctionDecl {{.*}} implicit used __builtin_LinAlg_MatrixOuterProduct 'void (__builtin_LinAlgMatrix {{.*}}, vector<int, 4>, vector<int, 4>)' extern
126+
// CHECK-NEXT: ParmVarDecl {{.*}} ret '__builtin_LinAlgMatrix {{.*}}'
127+
// CHECK-NEXT: ParmVarDecl {{.*}} vecA 'vector<int, 4>':'vector<int, 4>'
128+
// CHECK-NEXT: ParmVarDecl {{.*}} vecB 'vector<int, 4>':'vector<int, 4>'
129+
// CHECK-NEXT: HLSLIntrinsicAttr {{.*}} Implicit "op" "" 421
130+
// CHECK-NEXT: AvailabilityAttr {{.*}} Implicit 6.10 0 0 ""
131+
int4 vecA = {1,2,3,4};
132+
int4 vecB = {1,2,3,4};
133+
__builtin_LinAlg_MatrixOuterProduct(mat1, vecA, vecB);
134+
135+
// CHECK: FunctionDecl {{.*}} implicit used __builtin_LinAlg_MatrixQueryAccumulatorLayout 'unsigned int ()' extern
136+
// CHECK-NEXT: HLSLIntrinsicAttr {{.*}} Implicit "op" "" 418
137+
// CHECK-NEXT: AvailabilityAttr {{.*}} Implicit 6.10 0 0 ""
138+
uint layout = __builtin_LinAlg_MatrixQueryAccumulatorLayout();
139+
140+
// CHECK: FunctionDecl {{.*}} implicit used __builtin_LinAlg_MatrixSetElement 'void (__builtin_LinAlgMatrix {{.*}}, __builtin_LinAlgMatrix {{.*}}, unsigned int, unsigned int)' extern
141+
// CHECK-NEXT: ParmVarDecl {{.*}} ret '__builtin_LinAlgMatrix {{.*}}'
142+
// CHECK-NEXT: ParmVarDecl {{.*}} matrix '__builtin_LinAlgMatrix {{.*}}'
143+
// CHECK-NEXT: ParmVarDecl {{.*}} threadLocalIndex 'unsigned int'
144+
// CHECK-NEXT: ParmVarDecl {{.*}} value 'unsigned int'
145+
// CHECK-NEXT: HLSLIntrinsicAttr {{.*}} Implicit "op" "" 412
146+
// CHECK-NEXT: AvailabilityAttr {{.*}} Implicit 6.10 0 0 ""
147+
__builtin_LinAlg_MatrixSetElement(mat2, mat1, 1, 1);
148+
149+
// CHECK: FunctionDecl {{.*}} implicit used __builtin_LinAlg_MatrixStoreToDescriptor 'void (__builtin_LinAlgMatrix {{.*}}, RWByteAddressBuffer, unsigned int, unsigned int, unsigned int)' extern
150+
// CHECK-NEXT: ParmVarDecl {{.*}} matrix '__builtin_LinAlgMatrix {{.*}}'
151+
// CHECK-NEXT: ParmVarDecl {{.*}} buf 'RWByteAddressBuffer'
152+
// CHECK-NEXT: ParmVarDecl {{.*}} offset 'unsigned int'
153+
// CHECK-NEXT: ParmVarDecl {{.*}} stride 'unsigned int'
154+
// CHECK-NEXT: ParmVarDecl {{.*}} layout 'unsigned int'
155+
// CHECK-NEXT: HLSLIntrinsicAttr {{.*}} Implicit "op" "" 413
156+
// CHECK-NEXT: AvailabilityAttr {{.*}} Implicit 6.10 0 0 ""
157+
__builtin_LinAlg_MatrixStoreToDescriptor(mat1, Buf, 1, 2, 3);
158+
159+
// CHECK: FunctionDecl {{.*}} implicit used __builtin_LinAlg_MatrixStoreToMemory 'void (__builtin_LinAlgMatrix {{.*}}, float const __attribute__((address_space(3))) (&)[64], unsigned int, unsigned int, unsigned int)' extern
160+
// CHECK-NEXT: ParmVarDecl {{.*}} matrix '__builtin_LinAlgMatrix {{.*}}'
161+
// CHECK-NEXT: ParmVarDecl {{.*}} memory 'float const __attribute__((address_space(3))) (&)[64]'
162+
// CHECK-NEXT: ParmVarDecl {{.*}} offset 'unsigned int'
163+
// CHECK-NEXT: ParmVarDecl {{.*}} stride 'unsigned int'
164+
// CHECK-NEXT: ParmVarDecl {{.*}} layout 'unsigned int'
165+
// CHECK-NEXT: HLSLIntrinsicAttr {{.*}} Implicit "op" "" 414
166+
// CHECK-NEXT: AvailabilityAttr {{.*}} Implicit 6.10 0 0 ""
167+
168+
__builtin_LinAlg_MatrixStoreToMemory(mat1, SharedArr, 0, 0, 0);
169+
170+
// CHECK: FunctionDecl {{.*}} implicit used __builtin_LinAlg_MatrixVectorMultiply 'void (vector<float, 4> &, __builtin_LinAlgMatrix {{.*}}, vector<float, 4>, unsigned int)' extern
171+
// CHECK-NEXT: ParmVarDecl {{.*}} ret 'vector<float, 4> &&__restrict'
172+
// CHECK-NEXT: ParmVarDecl {{.*}} mat '__builtin_LinAlgMatrix {{.*}}'
173+
// CHECK-NEXT: ParmVarDecl {{.*}} input 'vector<float, 4>':'vector<float, 4>'
174+
// CHECK-NEXT: ParmVarDecl {{.*}} input_interp 'unsigned int'
175+
// CHECK-NEXT: HLSLIntrinsicAttr {{.*}} Implicit "op" "" 422
176+
// CHECK-NEXT: AvailabilityAttr {{.*}} Implicit 6.10 0 0 ""
177+
float4 vec = {1,2,3,4};
178+
float4 result;
179+
__builtin_LinAlg_MatrixVectorMultiply(result, mat1, vec, 1);
180+
181+
// CHECK: FunctionDecl {{.*}} implicit used __builtin_LinAlg_MatrixVectorMultiplyAdd 'void (vector<float, 4> &, __builtin_LinAlgMatrix {{.*}}, vector<float, 4>, unsigned int, vector<float, 4>, unsigned int)' extern
182+
// CHECK-NEXT: ParmVarDecl {{.*}} ret 'vector<float, 4> &&__restrict'
183+
// CHECK-NEXT: ParmVarDecl {{.*}} mat '__builtin_LinAlgMatrix {{.*}}'
184+
// CHECK-NEXT: ParmVarDecl {{.*}} input 'vector<float, 4>':'vector<float, 4>'
185+
// CHECK-NEXT: ParmVarDecl {{.*}} input_interp 'unsigned int'
186+
// CHECK-NEXT: ParmVarDecl {{.*}} bias 'vector<float, 4>':'vector<float, 4>'
187+
// CHECK-NEXT: ParmVarDecl {{.*}} bias_interp 'unsigned int'
188+
// CHECK-NEXT: HLSLIntrinsicAttr {{.*}} Implicit "op" "" 423
189+
// CHECK-NEXT: AvailabilityAttr {{.*}} Implicit 6.10 0 0 ""
190+
float4 input = {1,2,3,4};
191+
float4 bias = {5,6,7,8};
192+
__builtin_LinAlg_MatrixVectorMultiplyAdd(result, mat1, input, 1, bias, 2);
193+
}

tools/clang/test/SemaHLSL/hlsl/linalg/builtins/matrixaccumulate/ast.hlsl

Lines changed: 0 additions & 19 deletions
This file was deleted.

tools/clang/test/SemaHLSL/hlsl/linalg/builtins/matrixaccumulatetodescriptor/ast.hlsl

Lines changed: 0 additions & 20 deletions
This file was deleted.

tools/clang/test/SemaHLSL/hlsl/linalg/builtins/matrixgetcoordinate/ast.hlsl

Lines changed: 0 additions & 15 deletions
This file was deleted.

tools/clang/test/SemaHLSL/hlsl/linalg/builtins/matrixgetelement/ast.hlsl

Lines changed: 0 additions & 28 deletions
This file was deleted.

tools/clang/test/SemaHLSL/hlsl/linalg/builtins/matrixlength/ast.hlsl

Lines changed: 0 additions & 14 deletions
This file was deleted.

tools/clang/test/SemaHLSL/hlsl/linalg/builtins/matrixloadfromdescriptor/ast.hlsl

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)