diff options
| author | venkataram-nv <vedavamadath@nvidia.com> | 2025-07-30 09:27:38 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-30 16:27:38 +0000 |
| commit | 92ee2927d0012dd454dff7bb53b900f5240073d5 (patch) | |
| tree | d0a648fbb1e6b08c6eec90fadb23435731c1eefe /tests/spirv | |
| parent | 42dc521f7817328a20e40b3352ae667dfd124edb (diff) | |
Lowering unsupported matrix types for GLSL/WGSL/Metal targets (#7936)
* Add emit cases for WGSL and GLSL
* Fix compilation warnings
Modify short cutting test to reflect change in emit logic
Lower matrix for metal as well
Add emit matrix logic for metal
Fix compiler warning
Brace initializer for lowered matrices
Fix compiler warnings
* Tests for metal
* Fix mult, any, and determinant
* Fix matrix-matrix multiplication
* Fix mat mul to be element-wise
* Fix compiler warning
* Move makeMatrix to legalization
* Move unary and binary arithmetic operator lowering to legalization
* Remove emit logic and move final comparison operators to legalization
* Handle vector/matrix negation for WGSL
* Restore older SPIR-V emit logic
* Address PR comments
* Revert to zero minus for negation
* format code
---------
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Diffstat (limited to 'tests/spirv')
| -rw-r--r-- | tests/spirv/matrix-bool-lowering.slang | 2 | ||||
| -rw-r--r-- | tests/spirv/matrix-integer-lowering.slang | 12 |
2 files changed, 12 insertions, 2 deletions
diff --git a/tests/spirv/matrix-bool-lowering.slang b/tests/spirv/matrix-bool-lowering.slang index 63b7caacf..f903fbf17 100644 --- a/tests/spirv/matrix-bool-lowering.slang +++ b/tests/spirv/matrix-bool-lowering.slang @@ -1,6 +1,6 @@ //TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-slang -compute -vk -shaderobj -xslang -emit-spirv-directly -//TEST_INPUT:ubuffer(data=[1 0], stride=4):in,name inputBuffer +//TEST_INPUT:ubuffer(data=[1 0], stride=4):name inputBuffer //TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], stride=4):out,name outputBuffer RWStructuredBuffer<int> inputBuffer; RWStructuredBuffer<int> outputBuffer; diff --git a/tests/spirv/matrix-integer-lowering.slang b/tests/spirv/matrix-integer-lowering.slang index 518d0f78b..fded652a4 100644 --- a/tests/spirv/matrix-integer-lowering.slang +++ b/tests/spirv/matrix-integer-lowering.slang @@ -10,8 +10,10 @@ typealias m2x3 = matrix<TYPE, 2, 3>; typealias m3x3 = matrix<TYPE, 3, 3>; typealias m2x4 = matrix<TYPE, 2, 4>; -//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], stride=4):out,name outputBuffer +//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], stride=4):out,name outputBuffer +//TEST_INPUT:ubuffer(data=[-1 4], stride=4):name expectedBuffer RWStructuredBuffer<TYPE> outputBuffer; +RWStructuredBuffer<TYPE> expectedBuffer; struct matrixWrapper { m2x2 mat1 = m2x2(1, 2, 3, 4); @@ -103,6 +105,10 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) matrix<bool, 2, 2> equal_to = comp_mat1 == comp_mat2; matrix<bool, 2, 2> not_equal = comp_mat1 != comp_mat2; + // Test matrix negation operations + m2x2 neg_mat = m2x2(1, -2, 3, -4); + m2x2 negated = -neg_mat; + // Store results outputBuffer[0] = val1; // CHECK: 1 @@ -186,4 +192,8 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) // CHECK-NEXT: 0 outputBuffer[37] = TYPE(not_equal[0][0]); // CHECK-NEXT: 1 + outputBuffer[38] = TYPE(negated[0][0] == expectedBuffer[0]); + // CHECK-NEXT: 1 + outputBuffer[39] = TYPE(negated[1][1] == expectedBuffer[1]); + // CHECK-NEXT: 1 }
\ No newline at end of file |
