summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/slang/hlsl.meta.slang41
1 files changed, 39 insertions, 2 deletions
diff --git a/source/slang/hlsl.meta.slang b/source/slang/hlsl.meta.slang
index 46d251298..9800f2e65 100644
--- a/source/slang/hlsl.meta.slang
+++ b/source/slang/hlsl.meta.slang
@@ -26493,7 +26493,13 @@ CoopVec<T, M> coopVecMatMulPacked(
let inputInterpretationSpirv : int32_t = __getSpvCoopVecComponentType(inputInterpretation);
let memoryLayoutSpirv : int32_t = __getSpvCoopVecMatrixLayout(memoryLayout);
let matrixPtr = matrix.GetBufferPointer();
+
+ // https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/KHR/SPV_KHR_cooperative_matrix.asciidoc#3x-cooperative-matrix-operands
int operands = 0; // NoneKHR
+ if (__isSignedInt<U>())
+ {
+ operands |= 0x02; // MatrixBSignedComponentsKHR
+ }
if (__isSignedInt<T>())
{
operands |= 0x08; // MatrixResultSignedComponentsKHR
@@ -26693,9 +26699,21 @@ CoopVec<T, M> coopVecMatMulAddPacked<T : __BuiltinArithmeticType, let M : int, l
let memoryLayoutSpirv : int32_t = __getSpvCoopVecMatrixLayout(memoryLayout);
let matrixPtr = matrix.GetBufferPointer();
let biasPtr = bias.GetBufferPointer();
+
+ // https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/KHR/SPV_KHR_cooperative_matrix.asciidoc#3x-cooperative-matrix-operands
+ int operands = 0; // NoneKHR
+ if (__isSignedInt<U>())
+ {
+ operands |= 0x02; // MatrixBSignedComponentsKHR
+ operands |= 0x04; // MatrixCSignedComponentsKHR
+ }
+ if (__isSignedInt<T>())
+ {
+ operands |= 0x08; // MatrixResultSignedComponentsKHR
+ }
return spirv_asm
{
- result:$$CoopVec<T, M> = OpCooperativeVectorMatrixMulAddNV $input $inputInterpretationSpirv $matrixPtr $matrixOffset $matrixInterpretationSpirv $biasPtr $biasOffset $biasInterpretationSpirv $m $k $memoryLayoutSpirv $transpose $matrixStride;
+ result:$$CoopVec<T, M> = OpCooperativeVectorMatrixMulAddNV $input $inputInterpretationSpirv $matrixPtr $matrixOffset $matrixInterpretationSpirv $biasPtr $biasOffset $biasInterpretationSpirv $m $k $memoryLayoutSpirv $transpose $matrixStride !operands;
};
case hlsl:
@@ -27036,7 +27054,13 @@ CoopVec<T, M> coopVecMatMulPacked(
let inputInterpretationSpirv : int32_t = __getSpvCoopVecComponentType(inputInterpretation);
let memoryLayoutSpirv : int32_t = __getSpvCoopVecMatrixLayout(memoryLayout);
let matrixPtr = __getStructuredBufferPtr(matrix);
+
+ // https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/KHR/SPV_KHR_cooperative_matrix.asciidoc#3x-cooperative-matrix-operands
int operands = 0; // NoneKHR
+ if (__isSignedInt<U>())
+ {
+ operands |= 0x02; // MatrixBSignedComponentsKHR
+ }
if (__isSignedInt<T>())
{
operands |= 0x08; // MatrixResultSignedComponentsKHR
@@ -27109,9 +27133,22 @@ CoopVec<T, M> coopVecMatMulAddPacked<T : __BuiltinArithmeticType, let M : int, l
let memoryLayoutSpirv : int32_t = __getSpvCoopVecMatrixLayout(memoryLayout);
let matrixPtr = __getStructuredBufferPtr(matrix);
let biasPtr = __getStructuredBufferPtr(bias);
+
+ // https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/KHR/SPV_KHR_cooperative_matrix.asciidoc#3x-cooperative-matrix-operands
+ int operands = 0; // NoneKHR
+ if (__isSignedInt<U>())
+ {
+ operands |= 0x02; // MatrixBSignedComponentsKHR
+ operands |= 0x04; // MatrixCSignedComponentsKHR
+ }
+ if (__isSignedInt<T>())
+ {
+ operands |= 0x08; // MatrixResultSignedComponentsKHR
+ }
+
return spirv_asm
{
- result:$$CoopVec<T, M> = OpCooperativeVectorMatrixMulAddNV $input $inputInterpretationSpirv $matrixPtr $matrixOffset $matrixInterpretationSpirv $biasPtr $biasOffset $biasInterpretationSpirv $m $k $memoryLayoutSpirv $transpose $matrixStride;
+ result:$$CoopVec<T, M> = OpCooperativeVectorMatrixMulAddNV $input $inputInterpretationSpirv $matrixPtr $matrixOffset $matrixInterpretationSpirv $biasPtr $biasOffset $biasInterpretationSpirv $m $k $memoryLayoutSpirv $transpose $matrixStride !operands;
};
}
}