Skip to content

Commit 62208ca

Browse files
authored
[SM6.10] Add dx.types.MatrixRef to DXIL (#8027)
Introduces `dx.types.MatrixRef` as a legal DXIL type without using it anywhere. This doesn't expose the type to higher levels yet so it's not possible to write a meaningful test for the PR. The very next PR in the stack will have tests that emit the type and test this code path. The DXIL ops that operate over the `MatrixRef` type have been updated to use the new type `include/dxc/DXIL/DxilInstructions.h` is entirely generated code and all the `case` updates to `lib/DXIL/DxilOperations.cpp` is generated code.
1 parent 3e46e22 commit 62208ca

7 files changed

Lines changed: 139 additions & 151 deletions

File tree

include/dxc/DXIL/DxilInstructions.h

Lines changed: 63 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -10539,12 +10539,12 @@ struct DxilInst_FillMatrix {
1053910539
bool requiresUniformInputs() const { return false; }
1054010540
// Operand indexes
1054110541
enum OperandIdx {
10542-
arg_matrixRef = 1,
10542+
arg_matrix = 1,
1054310543
arg_value = 2,
1054410544
};
1054510545
// Accessors
10546-
llvm::Value *get_matrixRef() const { return Instr->getOperand(1); }
10547-
void set_matrixRef(llvm::Value *val) { Instr->setOperand(1, val); }
10546+
llvm::Value *get_matrix() const { return Instr->getOperand(1); }
10547+
void set_matrix(llvm::Value *val) { Instr->setOperand(1, val); }
1054810548
llvm::Value *get_value() const { return Instr->getOperand(2); }
1054910549
void set_value(llvm::Value *val) { Instr->setOperand(2, val); }
1055010550
};
@@ -10570,15 +10570,15 @@ struct DxilInst_CopyConvertMatrix {
1057010570
bool requiresUniformInputs() const { return false; }
1057110571
// Operand indexes
1057210572
enum OperandIdx {
10573-
arg_destMatrixRef = 1,
10574-
arg_srcMatrixRef = 2,
10573+
arg_destination = 1,
10574+
arg_source = 2,
1057510575
arg_transpose = 3,
1057610576
};
1057710577
// Accessors
10578-
llvm::Value *get_destMatrixRef() const { return Instr->getOperand(1); }
10579-
void set_destMatrixRef(llvm::Value *val) { Instr->setOperand(1, val); }
10580-
llvm::Value *get_srcMatrixRef() const { return Instr->getOperand(2); }
10581-
void set_srcMatrixRef(llvm::Value *val) { Instr->setOperand(2, val); }
10578+
llvm::Value *get_destination() const { return Instr->getOperand(1); }
10579+
void set_destination(llvm::Value *val) { Instr->setOperand(1, val); }
10580+
llvm::Value *get_source() const { return Instr->getOperand(2); }
10581+
void set_source(llvm::Value *val) { Instr->setOperand(2, val); }
1058210582
llvm::Value *get_transpose() const { return Instr->getOperand(3); }
1058310583
void set_transpose(llvm::Value *val) { Instr->setOperand(3, val); }
1058410584
};
@@ -10604,15 +10604,15 @@ struct DxilInst_MatrixLoadFromDescriptor {
1060410604
bool requiresUniformInputs() const { return false; }
1060510605
// Operand indexes
1060610606
enum OperandIdx {
10607-
arg_matrixRef = 1,
10607+
arg_matrix = 1,
1060810608
arg_handle = 2,
1060910609
arg_offset = 3,
1061010610
arg_stride = 4,
1061110611
arg_layout = 5,
1061210612
};
1061310613
// Accessors
10614-
llvm::Value *get_matrixRef() const { return Instr->getOperand(1); }
10615-
void set_matrixRef(llvm::Value *val) { Instr->setOperand(1, val); }
10614+
llvm::Value *get_matrix() const { return Instr->getOperand(1); }
10615+
void set_matrix(llvm::Value *val) { Instr->setOperand(1, val); }
1061610616
llvm::Value *get_handle() const { return Instr->getOperand(2); }
1061710617
void set_handle(llvm::Value *val) { Instr->setOperand(2, val); }
1061810618
llvm::Value *get_offset() const { return Instr->getOperand(3); }
@@ -10643,15 +10643,15 @@ struct DxilInst_MatrixLoadFromMemory {
1064310643
bool requiresUniformInputs() const { return false; }
1064410644
// Operand indexes
1064510645
enum OperandIdx {
10646-
arg_matrixRef = 1,
10646+
arg_matrix = 1,
1064710647
arg_groupsharedArr = 2,
1064810648
arg_offset = 3,
1064910649
arg_stride = 4,
1065010650
arg_layout = 5,
1065110651
};
1065210652
// Accessors
10653-
llvm::Value *get_matrixRef() const { return Instr->getOperand(1); }
10654-
void set_matrixRef(llvm::Value *val) { Instr->setOperand(1, val); }
10653+
llvm::Value *get_matrix() const { return Instr->getOperand(1); }
10654+
void set_matrix(llvm::Value *val) { Instr->setOperand(1, val); }
1065510655
llvm::Value *get_groupsharedArr() const { return Instr->getOperand(2); }
1065610656
void set_groupsharedArr(llvm::Value *val) { Instr->setOperand(2, val); }
1065710657
llvm::Value *get_offset() const { return Instr->getOperand(3); }
@@ -10683,11 +10683,11 @@ struct DxilInst_MatrixLength {
1068310683
bool requiresUniformInputs() const { return false; }
1068410684
// Operand indexes
1068510685
enum OperandIdx {
10686-
arg_matrixRef = 1,
10686+
arg_matrix = 1,
1068710687
};
1068810688
// Accessors
10689-
llvm::Value *get_matrixRef() const { return Instr->getOperand(1); }
10690-
void set_matrixRef(llvm::Value *val) { Instr->setOperand(1, val); }
10689+
llvm::Value *get_matrix() const { return Instr->getOperand(1); }
10690+
void set_matrix(llvm::Value *val) { Instr->setOperand(1, val); }
1069110691
};
1069210692

1069310693
/// This instruction returns a two element vector containing the column and row
@@ -10711,12 +10711,12 @@ struct DxilInst_MatrixGetCoordinate {
1071110711
bool requiresUniformInputs() const { return false; }
1071210712
// Operand indexes
1071310713
enum OperandIdx {
10714-
arg_matrixRef = 1,
10714+
arg_matrix = 1,
1071510715
arg_threadLocalIndex = 2,
1071610716
};
1071710717
// Accessors
10718-
llvm::Value *get_matrixRef() const { return Instr->getOperand(1); }
10719-
void set_matrixRef(llvm::Value *val) { Instr->setOperand(1, val); }
10718+
llvm::Value *get_matrix() const { return Instr->getOperand(1); }
10719+
void set_matrix(llvm::Value *val) { Instr->setOperand(1, val); }
1072010720
llvm::Value *get_threadLocalIndex() const { return Instr->getOperand(2); }
1072110721
void set_threadLocalIndex(llvm::Value *val) { Instr->setOperand(2, val); }
1072210722
};
@@ -10742,12 +10742,12 @@ struct DxilInst_MatrixGetElement {
1074210742
bool requiresUniformInputs() const { return false; }
1074310743
// Operand indexes
1074410744
enum OperandIdx {
10745-
arg_matrixRef = 1,
10745+
arg_matrix = 1,
1074610746
arg_threadLocalIndex = 2,
1074710747
};
1074810748
// Accessors
10749-
llvm::Value *get_matrixRef() const { return Instr->getOperand(1); }
10750-
void set_matrixRef(llvm::Value *val) { Instr->setOperand(1, val); }
10749+
llvm::Value *get_matrix() const { return Instr->getOperand(1); }
10750+
void set_matrix(llvm::Value *val) { Instr->setOperand(1, val); }
1075110751
llvm::Value *get_threadLocalIndex() const { return Instr->getOperand(2); }
1075210752
void set_threadLocalIndex(llvm::Value *val) { Instr->setOperand(2, val); }
1075310753
};
@@ -10773,13 +10773,13 @@ struct DxilInst_MatrixSetElement {
1077310773
bool requiresUniformInputs() const { return false; }
1077410774
// Operand indexes
1077510775
enum OperandIdx {
10776-
arg_matrixRef = 1,
10776+
arg_matrix = 1,
1077710777
arg_threadLocalIndex = 2,
1077810778
arg_value = 3,
1077910779
};
1078010780
// Accessors
10781-
llvm::Value *get_matrixRef() const { return Instr->getOperand(1); }
10782-
void set_matrixRef(llvm::Value *val) { Instr->setOperand(1, val); }
10781+
llvm::Value *get_matrix() const { return Instr->getOperand(1); }
10782+
void set_matrix(llvm::Value *val) { Instr->setOperand(1, val); }
1078310783
llvm::Value *get_threadLocalIndex() const { return Instr->getOperand(2); }
1078410784
void set_threadLocalIndex(llvm::Value *val) { Instr->setOperand(2, val); }
1078510785
llvm::Value *get_value() const { return Instr->getOperand(3); }
@@ -10806,15 +10806,15 @@ struct DxilInst_MatrixStoreToDescriptor {
1080610806
bool requiresUniformInputs() const { return false; }
1080710807
// Operand indexes
1080810808
enum OperandIdx {
10809-
arg_matrixRef = 1,
10809+
arg_matrix = 1,
1081010810
arg_handle = 2,
1081110811
arg_offset = 3,
1081210812
arg_stride = 4,
1081310813
arg_layout = 5,
1081410814
};
1081510815
// Accessors
10816-
llvm::Value *get_matrixRef() const { return Instr->getOperand(1); }
10817-
void set_matrixRef(llvm::Value *val) { Instr->setOperand(1, val); }
10816+
llvm::Value *get_matrix() const { return Instr->getOperand(1); }
10817+
void set_matrix(llvm::Value *val) { Instr->setOperand(1, val); }
1081810818
llvm::Value *get_handle() const { return Instr->getOperand(2); }
1081910819
void set_handle(llvm::Value *val) { Instr->setOperand(2, val); }
1082010820
llvm::Value *get_offset() const { return Instr->getOperand(3); }
@@ -10845,15 +10845,15 @@ struct DxilInst_MatrixStoreToMemory {
1084510845
bool requiresUniformInputs() const { return false; }
1084610846
// Operand indexes
1084710847
enum OperandIdx {
10848-
arg_matrixRef = 1,
10848+
arg_matrix = 1,
1084910849
arg_groupsharedArr = 2,
1085010850
arg_offset = 3,
1085110851
arg_stride = 4,
1085210852
arg_layout = 5,
1085310853
};
1085410854
// Accessors
10855-
llvm::Value *get_matrixRef() const { return Instr->getOperand(1); }
10856-
void set_matrixRef(llvm::Value *val) { Instr->setOperand(1, val); }
10855+
llvm::Value *get_matrix() const { return Instr->getOperand(1); }
10856+
void set_matrix(llvm::Value *val) { Instr->setOperand(1, val); }
1085710857
llvm::Value *get_groupsharedArr() const { return Instr->getOperand(2); }
1085810858
void set_groupsharedArr(llvm::Value *val) { Instr->setOperand(2, val); }
1085910859
llvm::Value *get_offset() const { return Instr->getOperand(3); }
@@ -10906,17 +10906,17 @@ struct DxilInst_MatrixMulOp {
1090610906
bool requiresUniformInputs() const { return false; }
1090710907
// Operand indexes
1090810908
enum OperandIdx {
10909-
arg_matrixRefA = 1,
10910-
arg_matrixRefB = 2,
10911-
arg_matrixRefC = 3,
10909+
arg_matrixA = 1,
10910+
arg_matrixB = 2,
10911+
arg_matrixC = 3,
1091210912
};
1091310913
// Accessors
10914-
llvm::Value *get_matrixRefA() const { return Instr->getOperand(1); }
10915-
void set_matrixRefA(llvm::Value *val) { Instr->setOperand(1, val); }
10916-
llvm::Value *get_matrixRefB() const { return Instr->getOperand(2); }
10917-
void set_matrixRefB(llvm::Value *val) { Instr->setOperand(2, val); }
10918-
llvm::Value *get_matrixRefC() const { return Instr->getOperand(3); }
10919-
void set_matrixRefC(llvm::Value *val) { Instr->setOperand(3, val); }
10914+
llvm::Value *get_matrixA() const { return Instr->getOperand(1); }
10915+
void set_matrixA(llvm::Value *val) { Instr->setOperand(1, val); }
10916+
llvm::Value *get_matrixB() const { return Instr->getOperand(2); }
10917+
void set_matrixB(llvm::Value *val) { Instr->setOperand(2, val); }
10918+
llvm::Value *get_matrixC() const { return Instr->getOperand(3); }
10919+
void set_matrixC(llvm::Value *val) { Instr->setOperand(3, val); }
1092010920
};
1092110921

1092210922
/// This instruction accumulate A or B matrix into Accumulator matrix following
@@ -10940,14 +10940,14 @@ struct DxilInst_MatrixAccumulate {
1094010940
bool requiresUniformInputs() const { return false; }
1094110941
// Operand indexes
1094210942
enum OperandIdx {
10943-
arg_matrixRefRHS = 1,
10944-
arg_matrixRefLHS = 2,
10943+
arg_matrixRHS = 1,
10944+
arg_matrixLHS = 2,
1094510945
};
1094610946
// Accessors
10947-
llvm::Value *get_matrixRefRHS() const { return Instr->getOperand(1); }
10948-
void set_matrixRefRHS(llvm::Value *val) { Instr->setOperand(1, val); }
10949-
llvm::Value *get_matrixRefLHS() const { return Instr->getOperand(2); }
10950-
void set_matrixRefLHS(llvm::Value *val) { Instr->setOperand(2, val); }
10947+
llvm::Value *get_matrixRHS() const { return Instr->getOperand(1); }
10948+
void set_matrixRHS(llvm::Value *val) { Instr->setOperand(1, val); }
10949+
llvm::Value *get_matrixLHS() const { return Instr->getOperand(2); }
10950+
void set_matrixLHS(llvm::Value *val) { Instr->setOperand(2, val); }
1095110951
};
1095210952

1095310953
/// This instruction Multiplies a MxK dimension matrix and a K sized input
@@ -10971,13 +10971,13 @@ struct DxilInst_MatrixVecMul {
1097110971
bool requiresUniformInputs() const { return false; }
1097210972
// Operand indexes
1097310973
enum OperandIdx {
10974-
arg_matrixRef = 1,
10974+
arg_matrix = 1,
1097510975
arg_inputVector = 2,
1097610976
arg_interpretation = 3,
1097710977
};
1097810978
// Accessors
10979-
llvm::Value *get_matrixRef() const { return Instr->getOperand(1); }
10980-
void set_matrixRef(llvm::Value *val) { Instr->setOperand(1, val); }
10979+
llvm::Value *get_matrix() const { return Instr->getOperand(1); }
10980+
void set_matrix(llvm::Value *val) { Instr->setOperand(1, val); }
1098110981
llvm::Value *get_inputVector() const { return Instr->getOperand(2); }
1098210982
void set_inputVector(llvm::Value *val) { Instr->setOperand(2, val); }
1098310983
llvm::Value *get_interpretation() const { return Instr->getOperand(3); }
@@ -11005,15 +11005,15 @@ struct DxilInst_MatrixVecMulAdd {
1100511005
bool requiresUniformInputs() const { return false; }
1100611006
// Operand indexes
1100711007
enum OperandIdx {
11008-
arg_matrixRef = 1,
11008+
arg_matrix = 1,
1100911009
arg_inputVector = 2,
1101011010
arg_inputInterpretation = 3,
1101111011
arg_biasVector = 4,
1101211012
arg_biasInterpretation = 5,
1101311013
};
1101411014
// Accessors
11015-
llvm::Value *get_matrixRef() const { return Instr->getOperand(1); }
11016-
void set_matrixRef(llvm::Value *val) { Instr->setOperand(1, val); }
11015+
llvm::Value *get_matrix() const { return Instr->getOperand(1); }
11016+
void set_matrix(llvm::Value *val) { Instr->setOperand(1, val); }
1101711017
llvm::Value *get_inputVector() const { return Instr->getOperand(2); }
1101811018
void set_inputVector(llvm::Value *val) { Instr->setOperand(2, val); }
1101911019
llvm::Value *get_inputInterpretation() const { return Instr->getOperand(3); }
@@ -11045,15 +11045,15 @@ struct DxilInst_MatrixAccumulateToDescriptor {
1104511045
bool requiresUniformInputs() const { return false; }
1104611046
// Operand indexes
1104711047
enum OperandIdx {
11048-
arg_matrixRef = 1,
11048+
arg_matrix = 1,
1104911049
arg_handle = 2,
1105011050
arg_offset = 3,
1105111051
arg_stride = 4,
1105211052
arg_layout = 5,
1105311053
};
1105411054
// Accessors
11055-
llvm::Value *get_matrixRef() const { return Instr->getOperand(1); }
11056-
void set_matrixRef(llvm::Value *val) { Instr->setOperand(1, val); }
11055+
llvm::Value *get_matrix() const { return Instr->getOperand(1); }
11056+
void set_matrix(llvm::Value *val) { Instr->setOperand(1, val); }
1105711057
llvm::Value *get_handle() const { return Instr->getOperand(2); }
1105811058
void set_handle(llvm::Value *val) { Instr->setOperand(2, val); }
1105911059
llvm::Value *get_offset() const { return Instr->getOperand(3); }
@@ -11085,15 +11085,15 @@ struct DxilInst_MatrixAccumulateToMemory {
1108511085
bool requiresUniformInputs() const { return false; }
1108611086
// Operand indexes
1108711087
enum OperandIdx {
11088-
arg_matrixRef = 1,
11088+
arg_matrix = 1,
1108911089
arg_groupsharedArr = 2,
1109011090
arg_offset = 3,
1109111091
arg_stride = 4,
1109211092
arg_layout = 5,
1109311093
};
1109411094
// Accessors
11095-
llvm::Value *get_matrixRef() const { return Instr->getOperand(1); }
11096-
void set_matrixRef(llvm::Value *val) { Instr->setOperand(1, val); }
11095+
llvm::Value *get_matrix() const { return Instr->getOperand(1); }
11096+
void set_matrix(llvm::Value *val) { Instr->setOperand(1, val); }
1109711097
llvm::Value *get_groupsharedArr() const { return Instr->getOperand(2); }
1109811098
void set_groupsharedArr(llvm::Value *val) { Instr->setOperand(2, val); }
1109911099
llvm::Value *get_offset() const { return Instr->getOperand(3); }
@@ -11125,13 +11125,13 @@ struct DxilInst_MatrixOuterProduct {
1112511125
bool requiresUniformInputs() const { return false; }
1112611126
// Operand indexes
1112711127
enum OperandIdx {
11128-
arg_matrixRef = 1,
11128+
arg_matrix = 1,
1112911129
arg_vectorA = 2,
1113011130
arg_vectorB = 3,
1113111131
};
1113211132
// Accessors
11133-
llvm::Value *get_matrixRef() const { return Instr->getOperand(1); }
11134-
void set_matrixRef(llvm::Value *val) { Instr->setOperand(1, val); }
11133+
llvm::Value *get_matrix() const { return Instr->getOperand(1); }
11134+
void set_matrix(llvm::Value *val) { Instr->setOperand(1, val); }
1113511135
llvm::Value *get_vectorA() const { return Instr->getOperand(2); }
1113611136
void set_vectorA(llvm::Value *val) { Instr->setOperand(2, val); }
1113711137
llvm::Value *get_vectorB() const { return Instr->getOperand(3); }

include/dxc/DXIL/DxilOperations.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ class OP {
8484
llvm::LLVMContext &GetCtx() { return m_Ctx; }
8585
llvm::Module *GetModule() { return m_pModule; }
8686
llvm::Type *GetHandleType() const;
87+
llvm::Type *GetMatrixRefType() const;
8788
llvm::Type *GetHitObjectType() const;
8889
llvm::Type *GetNodeHandleType() const;
8990
llvm::Type *GetNodeRecordHandleType() const;
@@ -190,6 +191,7 @@ class OP {
190191
llvm::Type *m_pSplitDoubleType;
191192
llvm::Type *m_pFourI32Type;
192193
llvm::Type *m_pFourI16Type;
194+
llvm::Type *m_pMatrixRefType;
193195

194196
DXIL::LowPrecisionMode m_LowPrecisionMode;
195197

include/dxc/DXIL/DxilUtil.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ bool IsHLSLObjectType(llvm::Type *Ty);
164164
bool IsHLSLRayQueryType(llvm::Type *Ty);
165165
llvm::Type *GetHLSLHitObjectType(llvm::Module *M);
166166
bool IsHLSLHitObjectType(llvm::Type *Ty);
167+
llvm::Type *GetHLSLMatrixRefType(llvm::Module *M);
168+
bool IsHLSLMatrixRefType(llvm::Type *Ty);
167169
bool IsHLSLResourceDescType(llvm::Type *Ty);
168170
bool IsResourceSingleComponent(llvm::Type *Ty);
169171
uint8_t GetResourceComponentCount(llvm::Type *Ty);

0 commit comments

Comments
 (0)