Skip to content

Commit 67a8e24

Browse files
damyanphekotaCopilot
authored
Remove experimental Cooperative Vector feature (#8291)
The experimental Cooperative Vector feature has been superseded by LinAlg. This change removes the code supporting the old feature. Fixes #8147 --------- Co-authored-by: Helena Kotas <hekotas@microsoft.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: damyanp <8118402+damyanp@users.noreply.github.com>
1 parent 9b0463b commit 67a8e24

File tree

78 files changed

+522
-7149
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+522
-7149
lines changed

docs/DXIL.rst

Lines changed: 292 additions & 302 deletions
Large diffs are not rendered by default.

docs/ReleaseNotes.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ line upon naming the release. Refer to previous for appropriate section names.
2424

2525
#### Experimental Shader Model 6.10
2626

27-
- 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.
27+
- Removed experimental Cooperative Vector, this has been replaced by LinAlg matrix.
2928
- Implement GetGroupWaveIndex and GetGroupWaveCount in experimental Shader Model 6.10.
3029
- [proposal](https://github.com/microsoft/hlsl-specs/blob/main/proposals/0048-group-wave-index.md)
3130
- 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.

include/dxc/DXIL/DxilConstants.h

Lines changed: 21 additions & 57 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,
@@ -524,9 +531,9 @@ static const OpCodeTableID TableID = OpCodeTableID::ExperimentalOps;
524531
// Enumeration for ExperimentalOps DXIL operations
525532
enum class OpCode : unsigned {
526533
//
527-
ReservedD1 = 30, // reserved
528-
ReservedD2 = 31, // reserved
529-
ReservedD3 = 32, // reserved
534+
ReservedE1 = 30, // reserved
535+
ReservedE2 = 31, // reserved
536+
ReservedE3 = 32, // reserved
530537

531538
// Debugging
532539
DebugBreak = 33, // triggers a breakpoint if a debugger is attached
@@ -647,6 +654,10 @@ enum class OpCode : unsigned {
647654
ReservedC7 = 300, // reserved
648655
ReservedC8 = 301, // reserved
649656
ReservedC9 = 302, // reserved
657+
ReservedD0 = 305, // reserved
658+
ReservedD1 = 306, // reserved
659+
ReservedD2 = 307, // reserved
660+
ReservedD3 = 308, // reserved
650661

651662
// Amplification shader instructions
652663
DispatchMesh = 173, // Amplification shader intrinsic DispatchMesh
@@ -876,19 +887,6 @@ enum class OpCode : unsigned {
876887
CreateHandleForLib =
877888
160, // create resource handle from resource struct for library
878889

879-
// Linear Algebra Operations
880-
MatVecMul =
881-
305, // Multiplies a MxK dimension matrix and a K sized input vector
882-
MatVecMulAdd = 306, // multiplies a MxK dimension matrix and a K sized input
883-
// vector and adds an M-sized bias vector
884-
OuterProductAccumulate =
885-
307, // Computes the outer product between column vectors and an MxN
886-
// matrix is accumulated component-wise atomically (with device
887-
// scope) in memory
888-
VectorAccumulate = 308, // Accumulates the components of a vector
889-
// component-wise atomically (with device scope) to
890-
// the corresponding elements of an array in memory
891-
892890
// Mesh shader instructions
893891
EmitIndices = 169, // emit a primitive's vertex indices in a mesh shader
894892
GetMeshPayload =
@@ -1351,12 +1349,12 @@ enum class OpCode : unsigned {
13511349
ExperimentalOps,
13521350
LinAlgMatrixOuterProduct), // Outer products an M sized vector and a N
13531351
// sized vector producing an MxN matrix
1354-
// ReservedD1 = 0x8000001E, 2147483678U, -2147483618
1355-
EXP_OPCODE(ExperimentalOps, ReservedD1), // reserved
1356-
// ReservedD2 = 0x8000001F, 2147483679U, -2147483617
1357-
EXP_OPCODE(ExperimentalOps, ReservedD2), // reserved
1358-
// ReservedD3 = 0x80000020, 2147483680U, -2147483616
1359-
EXP_OPCODE(ExperimentalOps, ReservedD3), // reserved
1352+
// ReservedE1 = 0x8000001E, 2147483678U, -2147483618
1353+
EXP_OPCODE(ExperimentalOps, ReservedE1), // reserved
1354+
// ReservedE2 = 0x8000001F, 2147483679U, -2147483617
1355+
EXP_OPCODE(ExperimentalOps, ReservedE2), // reserved
1356+
// ReservedE3 = 0x80000020, 2147483680U, -2147483616
1357+
EXP_OPCODE(ExperimentalOps, ReservedE3), // reserved
13601358
// DebugBreak = 0x80000021, 2147483681U, -2147483615
13611359
EXP_OPCODE(ExperimentalOps,
13621360
DebugBreak), // triggers a breakpoint if a debugger is attached
@@ -1541,10 +1539,6 @@ enum class OpCodeClass : unsigned {
15411539
LinAlgMatrixSetElement,
15421540
LinAlgMatrixStoreToDescriptor,
15431541
LinAlgMatrixStoreToMemory,
1544-
MatVecMul,
1545-
MatVecMulAdd,
1546-
OuterProductAccumulate,
1547-
VectorAccumulate,
15481542

15491543
// Mesh shader instructions
15501544
EmitIndices,
@@ -1731,7 +1725,7 @@ enum class OpCodeClass : unsigned {
17311725
NodeOutputIsValid,
17321726
OutputComplete,
17331727

1734-
NumOpClasses = 225, // exclusive last value of enumeration
1728+
NumOpClasses = 221, // exclusive last value of enumeration
17351729
};
17361730
// OPCODECLASS-ENUM:END
17371731

@@ -1911,29 +1905,6 @@ const unsigned kHitObjectTraceRay_RayDescOpIdx = 7;
19111905
const unsigned kHitObjectTraceRay_PayloadOpIdx = 15;
19121906
const unsigned kHitObjectTraceRay_NumOp = 16;
19131907

1914-
// MatVec Ops
1915-
const unsigned kMatVecMulInputVectorIdx = 1;
1916-
const unsigned kMatVecMulIsInputUnsignedIdx = 2;
1917-
const unsigned kMatVecMulInputInterpretationIdx = 3;
1918-
const unsigned kMatVecMulMatrixBufferIdx = 4;
1919-
const unsigned kMatVecMulMatrixOffsetIdx = 5;
1920-
const unsigned kMatVecMulMatrixInterpretationIdx = 6;
1921-
const unsigned kMatVecMulMatrixMIdx = 7;
1922-
const unsigned kMatVecMulMatrixKIdx = 8;
1923-
const unsigned kMatVecMulMatrixLayoutIdx = 9;
1924-
const unsigned kMatVecMulMatrixTransposeIdx = 10;
1925-
const unsigned kMatVecMulMatrixStrideIdx = 11;
1926-
const unsigned kMatVecMulIsOutputUnsignedIdx = 12;
1927-
1928-
// MatVecAdd
1929-
const unsigned kMatVecMulAddBiasInterpretation = 14;
1930-
const unsigned kMatVecMulAddIsOutputUnsignedIdx = 15;
1931-
1932-
// Outer Product Accumulate
1933-
const unsigned kOuterProdAccMatrixInterpretation = 5;
1934-
const unsigned kOuterProdAccMatrixLayout = 6;
1935-
const unsigned kOuterProdAccMatrixStride = 7;
1936-
19371908
// TODO: add operand index for all the OpCodeClass.
19381909
} // namespace OperandIndex
19391910

@@ -2506,13 +2477,6 @@ extern const char *kHostLayoutTypePrefix;
25062477

25072478
extern const char *kWaveOpsIncludeHelperLanesString;
25082479

2509-
enum class LinalgMatrixLayout : uint32_t {
2510-
RowMajor = 0,
2511-
ColumnMajor = 1,
2512-
MulOptimal = 2,
2513-
OuterProductOptimal = 3,
2514-
};
2515-
25162480
} // namespace DXIL
25172481

25182482
} // namespace hlsl

include/dxc/DXIL/DxilInstructions.h

Lines changed: 0 additions & 230 deletions
Original file line numberDiff line numberDiff line change
@@ -9919,236 +9919,6 @@ struct DxilInst_RawBufferVectorStore {
99199919
}
99209920
};
99219921

9922-
/// This instruction Multiplies a MxK dimension matrix and a K sized input
9923-
/// vector
9924-
struct DxilInst_MatVecMul {
9925-
llvm::Instruction *Instr;
9926-
// Construction and identification
9927-
DxilInst_MatVecMul(llvm::Instruction *pInstr) : Instr(pInstr) {}
9928-
operator bool() const {
9929-
return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::MatVecMul);
9930-
}
9931-
// Validation support
9932-
bool isAllowed() const { return true; }
9933-
bool isArgumentListValid() const {
9934-
if (13 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands())
9935-
return false;
9936-
return true;
9937-
}
9938-
// Metadata
9939-
bool requiresUniformInputs() const { return false; }
9940-
// Operand indexes
9941-
enum OperandIdx {
9942-
arg_inputVector = 1,
9943-
arg_isInputUnsigned = 2,
9944-
arg_inputInterpretation = 3,
9945-
arg_matrixBuffer = 4,
9946-
arg_matrixOffset = 5,
9947-
arg_matrixIntepretation = 6,
9948-
arg_matrixM = 7,
9949-
arg_matrixK = 8,
9950-
arg_matrixLayout = 9,
9951-
arg_matrixTranspose = 10,
9952-
arg_matrixStride = 11,
9953-
arg_isOutputUnsigned = 12,
9954-
};
9955-
// Accessors
9956-
llvm::Value *get_inputVector() const { return Instr->getOperand(1); }
9957-
void set_inputVector(llvm::Value *val) { Instr->setOperand(1, val); }
9958-
llvm::Value *get_isInputUnsigned() const { return Instr->getOperand(2); }
9959-
void set_isInputUnsigned(llvm::Value *val) { Instr->setOperand(2, val); }
9960-
llvm::Value *get_inputInterpretation() const { return Instr->getOperand(3); }
9961-
void set_inputInterpretation(llvm::Value *val) { Instr->setOperand(3, val); }
9962-
llvm::Value *get_matrixBuffer() const { return Instr->getOperand(4); }
9963-
void set_matrixBuffer(llvm::Value *val) { Instr->setOperand(4, val); }
9964-
llvm::Value *get_matrixOffset() const { return Instr->getOperand(5); }
9965-
void set_matrixOffset(llvm::Value *val) { Instr->setOperand(5, val); }
9966-
llvm::Value *get_matrixIntepretation() const { return Instr->getOperand(6); }
9967-
void set_matrixIntepretation(llvm::Value *val) { Instr->setOperand(6, val); }
9968-
llvm::Value *get_matrixM() const { return Instr->getOperand(7); }
9969-
void set_matrixM(llvm::Value *val) { Instr->setOperand(7, val); }
9970-
llvm::Value *get_matrixK() const { return Instr->getOperand(8); }
9971-
void set_matrixK(llvm::Value *val) { Instr->setOperand(8, val); }
9972-
llvm::Value *get_matrixLayout() const { return Instr->getOperand(9); }
9973-
void set_matrixLayout(llvm::Value *val) { Instr->setOperand(9, val); }
9974-
llvm::Value *get_matrixTranspose() const { return Instr->getOperand(10); }
9975-
void set_matrixTranspose(llvm::Value *val) { Instr->setOperand(10, val); }
9976-
llvm::Value *get_matrixStride() const { return Instr->getOperand(11); }
9977-
void set_matrixStride(llvm::Value *val) { Instr->setOperand(11, val); }
9978-
llvm::Value *get_isOutputUnsigned() const { return Instr->getOperand(12); }
9979-
void set_isOutputUnsigned(llvm::Value *val) { Instr->setOperand(12, val); }
9980-
};
9981-
9982-
/// This instruction multiplies a MxK dimension matrix and a K sized input
9983-
/// vector and adds an M-sized bias vector
9984-
struct DxilInst_MatVecMulAdd {
9985-
llvm::Instruction *Instr;
9986-
// Construction and identification
9987-
DxilInst_MatVecMulAdd(llvm::Instruction *pInstr) : Instr(pInstr) {}
9988-
operator bool() const {
9989-
return hlsl::OP::IsDxilOpFuncCallInst(Instr,
9990-
hlsl::OP::OpCode::MatVecMulAdd);
9991-
}
9992-
// Validation support
9993-
bool isAllowed() const { return true; }
9994-
bool isArgumentListValid() const {
9995-
if (16 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands())
9996-
return false;
9997-
return true;
9998-
}
9999-
// Metadata
10000-
bool requiresUniformInputs() const { return false; }
10001-
// Operand indexes
10002-
enum OperandIdx {
10003-
arg_inputVector = 1,
10004-
arg_isInputUnsigned = 2,
10005-
arg_inputInterpretation = 3,
10006-
arg_matrixBuffer = 4,
10007-
arg_matrixOffset = 5,
10008-
arg_matrixIntepretation = 6,
10009-
arg_matrixM = 7,
10010-
arg_matrixK = 8,
10011-
arg_matrixLayout = 9,
10012-
arg_matrixTranspose = 10,
10013-
arg_matrixStride = 11,
10014-
arg_biasBuffer = 12,
10015-
arg_biasOffset = 13,
10016-
arg_biasIntepretation = 14,
10017-
arg_isOutputUnsigned = 15,
10018-
};
10019-
// Accessors
10020-
llvm::Value *get_inputVector() const { return Instr->getOperand(1); }
10021-
void set_inputVector(llvm::Value *val) { Instr->setOperand(1, val); }
10022-
llvm::Value *get_isInputUnsigned() const { return Instr->getOperand(2); }
10023-
void set_isInputUnsigned(llvm::Value *val) { Instr->setOperand(2, val); }
10024-
llvm::Value *get_inputInterpretation() const { return Instr->getOperand(3); }
10025-
void set_inputInterpretation(llvm::Value *val) { Instr->setOperand(3, val); }
10026-
llvm::Value *get_matrixBuffer() const { return Instr->getOperand(4); }
10027-
void set_matrixBuffer(llvm::Value *val) { Instr->setOperand(4, val); }
10028-
llvm::Value *get_matrixOffset() const { return Instr->getOperand(5); }
10029-
void set_matrixOffset(llvm::Value *val) { Instr->setOperand(5, val); }
10030-
llvm::Value *get_matrixIntepretation() const { return Instr->getOperand(6); }
10031-
void set_matrixIntepretation(llvm::Value *val) { Instr->setOperand(6, val); }
10032-
llvm::Value *get_matrixM() const { return Instr->getOperand(7); }
10033-
void set_matrixM(llvm::Value *val) { Instr->setOperand(7, val); }
10034-
llvm::Value *get_matrixK() const { return Instr->getOperand(8); }
10035-
void set_matrixK(llvm::Value *val) { Instr->setOperand(8, val); }
10036-
llvm::Value *get_matrixLayout() const { return Instr->getOperand(9); }
10037-
void set_matrixLayout(llvm::Value *val) { Instr->setOperand(9, val); }
10038-
llvm::Value *get_matrixTranspose() const { return Instr->getOperand(10); }
10039-
void set_matrixTranspose(llvm::Value *val) { Instr->setOperand(10, val); }
10040-
llvm::Value *get_matrixStride() const { return Instr->getOperand(11); }
10041-
void set_matrixStride(llvm::Value *val) { Instr->setOperand(11, val); }
10042-
llvm::Value *get_biasBuffer() const { return Instr->getOperand(12); }
10043-
void set_biasBuffer(llvm::Value *val) { Instr->setOperand(12, val); }
10044-
llvm::Value *get_biasOffset() const { return Instr->getOperand(13); }
10045-
void set_biasOffset(llvm::Value *val) { Instr->setOperand(13, val); }
10046-
llvm::Value *get_biasIntepretation() const { return Instr->getOperand(14); }
10047-
void set_biasIntepretation(llvm::Value *val) { Instr->setOperand(14, val); }
10048-
llvm::Value *get_isOutputUnsigned() const { return Instr->getOperand(15); }
10049-
void set_isOutputUnsigned(llvm::Value *val) { Instr->setOperand(15, val); }
10050-
};
10051-
10052-
/// This instruction Computes the outer product between column vectors and an
10053-
/// MxN matrix is accumulated component-wise atomically (with device scope) in
10054-
/// memory
10055-
struct DxilInst_OuterProductAccumulate {
10056-
llvm::Instruction *Instr;
10057-
// Construction and identification
10058-
DxilInst_OuterProductAccumulate(llvm::Instruction *pInstr) : Instr(pInstr) {}
10059-
operator bool() const {
10060-
return hlsl::OP::IsDxilOpFuncCallInst(
10061-
Instr, hlsl::OP::OpCode::OuterProductAccumulate);
10062-
}
10063-
// Validation support
10064-
bool isAllowed() const { return true; }
10065-
bool isArgumentListValid() const {
10066-
if (8 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands())
10067-
return false;
10068-
return true;
10069-
}
10070-
// Metadata
10071-
bool requiresUniformInputs() const { return false; }
10072-
// Operand indexes
10073-
enum OperandIdx {
10074-
arg_inputVector1 = 1,
10075-
arg_inputVector2 = 2,
10076-
arg_matrixBuffer = 3,
10077-
arg_matrixOffset = 4,
10078-
arg_matrixIntepretation = 5,
10079-
arg_matrixLayout = 6,
10080-
arg_matrixStride = 7,
10081-
};
10082-
// Accessors
10083-
llvm::Value *get_inputVector1() const { return Instr->getOperand(1); }
10084-
void set_inputVector1(llvm::Value *val) { Instr->setOperand(1, val); }
10085-
llvm::Value *get_inputVector2() const { return Instr->getOperand(2); }
10086-
void set_inputVector2(llvm::Value *val) { Instr->setOperand(2, val); }
10087-
llvm::Value *get_matrixBuffer() const { return Instr->getOperand(3); }
10088-
void set_matrixBuffer(llvm::Value *val) { Instr->setOperand(3, val); }
10089-
llvm::Value *get_matrixOffset() const { return Instr->getOperand(4); }
10090-
void set_matrixOffset(llvm::Value *val) { Instr->setOperand(4, val); }
10091-
llvm::Value *get_matrixIntepretation() const { return Instr->getOperand(5); }
10092-
void set_matrixIntepretation(llvm::Value *val) { Instr->setOperand(5, val); }
10093-
int32_t get_matrixIntepretation_val() const {
10094-
return (int32_t)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(5))
10095-
->getZExtValue());
10096-
}
10097-
void set_matrixIntepretation_val(int32_t val) {
10098-
Instr->setOperand(5, llvm::Constant::getIntegerValue(
10099-
llvm::IntegerType::get(Instr->getContext(), 32),
10100-
llvm::APInt(32, (uint64_t)val)));
10101-
}
10102-
llvm::Value *get_matrixLayout() const { return Instr->getOperand(6); }
10103-
void set_matrixLayout(llvm::Value *val) { Instr->setOperand(6, val); }
10104-
int32_t get_matrixLayout_val() const {
10105-
return (int32_t)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(6))
10106-
->getZExtValue());
10107-
}
10108-
void set_matrixLayout_val(int32_t val) {
10109-
Instr->setOperand(6, llvm::Constant::getIntegerValue(
10110-
llvm::IntegerType::get(Instr->getContext(), 32),
10111-
llvm::APInt(32, (uint64_t)val)));
10112-
}
10113-
llvm::Value *get_matrixStride() const { return Instr->getOperand(7); }
10114-
void set_matrixStride(llvm::Value *val) { Instr->setOperand(7, val); }
10115-
};
10116-
10117-
/// This instruction Accumulates the components of a vector component-wise
10118-
/// atomically (with device scope) to the corresponding elements of an array in
10119-
/// memory
10120-
struct DxilInst_VectorAccumulate {
10121-
llvm::Instruction *Instr;
10122-
// Construction and identification
10123-
DxilInst_VectorAccumulate(llvm::Instruction *pInstr) : Instr(pInstr) {}
10124-
operator bool() const {
10125-
return hlsl::OP::IsDxilOpFuncCallInst(Instr,
10126-
hlsl::OP::OpCode::VectorAccumulate);
10127-
}
10128-
// Validation support
10129-
bool isAllowed() const { return true; }
10130-
bool isArgumentListValid() const {
10131-
if (4 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands())
10132-
return false;
10133-
return true;
10134-
}
10135-
// Metadata
10136-
bool requiresUniformInputs() const { return false; }
10137-
// Operand indexes
10138-
enum OperandIdx {
10139-
arg_inputVector = 1,
10140-
arg_arrayBuffer = 2,
10141-
arg_arrayOffset = 3,
10142-
};
10143-
// Accessors
10144-
llvm::Value *get_inputVector() const { return Instr->getOperand(1); }
10145-
void set_inputVector(llvm::Value *val) { Instr->setOperand(1, val); }
10146-
llvm::Value *get_arrayBuffer() const { return Instr->getOperand(2); }
10147-
void set_arrayBuffer(llvm::Value *val) { Instr->setOperand(2, val); }
10148-
llvm::Value *get_arrayOffset() const { return Instr->getOperand(3); }
10149-
void set_arrayOffset(llvm::Value *val) { Instr->setOperand(3, val); }
10150-
};
10151-
101529922
/// This instruction Bitwise AND reduction of the vector returning a scalar
101539923
struct DxilInst_VectorReduceAnd {
101549924
llvm::Instruction *Instr;

0 commit comments

Comments
 (0)