From 8338b9a503975b9bd1ef1c597fb646e779f6b48b Mon Sep 17 00:00:00 2001 From: Gangzheng Tong Date: Wed, 25 Jun 2025 23:17:46 -0700 Subject: [PATCH] Revert "Add matrix operand for OpCooperativeVectorMatrixMulAddNV (#7524)" This reverts commit 5afebcf02748384471a98858eedb685024f7f854. --- source/slang/hlsl.meta.slang | 41 +------------------ .../matrix-mul-bias-packed-mut.slang | 2 +- .../matrix-mul-bias-packed.slang | 2 +- 3 files changed, 4 insertions(+), 41 deletions(-) diff --git a/source/slang/hlsl.meta.slang b/source/slang/hlsl.meta.slang index 9800f2e6562..46d251298ed 100644 --- a/source/slang/hlsl.meta.slang +++ b/source/slang/hlsl.meta.slang @@ -26493,13 +26493,7 @@ CoopVec 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()) - { - operands |= 0x02; // MatrixBSignedComponentsKHR - } if (__isSignedInt()) { operands |= 0x08; // MatrixResultSignedComponentsKHR @@ -26699,21 +26693,9 @@ CoopVec coopVecMatMulAddPacked()) - { - operands |= 0x02; // MatrixBSignedComponentsKHR - operands |= 0x04; // MatrixCSignedComponentsKHR - } - if (__isSignedInt()) - { - operands |= 0x08; // MatrixResultSignedComponentsKHR - } return spirv_asm { - result:$$CoopVec = OpCooperativeVectorMatrixMulAddNV $input $inputInterpretationSpirv $matrixPtr $matrixOffset $matrixInterpretationSpirv $biasPtr $biasOffset $biasInterpretationSpirv $m $k $memoryLayoutSpirv $transpose $matrixStride !operands; + result:$$CoopVec = OpCooperativeVectorMatrixMulAddNV $input $inputInterpretationSpirv $matrixPtr $matrixOffset $matrixInterpretationSpirv $biasPtr $biasOffset $biasInterpretationSpirv $m $k $memoryLayoutSpirv $transpose $matrixStride; }; case hlsl: @@ -27054,13 +27036,7 @@ CoopVec 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()) - { - operands |= 0x02; // MatrixBSignedComponentsKHR - } if (__isSignedInt()) { operands |= 0x08; // MatrixResultSignedComponentsKHR @@ -27133,22 +27109,9 @@ CoopVec coopVecMatMulAddPacked()) - { - operands |= 0x02; // MatrixBSignedComponentsKHR - operands |= 0x04; // MatrixCSignedComponentsKHR - } - if (__isSignedInt()) - { - operands |= 0x08; // MatrixResultSignedComponentsKHR - } - return spirv_asm { - result:$$CoopVec = OpCooperativeVectorMatrixMulAddNV $input $inputInterpretationSpirv $matrixPtr $matrixOffset $matrixInterpretationSpirv $biasPtr $biasOffset $biasInterpretationSpirv $m $k $memoryLayoutSpirv $transpose $matrixStride !operands; + result:$$CoopVec = OpCooperativeVectorMatrixMulAddNV $input $inputInterpretationSpirv $matrixPtr $matrixOffset $matrixInterpretationSpirv $biasPtr $biasOffset $biasInterpretationSpirv $m $k $memoryLayoutSpirv $transpose $matrixStride; }; } } diff --git a/tests/cooperative-vector/matrix-mul-bias-packed-mut.slang b/tests/cooperative-vector/matrix-mul-bias-packed-mut.slang index 54d3b11ddab..b3443e08aff 100644 --- a/tests/cooperative-vector/matrix-mul-bias-packed-mut.slang +++ b/tests/cooperative-vector/matrix-mul-bias-packed-mut.slang @@ -25,7 +25,7 @@ ByteAddressBuffer bias; [numthreads(1, 1, 1)] void computeMain() { - let vec = coopVecLoad<1, uint32_t>(input); + let vec = coopVecLoad<1, int32_t>(input); var result = CoopVec(8000); result.matMulAddAccumPacked( vec, diff --git a/tests/cooperative-vector/matrix-mul-bias-packed.slang b/tests/cooperative-vector/matrix-mul-bias-packed.slang index e80fb02aca0..a47a82714d1 100644 --- a/tests/cooperative-vector/matrix-mul-bias-packed.slang +++ b/tests/cooperative-vector/matrix-mul-bias-packed.slang @@ -25,7 +25,7 @@ ByteAddressBuffer bias; [numthreads(1, 1, 1)] void computeMain() { - let vec = coopVecLoad<1, uint32_t>(input); + let vec = coopVecLoad<1, int32_t>(input); let result = coopVecMatMulAddPacked( vec, CoopVecComponentType::SignedInt8Packed,