From b39ec87cccaadebbb9325dd2adb8c0b13b364805 Mon Sep 17 00:00:00 2001 From: sricker-nvidia <115114531+sricker-nvidia@users.noreply.github.com> Date: Thu, 15 May 2025 17:01:08 -0700 Subject: Fix broken -emit-spirv-via-glsl test option (#7091) Fixes issue #6898 The -emit-spirv-via-glsl slang-test option has been broken for some amount of time. Tests that were using it were operating as if using -emit-spirv-directly, leading to many duplicated tests. After fixing the test option, there were an number of errors that appeared as a result. This change fixes the broken test option and the resulting test errors. Some of the test errors revealed some legitimate issues, such as: -The GLSL bitCount instrinsic only supports 32-bit integers and requires emulation for other bit widths. -Emitting GLSL 8-bit and 16-bit glsl integer types did not emit the proper extension requirements -Emitting GLSL and casting for 16-bit integers was missing a closing parenthesis. -Missing profile for GL_EXT_shader_explicit_arithmetic_types -Missing toType cases for UInt8/Int8 for the kIROp_BitCast case in tryEmitInstExprImpl. --- tests/bugs/gh-4305.slang | 5 +- tests/cooperative-matrix/return.slang | 2 +- tests/cooperative-vector/atan.slang | 2 +- tests/cooperative-vector/clamp.slang | 2 +- tests/cooperative-vector/conversion.slang | 2 +- tests/cooperative-vector/exp.slang | 2 +- tests/cooperative-vector/fma.slang | 2 +- tests/cooperative-vector/log.slang | 2 +- .../matrix-mul-bias-packed-mut.slang | 2 +- .../matrix-mul-bias-packed.slang | 2 +- tests/cooperative-vector/max.slang | 2 +- tests/cooperative-vector/min.slang | 2 +- tests/cooperative-vector/scalar-mul.slang | 2 +- tests/cooperative-vector/step.slang | 2 +- tests/cooperative-vector/tanh.slang | 2 +- tests/glsl/integer_pack.slang | 118 +++++++++++++++++++++ tests/glsl/interger_pack.slang | 118 --------------------- tests/hlsl-intrinsic/countbits.slang | 2 +- tests/hlsl-intrinsic/countbits16.slang | 2 +- tests/hlsl-intrinsic/countbits64.slang | 6 +- tests/hlsl-intrinsic/countbits8.slang | 2 +- .../wave-rotate/wave-rotate-clustered.slang | 5 +- tests/hlsl-intrinsic/wave-rotate/wave-rotate.slang | 4 +- .../bit-cast/struct-bit-cast-2.slang | 2 +- .../bit-cast/struct-reinterpret.slang | 2 +- .../bitfield-insert-extract-non32bit.slang | 2 +- tests/spirv/spec-constant-generic.slang | 2 +- tests/spirv/spec-constant-sized-array-1.slang | 2 +- tests/spirv/spec-constant-sized-array-2.slang | 2 +- tests/spirv/spec-constant-sized-array-3.slang | 2 +- tests/spirv/spec-constant-sized-array-4.slang | 2 +- 31 files changed, 152 insertions(+), 154 deletions(-) create mode 100644 tests/glsl/integer_pack.slang delete mode 100644 tests/glsl/interger_pack.slang (limited to 'tests') diff --git a/tests/bugs/gh-4305.slang b/tests/bugs/gh-4305.slang index dd09bda1e..29d61f787 100644 --- a/tests/bugs/gh-4305.slang +++ b/tests/bugs/gh-4305.slang @@ -32,9 +32,10 @@ layout(local_size_x = 2, local_size_y = 2, local_size_z = 1) in; [DerivativeGroupLinear] #endif // #ifdef QUAD [numthreads(2, 2, 1)] -#endif //#ifndef MODIFIER +#endif // #ifndef MODIFIER +[shader("compute")] void computeMain() { //BUF:1 outputBuffer[0] = t2D.Sample(samplerState, float2(0.5, 0.5)); -} \ No newline at end of file +} diff --git a/tests/cooperative-matrix/return.slang b/tests/cooperative-matrix/return.slang index b67117892..2da0c81ad 100644 --- a/tests/cooperative-matrix/return.slang +++ b/tests/cooperative-matrix/return.slang @@ -1,4 +1,4 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -skip-spirv-validation +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -skip-spirv-validation -emit-spirv-directly // CHECK: type: float // CHECK-NEXT: 3.000000 diff --git a/tests/cooperative-vector/atan.slang b/tests/cooperative-vector/atan.slang index 4ae135dcd..83c4da5ab 100644 --- a/tests/cooperative-vector/atan.slang +++ b/tests/cooperative-vector/atan.slang @@ -1,4 +1,4 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type -emit-spirv-directly //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -render-feature cooperative-vector -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -capability hlsl_coopvec_poc //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type diff --git a/tests/cooperative-vector/clamp.slang b/tests/cooperative-vector/clamp.slang index 1250aaae0..72202ee98 100644 --- a/tests/cooperative-vector/clamp.slang +++ b/tests/cooperative-vector/clamp.slang @@ -1,4 +1,4 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type -emit-spirv-directly //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -render-feature cooperative-vector -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -capability hlsl_coopvec_poc //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type diff --git a/tests/cooperative-vector/conversion.slang b/tests/cooperative-vector/conversion.slang index 5bba7961b..c0f8f788a 100644 --- a/tests/cooperative-vector/conversion.slang +++ b/tests/cooperative-vector/conversion.slang @@ -1,4 +1,4 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type -emit-spirv-directly //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -render-feature cooperative-vector -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -capability hlsl_coopvec_poc //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type diff --git a/tests/cooperative-vector/exp.slang b/tests/cooperative-vector/exp.slang index 82c43c900..18e41b1b9 100644 --- a/tests/cooperative-vector/exp.slang +++ b/tests/cooperative-vector/exp.slang @@ -1,4 +1,4 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type -emit-spirv-directly //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -render-feature cooperative-vector -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -capability hlsl_coopvec_poc //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type diff --git a/tests/cooperative-vector/fma.slang b/tests/cooperative-vector/fma.slang index 9f0e194aa..cddf91ad2 100644 --- a/tests/cooperative-vector/fma.slang +++ b/tests/cooperative-vector/fma.slang @@ -1,4 +1,4 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type -emit-spirv-directly //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -render-feature cooperative-vector -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -capability hlsl_coopvec_poc //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type diff --git a/tests/cooperative-vector/log.slang b/tests/cooperative-vector/log.slang index 3e5cd32cf..99a5e1c49 100644 --- a/tests/cooperative-vector/log.slang +++ b/tests/cooperative-vector/log.slang @@ -1,4 +1,4 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type -emit-spirv-directly //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -render-feature cooperative-vector -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -capability hlsl_coopvec_poc //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type diff --git a/tests/cooperative-vector/matrix-mul-bias-packed-mut.slang b/tests/cooperative-vector/matrix-mul-bias-packed-mut.slang index 29038c83d..4abaaec8c 100644 --- a/tests/cooperative-vector/matrix-mul-bias-packed-mut.slang +++ b/tests/cooperative-vector/matrix-mul-bias-packed-mut.slang @@ -1,4 +1,4 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type -emit-spirv-directly //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -render-feature cooperative-vector -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -capability hlsl_coopvec_poc //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type diff --git a/tests/cooperative-vector/matrix-mul-bias-packed.slang b/tests/cooperative-vector/matrix-mul-bias-packed.slang index 16975cd09..c1f87b65c 100644 --- a/tests/cooperative-vector/matrix-mul-bias-packed.slang +++ b/tests/cooperative-vector/matrix-mul-bias-packed.slang @@ -1,4 +1,4 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type -emit-spirv-directly //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -render-feature cooperative-vector -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -capability hlsl_coopvec_poc //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type diff --git a/tests/cooperative-vector/max.slang b/tests/cooperative-vector/max.slang index 09eff40d7..55091127b 100644 --- a/tests/cooperative-vector/max.slang +++ b/tests/cooperative-vector/max.slang @@ -1,4 +1,4 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type -emit-spirv-directly //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -render-feature cooperative-vector -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -capability hlsl_coopvec_poc //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type diff --git a/tests/cooperative-vector/min.slang b/tests/cooperative-vector/min.slang index 25c363133..825891f6f 100644 --- a/tests/cooperative-vector/min.slang +++ b/tests/cooperative-vector/min.slang @@ -1,4 +1,4 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type -emit-spirv-directly //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -render-feature cooperative-vector -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -capability hlsl_coopvec_poc //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type diff --git a/tests/cooperative-vector/scalar-mul.slang b/tests/cooperative-vector/scalar-mul.slang index f9fed6d7d..bbb560daa 100644 --- a/tests/cooperative-vector/scalar-mul.slang +++ b/tests/cooperative-vector/scalar-mul.slang @@ -1,4 +1,4 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type -emit-spirv-directly //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -render-feature cooperative-vector -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -capability hlsl_coopvec_poc //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type diff --git a/tests/cooperative-vector/step.slang b/tests/cooperative-vector/step.slang index 620ad3398..4e6235f51 100644 --- a/tests/cooperative-vector/step.slang +++ b/tests/cooperative-vector/step.slang @@ -1,4 +1,4 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type -emit-spirv-directly //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -render-feature cooperative-vector -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -capability hlsl_coopvec_poc //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type diff --git a/tests/cooperative-vector/tanh.slang b/tests/cooperative-vector/tanh.slang index 15fecbfa5..69334762e 100644 --- a/tests/cooperative-vector/tanh.slang +++ b/tests/cooperative-vector/tanh.slang @@ -1,4 +1,4 @@ -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type -emit-spirv-directly //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -render-feature cooperative-vector -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -capability hlsl_coopvec_poc //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type diff --git a/tests/glsl/integer_pack.slang b/tests/glsl/integer_pack.slang new file mode 100644 index 000000000..cf2c49f9c --- /dev/null +++ b/tests/glsl/integer_pack.slang @@ -0,0 +1,118 @@ +//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl +//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl -emit-spirv-via-glsl + +#version 450 + +//TEST_INPUT:ubuffer(data=[0xA802 0x1349 0xC2 0x91 0xB2 0x72], stride=4):out,name=inputBuffer +layout(scalar) buffer MyBlock1 +{ + uint32_t a; + uint32_t b; + + uint32_t c; + uint32_t d; + uint32_t e; + uint32_t f; +} inputBuffer; +// BUF: A802 +// BUF-NEXT: 1349 +// BUF-NEXT: C2 +// BUF-NEXT: 91 +// BUF-NEXT: B2 +// BUF-NEXT: 72 + +//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], stride=4):out,name=outputBuffer +layout(scalar) buffer MyBlock2 +{ + uvec4 a; + ivec4 b; + + uvec2 c; + ivec2 d; + + uvec2 e; + ivec2 f; + + uint32_t g; + int32_t h; + + uint32_t i; + int32_t j; + + uint32_t k; + int32_t l; + + uint32_t m; + uint32_t n; +} outputBuffer; + +layout(local_size_x = 1) in; +void computeMain() +{ + uint32_t a = 0xF2845678; + outputBuffer.a = unpack8(a); + // BUF-NEXT: 78 + // BUF-NEXT: 56 + // BUF-NEXT: 84 + // BUF-NEXT: F2 + + int32_t b = 0xF2845678; + outputBuffer.b = unpack8(b); + // BUF: 78 + // BUF-NEXT: 56 + // BUF-NEXT: FFFFFF84 + // BUF-NEXT: FFFFFFF2 + + uint16_t c = 0xF256; + outputBuffer.c = unpack8(c); + // BUF-NEXT: 56 + // BUF-NEXT: F2 + + int16_t d = 0xF256; + outputBuffer.d = unpack8(d); + // BUF-NEXT: 56 + // BUF-NEXT: FFFFFFF2 + + uint32_t e = 0xF2845678; + outputBuffer.e = unpack16(e); + // BUF-NEXT: 5678 + // BUF-NEXT: F284 + + int32_t f = 0xF2845678; + outputBuffer.f = unpack16(f); + // BUF-NEXT: 5678 + // BUF-NEXT: FFFFF284 + + u16vec2 g = {0xF256, 0x1234}; + outputBuffer.g = pack32(g); + // BUF-NEXT: 1234F256 + + i16vec2 h = {0xF256, 0x1234}; + outputBuffer.h = pack32(h); + // BUF-NEXT: 1234F256 + + u8vec4 i = {0xF2, 0x56, 0x12, 0x34}; + outputBuffer.i = pack32(i); + // BUF-NEXT: 341256F2 + + i8vec4 j = {0x82, 0x56, 0x12, 0x80}; + outputBuffer.j = pack32(j); + // BUF-NEXT: 80125682 + + // Note: Below tests are mainly to verify that we don't emit invalid spirv code + u16vec2 k = {inputBuffer.a, inputBuffer.b}; + outputBuffer.k = pack32(k); + // BUF-NEXT: 1349A802 + + i16vec2 l = {inputBuffer.a, inputBuffer.b}; + outputBuffer.l = pack32(l); + // BUF-NEXT: 1349A802 + + u8vec4 m = {inputBuffer.c, inputBuffer.d, inputBuffer.e, inputBuffer.f}; + outputBuffer.m = pack32(m); + // BUF-NEXT: 72B291C2 + + u8vec4 n = {inputBuffer.c, inputBuffer.d, inputBuffer.e, inputBuffer.f}; + outputBuffer.n = pack32(n); + // BUF-NEXT: 72B291C2 +} diff --git a/tests/glsl/interger_pack.slang b/tests/glsl/interger_pack.slang deleted file mode 100644 index cf2c49f9c..000000000 --- a/tests/glsl/interger_pack.slang +++ /dev/null @@ -1,118 +0,0 @@ -//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl -//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl -emit-spirv-via-glsl - -#version 450 - -//TEST_INPUT:ubuffer(data=[0xA802 0x1349 0xC2 0x91 0xB2 0x72], stride=4):out,name=inputBuffer -layout(scalar) buffer MyBlock1 -{ - uint32_t a; - uint32_t b; - - uint32_t c; - uint32_t d; - uint32_t e; - uint32_t f; -} inputBuffer; -// BUF: A802 -// BUF-NEXT: 1349 -// BUF-NEXT: C2 -// BUF-NEXT: 91 -// BUF-NEXT: B2 -// BUF-NEXT: 72 - -//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], stride=4):out,name=outputBuffer -layout(scalar) buffer MyBlock2 -{ - uvec4 a; - ivec4 b; - - uvec2 c; - ivec2 d; - - uvec2 e; - ivec2 f; - - uint32_t g; - int32_t h; - - uint32_t i; - int32_t j; - - uint32_t k; - int32_t l; - - uint32_t m; - uint32_t n; -} outputBuffer; - -layout(local_size_x = 1) in; -void computeMain() -{ - uint32_t a = 0xF2845678; - outputBuffer.a = unpack8(a); - // BUF-NEXT: 78 - // BUF-NEXT: 56 - // BUF-NEXT: 84 - // BUF-NEXT: F2 - - int32_t b = 0xF2845678; - outputBuffer.b = unpack8(b); - // BUF: 78 - // BUF-NEXT: 56 - // BUF-NEXT: FFFFFF84 - // BUF-NEXT: FFFFFFF2 - - uint16_t c = 0xF256; - outputBuffer.c = unpack8(c); - // BUF-NEXT: 56 - // BUF-NEXT: F2 - - int16_t d = 0xF256; - outputBuffer.d = unpack8(d); - // BUF-NEXT: 56 - // BUF-NEXT: FFFFFFF2 - - uint32_t e = 0xF2845678; - outputBuffer.e = unpack16(e); - // BUF-NEXT: 5678 - // BUF-NEXT: F284 - - int32_t f = 0xF2845678; - outputBuffer.f = unpack16(f); - // BUF-NEXT: 5678 - // BUF-NEXT: FFFFF284 - - u16vec2 g = {0xF256, 0x1234}; - outputBuffer.g = pack32(g); - // BUF-NEXT: 1234F256 - - i16vec2 h = {0xF256, 0x1234}; - outputBuffer.h = pack32(h); - // BUF-NEXT: 1234F256 - - u8vec4 i = {0xF2, 0x56, 0x12, 0x34}; - outputBuffer.i = pack32(i); - // BUF-NEXT: 341256F2 - - i8vec4 j = {0x82, 0x56, 0x12, 0x80}; - outputBuffer.j = pack32(j); - // BUF-NEXT: 80125682 - - // Note: Below tests are mainly to verify that we don't emit invalid spirv code - u16vec2 k = {inputBuffer.a, inputBuffer.b}; - outputBuffer.k = pack32(k); - // BUF-NEXT: 1349A802 - - i16vec2 l = {inputBuffer.a, inputBuffer.b}; - outputBuffer.l = pack32(l); - // BUF-NEXT: 1349A802 - - u8vec4 m = {inputBuffer.c, inputBuffer.d, inputBuffer.e, inputBuffer.f}; - outputBuffer.m = pack32(m); - // BUF-NEXT: 72B291C2 - - u8vec4 n = {inputBuffer.c, inputBuffer.d, inputBuffer.e, inputBuffer.f}; - outputBuffer.n = pack32(n); - // BUF-NEXT: 72B291C2 -} diff --git a/tests/hlsl-intrinsic/countbits.slang b/tests/hlsl-intrinsic/countbits.slang index 060ad98f4..689a58f7f 100644 --- a/tests/hlsl-intrinsic/countbits.slang +++ b/tests/hlsl-intrinsic/countbits.slang @@ -5,7 +5,7 @@ //TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -cuda -compute //TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -mtl -compute //TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -wgpu -compute -// TODO: test GLSL pathway once emit-spirv-via-glsl is fixed and shader output reading is fixed for GLSL +//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -vk -compute -emit-spirv-via-glsl //CHK:1 diff --git a/tests/hlsl-intrinsic/countbits16.slang b/tests/hlsl-intrinsic/countbits16.slang index dbfdc9217..fbdb48a83 100644 --- a/tests/hlsl-intrinsic/countbits16.slang +++ b/tests/hlsl-intrinsic/countbits16.slang @@ -7,7 +7,7 @@ // https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/hlsl-shader-model-6-0-features-for-direct3d-12 //TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -compute -dx12 -profile cs_6_2 -use-dxil -shaderobj -render-feature hardware-device // wgpu only has 32-bit support, so we do not try and test it here -// TODO: test GLSL pathway once emit-spirv-via-glsl is fixed and shader output reading is fixed for GLSL +//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -vk -compute -emit-spirv-via-glsl //CHK:1 diff --git a/tests/hlsl-intrinsic/countbits64.slang b/tests/hlsl-intrinsic/countbits64.slang index 90799e411..ac2902108 100644 --- a/tests/hlsl-intrinsic/countbits64.slang +++ b/tests/hlsl-intrinsic/countbits64.slang @@ -1,8 +1,6 @@ //TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -compute -cpu -//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -vk -compute -render-feature int64 -// emit-spirv-via-glsl is currently ignored, but even working around this, output does not appear to be captured for GLSL -// No support for uint64_t in GLSL without an extension like GL_EXT_shader_explicit_arithmetic_types_int64 -//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -vk -compute -render-feature int64 -emit-spirv-via-glsl -profile GLSL_400 -Xslang... -capability GL_EXT_shader_explicit_arithmetic_types_int64. +//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -vk -compute +//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -vk -compute -emit-spirv-via-glsl //TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -cuda -compute //TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -mtl -compute // No support for uint64_t on fxc - we need SM6.0 and dxil to use uint64_t with d3d12 diff --git a/tests/hlsl-intrinsic/countbits8.slang b/tests/hlsl-intrinsic/countbits8.slang index 1db8e805c..0426b5682 100644 --- a/tests/hlsl-intrinsic/countbits8.slang +++ b/tests/hlsl-intrinsic/countbits8.slang @@ -6,7 +6,7 @@ // Not testing the following: // -dx12/hlsl, No support for uint8_t with hlsl // -wgpu, only has 32-bit support -// -vk/glsl, No support for uint8_t with glsl +//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -vk -compute -emit-spirv-via-glsl //CHK:1 diff --git a/tests/hlsl-intrinsic/wave-rotate/wave-rotate-clustered.slang b/tests/hlsl-intrinsic/wave-rotate/wave-rotate-clustered.slang index d52384c15..a8ca2d66f 100644 --- a/tests/hlsl-intrinsic/wave-rotate/wave-rotate-clustered.slang +++ b/tests/hlsl-intrinsic/wave-rotate/wave-rotate-clustered.slang @@ -1,9 +1,8 @@ //TEST_CATEGORY(wave, compute) //TEST:COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-vk -compute -shaderobj -emit-spirv-directly -//TEST:COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-vk -compute -shaderobj -emit-spirv-via-glsl - +//TEST:COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-vk -compute -shaderobj -emit-spirv-via-glsl -Xslang... -capability GL_KHR_shader_subgroup_rotate -X. //TEST:COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-vk -compute -shaderobj -emit-spirv-directly -xslang -DUSE_GLSL_SYNTAX -allow-glsl -//TEST:COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-vk -compute -shaderobj -emit-spirv-via-glsl -xslang -DUSE_GLSL_SYNTAX -allow-glsl +//TEST:COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-vk -compute -shaderobj -emit-spirv-via-glsl -allow-glsl -Xslang... -DUSE_GLSL_SYNTAX -capability GL_KHR_shader_subgroup_rotate -X. #if defined(USE_GLSL_SYNTAX) #define __clusteredRotate subgroupClusteredRotate diff --git a/tests/hlsl-intrinsic/wave-rotate/wave-rotate.slang b/tests/hlsl-intrinsic/wave-rotate/wave-rotate.slang index 4b815c265..5dc319254 100644 --- a/tests/hlsl-intrinsic/wave-rotate/wave-rotate.slang +++ b/tests/hlsl-intrinsic/wave-rotate/wave-rotate.slang @@ -1,11 +1,11 @@ //TEST_CATEGORY(wave, compute) //TEST:COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-vk -compute -shaderobj -emit-spirv-directly -//TEST:COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-vk -compute -shaderobj -emit-spirv-via-glsl +//TEST:COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-vk -compute -shaderobj -emit-spirv-via-glsl -Xslang... -capability GL_KHR_shader_subgroup_rotate -X. //TEST:COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-metal -compute -shaderobj -xslang -DMETAL //TEST:COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-vk -compute -shaderobj -emit-spirv-directly -xslang -DUSE_GLSL_SYNTAX -allow-glsl -//TEST:COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-vk -compute -shaderobj -emit-spirv-via-glsl -xslang -DUSE_GLSL_SYNTAX -allow-glsl +//TEST:COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-vk -compute -shaderobj -emit-spirv-via-glsl -allow-glsl -Xslang... -DUSE_GLSL_SYNTAX -capability GL_KHR_shader_subgroup_rotate -X. //TEST:COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-metal -compute -shaderobj -xslang -DMETAL -xslang -DUSE_GLSL_SYNTAX -allow-glsl diff --git a/tests/language-feature/bit-cast/struct-bit-cast-2.slang b/tests/language-feature/bit-cast/struct-bit-cast-2.slang index edf91e00b..dd9922ee8 100644 --- a/tests/language-feature/bit-cast/struct-bit-cast-2.slang +++ b/tests/language-feature/bit-cast/struct-bit-cast-2.slang @@ -1,7 +1,7 @@ // struct-bit-cast-2.slang // Test bit casts for read across boundaries of scalar types. -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -vk -shaderobj +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -vk -shaderobj -emit-spirv-directly //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -cpu -shaderobj //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -cuda -shaderobj diff --git a/tests/language-feature/bit-cast/struct-reinterpret.slang b/tests/language-feature/bit-cast/struct-reinterpret.slang index 6be359d79..4b9518a4b 100644 --- a/tests/language-feature/bit-cast/struct-reinterpret.slang +++ b/tests/language-feature/bit-cast/struct-reinterpret.slang @@ -1,7 +1,7 @@ // struct-bit-cast-2.slang // Test bit casts for read across boundaries of scalar types. -//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -vk -shaderobj +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -vk -shaderobj -emit-spirv-directly //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -cpu -shaderobj //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -cuda -shaderobj diff --git a/tests/language-feature/bitfield/bitfield-insert-extract-non32bit.slang b/tests/language-feature/bitfield/bitfield-insert-extract-non32bit.slang index 0edbb049a..ded0baed4 100644 --- a/tests/language-feature/bitfield/bitfield-insert-extract-non32bit.slang +++ b/tests/language-feature/bitfield/bitfield-insert-extract-non32bit.slang @@ -1,4 +1,4 @@ -//TEST:COMPARE_COMPUTE(filecheck-buffer=BUF): -vk -output-using-type +//TEST:COMPARE_COMPUTE(filecheck-buffer=BUF): -vk -output-using-type -emit-spirv-directly //TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0], stride=4):out,name=outputBuffer RWStructuredBuffer outputBuffer; diff --git a/tests/spirv/spec-constant-generic.slang b/tests/spirv/spec-constant-generic.slang index 65eed2810..9a9f7006f 100644 --- a/tests/spirv/spec-constant-generic.slang +++ b/tests/spirv/spec-constant-generic.slang @@ -1,5 +1,5 @@ //TEST:SIMPLE(filecheck=CHECK): -target spirv -//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -output-using-type +//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -output-using-type -emit-spirv-directly // CHECK: %[[C0:[0-9A-Za-z_]+]] = OpSpecConstant %int 32 // CHECK: %[[C1:[0-9A-Za-z_]+]] = OpSpecConstant %int 2 diff --git a/tests/spirv/spec-constant-sized-array-1.slang b/tests/spirv/spec-constant-sized-array-1.slang index e974fc37e..ea9081fbf 100644 --- a/tests/spirv/spec-constant-sized-array-1.slang +++ b/tests/spirv/spec-constant-sized-array-1.slang @@ -1,5 +1,5 @@ //TEST:SIMPLE(filecheck=CHECK): -target spirv -//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -output-using-type +//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -output-using-type -emit-spirv-directly // CHECK: %[[C0:[0-9A-Za-z_]+]] = OpSpecConstant %int 5 // CHECK: %[[I3:[0-9A-Za-z_]+]] = OpConstant %int 3 diff --git a/tests/spirv/spec-constant-sized-array-2.slang b/tests/spirv/spec-constant-sized-array-2.slang index 95d2f4aee..0a4dea994 100644 --- a/tests/spirv/spec-constant-sized-array-2.slang +++ b/tests/spirv/spec-constant-sized-array-2.slang @@ -1,5 +1,5 @@ //TEST:SIMPLE(filecheck=CHECK): -target spirv -//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -output-using-type +//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -output-using-type -emit-spirv-directly // CHECK: %[[C0:[0-9A-Za-z_]+]] = OpSpecConstant %int 32 // CHECK: %[[I2:[0-9A-Za-z_]+]] = OpConstant %int 2 diff --git a/tests/spirv/spec-constant-sized-array-3.slang b/tests/spirv/spec-constant-sized-array-3.slang index 39106aa5b..45c11edde 100644 --- a/tests/spirv/spec-constant-sized-array-3.slang +++ b/tests/spirv/spec-constant-sized-array-3.slang @@ -1,5 +1,5 @@ //TEST:SIMPLE(filecheck=CHECK): -target spirv -//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -output-using-type +//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -output-using-type -emit-spirv-directly // CHECK: %[[C0:[0-9A-Za-z_]+]] = OpSpecConstant %int 4 // CHECK: %[[I1:[0-9A-Za-z_]+]] = OpConstant %int 1 diff --git a/tests/spirv/spec-constant-sized-array-4.slang b/tests/spirv/spec-constant-sized-array-4.slang index 0c511bc01..a1f44abf4 100644 --- a/tests/spirv/spec-constant-sized-array-4.slang +++ b/tests/spirv/spec-constant-sized-array-4.slang @@ -1,5 +1,5 @@ //TEST:SIMPLE(filecheck=CHECK): -target spirv -//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -output-using-type +//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -output-using-type -emit-spirv-directly // CHECK: %[[C0:[0-9A-Za-z_]+]] = OpSpecConstant %int 32 // CHECK: %[[C1:[0-9A-Za-z_]+]] = OpSpecConstant %int 2 -- cgit v1.2.3