Skip to content

Commit 3e6e148

Browse files
authored
[CoopVec] Rename header and namespace (#8148)
Renames cooperative vectors' header to `coopvec.h` with namespace `dx::coopvec`. The `linalg.h` header name will be used for the LinAlg Matrix work. Also moves one remaining test from linalg to coopvec directory. Fixes #8146 Related to #8147
1 parent 907ddac commit 3e6e148

20 files changed

Lines changed: 62 additions & 61 deletions

docs/ReleaseNotes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ line upon naming the release. Refer to previous for appropriate section names.
2525
#### Experimental Shader Model 6.10
2626

2727
- Moved Linear Algebra (Cooperative Vector) DXIL Opcodes to experimental Shader Model 6.10
28+
- The Cooperative Vectors API was moved to `coopvec.h` header and under the `dx::coopvec` namespace.
2829
- Implement GetGroupWaveIndex and GetGroupWaveCount in experimental Shader Model 6.10.
2930
- [proposal](https://github.com/microsoft/hlsl-specs/blob/main/proposals/0048-group-wave-index.md)
3031
- GetGroupWaveIndex: New intrinsic for Compute, Mesh, Amplification and Node shaders which returns the index of the wave within the thread group that the the thread is executing.
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Header for linear algebra APIs.
1+
// Header for cooperative vectors APIs.
22

33
#if __spirv__
44
#error "Cooperative vectors not (yet) supported for SPIRV"
@@ -9,10 +9,10 @@
99
(__HLSL_VERSION >= 2021)
1010

1111
namespace dx {
12-
namespace linalg {
12+
namespace coopvec {
1313

1414
// NOTE: can't be an enum class because we get this error:
15-
// error: non-type template argument of type 'dx::linalg::DataType' is not
15+
// error: non-type template argument of type 'dx::coopvec::DataType' is not
1616
// an integral constant expression
1717
//
1818
enum DataType {
@@ -192,7 +192,7 @@ void VectorAccumulate(vector<ElTy, ElCount> InputVector,
192192
__builtin_VectorAccumulate(InputVector, Buffer, Offset);
193193
}
194194

195-
} // namespace linalg
195+
} // namespace coopvec
196196
} // namespace dx
197197

198198
#endif // SM 6.9 check and HV version check

tools/clang/test/CodeGenDXIL/hlsl/coopvec/mat-vec-mul.hlsl

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

4-
#include <dx/linalg.h>
4+
#include <dx/coopvec.h>
55

66
ByteAddressBuffer Buf;
77

88
export float4 Test1(vector<float, 4> Input) {
9-
using namespace dx::linalg;
9+
using namespace dx::coopvec;
1010

1111
MatrixRef<DATA_TYPE_FLOAT16, 4, 4, MATRIX_LAYOUT_MUL_OPTIMAL, true> Matrix = {
1212
Buf, 0, 0};
@@ -17,7 +17,7 @@ export float4 Test1(vector<float, 4> Input) {
1717
}
1818

1919
export vector<float, 8> Test2(vector<uint, 6> Input) {
20-
using namespace dx::linalg;
20+
using namespace dx::coopvec;
2121

2222
MatrixRef<DATA_TYPE_UINT8, 8, 6 * 4, MATRIX_LAYOUT_MUL_OPTIMAL> Matrix = {
2323
Buf, 0, 0};
@@ -30,7 +30,7 @@ export vector<float, 8> Test2(vector<uint, 6> Input) {
3030

3131
// test that "stride" isn't ignored in non-optimal layouts
3232
export vector<float, 8> Test3(vector<uint, 6> Input) {
33-
using namespace dx::linalg;
33+
using namespace dx::coopvec;
3434

3535
MatrixRef<DATA_TYPE_UINT8, 8, 6 * 4, MATRIX_LAYOUT_ROW_MAJOR> Matrix = {
3636
Buf, 0, 6 * 4 * 8};
@@ -42,7 +42,7 @@ export vector<float, 8> Test3(vector<uint, 6> Input) {
4242

4343
// test that isUnsigned is set correctly for uint16_t
4444
export vector<uint16_t, 8> Test4(vector<uint, 6> Input) {
45-
using namespace dx::linalg;
45+
using namespace dx::coopvec;
4646

4747
MatrixRef<DATA_TYPE_UINT8, 8, 6 * 4, MATRIX_LAYOUT_ROW_MAJOR> Matrix = {
4848
Buf, 0, 6 * 4 * 8};
@@ -55,7 +55,7 @@ export vector<uint16_t, 8> Test4(vector<uint, 6> Input) {
5555

5656
// test that isUnsigned is set correctly for uint32_t
5757
export vector<uint, 8> Test5(vector<uint, 6> Input) {
58-
using namespace dx::linalg;
58+
using namespace dx::coopvec;
5959

6060
MatrixRef<DATA_TYPE_UINT8, 8, 6 * 4, MATRIX_LAYOUT_ROW_MAJOR> Matrix = {
6161
Buf, 0, 6 * 4 * 8};
@@ -68,7 +68,7 @@ export vector<uint, 8> Test5(vector<uint, 6> Input) {
6868

6969
// test that isUnsigned is set correctly for uint8_t4_packed
7070
export vector<uint, 8> Test5(vector<uint8_t4_packed, 6> Input) {
71-
using namespace dx::linalg;
71+
using namespace dx::coopvec;
7272

7373
MatrixRef<DATA_TYPE_UINT8, 8, 6 * 4, MATRIX_LAYOUT_ROW_MAJOR> Matrix = {
7474
Buf, 0, 6 * 4 * 8};
@@ -81,7 +81,7 @@ export vector<uint, 8> Test5(vector<uint8_t4_packed, 6> Input) {
8181

8282
// test that isUnsigned is set correctly for int8_t4_packed
8383
export vector<uint, 8> Test5(vector<int8_t4_packed, 6> Input) {
84-
using namespace dx::linalg;
84+
using namespace dx::coopvec;
8585

8686
MatrixRef<DATA_TYPE_UINT8, 8, 6 * 4, MATRIX_LAYOUT_ROW_MAJOR> Matrix = {
8787
Buf, 0, 6 * 4 * 8};

tools/clang/test/CodeGenDXIL/hlsl/coopvec/mat-vec-muladd.hlsl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// REQUIRES: dxil-1-10
22
// RUN: %dxc -I %hlsl_headers -T lib_6_10 %s | FileCheck %s
33

4-
#include <dx/linalg.h>
4+
#include <dx/coopvec.h>
55

66
ByteAddressBuffer Buf;
77

88
export float4 Test1(float4 input) {
9-
using namespace dx::linalg;
9+
using namespace dx::coopvec;
1010

1111
MatrixRef<DATA_TYPE_FLOAT16, 4, 4, MATRIX_LAYOUT_MUL_OPTIMAL> matrix = {Buf,
1212
0, 0};
@@ -21,7 +21,7 @@ export float4 Test1(float4 input) {
2121
}
2222

2323
export float4 Test2(float4 input) {
24-
using namespace dx::linalg;
24+
using namespace dx::coopvec;
2525

2626
MatrixRef<DATA_TYPE_FLOAT16, 4, 4, MATRIX_LAYOUT_MUL_OPTIMAL, true> matrix = {
2727
Buf, 0, 0};
@@ -36,7 +36,7 @@ export float4 Test2(float4 input) {
3636
}
3737

3838
export float4 Test3(float4 input) {
39-
using namespace dx::linalg;
39+
using namespace dx::coopvec;
4040

4141
MatrixRef<DATA_TYPE_FLOAT16, 4, 4, MATRIX_LAYOUT_MUL_OPTIMAL, true> matrix = {
4242
Buf, 0, 0};
@@ -53,7 +53,7 @@ namespace ProposalExample {
5353
ByteAddressBuffer model;
5454

5555
vector<float, 3> ApplyNeuralMaterial(vector<half, 8> inputVector) {
56-
using namespace dx::linalg;
56+
using namespace dx::coopvec;
5757

5858
MatrixRef<DATA_TYPE_FLOAT8_E4M3, 32, 8, MATRIX_LAYOUT_MUL_OPTIMAL> matrix0 = {
5959
model, 0, 0};

tools/clang/test/CodeGenDXIL/hlsl/coopvec/outer-product-accumulate-matrix-layout.hlsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ ByteAddressBuffer input_vector_buffer;
88
ByteAddressBuffer input_vector_buffer2;
99
RWByteAddressBuffer matrix_buffer;
1010

11-
#include <dx/linalg.h>
11+
#include <dx/coopvec.h>
1212

1313
// CHECK: call void @dx.op.outerProductAccumulate.v8f16.v8f16(i32 307, <8 x half> %{{[^ ]+}}, <8 x half> %{{[^ ]+}}, %dx.types.Handle %{{[^ ]+}}, i32 0, i32 8, i32 3, i32 0)
14-
using namespace dx::linalg;
14+
using namespace dx::coopvec;
1515

1616
[Numthreads(1,1,1)]
1717
[shader("compute")]

tools/clang/test/CodeGenDXIL/hlsl/coopvec/outerproductaccumulate.hlsl

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

4-
#include <dx/linalg.h>
4+
#include <dx/coopvec.h>
55

66
RWByteAddressBuffer RWBuf;
77

88
export void Test4(vector<half, 128> Input1, vector<half, 64> Input2) {
9-
using namespace dx::linalg;
9+
using namespace dx::coopvec;
1010

1111
RWMatrixRef<DATA_TYPE_FLOAT16, 128, 64, MATRIX_LAYOUT_OUTER_PRODUCT_OPTIMAL>
1212
matrix = {RWBuf, 0, 0};

tools/clang/test/CodeGenDXIL/hlsl/coopvec/vectoraccumulate.hlsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// REQUIRES: dxil-1-10
22
// RUN: %dxc -I %hlsl_headers -T lib_6_10 %s | FileCheck %s
33

4-
#include <dx/linalg.h>
4+
#include <dx/coopvec.h>
55

66
RWByteAddressBuffer RWBuf;
77

88
export void Test5(vector<half, 128> Input) {
9-
using namespace dx::linalg;
9+
using namespace dx::coopvec;
1010

1111
RWBuf.Store<vector<half, 128> >(0, Input);
1212

tools/clang/test/CodeGenSPIRV/linalg/outerproductaccumulate-spirv-errors.hlsl renamed to tools/clang/test/CodeGenSPIRV/coopvec/outerproductaccumulate-spirv-errors.hlsl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
// This is a copy of \tools\clang\test\CodeGenDXIL\hlsl\linalg\outerproductaccumulate.hlsl
55
// except that spirv is targeted
66

7-
// expected-error@dx/linalg.h:4{{Cooperative vectors not (yet) supported for SPIRV}}
8-
#include <dx/linalg.h>
7+
// expected-error@dx/coopvec.h:4{{Cooperative vectors not (yet) supported for SPIRV}}
8+
#include <dx/coopvec.h>
99

1010
RWByteAddressBuffer RWBuf;
1111

1212
export void Test4(vector<half, 128> Input1, vector<half, 64> Input2) {
13-
using namespace dx::linalg;
13+
using namespace dx::coopvec;
1414

1515
RWMatrixRef<DATA_TYPE_FLOAT16, 128, 64, MATRIX_LAYOUT_OUTER_PRODUCT_OPTIMAL>
1616
matrix = {RWBuf, 0, 0};

tools/clang/test/SemaHLSL/hlsl/coopvec/builtins/mul_add_invalid.hlsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// RUN: %dxc -I %hlsl_headers -T lib_6_10 -enable-16bit-types %s -verify
22

3-
#include <dx/linalg.h>
3+
#include <dx/coopvec.h>
44

5-
using namespace dx::linalg;
5+
using namespace dx::coopvec;
66

77
ByteAddressBuffer input_vector_buffer;
88
ByteAddressBuffer matrix_buffer;

tools/clang/test/SemaHLSL/hlsl/coopvec/builtins/mul_add_valid.hlsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// REQUIRES: dxil-1-10
22
// RUN: %dxc -I %hlsl_headers -T lib_6_10 %s
33

4-
#include <dx/linalg.h>
4+
#include <dx/coopvec.h>
55

6-
using namespace dx::linalg;
6+
using namespace dx::coopvec;
77

88
ByteAddressBuffer input_vector_buffer;
99
ByteAddressBuffer matrix_buffer;

0 commit comments

Comments
 (0)