Skip to content
Merged
Show file tree
Hide file tree
Changes from 94 commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
75bb05e
Implement MulAdd, OutProdAcc, VecAcc lowering
anupamachandra Mar 26, 2025
913c352
Add is signed parameters to the builtins
anupamachandra Mar 26, 2025
a6863d4
Change parameter names for better readability
anupamachandra Apr 1, 2025
49bc4f0
Keeping parameter names accurate
anupamachandra Apr 1, 2025
564689a
After clang-format
anupamachandra Apr 2, 2025
6ec25f8
Fix variable names per LLVM coding standards
anupamachandra Apr 2, 2025
3081f9e
chore: autopublish 2025-04-02T15:32:45Z
github-actions[bot] Apr 2, 2025
ae115e1
Update utils/hct/hctdb.py
anupamachandra Apr 2, 2025
2b2656d
Change isSigned to isUnsigned
anupamachandra Apr 2, 2025
5ef516a
Change HLSL intrinsic args from snake to upper camel case
anupamachandra Apr 3, 2025
8c2d9ae
Name change for readability
anupamachandra Apr 3, 2025
df28777
Review Feedback: Add description for DXIL ops
anupamachandra Apr 3, 2025
a3bdc34
Fix generated files
anupamachandra Apr 3, 2025
f7fabd9
Add validation rules for DXIL ops
anupamachandra Apr 4, 2025
50155c1
Unit test 1: Check linalg builtins for different shader stages: ps, v…
anupamachandra Apr 4, 2025
9383c47
Replace std::set with linear search
anupamachandra Apr 4, 2025
8df9520
Unit test: Check Intrinsic not enabled pre SM6.9
anupamachandra Apr 4, 2025
8d44645
Unit tests: Check parameters of the Builtin calls
anupamachandra Apr 5, 2025
e70c140
Unit test: Outer Product Accumulate Multidimensional overload
anupamachandra Apr 5, 2025
6c93071
Unit test: IR->IR Dxilgen test
anupamachandra Apr 5, 2025
ee9f3a2
Unit test ; Multidim overload for MatVecMul
anupamachandra Apr 5, 2025
5d3f8b2
Simplify Matrix Layout check
anupamachandra Apr 5, 2025
d6c2806
Add checks to the HLSL source file linalg_builtins.hlsl
anupamachandra Apr 7, 2025
7d74050
Updated RUN line and renamed test
simoll Apr 7, 2025
724bebd
cleanup test
simoll Apr 8, 2025
615824d
[nfc] Fix -Werror by removing braces
simoll Apr 8, 2025
5b3b7ce
Fix debug field names for vectors > 4 elements
simoll Apr 8, 2025
453d643
[nfc] auto-format hctdb.py
simoll Apr 9, 2025
e40b24d
Move sema test to SemaHLSL test folder (spurious CodeGenHashStability…
simoll Apr 9, 2025
3d4b3ab
Merge branch 'staging-sm6.9' into anupamac/coop-vec-5
damyanp Apr 10, 2025
bc1082e
Revert SPIRV-Tools submodule to match staging-sm6.9 and main
damyanp Apr 10, 2025
5455e64
Update lib/DxilValidation/DxilValidation.cpp
simoll Apr 10, 2025
c626bdb
Update lib/DxilValidation/DxilValidation.cpp
simoll Apr 10, 2025
da9f549
Update lib/DxilValidation/DxilValidation.cpp
simoll Apr 10, 2025
ebdc454
Update lib/DxilValidation/DxilValidation.cpp
simoll Apr 10, 2025
6bb201a
Update lib/DxilValidation/DxilValidation.cpp
simoll Apr 10, 2025
3816d7c
Update lib/DxilValidation/DxilValidation.cpp
simoll Apr 10, 2025
0166d20
Update lib/DxilValidation/DxilValidation.cpp
simoll Apr 10, 2025
3027487
Update lib/DxilValidation/DxilValidation.cpp
simoll Apr 10, 2025
a80ab65
Update lib/DxilValidation/DxilValidation.cpp
simoll Apr 10, 2025
067bea3
Update lib/DxilValidation/DxilValidation.cpp
simoll Apr 10, 2025
1dc4b2d
Update lib/DxilValidation/DxilValidation.cpp
simoll Apr 10, 2025
3d06120
Update lib/DxilValidation/DxilValidation.cpp
simoll Apr 10, 2025
cde0954
Update lib/DxilValidation/DxilValidation.cpp
simoll Apr 10, 2025
372c431
[nfc] Coding Standards changes
simoll Apr 10, 2025
7633d12
Renamed params to isInput|OutputUnsigned and fixed description
simoll Apr 10, 2025
9aa5df7
Explicitly assign numbers to ComponentType enum
simoll Apr 10, 2025
d2cbc3b
Move debug info fix into separate PR #7332
simoll Apr 10, 2025
df67c9f
move all tests to CodeGenDXIL/hlsl/intrinsics/linalg_builtin and make…
simoll Apr 10, 2025
e15eacb
Move linalg-builtins.ll test to DXC/Passes/DxilGen
simoll Apr 10, 2025
9fcf8c7
Factored common code into function in check-shader-stages.hlsl
simoll Apr 10, 2025
6eb36e4
Add test variations for different matVecMul parameter settings
simoll Apr 10, 2025
e310fd6
Add test with variations for matVecMulAdd
simoll Apr 10, 2025
dff8fba
Add HLSL -> HL checks for matVecMul
simoll Apr 10, 2025
8c924ba
Add HLSL -> HL checks for matVecMulAdd
simoll Apr 10, 2025
55d8fc7
update tests to not transpose RowMajor/ColumnMajor
simoll Apr 10, 2025
5c61273
Diagnose unsigned<>type mismatches and transpose<>layout mismatch
simoll Apr 10, 2025
5b190f0
Fix merge resolution for DXIL 1.9 opcode cap.
tex3d Apr 10, 2025
b0bcab8
Update lib/DxilValidation/DxilValidation.cpp
simoll Apr 14, 2025
61607e7
Update lib/DxilValidation/DxilValidation.cpp
simoll Apr 14, 2025
78a39c6
Update lib/DxilValidation/DxilValidation.cpp
simoll Apr 14, 2025
a54d4d0
Update lib/DxilValidation/DxilValidation.cpp
simoll Apr 14, 2025
5e72dbf
Update lib/DxilValidation/DxilValidation.cpp
simoll Apr 14, 2025
50e0b73
Update lib/DxilValidation/DxilValidation.cpp
simoll Apr 14, 2025
441c4a4
Update lib/DxilValidation/DxilValidation.cpp
simoll Apr 14, 2025
083f258
Update lib/DxilValidation/DxilValidation.cpp
simoll Apr 14, 2025
ede7bdb
Update lib/DxilValidation/DxilValidation.cpp
simoll Apr 14, 2025
8675c40
Update lib/DxilValidation/DxilValidation.cpp
simoll Apr 14, 2025
82ee147
Update lib/DxilValidation/DxilValidation.cpp
simoll Apr 14, 2025
623f752
nfc: fix call after callee name change
simoll Apr 14, 2025
5d4af66
remove opcode marker
simoll Apr 14, 2025
5951621
nfc: s/\t/ /g + strip trailing wspace
simoll Apr 14, 2025
70cdd13
some more s/\t/ /g
simoll Apr 14, 2025
4d97b84
Add all params to test
simoll Apr 14, 2025
8a96622
Merge remote-tracking branch 'ms/main' into coop-vec-5
tex3d Apr 15, 2025
8ce1223
Merge remote-tracking branch 'ms/staging-sm6.9' into coop-vec-5
tex3d Apr 15, 2025
c636e6f
Update include/dxc/DXIL/DxilConstants.h
simoll Apr 15, 2025
70a83af
Update utils/hct/hctdb.py
simoll Apr 15, 2025
9cf0b99
Update utils/hct/hctdb.py
simoll Apr 15, 2025
503d4b8
Repair after DXILMatrixLayout -> LinalgMatrixLayout name change
simoll Apr 15, 2025
797d89c
Regen after attr change from 'None' -> 'ReadOnly'
simoll Apr 15, 2025
b8e4985
nfc: store output vector in tests to keep coopvec dxil ops alive
simoll Apr 15, 2025
47c4f3f
Remove redundant tests (subsumed by multioverload versions)
simoll Apr 15, 2025
cc6cc27
CheckLinalgInterpretation for InMemory and InRegister type validation
simoll Apr 15, 2025
d344e73
Align test with spec: "Note: Only Optimal layouts can be used with fo…
simoll Apr 15, 2025
faa8f8f
Align test with spec: "Packed" type conversions are bitcasts to a sma…
simoll Apr 15, 2025
41217f3
Fix DXIL OuterProductAccmulate param ordering (minterp, mlayout, mstr…
simoll Apr 15, 2025
1b23b26
Multioverload OuterProductAccmuluate test (and remove redundant
simoll Apr 15, 2025
a3f76ef
nfc: autoformat
simoll Apr 15, 2025
871694c
Merge remote-tracking branch 'ms/staging-sm6.9' into coop-vec-5
tex3d Apr 16, 2025
791dff3
Update tests with new hl opcodes
tex3d Apr 16, 2025
d5f03f2
Remvoved MatrixLayout check for OuterProductAccumulate, updated DXIL …
anupamachandra Apr 18, 2025
f5a1a51
Update linalg_builtin.hlsl to intialize input vectors for outerproduc…
anupamachandra Apr 18, 2025
1538453
Removed undefs and added named checks for resource handles in the lin…
anupamachandra Apr 18, 2025
7cbe979
Update diagnostics per llvm coding guidelines
anupamachandra Apr 18, 2025
faf6df0
Missing trailing comma was bugging darker
anupamachandra Apr 18, 2025
8782246
Fix linalg-builtins.hlsl file check: missing comma
anupamachandra Apr 18, 2025
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
12 changes: 12 additions & 0 deletions docs/DXIL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2419,6 +2419,10 @@ ID Name Description
302 ReservedC9 reserved
303 RawBufferVectorLoad reads from a raw buffer and structured buffer
304 RawBufferVectorStore writes to a RWByteAddressBuffer or RWStructuredBuffer
305 MatVecMul Multiplies a MxK dimension matrix and a K sized input vector
306 MatVecMulAdd multiplies a MxK dimension matrix and a K sized input vector and adds an M-sized bias vector
307 OuterProductAccumulate Computes the outer product between column vectors and an MxN matrix is accumulated component-wise atomically (with device scope) in memory
308 VectorAccumulate Accumulates the components of a vector component-wise atomically (with device scope) to the corresponding elements of an array in memory
=== ===================================================== =======================================================================================================================================================================================================================


Expand Down Expand Up @@ -3134,6 +3138,14 @@ INSTR.ILLEGALDXILOPCODE DXILOpCode must be [0..%0]
INSTR.ILLEGALDXILOPFUNCTION '%0' is not a DXILOpFuncition for DXILOpcode '%1'.
INSTR.IMMBIASFORSAMPLEB bias amount for sample_b must be in the range [%0,%1], but %2 was specified as an immediate.
INSTR.INBOUNDSACCESS Access to out-of-bounds memory is disallowed.
INSTR.LINALGINTERPRETATIONPARAMARECONST In Linalg operations, Interpretation value is a constant.
INSTR.LINALGINVALIDMATRIXLAYOUTVALUEFORMATVECOPS Matrix Layout for Linalg Mul/MulAdd operation must be valid.
INSTR.LINALGINVALIDMEMORYINTERPVALUE In Memory Interpolation value must be valid.
INSTR.LINALGINVALIDREGISTERINTERPVALUE From Register Interpretation value must be valid.
INSTR.LINALGMATRIXLAYOUTNOTTRANSPOSABLE Row Major and Column Major matrix layouts are not transposable.
INSTR.LINALGMATRIXSHAPEPARAMSARECONST Matrix Layout, Dimensions and isTranspose are constants
INSTR.LINALGNOTANUNSIGNEDTYPE Unsigned flag set for a float signed type
INSTR.MATVECOPISUNSIGNEDFLAGSARECONST In Linalg Mul/MulAdd functions, IsUnsigned flag is a constant.
INSTR.MAYREORDERTHREADUNDEFCOHERENCEHINTPARAM Use of undef coherence hint or num coherence hint bits in MaybeReorderThread.
INSTR.MINPRECISIONNOTPRECISE Instructions marked precise may not refer to minprecision values.
INSTR.MINPRECISONBITCAST Bitcast on minprecison types is not allowed.
Expand Down
96 changes: 76 additions & 20 deletions include/dxc/DXIL/DxilConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,24 +162,32 @@ const unsigned kDxilMaxOloadDims = 2;

enum class ComponentType : uint32_t {
Invalid = 0,
I1,
I16,
U16,
I32,
U32,
I64,
U64,
F16,
F32,
F64,
SNormF16,
UNormF16,
SNormF32,
UNormF32,
SNormF64,
UNormF64,
PackedS8x32,
PackedU8x32,
I1 = 1,
I16 = 2,
U16 = 3,
I32 = 4,
U32 = 5,
I64 = 6,
U64 = 7,
F16 = 8,
F32 = 9,
F64 = 10,
SNormF16 = 11,
UNormF16 = 12,
SNormF32 = 13,
UNormF32 = 14,
SNormF64 = 15,
UNormF64 = 16,
PackedS8x32 = 17,
PackedU8x32 = 18,

// BEGIN NEW FOR SM 6.9
U8 = 19,
I8 = 20,
F8_E4M3 = 21,
F8_E5M2 = 22,
// END

LastEntry
};

Expand Down Expand Up @@ -743,6 +751,19 @@ 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 @@ -1060,7 +1081,7 @@ enum class OpCode : unsigned {
NumOpCodes_Dxil_1_7 = 226,
NumOpCodes_Dxil_1_8 = 258,

NumOpCodes = 305 // exclusive last value of enumeration
NumOpCodes = 309 // exclusive last value of enumeration
};
// OPCODE-ENUM:END

Expand Down Expand Up @@ -1201,6 +1222,12 @@ enum class OpCodeClass : unsigned {
// Library create handle from resource struct (like HL intrinsic)
CreateHandleForLib,

// Linear Algebra Operations
MatVecMul,
MatVecMulAdd,
OuterProductAccumulate,
VectorAccumulate,

// Mesh shader instructions
EmitIndices,
GetMeshPayload,
Expand Down Expand Up @@ -1385,7 +1412,7 @@ enum class OpCodeClass : unsigned {
NumOpClasses_Dxil_1_7 = 153,
NumOpClasses_Dxil_1_8 = 174,

NumOpClasses = 190 // exclusive last value of enumeration
NumOpClasses = 194 // exclusive last value of enumeration
};
// OPCODECLASS-ENUM:END

Expand Down Expand Up @@ -1556,6 +1583,28 @@ const unsigned kMSStoreOutputColOpIdx = 3;
const unsigned kMSStoreOutputVIdxOpIdx = 4;
const unsigned kMSStoreOutputValOpIdx = 5;

// 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;

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

Expand Down Expand Up @@ -2127,6 +2176,13 @@ 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
Loading
Loading