Skip to content

Commit a327386

Browse files
Copilotdamyanp
andauthored
Restore LinalgMatrixLayout to DxilConstants.h instead of local enum
Co-authored-by: damyanp <[email protected]> Agent-Logs-Url: https://github.com/damyanp/DirectXShaderCompiler/sessions/4d3d86d1-1c56-4d1f-a553-bf8c37a74c84
1 parent bca4081 commit a327386

2 files changed

Lines changed: 14 additions & 8 deletions

File tree

include/dxc/DXIL/DxilConstants.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,13 @@ enum class MatrixScope : uint32_t {
204204
ThreadGroup = 2,
205205
};
206206

207+
enum class LinalgMatrixLayout : uint32_t {
208+
RowMajor = 0,
209+
ColumnMajor = 1,
210+
MulOptimal = 2,
211+
OuterProductOptimal = 3,
212+
};
213+
207214
// Must match D3D_INTERPOLATION_MODE
208215
enum class InterpolationMode : uint8_t {
209216
Undefined = 0,

tools/clang/unittests/HLSLExec/LinAlgTests.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,10 @@
3232
namespace LinAlg {
3333

3434
using hlsl::DXIL::ComponentType;
35+
using hlsl::DXIL::LinalgMatrixLayout;
3536
using hlsl::DXIL::MatrixScope;
3637
using hlsl::DXIL::MatrixUse;
3738

38-
enum class MatrixLayout : uint32_t { RowMajor = 0, ColumnMajor = 1 };
39-
4039
/// Return the byte size of a single element for the given component type.
4140
static int elemSize(ComponentType CT) {
4241
switch (CT) {
@@ -187,13 +186,13 @@ struct MatrixParams {
187186
int N;
188187
MatrixUse Use;
189188
MatrixScope Scope;
190-
MatrixLayout Layout;
189+
LinalgMatrixLayout Layout;
191190
int NumThreads;
192191
bool Enable16Bit;
193192

194193
int strideBytes() const {
195194
int ES = elemSize(CompType);
196-
if (Layout == MatrixLayout::RowMajor)
195+
if (Layout == LinalgMatrixLayout::RowMajor)
197196
return N * ES;
198197
return M * ES;
199198
}
@@ -459,7 +458,7 @@ void DxilConf_SM610_LinAlg::LoadStoreRoundtrip_Wave_F32() {
459458
Params.N = 8;
460459
Params.Use = MatrixUse::A;
461460
Params.Scope = MatrixScope::Wave;
462-
Params.Layout = MatrixLayout::RowMajor;
461+
Params.Layout = LinalgMatrixLayout::RowMajor;
463462
Params.NumThreads = 64;
464463
Params.Enable16Bit = false;
465464
runLoadStoreRoundtrip(D3DDevice, DxcSupport, Params, VerboseLogging);
@@ -472,7 +471,7 @@ void DxilConf_SM610_LinAlg::LoadStoreRoundtrip_Wave_I32() {
472471
Params.N = 8;
473472
Params.Use = MatrixUse::A;
474473
Params.Scope = MatrixScope::Wave;
475-
Params.Layout = MatrixLayout::RowMajor;
474+
Params.Layout = LinalgMatrixLayout::RowMajor;
476475
Params.NumThreads = 64;
477476
Params.Enable16Bit = false;
478477
runLoadStoreRoundtrip(D3DDevice, DxcSupport, Params, VerboseLogging);
@@ -563,7 +562,7 @@ void DxilConf_SM610_LinAlg::SplatStore_Wave_F32() {
563562
Params.N = 8;
564563
Params.Use = MatrixUse::Accumulator;
565564
Params.Scope = MatrixScope::Wave;
566-
Params.Layout = MatrixLayout::RowMajor;
565+
Params.Layout = LinalgMatrixLayout::RowMajor;
567566
Params.NumThreads = 64;
568567
Params.Enable16Bit = false;
569568
runSplatStore(D3DDevice, DxcSupport, Params, 42.0f, VerboseLogging);
@@ -576,7 +575,7 @@ void DxilConf_SM610_LinAlg::SplatStore_Wave_I32() {
576575
Params.N = 8;
577576
Params.Use = MatrixUse::Accumulator;
578577
Params.Scope = MatrixScope::Wave;
579-
Params.Layout = MatrixLayout::RowMajor;
578+
Params.Layout = LinalgMatrixLayout::RowMajor;
580579
Params.NumThreads = 64;
581580
Params.Enable16Bit = false;
582581
runSplatStore(D3DDevice, DxcSupport, Params, 7.0f, VerboseLogging);

0 commit comments

Comments
 (0)