Skip to content

Commit 6dee5ce

Browse files
[SM6.10] Update LinAlg header align parameter (#8377)
microsoft/hlsl-specs#854 updated alignement value in the header. This reflects that spec change (also deletes some trailing spaces left over in the test files) --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 4897501 commit 6dee5ce

File tree

3 files changed

+20
-24
lines changed

3 files changed

+20
-24
lines changed

tools/clang/lib/Headers/hlsl/dx/linalg.h

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -271,17 +271,15 @@ class Matrix {
271271
}
272272

273273
static Matrix Load(ByteAddressBuffer Res, uint StartOffset, uint Stride,
274-
MatrixLayoutEnum Layout,
275-
uint Align = sizeof(ElementType)) {
274+
MatrixLayoutEnum Layout, uint Align = 128) {
276275
Matrix Result;
277276
__builtin_LinAlg_MatrixLoadFromDescriptor(Result.__handle, Res, StartOffset,
278277
Stride, Layout, Align);
279278
return Result;
280279
}
281280

282281
static Matrix Load(RWByteAddressBuffer Res, uint StartOffset, uint Stride,
283-
MatrixLayoutEnum Layout,
284-
uint Align = sizeof(ElementType)) {
282+
MatrixLayoutEnum Layout, uint Align = 128) {
285283
Matrix Result;
286284
__builtin_LinAlg_MatrixLoadFromDescriptor(Result.__handle, Res, StartOffset,
287285
Stride, Layout, Align);
@@ -331,7 +329,7 @@ class Matrix {
331329
}
332330

333331
void Store(RWByteAddressBuffer Res, uint StartOffset, uint Stride,
334-
MatrixLayoutEnum Layout, uint Align = sizeof(ElementType)) {
332+
MatrixLayoutEnum Layout, uint Align = 128) {
335333
__builtin_LinAlg_MatrixStoreToDescriptor(__handle, Res, StartOffset, Stride,
336334
Layout, Align);
337335
}
@@ -351,8 +349,7 @@ class Matrix {
351349
typename hlsl::enable_if<Use == MatrixUse::Accumulator && UseLocal == Use,
352350
void>::type
353351
InterlockedAccumulate(RWByteAddressBuffer Res, uint StartOffset, uint Stride,
354-
MatrixLayoutEnum Layout,
355-
uint Align = sizeof(ElementType)) {
352+
MatrixLayoutEnum Layout, uint Align = 128) {
356353
__builtin_LinAlg_MatrixAccumulateToDescriptor(__handle, Res, StartOffset,
357354
Stride, Layout, Align);
358355
}
@@ -409,8 +406,7 @@ class Matrix<ComponentTy, M, N, Use, MatrixScope::Thread> {
409406
template <MatrixLayoutEnum Layout, MatrixUseEnum UseLocal = Use>
410407
static typename hlsl::enable_if<Use == MatrixUse::A && UseLocal == Use,
411408
Matrix>::type
412-
Load(ByteAddressBuffer Res, uint StartOffset, uint Stride,
413-
uint Align = sizeof(ElementType)) {
409+
Load(ByteAddressBuffer Res, uint StartOffset, uint Stride, uint Align = 128) {
414410
Matrix Result;
415411
__builtin_LinAlg_MatrixLoadFromDescriptor(Result.__handle, Res, StartOffset,
416412
Stride, Layout, Align);

tools/clang/test/CodeGenDXIL/hlsl/linalg/api/matrix-class.hlsl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,16 @@ void main(uint ID : SV_GroupID)
5656
//
5757
// CHECK: %[[MATA2:.*]] = call %dx.types.LinAlgMatrixC9M4N4U0S1
5858
// CHECK-SAME: @dx.op.linAlgMatrixLoadFromDescriptor.mC9M4N4U0S1(i32 -2147483634,
59-
// CHECK-SAME: %dx.types.Handle %{{[0-9]+}}, i32 0, i32 16, i32 1, i32 4)
59+
// CHECK-SAME: %dx.types.Handle %{{[0-9]+}}, i32 0, i32 16, i32 1, i32 128)
6060
// CHECK-SAME: ; LinAlgMatrixLoadFromDescriptor(handle,offset,stride,layout,align)
6161
MatrixATy MatA2 = MatrixATy::Load(BAB, 0, 16, MatrixLayoutEnum::ColMajor);
6262

6363
// Matrix::Load from RWByteAddressBuffer
6464
//
6565
// CHECK: %[[MATB2:.*]] = call %dx.types.LinAlgMatrixC9M4N4U1S1
6666
// CHECK-SAME: @dx.op.linAlgMatrixLoadFromDescriptor.mC9M4N4U1S1(i32 -2147483634,
67-
// CHECK-SAME: %dx.types.Handle %{{[0-9]+}}, i32 256, i32 16, i32 1, i32 4)
68-
// CHECK-SAME: ; LinAlgMatrixLoadFromDescriptor(handle,offset,stride,layout,align)
67+
// CHECK-SAME: %dx.types.Handle %{{[0-9]+}}, i32 256, i32 16, i32 1, i32 128)
68+
// CHECK-SAME: ; LinAlgMatrixLoadFromDescriptor(handle,offset,stride,layout,align)
6969
MatrixBTy MatB2;
7070
MatB2 = MatrixBTy::Load(RWBAB, 256, 16, MatrixLayoutEnum::ColMajor);
7171

@@ -87,7 +87,7 @@ void main(uint ID : SV_GroupID)
8787
// Matrix::GetCoordinate
8888
//
8989
// CHECK: call <2 x i32> @dx.op.linAlgMatrixGetCoordinate.mC9M4N4U1S1(i32 -2147483631,
90-
// CHECK-SAME: %dx.types.LinAlgMatrixC9M4N4U1S1 %[[MATB1]], i32 %[[GROUP_ID]])
90+
// CHECK-SAME: %dx.types.LinAlgMatrixC9M4N4U1S1 %[[MATB1]], i32 %[[GROUP_ID]])
9191
// CHECK-SAME:; LinAlgMatrixGetCoordinate(matrix,threadLocalIndex)
9292
uint2 coord = MatB1.GetCoordinate(ID);
9393

@@ -110,7 +110,7 @@ void main(uint ID : SV_GroupID)
110110
//
111111
// CHECK: call void @dx.op.linAlgMatrixStoreToDescriptor.mC9M4N4U1S1(i32 -2147483628,
112112
// CHECK-SAME: %dx.types.LinAlgMatrixC9M4N4U1S1 %[[MATB1_2]], %dx.types.Handle %{{[0-9]+}},
113-
// CHECK-SAME: i32 256, i32 16, i32 1, i32 4) ;
113+
// CHECK-SAME: i32 256, i32 16, i32 1, i32 128) ;
114114
// CHECK-SAME: LinAlgMatrixStoreToDescriptor(matrix,handle,offset,stride,layout,align)
115115
MatB1.Store(RWBAB, 256, 16, MatrixLayoutEnum::ColMajor);
116116

@@ -129,7 +129,7 @@ void main(uint ID : SV_GroupID)
129129
// Matrix::InterlockedAccumulate to resource descriptor
130130
//
131131
// CHECK: call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC9M4N4U2S1(i32 -2147483621,
132-
// CHECK-SAME: %dx.types.LinAlgMatrixC9M4N4U2S1 %[[ACCUM0]], %dx.types.Handle %{{[0-9]+}}, i32 0, i32 16, i32 1, i32 4)
132+
// CHECK-SAME: %dx.types.LinAlgMatrixC9M4N4U2S1 %[[ACCUM0]], %dx.types.Handle %{{[0-9]+}}, i32 0, i32 16, i32 1, i32 128)
133133
// CHECK-SAME: ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align)
134134
AccMat1.InterlockedAccumulate(RWBAB, 0, 16, MatrixLayoutEnum::ColMajor);
135135

@@ -160,7 +160,7 @@ void main(uint ID : SV_GroupID)
160160
// CHECK-SAME: %dx.types.LinAlgMatrixC9M4N4U1S1 %[[MATB2]])
161161
// CHECK-SAME: ; LinAlgMatrixAccumulate(matrixLHS,matrixRHS)
162162
AccMat2.Accumulate(MatB2);
163-
163+
164164
// Matrix::MultiplyAccumulate
165165
//
166166
// CHECK: %[[ACCUM4:.*]] = call %dx.types.LinAlgMatrixC9M4N4U2S1
@@ -174,7 +174,7 @@ void main(uint ID : SV_GroupID)
174174
// Matrix::Load for thread-scope matrix
175175
//
176176
// CHECK: %[[TSMATA:.*]] = call %dx.types.LinAlgMatrixC9M4N4U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC9M4N4U0S0(
177-
// CHECK-SAME: i32 -2147483634, %dx.types.Handle %{{[0-9]+}}, i32 0, i32 16, i32 1, i32 4)
177+
// CHECK-SAME: i32 -2147483634, %dx.types.Handle %{{[0-9]+}}, i32 0, i32 16, i32 1, i32 128)
178178
// CHECK-SAME: ; LinAlgMatrixLoadFromDescriptor(handle,offset,stride,layout,align)
179179
TSMatrixATy TSMatA = TSMatrixATy::Load<MatrixLayoutEnum::ColMajor>(BAB, 0, 16);
180180

tools/clang/test/CodeGenDXIL/hlsl/linalg/api/vectors.hlsl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// REQUIRES: dxil-1-10
2-
// RUN: %dxc -I %hlsl_headers -enable-16bit-types -T cs_6_10 %s | FileCheck %s
2+
// RUN: %dxc -I %hlsl_headers -enable-16bit-types -T cs_6_10 %s | FileCheck %s
33

44
#include <dx/linalg.h>
55
using namespace dx::linalg;
@@ -12,16 +12,16 @@ ByteAddressBuffer BAB : register(t0);
1212

1313
[numthreads(4, 4, 4)]
1414
void main(uint ID : SV_GroupID) {
15-
15+
1616
// CHECK: %[[MAT1:.*]] = call %dx.types.LinAlgMatrixC8M8N4U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC8M8N4U0S0(
17-
// CHECK-SAME: i32 -2147483634, %dx.types.Handle %{{[0-9]+}}, i32 0, i32 8, i32 1, i32 2)
17+
// CHECK-SAME: i32 -2147483634, %dx.types.Handle %{{[0-9]+}}, i32 0, i32 8, i32 1, i32 128)
1818
// CHECK-SAME: ; LinAlgMatrixLoadFromDescriptor(handle,offset,stride,layout,align)
1919
MatrixATy Mat1 = MatrixATy::Load<MatrixLayoutEnum::ColMajor>(BAB, 0, 8);
2020

2121
vector<half, 4> vec1 = 10.3f;
2222

2323
// CHECK: %[[VEC2:.*]] = call <8 x half> @dx.op.linAlgMatVecMul.v8f16.mC8M8N4U0S0.v4f16(i32 -2147483623,
24-
// CHECK-SAME: %dx.types.LinAlgMatrixC8M8N4U0S0 %[[MAT1]], i1 true, <4 x half> <half 0xH4926, half 0xH4926, half 0xH4926,
24+
// CHECK-SAME: %dx.types.LinAlgMatrixC8M8N4U0S0 %[[MAT1]], i1 true, <4 x half> <half 0xH4926, half 0xH4926, half 0xH4926,
2525
// CHECK-SAME: half 0xH4926>, i32 8) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation)
2626
vector<half, 8> vec2 = Multiply<half>(Mat1, vec1);
2727

@@ -42,9 +42,9 @@ void main(uint ID : SV_GroupID) {
4242

4343
// CHECK: %[[RAWLOAD:.*]] = call %dx.types.ResRet.v8i16 @dx.op.rawBufferVectorLoad.v8i16(i32 303,
4444
// CHECK-SAME: %dx.types.Handle %{{[0-9]+}}, i32 4096, i32 undef, i32 2) ; RawBufferVectorLoad(buf,index,elementOffset,alignment)
45-
45+
4646
// CHECK: %[[VEC_BIAS:.*]] = extractvalue %dx.types.ResRet.v8i16 %[[RAWLOAD]], 0
47-
47+
4848
// CHECK: %[[VEC5:.*]] = call <8 x half> @dx.op.linAlgMatVecMulAdd.v8f16.mC8M8N4U0S0.v4f16.v8i16(i32 -2147483622,
4949
// CHECK-SAME: %dx.types.LinAlgMatrixC8M8N4U0S0 %[[MAT1]], i1 true, <4 x half> %[[VEC20]], i32 8, <8 x i16> %[[VEC_BIAS]], i32 2)
5050
// CHECK-SAME:; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector,biasInterpretation)
@@ -56,7 +56,7 @@ void main(uint ID : SV_GroupID) {
5656
// CHECK-SAME: ; RawBufferVectorLoad(buf,index,elementOffset,alignment)
5757

5858
// CHECK: %[[VEC_BIAS:.*]] = extractvalue %dx.types.ResRet.v8i16 %[[RAWLOAD]], 0
59-
59+
6060
// CHECK: %[[VEC6:.*]] = call <8 x half> @dx.op.linAlgMatVecMulAdd.v8f16.mC8M8N4U0S0.v4f16.v8i16(i32 -2147483622,
6161
// CHECK-SAME: %dx.types.LinAlgMatrixC8M8N4U0S0 %[[MAT1]], i1 true, <4 x half> %[[VEC20]], i32 8, <8 x i16> %[[VEC_BIAS]], i32 2)
6262
// CHECK-SAME: ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector,biasInterpretation)

0 commit comments

Comments
 (0)