Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
09e5654
Remove deprecated HLSL tests and associated configurations for cooper…
damyanp Mar 23, 2026
46f5ff9
Remove deprecated linear algebra operations and associated error diag…
damyanp Mar 23, 2026
b901747
Rename reserved cooperative vector operations to reserved D and E in …
damyanp Mar 23, 2026
03190fc
Update release notes
damyanp Mar 23, 2026
88ab843
Formatting
damyanp Mar 23, 2026
37af478
Remove accidentally added file
damyanp Mar 23, 2026
14014e0
Remove deprecated linear algebra layout checks and associated functions
damyanp Mar 23, 2026
0b14a20
Remove deprecated validation rules for Linalg operations in db_dxil c…
damyanp Mar 23, 2026
6cc39a5
Fix comment
damyanp Mar 24, 2026
d5c3710
Update docs/ReleaseNotes.md
damyanp Mar 24, 2026
1c3535a
Roll back the unintended regeration of DxilCounters.cpp
damyanp Mar 24, 2026
7a1d568
Merge branch 'byebyecoopvec' of https://github.com/damyanp/DirectXSha…
damyanp Mar 24, 2026
25f5019
Add LinalgMatrixLayout to DxilConstants.h
damyanp Mar 26, 2026
3547cb0
Remove unused static CheckLinalgInterpretation from DxilValidation.cpp
Copilot Mar 26, 2026
e589de4
Merge pull request #11 from damyanp/copilot/fix-linux-macos-build-issues
damyanp Mar 26, 2026
fbb8408
Merge microsoft/main into byebyecoopvec, resolving conflicts from PR …
Copilot Mar 26, 2026
f082a08
Merge pull request #12 from damyanp/copilot/resolve-merge-conflicts
damyanp Mar 26, 2026
35eaa09
Merge remote-tracking branch 'upstream/main' into byebyecoopvec
damyanp Mar 26, 2026
0acb4ec
Fix intrinsic operation codes and update related tests
damyanp Mar 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
594 changes: 292 additions & 302 deletions docs/DXIL.rst

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions docs/ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ line upon naming the release. Refer to previous for appropriate section names.

#### Experimental Shader Model 6.10

