From c787c4b82ba76f87069911f203eb192060b5264f Mon Sep 17 00:00:00 2001 From: Yong He Date: Mon, 28 Aug 2023 21:24:49 -0700 Subject: Add `target_switch` and `intrinsic_asm` statement. (#3154) * Add `target_switch` and `__intrinsic_asm` statement. * Cleanup. * WaveGetActiveMask, WaveGetActiveMask, WaveCountBits. * WaveIsFirstLane. * More wave intrinsics. * wave intrinsics. * merge fix. * Fix. * Fix. * Update test. * update test. * Fix. --------- Co-authored-by: Yong He --- tests/expected-failure.txt | 26 ---------------------- tests/language-feature/spirv-asm/bad-addr.slang | 4 ++-- .../spirv-asm/instructions-at-end.slang | 2 +- .../spirv-asm/too-many-operands.slang | 4 ++-- .../spirv-asm/wrong-assignment-opcode.slang | 12 +++++----- 5 files changed, 11 insertions(+), 37 deletions(-) (limited to 'tests') diff --git a/tests/expected-failure.txt b/tests/expected-failure.txt index e57fe6bc2..83fd576d6 100644 --- a/tests/expected-failure.txt +++ b/tests/expected-failure.txt @@ -1,19 +1,15 @@ tests/autodiff/global-param-hoisting.slang.1 (vk) tests/bugs/atomic-coerce.slang.1 (vk) -tests/bugs/bool-op.slang.1 (vk) tests/bugs/buffer-swizzle-store.slang.1 (vk) tests/bugs/byte-address-buffer-interlocked-add-f32.slang (vk) tests/bugs/gh-3075.slang.2 (vk) tests/bugs/ray-query-in-generic.slang.1 (vk) -tests/bugs/vec-compare.slang.2 (vk) tests/compute/buffer-layout.slang.2 (vk) tests/compute/half-rw-texture-convert.slang.4 (vk) tests/compute/half-rw-texture-convert2.slang.4 (vk) -tests/compute/half-vector-compare.slang.1 (vk) tests/compute/loop-unroll.slang.5 (vk) tests/compute/ray-tracing-inline.slang.1 (vk) tests/compute/rw-texture-simple.slang.4 (vk) -tests/compute/static-const-matrix-array.slang.1 (vk) tests/compute/texture-sample-grad-offset-clamp.slang (vk) tests/compute/texture-simple.slang.4 (vk) tests/compute/texture-simpler.slang (vk) @@ -25,39 +21,17 @@ tests/hlsl-intrinsic/scalar-double-d3d-intrinsic.slang.4 (vk) tests/hlsl-intrinsic/scalar-double-simple.slang.4 (vk) tests/hlsl-intrinsic/scalar-double-vk-intrinsic.slang.1 (vk) tests/hlsl-intrinsic/scalar-float.slang.3 (vk) -tests/hlsl-intrinsic/scalar-uint.slang.3 (vk) -tests/hlsl-intrinsic/scalar-uint64.slang.4 (vk) tests/hlsl-intrinsic/vector-double-reduced-intrinsic.slang.3 (vk) tests/hlsl-intrinsic/vector-float.slang.3 (vk) -tests/hlsl-intrinsic/wave-active-count-bits.slang.3 (vk) -tests/hlsl-intrinsic/wave-active-product.slang.3 (vk) -tests/hlsl-intrinsic/wave-broadcast-lane-at-vk.slang.1 (vk) -tests/hlsl-intrinsic/wave-diverge.slang.3 (vk) -tests/hlsl-intrinsic/wave-equality.slang.3 (vk) tests/hlsl-intrinsic/wave-get-lane-index.slang.3 (vk) -tests/hlsl-intrinsic/wave-is-first-lane.slang.3 (vk) tests/hlsl-intrinsic/wave-prefix-count-bits.slang.3 (vk) tests/hlsl-intrinsic/wave-prefix-product.slang.3 (vk) tests/hlsl-intrinsic/wave-prefix-sum.slang.3 (vk) -tests/hlsl-intrinsic/wave-read-lane-at-vk.slang.1 (vk) -tests/hlsl-intrinsic/wave-shuffle-vk.slang.3 (vk) -tests/hlsl-intrinsic/wave-vector.slang.3 (vk) -tests/hlsl-intrinsic/wave.slang.3 (vk) -tests/hlsl-intrinsic/active-mask/switch.slang.3 (vk) -tests/hlsl-intrinsic/size-of/align-of-3.slang.3 (vk) -tests/hlsl-intrinsic/size-of/size-of-3.slang.3 (vk) -tests/hlsl-intrinsic/wave-mask/wave-active-product.slang.3 (vk) tests/hlsl-intrinsic/wave-mask/wave-broadcast-lane-at-vk.slang.1 (vk) -tests/hlsl-intrinsic/wave-mask/wave-diverge.slang.3 (vk) -tests/hlsl-intrinsic/wave-mask/wave-equality.slang.3 (vk) tests/hlsl-intrinsic/wave-mask/wave-get-active.slang.3 (vk) tests/hlsl-intrinsic/wave-mask/wave-get-converged.slang.3 (vk) -tests/hlsl-intrinsic/wave-mask/wave-is-first-lane.slang.3 (vk) tests/hlsl-intrinsic/wave-mask/wave-prefix-product.slang.3 (vk) tests/hlsl-intrinsic/wave-mask/wave-prefix-sum.slang.3 (vk) -tests/hlsl-intrinsic/wave-mask/wave-read-lane-at-vk.slang.1 (vk) -tests/hlsl-intrinsic/wave-mask/wave-shuffle-vk.slang.3 (vk) -tests/hlsl-intrinsic/wave-mask/wave-vector.slang.3 (vk) tests/hlsl-intrinsic/wave-mask/wave.slang.3 (vk) tests/language-feature/constants/constexpr-loop.slang.1 (vk) tests/optimization/func-resource-result/func-resource-result-complex.slang.1 (vk) diff --git a/tests/language-feature/spirv-asm/bad-addr.slang b/tests/language-feature/spirv-asm/bad-addr.slang index 4fc29a921..422b51655 100644 --- a/tests/language-feature/spirv-asm/bad-addr.slang +++ b/tests/language-feature/spirv-asm/bad-addr.slang @@ -11,8 +11,8 @@ int foo(const int constParam) return spirv_asm { OpLoad $$int %foo &buf; - // CHECK: bad-addr.slang([[#@LINE-1]]): note 29103: unable to take the address of this address-of asm operand + // CHECK: bad-addr.slang([[#@LINE-1]]): note {{.*}}: unable to take the address of this address-of asm operand OpLoad $$int result &constParam; - // CHECK: bad-addr.slang([[#@LINE-1]]): note 29103: unable to take the address of this address-of asm operand + // CHECK: bad-addr.slang([[#@LINE-1]]): note {{.*}}: unable to take the address of this address-of asm operand }; } diff --git a/tests/language-feature/spirv-asm/instructions-at-end.slang b/tests/language-feature/spirv-asm/instructions-at-end.slang index b39fa6da1..75179ea98 100644 --- a/tests/language-feature/spirv-asm/instructions-at-end.slang +++ b/tests/language-feature/spirv-asm/instructions-at-end.slang @@ -16,7 +16,7 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) { OpConstant $$int %two 2; OpIMul $$int result $n %two; - // CHECK: instructions-at-end.slang([[#@LINE-1]]): error 29101: the result-id marker must only be used in the last instruction of a spriv_asm expression + // CHECK: instructions-at-end.slang([[#@LINE-1]]): error {{.*}}: the result-id marker must only be used in the last instruction of a spriv_asm expression // CHECK: note 29102: consider adding an OpCopyObject instruction to the end of the spirv_asm expression OpIAdd $$uint %something %two %two; diff --git a/tests/language-feature/spirv-asm/too-many-operands.slang b/tests/language-feature/spirv-asm/too-many-operands.slang index 219448699..38cd456ad 100644 --- a/tests/language-feature/spirv-asm/too-many-operands.slang +++ b/tests/language-feature/spirv-asm/too-many-operands.slang @@ -16,11 +16,11 @@ void foo(const int constParam) %c %d %e - // CHECK: too-many-operands.slang([[#@LINE-1]]): warning 29104: too many operands for OpLoad (expected max 4), did you forget a semicolon? + // CHECK: too-many-operands.slang([[#@LINE-1]]): warning {{.*}}: too many operands for OpLoad (expected max 4), did you forget a semicolon? %f; %r : $$int = OpIAdd %r %r // oops, I forgot the semicolon OpNop - // CHECK: too-many-operands.slang([[#@LINE-1]]): warning 29104: too many operands for OpIAdd (expected max 4), did you forget a semicolon? + // CHECK: too-many-operands.slang([[#@LINE-1]]): warning {{.*}}: too many operands for OpIAdd (expected max 4), did you forget a semicolon? }; } diff --git a/tests/language-feature/spirv-asm/wrong-assignment-opcode.slang b/tests/language-feature/spirv-asm/wrong-assignment-opcode.slang index 4afbb0417..e93619254 100644 --- a/tests/language-feature/spirv-asm/wrong-assignment-opcode.slang +++ b/tests/language-feature/spirv-asm/wrong-assignment-opcode.slang @@ -15,7 +15,7 @@ int foo(const int constParam) spirv_asm { %bar : %wrong = OpTypeInt 32 0 - // CHECK: wrong-assignment-opcode.slang([[#@LINE-1]]): error 29104: cannot use this 'x : = OpTypeInt...' syntax because OpTypeInt does not have a operand + // CHECK: wrong-assignment-opcode.slang([[#@LINE-1]]): error {{.*}}: cannot use this 'x : = OpTypeInt...' syntax because OpTypeInt does not have a operand }; @@ -23,19 +23,19 @@ int foo(const int constParam) spirv_asm { %foo = OpStore 1 2; - // CHECK: wrong-assignment-opcode.slang([[#@LINE-1]]): error 29104: cannot use this 'x = OpStore...' syntax because OpStore does not have a operand + // CHECK: wrong-assignment-opcode.slang([[#@LINE-1]]): error {{.*}}: cannot use this 'x = OpStore...' syntax because OpStore does not have a operand }; // garbage spirv_asm { %foo =; - // CHECK: wrong-assignment-opcode.slang([[#@LINE-1]]): error 20003: unexpected ';' + // CHECK: wrong-assignment-opcode.slang([[#@LINE-1]]): error {{.*}}: unexpected ';' %foo :; - // CHECK: wrong-assignment-opcode.slang([[#@LINE-1]]): error 20003: unexpected ';' + // CHECK: wrong-assignment-opcode.slang([[#@LINE-1]]): error {{.*}}: unexpected ';' %foo : bar; - // CHECK: wrong-assignment-opcode.slang([[#@LINE-1]]): error 20001: unexpected ';', expected '=' + // CHECK: wrong-assignment-opcode.slang([[#@LINE-1]]): error {{.*}}: unexpected ';', expected '=' %foo : bar =; - // CHECK: wrong-assignment-opcode.slang([[#@LINE-1]]): error 20003: unexpected ';' + // CHECK: wrong-assignment-opcode.slang([[#@LINE-1]]): error {{.*}}: unexpected ';' }; } -- cgit v1.2.3