- Moved Linear Algebra (Cooperative Vector) DXIL Opcodes to experimental Shader Model 6.10
- The Cooperative Vectors API was moved to `coopvec.h` header and under the `dx::coopvec` namespace.
- Removed experimental Cooperative Vector, this has been replaced by LinAlg matrix.
- Implement GetGroupWaveIndex and GetGroupWaveCount in experimental Shader Model 6.10.
- [proposal](https://github.com/microsoft/hlsl-specs/blob/main/proposals/0048-group-wave-index.md)
- 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.
Expand Down
78 changes: 21 additions & 57 deletions include/dxc/DXIL/DxilConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,13 @@ enum class MatrixScope : uint32_t {
ThreadGroup = 2,
};

enum class LinalgMatrixLayout : uint32_t {
RowMajor = 0,
ColumnMajor = 1,
MulOptimal = 2,
OuterProductOptimal = 3,
};

// Must match D3D_INTERPOLATION_MODE
enum class InterpolationMode : uint8_t {
Undefined = 0,
Expand Down Expand Up @@ -524,9 +531,9 @@ static const OpCodeTableID TableID = OpCodeTableID::ExperimentalOps;
// Enumeration for ExperimentalOps DXIL operations
enum class OpCode : unsigned {
//
ReservedD1 = 30, // reserved
ReservedD2 = 31, // reserved
ReservedD3 = 32, // reserved
ReservedE1 = 30, // reserved
ReservedE2 = 31, // reserved
ReservedE3 = 32, // reserved

// Debugging
DebugBreak = 33, // triggers a breakpoint if a debugger is attached
Expand Down Expand Up @@ -647,6 +654,10 @@ enum class OpCode : unsigned {
ReservedC7 = 300, // reserved
ReservedC8 = 301, // reserved
ReservedC9 = 302, // reserved
ReservedD0 = 305, // reserved
ReservedD1 = 306, // reserved
ReservedD2 = 307, // reserved
ReservedD3 = 308, // reserved

// Amplification shader instructions
DispatchMesh = 173, // Amplification shader intrinsic DispatchMesh
Expand Down Expand Up @@ -876,19 +887,6 @@ enum class OpCode : unsigned {
CreateHandleForLib =
160, // create resource handle from resource struct for library

// Linear Algebra Operations
MatVecMul =
305, // Multiplies a MxK dimension matrix and a K sized input vector
MatVecMulAdd = 306, // multiplies a MxK dimension matrix and a K sized input
// vector and adds an M-sized bias vector
OuterProductAccumulate =
307, // Computes the outer product between column vectors and an MxN
// matrix is accumulated component-wise atomically (with device
// scope) in memory
VectorAccumulate = 308, // Accumulates the components of a vector
// component-wise atomically (with device scope) to
// the corresponding elements of an array in memory

// Mesh shader instructions
EmitIndices = 169, // emit a primitive's vertex indices in a mesh shader
GetMeshPayload =
Expand Down Expand Up @@ -1351,12 +1349,12 @@ enum class OpCode : unsigned {
ExperimentalOps,
LinAlgMatrixOuterProduct), // Outer products an M sized vector and a N
// sized vector producing an MxN matrix
// ReservedD1 = 0x8000001E, 2147483678U, -2147483618
EXP_OPCODE(ExperimentalOps, ReservedD1), // reserved
// ReservedD2 = 0x8000001F, 2147483679U, -2147483617
EXP_OPCODE(ExperimentalOps, ReservedD2), // reserved
// ReservedD3 = 0x80000020, 2147483680U, -2147483616
EXP_OPCODE(ExperimentalOps, ReservedD3), // reserved
// ReservedE1 = 0x8000001E, 2147483678U, -2147483618
EXP_OPCODE(ExperimentalOps, ReservedE1), // reserved
// ReservedE2 = 0x8000001F, 2147483679U, -2147483617
EXP_OPCODE(ExperimentalOps, ReservedE2), // reserved
// ReservedE3 = 0x80000020, 2147483680U, -2147483616
EXP_OPCODE(ExperimentalOps, ReservedE3), // reserved
// DebugBreak = 0x80000021, 2147483681U, -2147483615
EXP_OPCODE(ExperimentalOps,
DebugBreak), // triggers a breakpoint if a debugger is attached
Expand Down Expand Up @@ -1541,10 +1539,6 @@ enum class OpCodeClass : unsigned {
LinAlgMatrixSetElement,
LinAlgMatrixStoreToDescriptor,
LinAlgMatrixStoreToMemory,
MatVecMul,
MatVecMulAdd,
OuterProductAccumulate,
VectorAccumulate,

// Mesh shader instructions
EmitIndices,
Expand Down Expand Up @@ -1731,7 +1725,7 @@ enum class OpCodeClass : unsigned {
NodeOutputIsValid,
OutputComplete,

NumOpClasses = 225, // exclusive last value of enumeration
NumOpClasses = 221, // exclusive last value of enumeration
};
// OPCODECLASS-ENUM:END

Expand Down Expand Up @@ -1911,29 +1905,6 @@ const unsigned kHitObjectTraceRay_RayDescOpIdx = 7;
const unsigned kHitObjectTraceRay_PayloadOpIdx = 15;
const unsigned kHitObjectTraceRay_NumOp = 16;

// MatVec Ops
const unsigned kMatVecMulInputVectorIdx = 1;
const unsigned kMatVecMulIsInputUnsignedIdx = 2;
const unsigned kMatVecMulInputInterpretationIdx = 3;
const unsigned kMatVecMulMatrixBufferIdx = 4;
const unsigned kMatVecMulMatrixOffsetIdx = 5;
const unsigned kMatVecMulMatrixInterpretationIdx = 6;
const unsigned kMatVecMulMatrixMIdx = 7;
const unsigned kMatVecMulMatrixKIdx = 8;
const unsigned kMatVecMulMatrixLayoutIdx = 9;
const unsigned kMatVecMulMatrixTransposeIdx = 10;
const unsigned kMatVecMulMatrixStrideIdx = 11;
const unsigned kMatVecMulIsOutputUnsignedIdx = 12;

// MatVecAdd
const unsigned kMatVecMulAddBiasInterpretation = 14;
const unsigned kMatVecMulAddIsOutputUnsignedIdx = 15;

// Outer Product Accumulate
const unsigned kOuterProdAccMatrixInterpretation = 5;
const unsigned kOuterProdAccMatrixLayout = 6;
const unsigned kOuterProdAccMatrixStride = 7;

// TODO: add operand index for all the OpCodeClass.
} // namespace OperandIndex

Expand Down Expand Up @@ -2506,13 +2477,6 @@ extern const char *kHostLayoutTypePrefix;

extern const char *kWaveOpsIncludeHelperLanesString;

enum class LinalgMatrixLayout : uint32_t {
RowMajor = 0,
ColumnMajor = 1,
MulOptimal = 2,
OuterProductOptimal = 3,
};

} // namespace DXIL

} // namespace hlsl
230 changes: 0 additions & 230 deletions include/dxc/DXIL/DxilInstructions.h
Original file line number Diff line number Diff line change
Expand Up @@ -9919,236 +9919,6 @@ struct DxilInst_RawBufferVectorStore {
}
};

/// This instruction Multiplies a MxK dimension matrix and a K sized input
/// vector
struct DxilInst_MatVecMul {
llvm::Instruction *Instr;
// Construction and identification
DxilInst_MatVecMul(llvm::Instruction *pInstr) : Instr(pInstr) {}
operator bool() const {
return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::MatVecMul);
}
// Validation support
bool isAllowed() const { return true; }
bool isArgumentListValid() const {
if (13 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands())
return false;
return true;
}
// Metadata
bool requiresUniformInputs() const { return false; }
// Operand indexes
enum OperandIdx {
arg_inputVector = 1,
arg_isInputUnsigned = 2,
arg_inputInterpretation = 3,
arg_matrixBuffer = 4,
arg_matrixOffset = 5,
arg_matrixIntepretation = 6,
arg_matrixM = 7,
arg_matrixK = 8,
arg_matrixLayout = 9,
arg_matrixTranspose = 10,
arg_matrixStride = 11,
arg_isOutputUnsigned = 12,
};
// Accessors
llvm::Value *get_inputVector() const { return Instr->getOperand(1); }
void set_inputVector(llvm::Value *val) { Instr->setOperand(1, val); }
llvm::Value *get_isInputUnsigned() const { return Instr->getOperand(2); }
void set_isInputUnsigned(llvm::Value *val) { Instr->setOperand(2, val); }
llvm::Value *get_inputInterpretation() const { return Instr->getOperand(3); }
void set_inputInterpretation(llvm::Value *val) { Instr->setOperand(3, val); }
llvm::Value *get_matrixBuffer() const { return Instr->getOperand(4); }
void set_matrixBuffer(llvm::Value *val) { Instr->setOperand(4, val); }
llvm::Value *get_matrixOffset() const { return Instr->getOperand(5); }
void set_matrixOffset(llvm::Value *val) { Instr->setOperand(5, val); }
llvm::Value *get_matrixIntepretation() const { return Instr->getOperand(6); }
void set_matrixIntepretation(llvm::Value *val) { Instr->setOperand(6, val); }
llvm::Value *get_matrixM() const { return Instr->getOperand(7); }
void set_matrixM(llvm::Value *val) { Instr->setOperand(7, val); }
llvm::Value *get_matrixK() const { return Instr->getOperand(8); }
void set_matrixK(llvm::Value *val) { Instr->setOperand(8, val); }
llvm::Value *get_matrixLayout() const { return Instr->getOperand(9); }
void set_matrixLayout(llvm::Value *val) { Instr->setOperand(9, val); }
llvm::Value *get_matrixTranspose() const { return Instr->getOperand(10); }
void set_matrixTranspose(llvm::Value *val) { Instr->setOperand(10, val); }
llvm::Value *get_matrixStride() const { return Instr->getOperand(11); }
void set_matrixStride(llvm::Value *val) { Instr->setOperand(11, val); }
llvm::Value *get_isOutputUnsigned() const { return Instr->getOperand(12); }
void set_isOutputUnsigned(llvm::Value *val) { Instr->setOperand(12, val); }
};

/// This instruction multiplies a MxK dimension matrix and a K sized input
/// vector and adds an M-sized bias vector
struct DxilInst_MatVecMulAdd {
llvm::Instruction *Instr;
// Construction and identification
DxilInst_MatVecMulAdd(llvm::Instruction *pInstr) : Instr(pInstr) {}
operator bool() const {
return hlsl::OP::IsDxilOpFuncCallInst(Instr,
hlsl::OP::OpCode::MatVecMulAdd);
}
// Validation support
bool isAllowed() const { return true; }
bool isArgumentListValid() const {
if (16 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands())
return false;
return true;
}
// Metadata
bool requiresUniformInputs() const { return false; }
// Operand indexes
enum OperandIdx {
arg_inputVector = 1,
arg_isInputUnsigned = 2,
arg_inputInterpretation = 3,
arg_matrixBuffer = 4,
arg_matrixOffset = 5,
arg_matrixIntepretation = 6,
arg_matrixM = 7,
arg_matrixK = 8,
arg_matrixLayout = 9,
arg_matrixTranspose = 10,
arg_matrixStride = 11,
arg_biasBuffer = 12,
arg_biasOffset = 13,
arg_biasIntepretation = 14,
arg_isOutputUnsigned = 15,
};
// Accessors
llvm::Value *get_inputVector() const { return Instr->getOperand(1); }
void set_inputVector(llvm::Value *val) { Instr->setOperand(1, val); }
llvm::Value *get_isInputUnsigned() const { return Instr->getOperand(2); }
void set_isInputUnsigned(llvm::Value *val) { Instr->setOperand(2, val); }
llvm::Value *get_inputInterpretation() const { return Instr->getOperand(3); }
void set_inputInterpretation(llvm::Value *val) { Instr->setOperand(3, val); }
llvm::Value *get_matrixBuffer() const { return Instr->getOperand(4); }
void set_matrixBuffer(llvm::Value *val) { Instr->setOperand(4, val); }
llvm::Value *get_matrixOffset() const { return Instr->getOperand(5); }
void set_matrixOffset(llvm::Value *val) { Instr->setOperand(5, val); }
llvm::Value *get_matrixIntepretation() const { return Instr->getOperand(6); }
void set_matrixIntepretation(llvm::Value *val) { Instr->setOperand(6, val); }
llvm::Value *get_matrixM() const { return Instr->getOperand(7); }
void set_matrixM(llvm::Value *val) { Instr->setOperand(7, val); }
llvm::Value *get_matrixK() const { return Instr->getOperand(8); }
void set_matrixK(llvm::Value *val) { Instr->setOperand(8, val); }
llvm::Value *get_matrixLayout() const { return Instr->getOperand(9); }
void set_matrixLayout(llvm::Value *val) { Instr->setOperand(9, val); }
llvm::Value *get_matrixTranspose() const { return Instr->getOperand(10); }
void set_matrixTranspose(llvm::Value *val) { Instr->setOperand(10, val); }
llvm::Value *get_matrixStride() const { return Instr->getOperand(11); }
void set_matrixStride(llvm::Value *val) { Instr->setOperand(11, val); }
llvm::Value *get_biasBuffer() const { return Instr->getOperand(12); }
void set_biasBuffer(llvm::Value *val) { Instr->setOperand(12, val); }
llvm::Value *get_biasOffset() const { return Instr->getOperand(13); }
void set_biasOffset(llvm::Value *val) { Instr->setOperand(13, val); }
llvm::Value *get_biasIntepretation() const { return Instr->getOperand(14); }
void set_biasIntepretation(llvm::Value *val) { Instr->setOperand(14, val); }
llvm::Value *get_isOutputUnsigned() const { return Instr->getOperand(15); }
void set_isOutputUnsigned(llvm::Value *val) { Instr->setOperand(15, val); }
};

/// This instruction Computes the outer product between column vectors and an
/// MxN matrix is accumulated component-wise atomically (with device scope) in
/// memory
struct DxilInst_OuterProductAccumulate {
llvm::Instruction *Instr;
// Construction and identification
DxilInst_OuterProductAccumulate(llvm::Instruction *pInstr) : Instr(pInstr) {}
operator bool() const {
return hlsl::OP::IsDxilOpFuncCallInst(
Instr, hlsl::OP::OpCode::OuterProductAccumulate);
}
// Validation support
bool isAllowed() const { return true; }
bool isArgumentListValid() const {
if (8 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands())
return false;
return true;
}
// Metadata
bool requiresUniformInputs() const { return false; }
// Operand indexes
enum OperandIdx {
arg_inputVector1 = 1,
arg_inputVector2 = 2,
arg_matrixBuffer = 3,
arg_matrixOffset = 4,
arg_matrixIntepretation = 5,
arg_matrixLayout = 6,
arg_matrixStride = 7,
};
// Accessors
llvm::Value *get_inputVector1() const { return Instr->getOperand(1); }
void set_inputVector1(llvm::Value *val) { Instr->setOperand(1, val); }
llvm::Value *get_inputVector2() const { return Instr->getOperand(2); }
void set_inputVector2(llvm::Value *val) { Instr->setOperand(2, val); }
llvm::Value *get_matrixBuffer() const { return Instr->getOperand(3); }
void set_matrixBuffer(llvm::Value *val) { Instr->setOperand(3, val); }
llvm::Value *get_matrixOffset() const { return Instr->getOperand(4); }
void set_matrixOffset(llvm::Value *val) { Instr->setOperand(4, val); }
llvm::Value *get_matrixIntepretation() const { return Instr->getOperand(5); }
void set_matrixIntepretation(llvm::Value *val) { Instr->setOperand(5, val); }
int32_t get_matrixIntepretation_val() const {
return (int32_t)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(5))
->getZExtValue());
}
void set_matrixIntepretation_val(int32_t val) {
Instr->setOperand(5, llvm::Constant::getIntegerValue(
llvm::IntegerType::get(Instr->getContext(), 32),
llvm::APInt(32, (uint64_t)val)));
}
llvm::Value *get_matrixLayout() const { return Instr->getOperand(6); }
void set_matrixLayout(llvm::Value *val) { Instr->setOperand(6, val); }
int32_t get_matrixLayout_val() const {
return (int32_t)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(6))
->getZExtValue());
}
void set_matrixLayout_val(int32_t val) {
Instr->setOperand(6, llvm::Constant::getIntegerValue(
llvm::IntegerType::get(Instr->getContext(), 32),
llvm::APInt(32, (uint64_t)val)));
}
llvm::Value *get_matrixStride() const { return Instr->getOperand(7); }
void set_matrixStride(llvm::Value *val) { Instr->setOperand(7, val); }
};

/// This instruction Accumulates the components of a vector component-wise
/// atomically (with device scope) to the corresponding elements of an array in
/// memory
struct DxilInst_VectorAccumulate {
llvm::Instruction *Instr;
// Construction and identification
DxilInst_VectorAccumulate(llvm::Instruction *pInstr) : Instr(pInstr) {}
operator bool() const {
return hlsl::OP::IsDxilOpFuncCallInst(Instr,
hlsl::OP::OpCode::VectorAccumulate);
}
// Validation support
bool isAllowed() const { return true; }
bool isArgumentListValid() const {
if (4 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands())
return false;
return true;
}
// Metadata
bool requiresUniformInputs() const { return false; }
// Operand indexes
enum OperandIdx {
arg_inputVector = 1,
arg_arrayBuffer = 2,
arg_arrayOffset = 3,
};
// Accessors
llvm::Value *get_inputVector() const { return Instr->getOperand(1); }
void set_inputVector(llvm::Value *val) { Instr->setOperand(1, val); }
llvm::Value *get_arrayBuffer() const { return Instr->getOperand(2); }
void set_arrayBuffer(llvm::Value *val) { Instr->setOperand(2, val); }
llvm::Value *get_arrayOffset() const { return Instr->getOperand(3); }
void set_arrayOffset(llvm::Value *val) { Instr->setOperand(3, val); }
};

/// This instruction Bitwise AND reduction of the vector returning a scalar
struct DxilInst_VectorReduceAnd {
llvm::Instruction *Instr;
Expand Down
Loading
Loading