diff --git a/benchmarks/opencl/barrier/inlining/barrier-inlining-1.cl b/benchmarks/opencl/barrier/inlining/barrier-inlining-1.cl index 132f0f2b90..26b472e578 100644 --- a/benchmarks/opencl/barrier/inlining/barrier-inlining-1.cl +++ b/benchmarks/opencl/barrier/inlining/barrier-inlining-1.cl @@ -1,8 +1,8 @@ -// clang -x cl -cl-std=CL2.0 -target spir-unknown-unknown -cl-opt-disable -emit-llvm -c barrier-inlining-1.cl -o a.bc +// clang -x cl -cl-std=CL2.0 -target spir-unknown-unknown -fno-discard-value-names -cl-opt-disable -emit-llvm -c barrier-inlining-1.cl -o a.bc // llvm-spirv a.bc -o a.spv -// spirv-dis a.spv > barrier-inlining-1.spv.dis +// spirv-dis a.spv > barrier-inlining-1.spvasm -void synchronized_increment(__global uint* shared_value, uint local_id) { +static void synchronized_increment(__global uint* shared_value, uint local_id) { barrier(CLK_GLOBAL_MEM_FENCE); if (local_id == 0) { (*shared_value)++; diff --git a/benchmarks/opencl/barrier/inlining/barrier-inlining-2.cl b/benchmarks/opencl/barrier/inlining/barrier-inlining-2.cl index 2799c54be8..56f8d4c72b 100644 --- a/benchmarks/opencl/barrier/inlining/barrier-inlining-2.cl +++ b/benchmarks/opencl/barrier/inlining/barrier-inlining-2.cl @@ -1,8 +1,8 @@ -// clang -x cl -cl-std=CL2.0 -target spir-unknown-unknown -cl-opt-disable -emit-llvm -c barrier-inlining-2.cl -o a.bc +// clang -x cl -cl-std=CL2.0 -target spir-unknown-unknown -fno-discard-value-names -cl-opt-disable -emit-llvm -c barrier-inlining-2.cl -o a.bc // llvm-spirv a.bc -o a.spv -// spirv-dis a.spv > barrier-inlining-2.spv.dis +// spirv-dis a.spv > barrier-inlining-2.spvasm -void synchronized_increment(__global uint* shared_value, uint local_id) { +static void synchronized_increment(__global uint* shared_value, uint local_id) { barrier(CLK_GLOBAL_MEM_FENCE); if (local_id == 0) { (*shared_value)++; @@ -10,11 +10,11 @@ void synchronized_increment(__global uint* shared_value, uint local_id) { barrier(CLK_GLOBAL_MEM_FENCE); } -void agent_function1(__global uint* shared_value, uint local_id) { +static void agent_function1(__global uint* shared_value, uint local_id) { synchronized_increment(shared_value, local_id); } -void agent_function2(__global uint* shared_value, uint local_id) { +static void agent_function2(__global uint* shared_value, uint local_id) { synchronized_increment(shared_value, local_id); } diff --git a/benchmarks/opencl/barrier/inlining/barrier-inlining-3.cl b/benchmarks/opencl/barrier/inlining/barrier-inlining-3.cl index 66009c79bc..d58843e89e 100644 --- a/benchmarks/opencl/barrier/inlining/barrier-inlining-3.cl +++ b/benchmarks/opencl/barrier/inlining/barrier-inlining-3.cl @@ -1,8 +1,8 @@ -// clang -x cl -cl-std=CL2.0 -target spir-unknown-unknown -cl-opt-disable -emit-llvm -c barrier-inlining-3.cl -o a.bc +// clang -x cl -cl-std=CL2.0 -target spir-unknown-unknown -fno-discard-value-names -cl-opt-disable -emit-llvm -c barrier-inlining-3.cl -o a.bc // llvm-spirv a.bc -o a.spv -// spirv-dis a.spv > barrier-inlining-3.spv.dis +// spirv-dis a.spv > barrier-inlining-3.spvasm -void synchronized_increment(__global uint* shared_value, uint local_id) { +static void synchronized_increment(__global uint* shared_value, uint local_id) { barrier(CLK_GLOBAL_MEM_FENCE); if (local_id == 0) { (*shared_value)++; @@ -10,11 +10,11 @@ void synchronized_increment(__global uint* shared_value, uint local_id) { barrier(CLK_GLOBAL_MEM_FENCE); } -void agent_function1(__global uint* shared_value, uint local_id) { +static void agent_function1(__global uint* shared_value, uint local_id) { synchronized_increment(shared_value, local_id); } -void agent_function2(__global uint* shared_value, uint local_id) { +static void agent_function2(__global uint* shared_value, uint local_id) { agent_function1(shared_value, local_id); } diff --git a/benchmarks/opencl/barrier/inlining/barrier-inlining-4.cl b/benchmarks/opencl/barrier/inlining/barrier-inlining-4.cl index 69a729200f..95f05d298f 100644 --- a/benchmarks/opencl/barrier/inlining/barrier-inlining-4.cl +++ b/benchmarks/opencl/barrier/inlining/barrier-inlining-4.cl @@ -1,8 +1,8 @@ -// clang -x cl -cl-std=CL2.0 -target spir-unknown-unknown -cl-opt-disable -emit-llvm -c barrier-inlining-4.cl -o a.bc +// clang -x cl -cl-std=CL2.0 -target spir-unknown-unknown -fno-discard-value-names -cl-opt-disable -emit-llvm -c barrier-inlining-4.cl -o a.bc // llvm-spirv a.bc -o a.spv -// spirv-dis a.spv > barrier-inlining-4.spv.dis +// spirv-dis a.spv > barrier-inlining-4.spvasm -void synchronized_increment(__global uint* shared_value, uint local_id) { +static void synchronized_increment(__global uint* shared_value, uint local_id) { for (int i = 0; i < 2; i++) { barrier(CLK_GLOBAL_MEM_FENCE); if (local_id == 0) { diff --git a/benchmarks/opencl/barrier/inlining/barrier-inlining-5.cl b/benchmarks/opencl/barrier/inlining/barrier-inlining-5.cl index 10d8797096..c35f51695d 100644 --- a/benchmarks/opencl/barrier/inlining/barrier-inlining-5.cl +++ b/benchmarks/opencl/barrier/inlining/barrier-inlining-5.cl @@ -1,8 +1,8 @@ -// clang -x cl -cl-std=CL2.0 -target spir-unknown-unknown -cl-opt-disable -emit-llvm -c barrier-inlining-5.cl -o a.bc +// clang -x cl -cl-std=CL2.0 -target spir-unknown-unknown -fno-discard-value-names -cl-opt-disable -emit-llvm -c barrier-inlining-5.cl -o a.bc // llvm-spirv a.bc -o a.spv -// spirv-dis a.spv > barrier-inlining-5.spv.dis +// spirv-dis a.spv > barrier-inlining-5.spvasm -void synchronized_increment(__global uint* shared_value, uint local_id) { +static void synchronized_increment(__global uint* shared_value, uint local_id) { barrier(CLK_GLOBAL_MEM_FENCE); if (local_id == 0) { (*shared_value)++; diff --git a/benchmarks/opencl/barrier/inlining/barrier-no-inlining-1.cl b/benchmarks/opencl/barrier/inlining/barrier-no-inlining-1.cl index 67be42a0c7..3095f1143c 100644 --- a/benchmarks/opencl/barrier/inlining/barrier-no-inlining-1.cl +++ b/benchmarks/opencl/barrier/inlining/barrier-no-inlining-1.cl @@ -1,6 +1,6 @@ -// clang -x cl -cl-std=CL2.0 -target spir-unknown-unknown -cl-opt-disable -emit-llvm -c barrier-no-inlining-1.cl -o a.bc +// clang -x cl -cl-std=CL2.0 -target spir-unknown-unknown -fno-discard-value-names -cl-opt-disable -emit-llvm -c barrier-no-inlining-1.cl -o a.bc // llvm-spirv a.bc -o a.spv -// spirv-dis a.spv > barrier-no-inlining-1.spv.dis +// spirv-dis a.spv > barrier-no-inlining-1.spvasm __kernel void test(global uint* x) { uint tid = get_group_id(0); diff --git a/benchmarks/opencl/barrier/loop/barrier-loop-1.cl b/benchmarks/opencl/barrier/loop/barrier-loop-1.cl index fd6880ccf8..f03f215552 100644 --- a/benchmarks/opencl/barrier/loop/barrier-loop-1.cl +++ b/benchmarks/opencl/barrier/loop/barrier-loop-1.cl @@ -1,5 +1,5 @@ // clspv barrier-loop-1.cl --cl-std=CL2.0 --inline-entry-points --spv-version=1.6 -// spirv-dis a.spv > barrier-loop-1.spv.dis +// spirv-dis a.spv > barrier-loop-1.spvasm __kernel void test(global uint* x) { uint tid = get_global_id(0); diff --git a/benchmarks/opencl/barrier/loop/barrier-loop-2.cl b/benchmarks/opencl/barrier/loop/barrier-loop-2.cl index dee2c9af55..4d6a881423 100644 --- a/benchmarks/opencl/barrier/loop/barrier-loop-2.cl +++ b/benchmarks/opencl/barrier/loop/barrier-loop-2.cl @@ -1,5 +1,5 @@ // clspv barrier-loop-2.cl --cl-std=CL2.0 --inline-entry-points --spv-version=1.6 -// spirv-dis a.spv > barrier-loop-2.spv.dis +// spirv-dis a.spv > barrier-loop-2.spvasm __kernel void test(global uint* x) { uint tid = get_global_id(0); diff --git a/benchmarks/opencl/barrier/loop/barrier-loop-3.cl b/benchmarks/opencl/barrier/loop/barrier-loop-3.cl index ad6afb0e88..2aa75f8466 100644 --- a/benchmarks/opencl/barrier/loop/barrier-loop-3.cl +++ b/benchmarks/opencl/barrier/loop/barrier-loop-3.cl @@ -1,5 +1,5 @@ // clspv barrier-loop-3.cl --cl-std=CL2.0 --inline-entry-points --spv-version=1.6 -// spirv-dis a.spv > barrier-loop-3.spv.dis +// spirv-dis a.spv > barrier-loop-3.spvasm __kernel void test(global uint* x) { uint tid = get_global_id(0); diff --git a/benchmarks/opencl/barrier/loop/barrier-loop-4.cl b/benchmarks/opencl/barrier/loop/barrier-loop-4.cl index 62b8ff162a..e773f4e5ef 100644 --- a/benchmarks/opencl/barrier/loop/barrier-loop-4.cl +++ b/benchmarks/opencl/barrier/loop/barrier-loop-4.cl @@ -1,5 +1,5 @@ // clspv barrier-loop-4.cl --cl-std=CL2.0 --inline-entry-points --spv-version=1.6 -// spirv-dis a.spv > barrier-loop-4.spv.dis +// spirv-dis a.spv > barrier-loop-4.spvasm __kernel void test(global atomic_uint* x, global uint* r0) { uint tid = get_global_id(0); diff --git a/benchmarks/opencl/barrier/loop/barrier-loop-5.cl b/benchmarks/opencl/barrier/loop/barrier-loop-5.cl index e82cfce33c..55756bd7ec 100644 --- a/benchmarks/opencl/barrier/loop/barrier-loop-5.cl +++ b/benchmarks/opencl/barrier/loop/barrier-loop-5.cl @@ -1,5 +1,5 @@ // clspv barrier-loop-5.cl --cl-std=CL2.0 --inline-entry-points --spv-version=1.6 -// spirv-dis a.spv > barrier-loop-5.spv.dis +// spirv-dis a.spv > barrier-loop-5.spvasm __kernel void test(global atomic_uint* x, global uint* r0) { uint tid = get_global_id(0); diff --git a/benchmarks/opencl/barrier/loop/barrier-loop-6.cl b/benchmarks/opencl/barrier/loop/barrier-loop-6.cl index c86569a0aa..ad59f4106d 100644 --- a/benchmarks/opencl/barrier/loop/barrier-loop-6.cl +++ b/benchmarks/opencl/barrier/loop/barrier-loop-6.cl @@ -1,5 +1,5 @@ // clspv barrier-loop-6.cl --cl-std=CL2.0 --inline-entry-points --spv-version=1.6 -// spirv-dis a.spv > barrier-loop-6.spv.dis +// spirv-dis a.spv > barrier-loop-6.spvasm __kernel void test(global atomic_uint* x, global uint* r0) { uint tid = get_global_id(0); diff --git a/benchmarks/opencl/barrier/loop/barrier-no-loop-1.cl b/benchmarks/opencl/barrier/loop/barrier-no-loop-1.cl index 05329fa628..36bee657b7 100644 --- a/benchmarks/opencl/barrier/loop/barrier-no-loop-1.cl +++ b/benchmarks/opencl/barrier/loop/barrier-no-loop-1.cl @@ -1,5 +1,5 @@ // clspv barrier-no-loop-1.cl --cl-std=CL2.0 --inline-entry-points --spv-version=1.6 -// spirv-dis a.spv > barrier-no-loop-1.spv.dis +// spirv-dis a.spv > barrier-no-loop-1.spvasm __kernel void test(global uint* x) { uint tid = get_global_id(0); diff --git a/benchmarks/opencl/barrier/loop/barrier-no-loop-2.cl b/benchmarks/opencl/barrier/loop/barrier-no-loop-2.cl index 54db33b3ff..6d8eb7c576 100644 --- a/benchmarks/opencl/barrier/loop/barrier-no-loop-2.cl +++ b/benchmarks/opencl/barrier/loop/barrier-no-loop-2.cl @@ -1,5 +1,5 @@ // clspv barrier-no-loop-2.cl --cl-std=CL2.0 --inline-entry-points --spv-version=1.6 -// spirv-dis a.spv > barrier-no-loop-2.spv.dis +// spirv-dis a.spv > barrier-no-loop-2.spvasm __kernel void test(global uint* x) { uint tid = get_global_id(0); diff --git a/benchmarks/opencl/barrier/loop/barrier-no-loop-3.cl b/benchmarks/opencl/barrier/loop/barrier-no-loop-3.cl index 06d2ec6962..17ea486f0c 100644 --- a/benchmarks/opencl/barrier/loop/barrier-no-loop-3.cl +++ b/benchmarks/opencl/barrier/loop/barrier-no-loop-3.cl @@ -1,5 +1,5 @@ // clspv barrier-no-loop-3.cl --cl-std=CL2.0 --inline-entry-points --spv-version=1.6 -// spirv-dis a.spv > barrier-no-loop-3.spv.dis +// spirv-dis a.spv > barrier-no-loop-3.spvasm __kernel void test(global uint* x) { uint tid = get_global_id(0); diff --git a/benchmarks/opencl/barrier/loop/barrier-no-loop-4.cl b/benchmarks/opencl/barrier/loop/barrier-no-loop-4.cl index 849c04c05d..ff0e654351 100644 --- a/benchmarks/opencl/barrier/loop/barrier-no-loop-4.cl +++ b/benchmarks/opencl/barrier/loop/barrier-no-loop-4.cl @@ -1,5 +1,5 @@ // clspv barrier-no-loop-4.cl --cl-std=CL2.0 --inline-entry-points --spv-version=1.6 -// spirv-dis a.spv > barrier-no-loop-4.spv.dis +// spirv-dis a.spv > barrier-no-loop-4.spvasm __kernel void test(global atomic_uint* x, global uint* r0) { uint tid = get_global_id(0); diff --git a/benchmarks/opencl/barrier/loop/barrier-no-loop-5.cl b/benchmarks/opencl/barrier/loop/barrier-no-loop-5.cl index da4d65e134..b73b74c46c 100644 --- a/benchmarks/opencl/barrier/loop/barrier-no-loop-5.cl +++ b/benchmarks/opencl/barrier/loop/barrier-no-loop-5.cl @@ -1,5 +1,5 @@ // clspv barrier-no-loop-5.cl --cl-std=CL2.0 --inline-entry-points --spv-version=1.6 -// spirv-dis a.spv > barrier-no-loop-5.spv.dis +// spirv-dis a.spv > barrier-no-loop-5.spvasm __kernel void test(global atomic_uint* x, global uint* r0) { uint tid = get_global_id(0); diff --git a/benchmarks/opencl/barrier/loop/barrier-no-loop-6.cl b/benchmarks/opencl/barrier/loop/barrier-no-loop-6.cl index 5cce0d8e3a..139779cd87 100644 --- a/benchmarks/opencl/barrier/loop/barrier-no-loop-6.cl +++ b/benchmarks/opencl/barrier/loop/barrier-no-loop-6.cl @@ -1,5 +1,5 @@ // clspv barrier-no-loop-6.cl --cl-std=CL2.0 --inline-entry-points --spv-version=1.6 -// spirv-dis a.spv > barrier-no-loop-6.spv.dis +// spirv-dis a.spv > barrier-no-loop-6.spvasm __kernel void test(global atomic_uint* x, global uint* r0) { uint tid = get_global_id(0); diff --git a/benchmarks/opencl/benchmarks/caslock-sc.cl b/benchmarks/opencl/benchmarks/caslock-sc.cl index b035f95b83..a96661d7dc 100644 --- a/benchmarks/opencl/benchmarks/caslock-sc.cl +++ b/benchmarks/opencl/benchmarks/caslock-sc.cl @@ -1,5 +1,5 @@ // clspv caslock-cs.cl --cl-std=CL1.0 --inline-entry-points --spv-version=1.6 -// spirv-dis a.spv +// spirv-dis a.spv > caslock-cs.spvasm void lock(global uint* l) { while (atom_cmpxchg(l, 0, 1) == 1) {} diff --git a/benchmarks/opencl/benchmarks/caslock.cl b/benchmarks/opencl/benchmarks/caslock.cl index 81d0fb15c0..1c55b91b21 100644 --- a/benchmarks/opencl/benchmarks/caslock.cl +++ b/benchmarks/opencl/benchmarks/caslock.cl @@ -1,5 +1,5 @@ // clspv caslock.cl --cl-std=CL2.0 --inline-entry-points --spv-version=1.6 -// spirv-dis a.spv +// spirv-dis a.spv > caslock.spvasm #ifdef ACQ2RX #define mo_lock memory_order_relaxed diff --git a/benchmarks/opencl/benchmarks/ticketlock.cl b/benchmarks/opencl/benchmarks/ticketlock.cl index ce5fad585b..53b0c5df30 100644 --- a/benchmarks/opencl/benchmarks/ticketlock.cl +++ b/benchmarks/opencl/benchmarks/ticketlock.cl @@ -1,5 +1,5 @@ // clspv ticketlock.cl --cl-std=CL2.0 --inline-entry-points --spv-version=1.6 -// spirv-dis a.spv +// spirv-dis a.spv > ticketlock.spvasm #ifdef ACQ2RX #define mo_lock memory_order_relaxed diff --git a/benchmarks/opencl/benchmarks/ttaslock.cl b/benchmarks/opencl/benchmarks/ttaslock.cl index ee509325ec..6ef91f54fc 100644 --- a/benchmarks/opencl/benchmarks/ttaslock.cl +++ b/benchmarks/opencl/benchmarks/ttaslock.cl @@ -1,5 +1,5 @@ // clspv ttaslock.cl --cl-std=CL2.0 --inline-entry-points --spv-version=1.6 -// spirv-dis a.spv +// spirv-dis a.spv > ttaslock.spvasm #ifdef ACQ2RX #define mo_lock memory_order_relaxed diff --git a/benchmarks/opencl/benchmarks/xf-barrier.cl b/benchmarks/opencl/benchmarks/xf-barrier.cl index 10ab7de9cf..d8c001c37a 100644 --- a/benchmarks/opencl/benchmarks/xf-barrier.cl +++ b/benchmarks/opencl/benchmarks/xf-barrier.cl @@ -1,5 +1,5 @@ // clspv xf-barrier.cl --cl-std=CL2.0 --inline-entry-points --spv-version=1.6 -// spirv-dis a.spv +// spirv-dis a.spv > xf-barrier.spvasm #ifdef FAIL1 #define mo1 memory_order_relaxed diff --git a/benchmarks/opencl/patterns/corr.cl b/benchmarks/opencl/patterns/corr.cl index bf478bf6dc..1ad9386392 100644 --- a/benchmarks/opencl/patterns/corr.cl +++ b/benchmarks/opencl/patterns/corr.cl @@ -1,5 +1,5 @@ // clspv corr.cl --cl-std=CL2.0 --inline-entry-points --spv-version=1.6 -// spirv-dis a.spv +// spirv-dis a.spv > corr.spvasm __kernel void test(global atomic_uint* x, global uint* r0, global uint* r1, global uint* r2, global uint* r3) { if (get_group_id(0) == 0) { diff --git a/benchmarks/opencl/patterns/iriw.cl b/benchmarks/opencl/patterns/iriw.cl index 758f7d1f2c..dfdcdd47b4 100644 --- a/benchmarks/opencl/patterns/iriw.cl +++ b/benchmarks/opencl/patterns/iriw.cl @@ -1,5 +1,5 @@ // clspv iriw.cl --cl-std=CL2.0 --inline-entry-points --spv-version=1.6 -// spirv-dis a.spv +// spirv-dis a.spv > iriw.spvasm __kernel void test(global atomic_uint* x, global atomic_uint* y, global uint* r0, global uint* r1, global uint* r2, global uint* r3) { if (get_local_id(0) == 0) { diff --git a/benchmarks/opencl/patterns/mp.cl b/benchmarks/opencl/patterns/mp.cl index 5bf5b20c2c..dedf9f4099 100644 --- a/benchmarks/opencl/patterns/mp.cl +++ b/benchmarks/opencl/patterns/mp.cl @@ -1,5 +1,5 @@ // clspv mp.cl --cl-std=CL2.0 --inline-entry-points --spv-version=1.6 -// spirv-dis a.spv +// spirv-dis a.spv > mp.spvasm #ifdef ACQ2RX #define mo_acq memory_order_relaxed diff --git a/benchmarks/opencl/patterns/sb.cl b/benchmarks/opencl/patterns/sb.cl index 1d77f7aede..ac8dca1be5 100644 --- a/benchmarks/opencl/patterns/sb.cl +++ b/benchmarks/opencl/patterns/sb.cl @@ -1,5 +1,5 @@ // clspv sb.cl --cl-std=CL2.0 --inline-entry-points --spv-version=1.6 -// spirv-dis a.spv +// spirv-dis a.spv > sb.spvasm #ifdef ACQ2RX #define mo_acq memory_order_relaxed diff --git a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-1-exists-correct.spvasm b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-1-exists-correct.spvasm index f189b976a1..55cbb66555 100644 --- a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-1-exists-correct.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-1-exists-correct.spvasm @@ -1,90 +1,107 @@ -; @Input: %32 = {0, 0} -; @Output: exists (%32[0]==2 and %32[1]==2) +; @Input: %x = {0, 0} +; @Output: exists (%x[0]==2 and %x[1]==2) ; @Config: 2, 1, 2 ; SPIR-V ; Version: 1.0 ; Generator: Khronos LLVM/SPIR-V Translator; 14 ; Bound: 50 ; Schema: 0 - OpCapability Addresses - OpCapability Linkage - OpCapability Kernel - %1 = OpExtInstImport "OpenCL.std" - OpMemoryModel Physical32 OpenCL - OpEntryPoint Kernel %31 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId - OpSource OpenCL_C 200000 - OpName %__spirv_BuiltInWorkgroupId "__spirv_BuiltInWorkgroupId" - OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" - OpName %synchronized_increment "synchronized_increment" - OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId - OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId - OpDecorate %__spirv_BuiltInWorkgroupId Constant - OpDecorate %__spirv_BuiltInLocalInvocationId Constant - OpDecorate %synchronized_increment LinkageAttributes "synchronized_increment" Export - OpDecorate %__spirv_BuiltInWorkgroupId LinkageAttributes "__spirv_BuiltInWorkgroupId" Import - OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %34 Alignment 4 - OpDecorate %35 Alignment 4 - %uint = OpTypeInt 32 0 - %uint_2 = OpConstant %uint 2 -%uint_528 = OpConstant %uint 528 - %uint_0 = OpConstant %uint 0 - %uint_1 = OpConstant %uint 1 - %v3uint = OpTypeVector %uint 3 + OpCapability Addresses + OpCapability Linkage + OpCapability Kernel + %1 = OpExtInstImport "OpenCL.std" + OpMemoryModel Physical32 OpenCL + OpEntryPoint Kernel %10 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId + OpSource OpenCL_C 200000 + OpName %__spirv_BuiltInWorkgroupId "__spirv_BuiltInWorkgroupId" + OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %x "x" + OpName %entry "entry" + OpName %x_addr "x.addr" + OpName %tid "tid" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" + OpName %synchronized_increment "synchronized_increment" + OpName %shared_value "shared_value" + OpName %local_id "local_id" + OpName %arrayidx2 "arrayidx2" + OpName %call3 "call3" + OpName %entry_0 "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %shared_value_addr "shared_value.addr" + OpName %local_id_addr "local_id.addr" + OpName %cmp "cmp" + OpName %inc "inc" + OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId + OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId + OpDecorate %__spirv_BuiltInWorkgroupId Constant + OpDecorate %__spirv_BuiltInLocalInvocationId Constant + OpDecorate %__spirv_BuiltInWorkgroupId LinkageAttributes "__spirv_BuiltInWorkgroupId" Import + OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import + OpDecorate %x_addr Alignment 4 + OpDecorate %tid Alignment 4 + OpDecorate %shared_value_addr Alignment 4 + OpDecorate %local_id_addr Alignment 4 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %uint_528 = OpConstant %uint 528 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %v3uint = OpTypeVector %uint 3 %_ptr_Input_v3uint = OpTypePointer Input %v3uint - %void = OpTypeVoid + %void = OpTypeVoid %_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint - %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint + %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %_ptr_Function_uint = OpTypePointer Function %uint - %bool = OpTypeBool - %30 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint + %24 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint + %bool = OpTypeBool %__spirv_BuiltInWorkgroupId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input -%synchronized_increment = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %uint - %13 = OpLabel - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - OpStore %17 %11 Aligned 4 - OpStore %19 %12 Aligned 4 - OpControlBarrier %uint_2 %uint_2 %uint_528 - %22 = OpLoad %uint %19 Aligned 4 - %25 = OpIEqual %bool %22 %uint_0 - OpBranchConditional %25 %14 %15 - %14 = OpLabel - %26 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %27 = OpLoad %uint %26 Aligned 4 - %29 = OpIAdd %uint %27 %uint_1 - OpStore %26 %29 Aligned 4 - OpBranch %15 - %15 = OpLabel - OpControlBarrier %uint_2 %uint_2 %uint_528 - OpReturn - OpFunctionEnd - %31 = OpFunction %void DontInline %30 - %32 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %33 = OpLabel - %34 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %35 = OpVariable %_ptr_Function_uint Function - OpStore %34 %32 Aligned 4 - %36 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %37 = OpCompositeExtract %uint %36 0 - OpStore %35 %37 Aligned 4 - %38 = OpLoad %_ptr_CrossWorkgroup_uint %34 Aligned 4 - %39 = OpLoad %uint %35 Aligned 4 - %40 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %38 %39 - %41 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %42 = OpCompositeExtract %uint %41 0 - %43 = OpFunctionCall %void %synchronized_increment %40 %42 - %44 = OpLoad %_ptr_CrossWorkgroup_uint %34 Aligned 4 - %45 = OpLoad %uint %35 Aligned 4 - %46 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %44 %45 - %47 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %48 = OpCompositeExtract %uint %47 0 - %49 = OpFunctionCall %void %synchronized_increment %46 %48 - OpReturn - OpFunctionEnd + %10 = OpFunction %void DontInline %9 + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %tid = OpVariable %_ptr_Function_uint Function + OpStore %x_addr %x Aligned 4 + %17 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 + %call = OpCompositeExtract %uint %17 0 + OpStore %tid %call Aligned 4 + %19 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %20 = OpLoad %uint %tid Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %19 %20 + %22 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 + %call1 = OpCompositeExtract %uint %22 0 + %28 = OpFunctionCall %void %synchronized_increment %arrayidx %call1 + %29 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %30 = OpLoad %uint %tid Aligned 4 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %29 %30 + %32 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 + %call3 = OpCompositeExtract %uint %32 0 + %34 = OpFunctionCall %void %synchronized_increment %arrayidx2 %call3 + OpReturn + OpFunctionEnd +%synchronized_increment = OpFunction %void DontInline %24 +%shared_value = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %local_id = OpFunctionParameter %uint + %entry_0 = OpLabel +%shared_value_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%local_id_addr = OpVariable %_ptr_Function_uint Function + OpStore %shared_value_addr %shared_value Aligned 4 + OpStore %local_id_addr %local_id Aligned 4 + OpControlBarrier %uint_2 %uint_2 %uint_528 + %42 = OpLoad %uint %local_id_addr Aligned 4 + %cmp = OpIEqual %bool %42 %uint_0 + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel + %46 = OpLoad %_ptr_CrossWorkgroup_uint %shared_value_addr Aligned 4 + %47 = OpLoad %uint %46 Aligned 4 + %inc = OpIAdd %uint %47 %uint_1 + OpStore %46 %inc Aligned 4 + OpBranch %if_end + %if_end = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_528 + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-1-exists-wrong.spvasm b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-1-exists-wrong.spvasm index 3ea59b3638..0f6952cc81 100644 --- a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-1-exists-wrong.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-1-exists-wrong.spvasm @@ -1,90 +1,107 @@ -; @Input: %32 = {0, 0} -; @Output: exists (%32[0]==0 and %32[1]==0) +; @Input: %x = {0, 0} +; @Output: exists (%x[0]==0 and %x[1]==0) ; @Config: 2, 1, 2 ; SPIR-V ; Version: 1.0 ; Generator: Khronos LLVM/SPIR-V Translator; 14 ; Bound: 50 ; Schema: 0 - OpCapability Addresses - OpCapability Linkage - OpCapability Kernel - %1 = OpExtInstImport "OpenCL.std" - OpMemoryModel Physical32 OpenCL - OpEntryPoint Kernel %31 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId - OpSource OpenCL_C 200000 - OpName %__spirv_BuiltInWorkgroupId "__spirv_BuiltInWorkgroupId" - OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" - OpName %synchronized_increment "synchronized_increment" - OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId - OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId - OpDecorate %__spirv_BuiltInWorkgroupId Constant - OpDecorate %__spirv_BuiltInLocalInvocationId Constant - OpDecorate %synchronized_increment LinkageAttributes "synchronized_increment" Export - OpDecorate %__spirv_BuiltInWorkgroupId LinkageAttributes "__spirv_BuiltInWorkgroupId" Import - OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %34 Alignment 4 - OpDecorate %35 Alignment 4 - %uint = OpTypeInt 32 0 - %uint_2 = OpConstant %uint 2 -%uint_528 = OpConstant %uint 528 - %uint_0 = OpConstant %uint 0 - %uint_1 = OpConstant %uint 1 - %v3uint = OpTypeVector %uint 3 + OpCapability Addresses + OpCapability Linkage + OpCapability Kernel + %1 = OpExtInstImport "OpenCL.std" + OpMemoryModel Physical32 OpenCL + OpEntryPoint Kernel %10 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId + OpSource OpenCL_C 200000 + OpName %__spirv_BuiltInWorkgroupId "__spirv_BuiltInWorkgroupId" + OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %x "x" + OpName %entry "entry" + OpName %x_addr "x.addr" + OpName %tid "tid" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" + OpName %synchronized_increment "synchronized_increment" + OpName %shared_value "shared_value" + OpName %local_id "local_id" + OpName %arrayidx2 "arrayidx2" + OpName %call3 "call3" + OpName %entry_0 "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %shared_value_addr "shared_value.addr" + OpName %local_id_addr "local_id.addr" + OpName %cmp "cmp" + OpName %inc "inc" + OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId + OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId + OpDecorate %__spirv_BuiltInWorkgroupId Constant + OpDecorate %__spirv_BuiltInLocalInvocationId Constant + OpDecorate %__spirv_BuiltInWorkgroupId LinkageAttributes "__spirv_BuiltInWorkgroupId" Import + OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import + OpDecorate %x_addr Alignment 4 + OpDecorate %tid Alignment 4 + OpDecorate %shared_value_addr Alignment 4 + OpDecorate %local_id_addr Alignment 4 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %uint_528 = OpConstant %uint 528 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %v3uint = OpTypeVector %uint 3 %_ptr_Input_v3uint = OpTypePointer Input %v3uint - %void = OpTypeVoid + %void = OpTypeVoid %_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint - %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint + %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %_ptr_Function_uint = OpTypePointer Function %uint - %bool = OpTypeBool - %30 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint + %24 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint + %bool = OpTypeBool %__spirv_BuiltInWorkgroupId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input -%synchronized_increment = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %uint - %13 = OpLabel - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - OpStore %17 %11 Aligned 4 - OpStore %19 %12 Aligned 4 - OpControlBarrier %uint_2 %uint_2 %uint_528 - %22 = OpLoad %uint %19 Aligned 4 - %25 = OpIEqual %bool %22 %uint_0 - OpBranchConditional %25 %14 %15 - %14 = OpLabel - %26 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %27 = OpLoad %uint %26 Aligned 4 - %29 = OpIAdd %uint %27 %uint_1 - OpStore %26 %29 Aligned 4 - OpBranch %15 - %15 = OpLabel - OpControlBarrier %uint_2 %uint_2 %uint_528 - OpReturn - OpFunctionEnd - %31 = OpFunction %void DontInline %30 - %32 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %33 = OpLabel - %34 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %35 = OpVariable %_ptr_Function_uint Function - OpStore %34 %32 Aligned 4 - %36 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %37 = OpCompositeExtract %uint %36 0 - OpStore %35 %37 Aligned 4 - %38 = OpLoad %_ptr_CrossWorkgroup_uint %34 Aligned 4 - %39 = OpLoad %uint %35 Aligned 4 - %40 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %38 %39 - %41 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %42 = OpCompositeExtract %uint %41 0 - %43 = OpFunctionCall %void %synchronized_increment %40 %42 - %44 = OpLoad %_ptr_CrossWorkgroup_uint %34 Aligned 4 - %45 = OpLoad %uint %35 Aligned 4 - %46 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %44 %45 - %47 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %48 = OpCompositeExtract %uint %47 0 - %49 = OpFunctionCall %void %synchronized_increment %46 %48 - OpReturn - OpFunctionEnd + %10 = OpFunction %void DontInline %9 + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %tid = OpVariable %_ptr_Function_uint Function + OpStore %x_addr %x Aligned 4 + %17 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 + %call = OpCompositeExtract %uint %17 0 + OpStore %tid %call Aligned 4 + %19 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %20 = OpLoad %uint %tid Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %19 %20 + %22 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 + %call1 = OpCompositeExtract %uint %22 0 + %28 = OpFunctionCall %void %synchronized_increment %arrayidx %call1 + %29 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %30 = OpLoad %uint %tid Aligned 4 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %29 %30 + %32 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 + %call3 = OpCompositeExtract %uint %32 0 + %34 = OpFunctionCall %void %synchronized_increment %arrayidx2 %call3 + OpReturn + OpFunctionEnd +%synchronized_increment = OpFunction %void DontInline %24 +%shared_value = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %local_id = OpFunctionParameter %uint + %entry_0 = OpLabel +%shared_value_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%local_id_addr = OpVariable %_ptr_Function_uint Function + OpStore %shared_value_addr %shared_value Aligned 4 + OpStore %local_id_addr %local_id Aligned 4 + OpControlBarrier %uint_2 %uint_2 %uint_528 + %42 = OpLoad %uint %local_id_addr Aligned 4 + %cmp = OpIEqual %bool %42 %uint_0 + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel + %46 = OpLoad %_ptr_CrossWorkgroup_uint %shared_value_addr Aligned 4 + %47 = OpLoad %uint %46 Aligned 4 + %inc = OpIAdd %uint %47 %uint_1 + OpStore %46 %inc Aligned 4 + OpBranch %if_end + %if_end = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_528 + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-1-forall-correct.spvasm b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-1-forall-correct.spvasm index ba3ba504e9..dea1f0a346 100644 --- a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-1-forall-correct.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-1-forall-correct.spvasm @@ -1,90 +1,107 @@ -; @Input: %32 = {0, 0} -; @Output: forall (%32[0]==2 and %32[1]==2) +; @Input: %x = {0, 0} +; @Output: forall (%x[0]==2 and %x[1]==2) ; @Config: 2, 1, 2 ; SPIR-V ; Version: 1.0 ; Generator: Khronos LLVM/SPIR-V Translator; 14 ; Bound: 50 ; Schema: 0 - OpCapability Addresses - OpCapability Linkage - OpCapability Kernel - %1 = OpExtInstImport "OpenCL.std" - OpMemoryModel Physical32 OpenCL - OpEntryPoint Kernel %31 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId - OpSource OpenCL_C 200000 - OpName %__spirv_BuiltInWorkgroupId "__spirv_BuiltInWorkgroupId" - OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" - OpName %synchronized_increment "synchronized_increment" - OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId - OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId - OpDecorate %__spirv_BuiltInWorkgroupId Constant - OpDecorate %__spirv_BuiltInLocalInvocationId Constant - OpDecorate %synchronized_increment LinkageAttributes "synchronized_increment" Export - OpDecorate %__spirv_BuiltInWorkgroupId LinkageAttributes "__spirv_BuiltInWorkgroupId" Import - OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %34 Alignment 4 - OpDecorate %35 Alignment 4 - %uint = OpTypeInt 32 0 - %uint_2 = OpConstant %uint 2 -%uint_528 = OpConstant %uint 528 - %uint_0 = OpConstant %uint 0 - %uint_1 = OpConstant %uint 1 - %v3uint = OpTypeVector %uint 3 + OpCapability Addresses + OpCapability Linkage + OpCapability Kernel + %1 = OpExtInstImport "OpenCL.std" + OpMemoryModel Physical32 OpenCL + OpEntryPoint Kernel %10 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId + OpSource OpenCL_C 200000 + OpName %__spirv_BuiltInWorkgroupId "__spirv_BuiltInWorkgroupId" + OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %x "x" + OpName %entry "entry" + OpName %x_addr "x.addr" + OpName %tid "tid" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" + OpName %synchronized_increment "synchronized_increment" + OpName %shared_value "shared_value" + OpName %local_id "local_id" + OpName %arrayidx2 "arrayidx2" + OpName %call3 "call3" + OpName %entry_0 "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %shared_value_addr "shared_value.addr" + OpName %local_id_addr "local_id.addr" + OpName %cmp "cmp" + OpName %inc "inc" + OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId + OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId + OpDecorate %__spirv_BuiltInWorkgroupId Constant + OpDecorate %__spirv_BuiltInLocalInvocationId Constant + OpDecorate %__spirv_BuiltInWorkgroupId LinkageAttributes "__spirv_BuiltInWorkgroupId" Import + OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import + OpDecorate %x_addr Alignment 4 + OpDecorate %tid Alignment 4 + OpDecorate %shared_value_addr Alignment 4 + OpDecorate %local_id_addr Alignment 4 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %uint_528 = OpConstant %uint 528 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %v3uint = OpTypeVector %uint 3 %_ptr_Input_v3uint = OpTypePointer Input %v3uint - %void = OpTypeVoid + %void = OpTypeVoid %_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint - %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint + %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %_ptr_Function_uint = OpTypePointer Function %uint - %bool = OpTypeBool - %30 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint + %24 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint + %bool = OpTypeBool %__spirv_BuiltInWorkgroupId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input -%synchronized_increment = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %uint - %13 = OpLabel - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - OpStore %17 %11 Aligned 4 - OpStore %19 %12 Aligned 4 - OpControlBarrier %uint_2 %uint_2 %uint_528 - %22 = OpLoad %uint %19 Aligned 4 - %25 = OpIEqual %bool %22 %uint_0 - OpBranchConditional %25 %14 %15 - %14 = OpLabel - %26 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %27 = OpLoad %uint %26 Aligned 4 - %29 = OpIAdd %uint %27 %uint_1 - OpStore %26 %29 Aligned 4 - OpBranch %15 - %15 = OpLabel - OpControlBarrier %uint_2 %uint_2 %uint_528 - OpReturn - OpFunctionEnd - %31 = OpFunction %void DontInline %30 - %32 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %33 = OpLabel - %34 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %35 = OpVariable %_ptr_Function_uint Function - OpStore %34 %32 Aligned 4 - %36 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %37 = OpCompositeExtract %uint %36 0 - OpStore %35 %37 Aligned 4 - %38 = OpLoad %_ptr_CrossWorkgroup_uint %34 Aligned 4 - %39 = OpLoad %uint %35 Aligned 4 - %40 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %38 %39 - %41 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %42 = OpCompositeExtract %uint %41 0 - %43 = OpFunctionCall %void %synchronized_increment %40 %42 - %44 = OpLoad %_ptr_CrossWorkgroup_uint %34 Aligned 4 - %45 = OpLoad %uint %35 Aligned 4 - %46 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %44 %45 - %47 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %48 = OpCompositeExtract %uint %47 0 - %49 = OpFunctionCall %void %synchronized_increment %46 %48 - OpReturn - OpFunctionEnd + %10 = OpFunction %void DontInline %9 + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %tid = OpVariable %_ptr_Function_uint Function + OpStore %x_addr %x Aligned 4 + %17 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 + %call = OpCompositeExtract %uint %17 0 + OpStore %tid %call Aligned 4 + %19 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %20 = OpLoad %uint %tid Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %19 %20 + %22 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 + %call1 = OpCompositeExtract %uint %22 0 + %28 = OpFunctionCall %void %synchronized_increment %arrayidx %call1 + %29 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %30 = OpLoad %uint %tid Aligned 4 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %29 %30 + %32 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 + %call3 = OpCompositeExtract %uint %32 0 + %34 = OpFunctionCall %void %synchronized_increment %arrayidx2 %call3 + OpReturn + OpFunctionEnd +%synchronized_increment = OpFunction %void DontInline %24 +%shared_value = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %local_id = OpFunctionParameter %uint + %entry_0 = OpLabel +%shared_value_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%local_id_addr = OpVariable %_ptr_Function_uint Function + OpStore %shared_value_addr %shared_value Aligned 4 + OpStore %local_id_addr %local_id Aligned 4 + OpControlBarrier %uint_2 %uint_2 %uint_528 + %42 = OpLoad %uint %local_id_addr Aligned 4 + %cmp = OpIEqual %bool %42 %uint_0 + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel + %46 = OpLoad %_ptr_CrossWorkgroup_uint %shared_value_addr Aligned 4 + %47 = OpLoad %uint %46 Aligned 4 + %inc = OpIAdd %uint %47 %uint_1 + OpStore %46 %inc Aligned 4 + OpBranch %if_end + %if_end = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_528 + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-1-forall-wrong.spvasm b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-1-forall-wrong.spvasm index a031f42980..ff3f1a13f7 100644 --- a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-1-forall-wrong.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-1-forall-wrong.spvasm @@ -1,90 +1,107 @@ -; @Input: %32 = {0, 0} -; @Output: forall (%32[0]==0 and %32[1]==0) +; @Input: %x = {0, 0} +; @Output: forall (%x[0]==0 and %x[1]==0) ; @Config: 2, 1, 2 ; SPIR-V ; Version: 1.0 ; Generator: Khronos LLVM/SPIR-V Translator; 14 ; Bound: 50 ; Schema: 0 - OpCapability Addresses - OpCapability Linkage - OpCapability Kernel - %1 = OpExtInstImport "OpenCL.std" - OpMemoryModel Physical32 OpenCL - OpEntryPoint Kernel %31 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId - OpSource OpenCL_C 200000 - OpName %__spirv_BuiltInWorkgroupId "__spirv_BuiltInWorkgroupId" - OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" - OpName %synchronized_increment "synchronized_increment" - OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId - OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId - OpDecorate %__spirv_BuiltInWorkgroupId Constant - OpDecorate %__spirv_BuiltInLocalInvocationId Constant - OpDecorate %synchronized_increment LinkageAttributes "synchronized_increment" Export - OpDecorate %__spirv_BuiltInWorkgroupId LinkageAttributes "__spirv_BuiltInWorkgroupId" Import - OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %34 Alignment 4 - OpDecorate %35 Alignment 4 - %uint = OpTypeInt 32 0 - %uint_2 = OpConstant %uint 2 -%uint_528 = OpConstant %uint 528 - %uint_0 = OpConstant %uint 0 - %uint_1 = OpConstant %uint 1 - %v3uint = OpTypeVector %uint 3 + OpCapability Addresses + OpCapability Linkage + OpCapability Kernel + %1 = OpExtInstImport "OpenCL.std" + OpMemoryModel Physical32 OpenCL + OpEntryPoint Kernel %10 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId + OpSource OpenCL_C 200000 + OpName %__spirv_BuiltInWorkgroupId "__spirv_BuiltInWorkgroupId" + OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %x "x" + OpName %entry "entry" + OpName %x_addr "x.addr" + OpName %tid "tid" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" + OpName %synchronized_increment "synchronized_increment" + OpName %shared_value "shared_value" + OpName %local_id "local_id" + OpName %arrayidx2 "arrayidx2" + OpName %call3 "call3" + OpName %entry_0 "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %shared_value_addr "shared_value.addr" + OpName %local_id_addr "local_id.addr" + OpName %cmp "cmp" + OpName %inc "inc" + OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId + OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId + OpDecorate %__spirv_BuiltInWorkgroupId Constant + OpDecorate %__spirv_BuiltInLocalInvocationId Constant + OpDecorate %__spirv_BuiltInWorkgroupId LinkageAttributes "__spirv_BuiltInWorkgroupId" Import + OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import + OpDecorate %x_addr Alignment 4 + OpDecorate %tid Alignment 4 + OpDecorate %shared_value_addr Alignment 4 + OpDecorate %local_id_addr Alignment 4 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %uint_528 = OpConstant %uint 528 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %v3uint = OpTypeVector %uint 3 %_ptr_Input_v3uint = OpTypePointer Input %v3uint - %void = OpTypeVoid + %void = OpTypeVoid %_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint - %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint + %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %_ptr_Function_uint = OpTypePointer Function %uint - %bool = OpTypeBool - %30 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint + %24 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint + %bool = OpTypeBool %__spirv_BuiltInWorkgroupId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input -%synchronized_increment = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %uint - %13 = OpLabel - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - OpStore %17 %11 Aligned 4 - OpStore %19 %12 Aligned 4 - OpControlBarrier %uint_2 %uint_2 %uint_528 - %22 = OpLoad %uint %19 Aligned 4 - %25 = OpIEqual %bool %22 %uint_0 - OpBranchConditional %25 %14 %15 - %14 = OpLabel - %26 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %27 = OpLoad %uint %26 Aligned 4 - %29 = OpIAdd %uint %27 %uint_1 - OpStore %26 %29 Aligned 4 - OpBranch %15 - %15 = OpLabel - OpControlBarrier %uint_2 %uint_2 %uint_528 - OpReturn - OpFunctionEnd - %31 = OpFunction %void DontInline %30 - %32 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %33 = OpLabel - %34 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %35 = OpVariable %_ptr_Function_uint Function - OpStore %34 %32 Aligned 4 - %36 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %37 = OpCompositeExtract %uint %36 0 - OpStore %35 %37 Aligned 4 - %38 = OpLoad %_ptr_CrossWorkgroup_uint %34 Aligned 4 - %39 = OpLoad %uint %35 Aligned 4 - %40 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %38 %39 - %41 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %42 = OpCompositeExtract %uint %41 0 - %43 = OpFunctionCall %void %synchronized_increment %40 %42 - %44 = OpLoad %_ptr_CrossWorkgroup_uint %34 Aligned 4 - %45 = OpLoad %uint %35 Aligned 4 - %46 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %44 %45 - %47 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %48 = OpCompositeExtract %uint %47 0 - %49 = OpFunctionCall %void %synchronized_increment %46 %48 - OpReturn - OpFunctionEnd + %10 = OpFunction %void DontInline %9 + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %tid = OpVariable %_ptr_Function_uint Function + OpStore %x_addr %x Aligned 4 + %17 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 + %call = OpCompositeExtract %uint %17 0 + OpStore %tid %call Aligned 4 + %19 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %20 = OpLoad %uint %tid Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %19 %20 + %22 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 + %call1 = OpCompositeExtract %uint %22 0 + %28 = OpFunctionCall %void %synchronized_increment %arrayidx %call1 + %29 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %30 = OpLoad %uint %tid Aligned 4 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %29 %30 + %32 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 + %call3 = OpCompositeExtract %uint %32 0 + %34 = OpFunctionCall %void %synchronized_increment %arrayidx2 %call3 + OpReturn + OpFunctionEnd +%synchronized_increment = OpFunction %void DontInline %24 +%shared_value = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %local_id = OpFunctionParameter %uint + %entry_0 = OpLabel +%shared_value_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%local_id_addr = OpVariable %_ptr_Function_uint Function + OpStore %shared_value_addr %shared_value Aligned 4 + OpStore %local_id_addr %local_id Aligned 4 + OpControlBarrier %uint_2 %uint_2 %uint_528 + %42 = OpLoad %uint %local_id_addr Aligned 4 + %cmp = OpIEqual %bool %42 %uint_0 + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel + %46 = OpLoad %_ptr_CrossWorkgroup_uint %shared_value_addr Aligned 4 + %47 = OpLoad %uint %46 Aligned 4 + %inc = OpIAdd %uint %47 %uint_1 + OpStore %46 %inc Aligned 4 + OpBranch %if_end + %if_end = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_528 + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-2-exists-correct.spvasm b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-2-exists-correct.spvasm index e9725b03e3..4aa5b7415d 100644 --- a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-2-exists-correct.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-2-exists-correct.spvasm @@ -1,5 +1,5 @@ -; @Input: %50 = {0, 0} -; @Output: exists (%50[0]==2 and %50[1]==2) +; @Input: %x = {0, 0} +; @Output: exists (%x[0]==2 and %x[1]==2) ; @Config: 2, 1, 2 ; SPIR-V ; Version: 1.0 @@ -11,30 +11,55 @@ OpCapability Kernel %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical32 OpenCL - OpEntryPoint Kernel %49 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId + OpEntryPoint Kernel %10 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInWorkgroupId "__spirv_BuiltInWorkgroupId" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" - OpName %synchronized_increment "synchronized_increment" + OpName %x "x" + OpName %entry "entry" + OpName %x_addr "x.addr" + OpName %tid "tid" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" OpName %agent_function1 "agent_function1" + OpName %shared_value "shared_value" + OpName %local_id "local_id" + OpName %arrayidx2 "arrayidx2" + OpName %call3 "call3" OpName %agent_function2 "agent_function2" + OpName %shared_value_0 "shared_value" + OpName %local_id_0 "local_id" + OpName %entry_0 "entry" + OpName %shared_value_addr "shared_value.addr" + OpName %local_id_addr "local_id.addr" + OpName %synchronized_increment "synchronized_increment" + OpName %shared_value_1 "shared_value" + OpName %local_id_1 "local_id" + OpName %entry_1 "entry" + OpName %shared_value_addr_0 "shared_value.addr" + OpName %local_id_addr_0 "local_id.addr" + OpName %entry_2 "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %shared_value_addr_1 "shared_value.addr" + OpName %local_id_addr_1 "local_id.addr" + OpName %cmp "cmp" + OpName %inc "inc" OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInWorkgroupId Constant OpDecorate %__spirv_BuiltInLocalInvocationId Constant - OpDecorate %agent_function1 LinkageAttributes "agent_function1" Export - OpDecorate %agent_function2 LinkageAttributes "agent_function2" Export - OpDecorate %synchronized_increment LinkageAttributes "synchronized_increment" Export OpDecorate %__spirv_BuiltInWorkgroupId LinkageAttributes "__spirv_BuiltInWorkgroupId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %34 Alignment 4 - OpDecorate %35 Alignment 4 - OpDecorate %43 Alignment 4 - OpDecorate %44 Alignment 4 - OpDecorate %52 Alignment 4 - OpDecorate %53 Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %tid Alignment 4 + OpDecorate %shared_value_addr Alignment 4 + OpDecorate %local_id_addr Alignment 4 + OpDecorate %shared_value_addr_0 Alignment 4 + OpDecorate %local_id_addr_0 Alignment 4 + OpDecorate %shared_value_addr_1 Alignment 4 + OpDecorate %local_id_addr_1 Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_528 = OpConstant %uint 528 @@ -44,81 +69,81 @@ %_ptr_Input_v3uint = OpTypePointer Input %v3uint %void = OpTypeVoid %_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint - %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint + %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %_ptr_Function_uint = OpTypePointer Function %uint + %24 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint %bool = OpTypeBool - %48 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %__spirv_BuiltInWorkgroupId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input -%synchronized_increment = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %uint - %13 = OpLabel - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - OpStore %17 %11 Aligned 4 - OpStore %19 %12 Aligned 4 - OpControlBarrier %uint_2 %uint_2 %uint_528 - %22 = OpLoad %uint %19 Aligned 4 - %25 = OpIEqual %bool %22 %uint_0 - OpBranchConditional %25 %14 %15 - %14 = OpLabel - %26 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %27 = OpLoad %uint %26 Aligned 4 - %29 = OpIAdd %uint %27 %uint_1 - OpStore %26 %29 Aligned 4 - OpBranch %15 - %15 = OpLabel - OpControlBarrier %uint_2 %uint_2 %uint_528 + %10 = OpFunction %void DontInline %9 + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %tid = OpVariable %_ptr_Function_uint Function + OpStore %x_addr %x Aligned 4 + %17 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 + %call = OpCompositeExtract %uint %17 0 + OpStore %tid %call Aligned 4 + %19 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %20 = OpLoad %uint %tid Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %19 %20 + %22 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 + %call1 = OpCompositeExtract %uint %22 0 + %28 = OpFunctionCall %void %agent_function1 %arrayidx %call1 + %29 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %30 = OpLoad %uint %tid Aligned 4 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %29 %30 + %32 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 + %call3 = OpCompositeExtract %uint %32 0 + %37 = OpFunctionCall %void %agent_function2 %arrayidx2 %call3 OpReturn OpFunctionEnd -%agent_function1 = OpFunction %void DontInline %9 - %31 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %32 = OpFunctionParameter %uint - %33 = OpLabel - %34 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %35 = OpVariable %_ptr_Function_uint Function - OpStore %34 %31 Aligned 4 - OpStore %35 %32 Aligned 4 - %36 = OpLoad %_ptr_CrossWorkgroup_uint %34 Aligned 4 - %37 = OpLoad %uint %35 Aligned 4 - %38 = OpFunctionCall %void %synchronized_increment %36 %37 +%agent_function1 = OpFunction %void DontInline %24 +%shared_value = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %local_id = OpFunctionParameter %uint + %entry_0 = OpLabel +%shared_value_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%local_id_addr = OpVariable %_ptr_Function_uint Function + OpStore %shared_value_addr %shared_value Aligned 4 + OpStore %local_id_addr %local_id Aligned 4 + %41 = OpLoad %_ptr_CrossWorkgroup_uint %shared_value_addr Aligned 4 + %42 = OpLoad %uint %local_id_addr Aligned 4 + %46 = OpFunctionCall %void %synchronized_increment %41 %42 OpReturn OpFunctionEnd -%agent_function2 = OpFunction %void DontInline %9 - %40 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %41 = OpFunctionParameter %uint - %42 = OpLabel - %43 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %44 = OpVariable %_ptr_Function_uint Function - OpStore %43 %40 Aligned 4 - OpStore %44 %41 Aligned 4 - %45 = OpLoad %_ptr_CrossWorkgroup_uint %43 Aligned 4 - %46 = OpLoad %uint %44 Aligned 4 - %47 = OpFunctionCall %void %synchronized_increment %45 %46 +%agent_function2 = OpFunction %void DontInline %24 +%shared_value_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %local_id_0 = OpFunctionParameter %uint + %entry_1 = OpLabel +%shared_value_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%local_id_addr_0 = OpVariable %_ptr_Function_uint Function + OpStore %shared_value_addr_0 %shared_value_0 Aligned 4 + OpStore %local_id_addr_0 %local_id_0 Aligned 4 + %50 = OpLoad %_ptr_CrossWorkgroup_uint %shared_value_addr_0 Aligned 4 + %51 = OpLoad %uint %local_id_addr_0 Aligned 4 + %52 = OpFunctionCall %void %synchronized_increment %50 %51 OpReturn OpFunctionEnd - %49 = OpFunction %void DontInline %48 - %50 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %51 = OpLabel - %52 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %53 = OpVariable %_ptr_Function_uint Function - OpStore %52 %50 Aligned 4 - %54 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %55 = OpCompositeExtract %uint %54 0 - OpStore %53 %55 Aligned 4 - %56 = OpLoad %_ptr_CrossWorkgroup_uint %52 Aligned 4 - %57 = OpLoad %uint %53 Aligned 4 - %58 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %56 %57 - %59 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %60 = OpCompositeExtract %uint %59 0 - %61 = OpFunctionCall %void %agent_function1 %58 %60 - %62 = OpLoad %_ptr_CrossWorkgroup_uint %52 Aligned 4 - %63 = OpLoad %uint %53 Aligned 4 - %64 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %62 %63 - %65 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %66 = OpCompositeExtract %uint %65 0 - %67 = OpFunctionCall %void %agent_function2 %64 %66 +%synchronized_increment = OpFunction %void DontInline %24 +%shared_value_1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %local_id_1 = OpFunctionParameter %uint + %entry_2 = OpLabel +%shared_value_addr_1 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%local_id_addr_1 = OpVariable %_ptr_Function_uint Function + OpStore %shared_value_addr_1 %shared_value_1 Aligned 4 + OpStore %local_id_addr_1 %local_id_1 Aligned 4 + OpControlBarrier %uint_2 %uint_2 %uint_528 + %60 = OpLoad %uint %local_id_addr_1 Aligned 4 + %cmp = OpIEqual %bool %60 %uint_0 + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel + %64 = OpLoad %_ptr_CrossWorkgroup_uint %shared_value_addr_1 Aligned 4 + %65 = OpLoad %uint %64 Aligned 4 + %inc = OpIAdd %uint %65 %uint_1 + OpStore %64 %inc Aligned 4 + OpBranch %if_end + %if_end = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_528 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-2-exists-wrong.spvasm b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-2-exists-wrong.spvasm index f6111e344d..da7f342966 100644 --- a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-2-exists-wrong.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-2-exists-wrong.spvasm @@ -1,5 +1,5 @@ -; @Input: %50 = {0, 0} -; @Output: exists (%50[0]==0 and %50[1]==0) +; @Input: %x = {0, 0} +; @Output: exists (%x[0]==0 and %x[1]==0) ; @Config: 2, 1, 2 ; SPIR-V ; Version: 1.0 @@ -11,30 +11,55 @@ OpCapability Kernel %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical32 OpenCL - OpEntryPoint Kernel %49 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId + OpEntryPoint Kernel %10 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInWorkgroupId "__spirv_BuiltInWorkgroupId" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" - OpName %synchronized_increment "synchronized_increment" + OpName %x "x" + OpName %entry "entry" + OpName %x_addr "x.addr" + OpName %tid "tid" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" OpName %agent_function1 "agent_function1" + OpName %shared_value "shared_value" + OpName %local_id "local_id" + OpName %arrayidx2 "arrayidx2" + OpName %call3 "call3" OpName %agent_function2 "agent_function2" + OpName %shared_value_0 "shared_value" + OpName %local_id_0 "local_id" + OpName %entry_0 "entry" + OpName %shared_value_addr "shared_value.addr" + OpName %local_id_addr "local_id.addr" + OpName %synchronized_increment "synchronized_increment" + OpName %shared_value_1 "shared_value" + OpName %local_id_1 "local_id" + OpName %entry_1 "entry" + OpName %shared_value_addr_0 "shared_value.addr" + OpName %local_id_addr_0 "local_id.addr" + OpName %entry_2 "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %shared_value_addr_1 "shared_value.addr" + OpName %local_id_addr_1 "local_id.addr" + OpName %cmp "cmp" + OpName %inc "inc" OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInWorkgroupId Constant OpDecorate %__spirv_BuiltInLocalInvocationId Constant - OpDecorate %agent_function1 LinkageAttributes "agent_function1" Export - OpDecorate %agent_function2 LinkageAttributes "agent_function2" Export - OpDecorate %synchronized_increment LinkageAttributes "synchronized_increment" Export OpDecorate %__spirv_BuiltInWorkgroupId LinkageAttributes "__spirv_BuiltInWorkgroupId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %34 Alignment 4 - OpDecorate %35 Alignment 4 - OpDecorate %43 Alignment 4 - OpDecorate %44 Alignment 4 - OpDecorate %52 Alignment 4 - OpDecorate %53 Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %tid Alignment 4 + OpDecorate %shared_value_addr Alignment 4 + OpDecorate %local_id_addr Alignment 4 + OpDecorate %shared_value_addr_0 Alignment 4 + OpDecorate %local_id_addr_0 Alignment 4 + OpDecorate %shared_value_addr_1 Alignment 4 + OpDecorate %local_id_addr_1 Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_528 = OpConstant %uint 528 @@ -44,81 +69,81 @@ %_ptr_Input_v3uint = OpTypePointer Input %v3uint %void = OpTypeVoid %_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint - %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint + %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %_ptr_Function_uint = OpTypePointer Function %uint + %24 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint %bool = OpTypeBool - %48 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %__spirv_BuiltInWorkgroupId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input -%synchronized_increment = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %uint - %13 = OpLabel - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - OpStore %17 %11 Aligned 4 - OpStore %19 %12 Aligned 4 - OpControlBarrier %uint_2 %uint_2 %uint_528 - %22 = OpLoad %uint %19 Aligned 4 - %25 = OpIEqual %bool %22 %uint_0 - OpBranchConditional %25 %14 %15 - %14 = OpLabel - %26 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %27 = OpLoad %uint %26 Aligned 4 - %29 = OpIAdd %uint %27 %uint_1 - OpStore %26 %29 Aligned 4 - OpBranch %15 - %15 = OpLabel - OpControlBarrier %uint_2 %uint_2 %uint_528 + %10 = OpFunction %void DontInline %9 + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %tid = OpVariable %_ptr_Function_uint Function + OpStore %x_addr %x Aligned 4 + %17 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 + %call = OpCompositeExtract %uint %17 0 + OpStore %tid %call Aligned 4 + %19 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %20 = OpLoad %uint %tid Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %19 %20 + %22 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 + %call1 = OpCompositeExtract %uint %22 0 + %28 = OpFunctionCall %void %agent_function1 %arrayidx %call1 + %29 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %30 = OpLoad %uint %tid Aligned 4 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %29 %30 + %32 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 + %call3 = OpCompositeExtract %uint %32 0 + %37 = OpFunctionCall %void %agent_function2 %arrayidx2 %call3 OpReturn OpFunctionEnd -%agent_function1 = OpFunction %void DontInline %9 - %31 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %32 = OpFunctionParameter %uint - %33 = OpLabel - %34 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %35 = OpVariable %_ptr_Function_uint Function - OpStore %34 %31 Aligned 4 - OpStore %35 %32 Aligned 4 - %36 = OpLoad %_ptr_CrossWorkgroup_uint %34 Aligned 4 - %37 = OpLoad %uint %35 Aligned 4 - %38 = OpFunctionCall %void %synchronized_increment %36 %37 +%agent_function1 = OpFunction %void DontInline %24 +%shared_value = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %local_id = OpFunctionParameter %uint + %entry_0 = OpLabel +%shared_value_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%local_id_addr = OpVariable %_ptr_Function_uint Function + OpStore %shared_value_addr %shared_value Aligned 4 + OpStore %local_id_addr %local_id Aligned 4 + %41 = OpLoad %_ptr_CrossWorkgroup_uint %shared_value_addr Aligned 4 + %42 = OpLoad %uint %local_id_addr Aligned 4 + %46 = OpFunctionCall %void %synchronized_increment %41 %42 OpReturn OpFunctionEnd -%agent_function2 = OpFunction %void DontInline %9 - %40 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %41 = OpFunctionParameter %uint - %42 = OpLabel - %43 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %44 = OpVariable %_ptr_Function_uint Function - OpStore %43 %40 Aligned 4 - OpStore %44 %41 Aligned 4 - %45 = OpLoad %_ptr_CrossWorkgroup_uint %43 Aligned 4 - %46 = OpLoad %uint %44 Aligned 4 - %47 = OpFunctionCall %void %synchronized_increment %45 %46 +%agent_function2 = OpFunction %void DontInline %24 +%shared_value_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %local_id_0 = OpFunctionParameter %uint + %entry_1 = OpLabel +%shared_value_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%local_id_addr_0 = OpVariable %_ptr_Function_uint Function + OpStore %shared_value_addr_0 %shared_value_0 Aligned 4 + OpStore %local_id_addr_0 %local_id_0 Aligned 4 + %50 = OpLoad %_ptr_CrossWorkgroup_uint %shared_value_addr_0 Aligned 4 + %51 = OpLoad %uint %local_id_addr_0 Aligned 4 + %52 = OpFunctionCall %void %synchronized_increment %50 %51 OpReturn OpFunctionEnd - %49 = OpFunction %void DontInline %48 - %50 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %51 = OpLabel - %52 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %53 = OpVariable %_ptr_Function_uint Function - OpStore %52 %50 Aligned 4 - %54 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %55 = OpCompositeExtract %uint %54 0 - OpStore %53 %55 Aligned 4 - %56 = OpLoad %_ptr_CrossWorkgroup_uint %52 Aligned 4 - %57 = OpLoad %uint %53 Aligned 4 - %58 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %56 %57 - %59 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %60 = OpCompositeExtract %uint %59 0 - %61 = OpFunctionCall %void %agent_function1 %58 %60 - %62 = OpLoad %_ptr_CrossWorkgroup_uint %52 Aligned 4 - %63 = OpLoad %uint %53 Aligned 4 - %64 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %62 %63 - %65 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %66 = OpCompositeExtract %uint %65 0 - %67 = OpFunctionCall %void %agent_function2 %64 %66 +%synchronized_increment = OpFunction %void DontInline %24 +%shared_value_1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %local_id_1 = OpFunctionParameter %uint + %entry_2 = OpLabel +%shared_value_addr_1 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%local_id_addr_1 = OpVariable %_ptr_Function_uint Function + OpStore %shared_value_addr_1 %shared_value_1 Aligned 4 + OpStore %local_id_addr_1 %local_id_1 Aligned 4 + OpControlBarrier %uint_2 %uint_2 %uint_528 + %60 = OpLoad %uint %local_id_addr_1 Aligned 4 + %cmp = OpIEqual %bool %60 %uint_0 + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel + %64 = OpLoad %_ptr_CrossWorkgroup_uint %shared_value_addr_1 Aligned 4 + %65 = OpLoad %uint %64 Aligned 4 + %inc = OpIAdd %uint %65 %uint_1 + OpStore %64 %inc Aligned 4 + OpBranch %if_end + %if_end = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_528 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-2-forall-correct.spvasm b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-2-forall-correct.spvasm index bc5915f20b..591cf71988 100644 --- a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-2-forall-correct.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-2-forall-correct.spvasm @@ -1,5 +1,5 @@ -; @Input: %50 = {0, 0} -; @Output: forall (%50[0]==2 and %50[1]==2) +; @Input: %x = {0, 0} +; @Output: forall (%x[0]==2 and %x[1]==2) ; @Config: 2, 1, 2 ; SPIR-V ; Version: 1.0 @@ -11,30 +11,55 @@ OpCapability Kernel %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical32 OpenCL - OpEntryPoint Kernel %49 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId + OpEntryPoint Kernel %10 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInWorkgroupId "__spirv_BuiltInWorkgroupId" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" - OpName %synchronized_increment "synchronized_increment" + OpName %x "x" + OpName %entry "entry" + OpName %x_addr "x.addr" + OpName %tid "tid" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" OpName %agent_function1 "agent_function1" + OpName %shared_value "shared_value" + OpName %local_id "local_id" + OpName %arrayidx2 "arrayidx2" + OpName %call3 "call3" OpName %agent_function2 "agent_function2" + OpName %shared_value_0 "shared_value" + OpName %local_id_0 "local_id" + OpName %entry_0 "entry" + OpName %shared_value_addr "shared_value.addr" + OpName %local_id_addr "local_id.addr" + OpName %synchronized_increment "synchronized_increment" + OpName %shared_value_1 "shared_value" + OpName %local_id_1 "local_id" + OpName %entry_1 "entry" + OpName %shared_value_addr_0 "shared_value.addr" + OpName %local_id_addr_0 "local_id.addr" + OpName %entry_2 "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %shared_value_addr_1 "shared_value.addr" + OpName %local_id_addr_1 "local_id.addr" + OpName %cmp "cmp" + OpName %inc "inc" OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInWorkgroupId Constant OpDecorate %__spirv_BuiltInLocalInvocationId Constant - OpDecorate %agent_function1 LinkageAttributes "agent_function1" Export - OpDecorate %agent_function2 LinkageAttributes "agent_function2" Export - OpDecorate %synchronized_increment LinkageAttributes "synchronized_increment" Export OpDecorate %__spirv_BuiltInWorkgroupId LinkageAttributes "__spirv_BuiltInWorkgroupId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %34 Alignment 4 - OpDecorate %35 Alignment 4 - OpDecorate %43 Alignment 4 - OpDecorate %44 Alignment 4 - OpDecorate %52 Alignment 4 - OpDecorate %53 Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %tid Alignment 4 + OpDecorate %shared_value_addr Alignment 4 + OpDecorate %local_id_addr Alignment 4 + OpDecorate %shared_value_addr_0 Alignment 4 + OpDecorate %local_id_addr_0 Alignment 4 + OpDecorate %shared_value_addr_1 Alignment 4 + OpDecorate %local_id_addr_1 Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_528 = OpConstant %uint 528 @@ -44,81 +69,81 @@ %_ptr_Input_v3uint = OpTypePointer Input %v3uint %void = OpTypeVoid %_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint - %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint + %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %_ptr_Function_uint = OpTypePointer Function %uint + %24 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint %bool = OpTypeBool - %48 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %__spirv_BuiltInWorkgroupId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input -%synchronized_increment = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %uint - %13 = OpLabel - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - OpStore %17 %11 Aligned 4 - OpStore %19 %12 Aligned 4 - OpControlBarrier %uint_2 %uint_2 %uint_528 - %22 = OpLoad %uint %19 Aligned 4 - %25 = OpIEqual %bool %22 %uint_0 - OpBranchConditional %25 %14 %15 - %14 = OpLabel - %26 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %27 = OpLoad %uint %26 Aligned 4 - %29 = OpIAdd %uint %27 %uint_1 - OpStore %26 %29 Aligned 4 - OpBranch %15 - %15 = OpLabel - OpControlBarrier %uint_2 %uint_2 %uint_528 + %10 = OpFunction %void DontInline %9 + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %tid = OpVariable %_ptr_Function_uint Function + OpStore %x_addr %x Aligned 4 + %17 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 + %call = OpCompositeExtract %uint %17 0 + OpStore %tid %call Aligned 4 + %19 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %20 = OpLoad %uint %tid Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %19 %20 + %22 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 + %call1 = OpCompositeExtract %uint %22 0 + %28 = OpFunctionCall %void %agent_function1 %arrayidx %call1 + %29 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %30 = OpLoad %uint %tid Aligned 4 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %29 %30 + %32 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 + %call3 = OpCompositeExtract %uint %32 0 + %37 = OpFunctionCall %void %agent_function2 %arrayidx2 %call3 OpReturn OpFunctionEnd -%agent_function1 = OpFunction %void DontInline %9 - %31 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %32 = OpFunctionParameter %uint - %33 = OpLabel - %34 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %35 = OpVariable %_ptr_Function_uint Function - OpStore %34 %31 Aligned 4 - OpStore %35 %32 Aligned 4 - %36 = OpLoad %_ptr_CrossWorkgroup_uint %34 Aligned 4 - %37 = OpLoad %uint %35 Aligned 4 - %38 = OpFunctionCall %void %synchronized_increment %36 %37 +%agent_function1 = OpFunction %void DontInline %24 +%shared_value = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %local_id = OpFunctionParameter %uint + %entry_0 = OpLabel +%shared_value_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%local_id_addr = OpVariable %_ptr_Function_uint Function + OpStore %shared_value_addr %shared_value Aligned 4 + OpStore %local_id_addr %local_id Aligned 4 + %41 = OpLoad %_ptr_CrossWorkgroup_uint %shared_value_addr Aligned 4 + %42 = OpLoad %uint %local_id_addr Aligned 4 + %46 = OpFunctionCall %void %synchronized_increment %41 %42 OpReturn OpFunctionEnd -%agent_function2 = OpFunction %void DontInline %9 - %40 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %41 = OpFunctionParameter %uint - %42 = OpLabel - %43 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %44 = OpVariable %_ptr_Function_uint Function - OpStore %43 %40 Aligned 4 - OpStore %44 %41 Aligned 4 - %45 = OpLoad %_ptr_CrossWorkgroup_uint %43 Aligned 4 - %46 = OpLoad %uint %44 Aligned 4 - %47 = OpFunctionCall %void %synchronized_increment %45 %46 +%agent_function2 = OpFunction %void DontInline %24 +%shared_value_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %local_id_0 = OpFunctionParameter %uint + %entry_1 = OpLabel +%shared_value_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%local_id_addr_0 = OpVariable %_ptr_Function_uint Function + OpStore %shared_value_addr_0 %shared_value_0 Aligned 4 + OpStore %local_id_addr_0 %local_id_0 Aligned 4 + %50 = OpLoad %_ptr_CrossWorkgroup_uint %shared_value_addr_0 Aligned 4 + %51 = OpLoad %uint %local_id_addr_0 Aligned 4 + %52 = OpFunctionCall %void %synchronized_increment %50 %51 OpReturn OpFunctionEnd - %49 = OpFunction %void DontInline %48 - %50 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %51 = OpLabel - %52 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %53 = OpVariable %_ptr_Function_uint Function - OpStore %52 %50 Aligned 4 - %54 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %55 = OpCompositeExtract %uint %54 0 - OpStore %53 %55 Aligned 4 - %56 = OpLoad %_ptr_CrossWorkgroup_uint %52 Aligned 4 - %57 = OpLoad %uint %53 Aligned 4 - %58 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %56 %57 - %59 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %60 = OpCompositeExtract %uint %59 0 - %61 = OpFunctionCall %void %agent_function1 %58 %60 - %62 = OpLoad %_ptr_CrossWorkgroup_uint %52 Aligned 4 - %63 = OpLoad %uint %53 Aligned 4 - %64 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %62 %63 - %65 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %66 = OpCompositeExtract %uint %65 0 - %67 = OpFunctionCall %void %agent_function2 %64 %66 +%synchronized_increment = OpFunction %void DontInline %24 +%shared_value_1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %local_id_1 = OpFunctionParameter %uint + %entry_2 = OpLabel +%shared_value_addr_1 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%local_id_addr_1 = OpVariable %_ptr_Function_uint Function + OpStore %shared_value_addr_1 %shared_value_1 Aligned 4 + OpStore %local_id_addr_1 %local_id_1 Aligned 4 + OpControlBarrier %uint_2 %uint_2 %uint_528 + %60 = OpLoad %uint %local_id_addr_1 Aligned 4 + %cmp = OpIEqual %bool %60 %uint_0 + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel + %64 = OpLoad %_ptr_CrossWorkgroup_uint %shared_value_addr_1 Aligned 4 + %65 = OpLoad %uint %64 Aligned 4 + %inc = OpIAdd %uint %65 %uint_1 + OpStore %64 %inc Aligned 4 + OpBranch %if_end + %if_end = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_528 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-2-forall-wrong.spvasm b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-2-forall-wrong.spvasm index 49d552333d..574430934a 100644 --- a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-2-forall-wrong.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-2-forall-wrong.spvasm @@ -1,5 +1,5 @@ -; @Input: %50 = {0, 0} -; @Output: forall (%50[0]==0 and %50[1]==0) +; @Input: %x = {0, 0} +; @Output: forall (%x[0]==0 and %x[1]==0) ; @Config: 2, 1, 2 ; SPIR-V ; Version: 1.0 @@ -11,30 +11,55 @@ OpCapability Kernel %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical32 OpenCL - OpEntryPoint Kernel %49 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId + OpEntryPoint Kernel %10 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInWorkgroupId "__spirv_BuiltInWorkgroupId" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" - OpName %synchronized_increment "synchronized_increment" + OpName %x "x" + OpName %entry "entry" + OpName %x_addr "x.addr" + OpName %tid "tid" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" OpName %agent_function1 "agent_function1" + OpName %shared_value "shared_value" + OpName %local_id "local_id" + OpName %arrayidx2 "arrayidx2" + OpName %call3 "call3" OpName %agent_function2 "agent_function2" + OpName %shared_value_0 "shared_value" + OpName %local_id_0 "local_id" + OpName %entry_0 "entry" + OpName %shared_value_addr "shared_value.addr" + OpName %local_id_addr "local_id.addr" + OpName %synchronized_increment "synchronized_increment" + OpName %shared_value_1 "shared_value" + OpName %local_id_1 "local_id" + OpName %entry_1 "entry" + OpName %shared_value_addr_0 "shared_value.addr" + OpName %local_id_addr_0 "local_id.addr" + OpName %entry_2 "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %shared_value_addr_1 "shared_value.addr" + OpName %local_id_addr_1 "local_id.addr" + OpName %cmp "cmp" + OpName %inc "inc" OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInWorkgroupId Constant OpDecorate %__spirv_BuiltInLocalInvocationId Constant - OpDecorate %agent_function1 LinkageAttributes "agent_function1" Export - OpDecorate %agent_function2 LinkageAttributes "agent_function2" Export - OpDecorate %synchronized_increment LinkageAttributes "synchronized_increment" Export OpDecorate %__spirv_BuiltInWorkgroupId LinkageAttributes "__spirv_BuiltInWorkgroupId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %34 Alignment 4 - OpDecorate %35 Alignment 4 - OpDecorate %43 Alignment 4 - OpDecorate %44 Alignment 4 - OpDecorate %52 Alignment 4 - OpDecorate %53 Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %tid Alignment 4 + OpDecorate %shared_value_addr Alignment 4 + OpDecorate %local_id_addr Alignment 4 + OpDecorate %shared_value_addr_0 Alignment 4 + OpDecorate %local_id_addr_0 Alignment 4 + OpDecorate %shared_value_addr_1 Alignment 4 + OpDecorate %local_id_addr_1 Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_528 = OpConstant %uint 528 @@ -44,81 +69,81 @@ %_ptr_Input_v3uint = OpTypePointer Input %v3uint %void = OpTypeVoid %_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint - %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint + %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %_ptr_Function_uint = OpTypePointer Function %uint + %24 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint %bool = OpTypeBool - %48 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %__spirv_BuiltInWorkgroupId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input -%synchronized_increment = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %uint - %13 = OpLabel - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - OpStore %17 %11 Aligned 4 - OpStore %19 %12 Aligned 4 - OpControlBarrier %uint_2 %uint_2 %uint_528 - %22 = OpLoad %uint %19 Aligned 4 - %25 = OpIEqual %bool %22 %uint_0 - OpBranchConditional %25 %14 %15 - %14 = OpLabel - %26 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %27 = OpLoad %uint %26 Aligned 4 - %29 = OpIAdd %uint %27 %uint_1 - OpStore %26 %29 Aligned 4 - OpBranch %15 - %15 = OpLabel - OpControlBarrier %uint_2 %uint_2 %uint_528 + %10 = OpFunction %void DontInline %9 + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %tid = OpVariable %_ptr_Function_uint Function + OpStore %x_addr %x Aligned 4 + %17 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 + %call = OpCompositeExtract %uint %17 0 + OpStore %tid %call Aligned 4 + %19 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %20 = OpLoad %uint %tid Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %19 %20 + %22 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 + %call1 = OpCompositeExtract %uint %22 0 + %28 = OpFunctionCall %void %agent_function1 %arrayidx %call1 + %29 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %30 = OpLoad %uint %tid Aligned 4 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %29 %30 + %32 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 + %call3 = OpCompositeExtract %uint %32 0 + %37 = OpFunctionCall %void %agent_function2 %arrayidx2 %call3 OpReturn OpFunctionEnd -%agent_function1 = OpFunction %void DontInline %9 - %31 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %32 = OpFunctionParameter %uint - %33 = OpLabel - %34 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %35 = OpVariable %_ptr_Function_uint Function - OpStore %34 %31 Aligned 4 - OpStore %35 %32 Aligned 4 - %36 = OpLoad %_ptr_CrossWorkgroup_uint %34 Aligned 4 - %37 = OpLoad %uint %35 Aligned 4 - %38 = OpFunctionCall %void %synchronized_increment %36 %37 +%agent_function1 = OpFunction %void DontInline %24 +%shared_value = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %local_id = OpFunctionParameter %uint + %entry_0 = OpLabel +%shared_value_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%local_id_addr = OpVariable %_ptr_Function_uint Function + OpStore %shared_value_addr %shared_value Aligned 4 + OpStore %local_id_addr %local_id Aligned 4 + %41 = OpLoad %_ptr_CrossWorkgroup_uint %shared_value_addr Aligned 4 + %42 = OpLoad %uint %local_id_addr Aligned 4 + %46 = OpFunctionCall %void %synchronized_increment %41 %42 OpReturn OpFunctionEnd -%agent_function2 = OpFunction %void DontInline %9 - %40 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %41 = OpFunctionParameter %uint - %42 = OpLabel - %43 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %44 = OpVariable %_ptr_Function_uint Function - OpStore %43 %40 Aligned 4 - OpStore %44 %41 Aligned 4 - %45 = OpLoad %_ptr_CrossWorkgroup_uint %43 Aligned 4 - %46 = OpLoad %uint %44 Aligned 4 - %47 = OpFunctionCall %void %synchronized_increment %45 %46 +%agent_function2 = OpFunction %void DontInline %24 +%shared_value_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %local_id_0 = OpFunctionParameter %uint + %entry_1 = OpLabel +%shared_value_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%local_id_addr_0 = OpVariable %_ptr_Function_uint Function + OpStore %shared_value_addr_0 %shared_value_0 Aligned 4 + OpStore %local_id_addr_0 %local_id_0 Aligned 4 + %50 = OpLoad %_ptr_CrossWorkgroup_uint %shared_value_addr_0 Aligned 4 + %51 = OpLoad %uint %local_id_addr_0 Aligned 4 + %52 = OpFunctionCall %void %synchronized_increment %50 %51 OpReturn OpFunctionEnd - %49 = OpFunction %void DontInline %48 - %50 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %51 = OpLabel - %52 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %53 = OpVariable %_ptr_Function_uint Function - OpStore %52 %50 Aligned 4 - %54 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %55 = OpCompositeExtract %uint %54 0 - OpStore %53 %55 Aligned 4 - %56 = OpLoad %_ptr_CrossWorkgroup_uint %52 Aligned 4 - %57 = OpLoad %uint %53 Aligned 4 - %58 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %56 %57 - %59 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %60 = OpCompositeExtract %uint %59 0 - %61 = OpFunctionCall %void %agent_function1 %58 %60 - %62 = OpLoad %_ptr_CrossWorkgroup_uint %52 Aligned 4 - %63 = OpLoad %uint %53 Aligned 4 - %64 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %62 %63 - %65 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %66 = OpCompositeExtract %uint %65 0 - %67 = OpFunctionCall %void %agent_function2 %64 %66 +%synchronized_increment = OpFunction %void DontInline %24 +%shared_value_1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %local_id_1 = OpFunctionParameter %uint + %entry_2 = OpLabel +%shared_value_addr_1 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%local_id_addr_1 = OpVariable %_ptr_Function_uint Function + OpStore %shared_value_addr_1 %shared_value_1 Aligned 4 + OpStore %local_id_addr_1 %local_id_1 Aligned 4 + OpControlBarrier %uint_2 %uint_2 %uint_528 + %60 = OpLoad %uint %local_id_addr_1 Aligned 4 + %cmp = OpIEqual %bool %60 %uint_0 + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel + %64 = OpLoad %_ptr_CrossWorkgroup_uint %shared_value_addr_1 Aligned 4 + %65 = OpLoad %uint %64 Aligned 4 + %inc = OpIAdd %uint %65 %uint_1 + OpStore %64 %inc Aligned 4 + OpBranch %if_end + %if_end = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_528 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-3-exists-correct.spvasm b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-3-exists-correct.spvasm index 30de287c37..cc0df0de5c 100644 --- a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-3-exists-correct.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-3-exists-correct.spvasm @@ -1,5 +1,5 @@ -; @Input: %50 = {0, 0} -; @Output: exists (%50[0]==2 and %50[1]==2) +; @Input: %x = {0, 0} +; @Output: exists (%x[0]==2 and %x[1]==2) ; @Config: 2, 1, 2 ; SPIR-V ; Version: 1.0 @@ -11,30 +11,55 @@ OpCapability Kernel %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical32 OpenCL - OpEntryPoint Kernel %49 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId + OpEntryPoint Kernel %10 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInWorkgroupId "__spirv_BuiltInWorkgroupId" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" - OpName %synchronized_increment "synchronized_increment" - OpName %agent_function1 "agent_function1" + OpName %x "x" + OpName %entry "entry" + OpName %x_addr "x.addr" + OpName %tid "tid" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" OpName %agent_function2 "agent_function2" + OpName %shared_value "shared_value" + OpName %local_id "local_id" + OpName %arrayidx2 "arrayidx2" + OpName %call3 "call3" + OpName %entry_0 "entry" + OpName %shared_value_addr "shared_value.addr" + OpName %local_id_addr "local_id.addr" + OpName %agent_function1 "agent_function1" + OpName %shared_value_0 "shared_value" + OpName %local_id_0 "local_id" + OpName %entry_1 "entry" + OpName %shared_value_addr_0 "shared_value.addr" + OpName %local_id_addr_0 "local_id.addr" + OpName %synchronized_increment "synchronized_increment" + OpName %shared_value_1 "shared_value" + OpName %local_id_1 "local_id" + OpName %entry_2 "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %shared_value_addr_1 "shared_value.addr" + OpName %local_id_addr_1 "local_id.addr" + OpName %cmp "cmp" + OpName %inc "inc" OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInWorkgroupId Constant OpDecorate %__spirv_BuiltInLocalInvocationId Constant - OpDecorate %agent_function1 LinkageAttributes "agent_function1" Export - OpDecorate %agent_function2 LinkageAttributes "agent_function2" Export - OpDecorate %synchronized_increment LinkageAttributes "synchronized_increment" Export OpDecorate %__spirv_BuiltInWorkgroupId LinkageAttributes "__spirv_BuiltInWorkgroupId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %34 Alignment 4 - OpDecorate %35 Alignment 4 - OpDecorate %43 Alignment 4 - OpDecorate %44 Alignment 4 - OpDecorate %52 Alignment 4 - OpDecorate %53 Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %tid Alignment 4 + OpDecorate %shared_value_addr Alignment 4 + OpDecorate %local_id_addr Alignment 4 + OpDecorate %shared_value_addr_0 Alignment 4 + OpDecorate %local_id_addr_0 Alignment 4 + OpDecorate %shared_value_addr_1 Alignment 4 + OpDecorate %local_id_addr_1 Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_528 = OpConstant %uint 528 @@ -44,82 +69,81 @@ %_ptr_Input_v3uint = OpTypePointer Input %v3uint %void = OpTypeVoid %_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint - %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint + %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %_ptr_Function_uint = OpTypePointer Function %uint + %24 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint %bool = OpTypeBool - %48 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %__spirv_BuiltInWorkgroupId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input -%synchronized_increment = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %uint - %13 = OpLabel - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - OpStore %17 %11 Aligned 4 - OpStore %19 %12 Aligned 4 - OpControlBarrier %uint_2 %uint_2 %uint_528 - %22 = OpLoad %uint %19 Aligned 4 - %25 = OpIEqual %bool %22 %uint_0 - OpBranchConditional %25 %14 %15 - %14 = OpLabel - %26 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %27 = OpLoad %uint %26 Aligned 4 - %29 = OpIAdd %uint %27 %uint_1 - OpStore %26 %29 Aligned 4 - OpBranch %15 - %15 = OpLabel - OpControlBarrier %uint_2 %uint_2 %uint_528 + %10 = OpFunction %void DontInline %9 + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %tid = OpVariable %_ptr_Function_uint Function + OpStore %x_addr %x Aligned 4 + %17 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 + %call = OpCompositeExtract %uint %17 0 + OpStore %tid %call Aligned 4 + %19 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %20 = OpLoad %uint %tid Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %19 %20 + %22 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 + %call1 = OpCompositeExtract %uint %22 0 + %28 = OpFunctionCall %void %agent_function2 %arrayidx %call1 + %29 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %30 = OpLoad %uint %tid Aligned 4 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %29 %30 + %32 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 + %call3 = OpCompositeExtract %uint %32 0 + %34 = OpFunctionCall %void %agent_function2 %arrayidx2 %call3 OpReturn OpFunctionEnd -%agent_function1 = OpFunction %void DontInline %9 - %31 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %32 = OpFunctionParameter %uint - %33 = OpLabel - %34 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %35 = OpVariable %_ptr_Function_uint Function - OpStore %34 %31 Aligned 4 - OpStore %35 %32 Aligned 4 - %36 = OpLoad %_ptr_CrossWorkgroup_uint %34 Aligned 4 - %37 = OpLoad %uint %35 Aligned 4 - %38 = OpFunctionCall %void %synchronized_increment %36 %37 +%agent_function2 = OpFunction %void DontInline %24 +%shared_value = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %local_id = OpFunctionParameter %uint + %entry_0 = OpLabel +%shared_value_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%local_id_addr = OpVariable %_ptr_Function_uint Function + OpStore %shared_value_addr %shared_value Aligned 4 + OpStore %local_id_addr %local_id Aligned 4 + %38 = OpLoad %_ptr_CrossWorkgroup_uint %shared_value_addr Aligned 4 + %39 = OpLoad %uint %local_id_addr Aligned 4 + %43 = OpFunctionCall %void %agent_function1 %38 %39 OpReturn OpFunctionEnd -%agent_function2 = OpFunction %void DontInline %9 - %40 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %41 = OpFunctionParameter %uint - %42 = OpLabel - %43 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %44 = OpVariable %_ptr_Function_uint Function - OpStore %43 %40 Aligned 4 - OpStore %44 %41 Aligned 4 - %45 = OpLoad %_ptr_CrossWorkgroup_uint %43 Aligned 4 - %46 = OpLoad %uint %44 Aligned 4 - %47 = OpFunctionCall %void %agent_function1 %45 %46 +%agent_function1 = OpFunction %void DontInline %24 +%shared_value_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %local_id_0 = OpFunctionParameter %uint + %entry_1 = OpLabel +%shared_value_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%local_id_addr_0 = OpVariable %_ptr_Function_uint Function + OpStore %shared_value_addr_0 %shared_value_0 Aligned 4 + OpStore %local_id_addr_0 %local_id_0 Aligned 4 + %47 = OpLoad %_ptr_CrossWorkgroup_uint %shared_value_addr_0 Aligned 4 + %48 = OpLoad %uint %local_id_addr_0 Aligned 4 + %52 = OpFunctionCall %void %synchronized_increment %47 %48 OpReturn OpFunctionEnd - %49 = OpFunction %void DontInline %48 - %50 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %51 = OpLabel - %52 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %53 = OpVariable %_ptr_Function_uint Function - OpStore %52 %50 Aligned 4 - %54 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %55 = OpCompositeExtract %uint %54 0 - OpStore %53 %55 Aligned 4 - %56 = OpLoad %_ptr_CrossWorkgroup_uint %52 Aligned 4 - %57 = OpLoad %uint %53 Aligned 4 - %58 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %56 %57 - %59 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %60 = OpCompositeExtract %uint %59 0 - %61 = OpFunctionCall %void %agent_function2 %58 %60 - %62 = OpLoad %_ptr_CrossWorkgroup_uint %52 Aligned 4 - %63 = OpLoad %uint %53 Aligned 4 - %64 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %62 %63 - %65 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %66 = OpCompositeExtract %uint %65 0 - %67 = OpFunctionCall %void %agent_function2 %64 %66 +%synchronized_increment = OpFunction %void DontInline %24 +%shared_value_1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %local_id_1 = OpFunctionParameter %uint + %entry_2 = OpLabel +%shared_value_addr_1 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%local_id_addr_1 = OpVariable %_ptr_Function_uint Function + OpStore %shared_value_addr_1 %shared_value_1 Aligned 4 + OpStore %local_id_addr_1 %local_id_1 Aligned 4 + OpControlBarrier %uint_2 %uint_2 %uint_528 + %60 = OpLoad %uint %local_id_addr_1 Aligned 4 + %cmp = OpIEqual %bool %60 %uint_0 + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel + %64 = OpLoad %_ptr_CrossWorkgroup_uint %shared_value_addr_1 Aligned 4 + %65 = OpLoad %uint %64 Aligned 4 + %inc = OpIAdd %uint %65 %uint_1 + OpStore %64 %inc Aligned 4 + OpBranch %if_end + %if_end = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_528 OpReturn OpFunctionEnd - diff --git a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-3-exists-wrong.spvasm b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-3-exists-wrong.spvasm index 7c33b3c721..62cb44f674 100644 --- a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-3-exists-wrong.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-3-exists-wrong.spvasm @@ -1,5 +1,5 @@ -; @Input: %50 = {0, 0} -; @Output: exists (%50[0]==0 and %50[1]==0) +; @Input: %x = {0, 0} +; @Output: exists (%x[0]==0 and %x[1]==0) ; @Config: 2, 1, 2 ; SPIR-V ; Version: 1.0 @@ -11,30 +11,55 @@ OpCapability Kernel %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical32 OpenCL - OpEntryPoint Kernel %49 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId + OpEntryPoint Kernel %10 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInWorkgroupId "__spirv_BuiltInWorkgroupId" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" - OpName %synchronized_increment "synchronized_increment" - OpName %agent_function1 "agent_function1" + OpName %x "x" + OpName %entry "entry" + OpName %x_addr "x.addr" + OpName %tid "tid" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" OpName %agent_function2 "agent_function2" + OpName %shared_value "shared_value" + OpName %local_id "local_id" + OpName %arrayidx2 "arrayidx2" + OpName %call3 "call3" + OpName %entry_0 "entry" + OpName %shared_value_addr "shared_value.addr" + OpName %local_id_addr "local_id.addr" + OpName %agent_function1 "agent_function1" + OpName %shared_value_0 "shared_value" + OpName %local_id_0 "local_id" + OpName %entry_1 "entry" + OpName %shared_value_addr_0 "shared_value.addr" + OpName %local_id_addr_0 "local_id.addr" + OpName %synchronized_increment "synchronized_increment" + OpName %shared_value_1 "shared_value" + OpName %local_id_1 "local_id" + OpName %entry_2 "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %shared_value_addr_1 "shared_value.addr" + OpName %local_id_addr_1 "local_id.addr" + OpName %cmp "cmp" + OpName %inc "inc" OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInWorkgroupId Constant OpDecorate %__spirv_BuiltInLocalInvocationId Constant - OpDecorate %agent_function1 LinkageAttributes "agent_function1" Export - OpDecorate %agent_function2 LinkageAttributes "agent_function2" Export - OpDecorate %synchronized_increment LinkageAttributes "synchronized_increment" Export OpDecorate %__spirv_BuiltInWorkgroupId LinkageAttributes "__spirv_BuiltInWorkgroupId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %34 Alignment 4 - OpDecorate %35 Alignment 4 - OpDecorate %43 Alignment 4 - OpDecorate %44 Alignment 4 - OpDecorate %52 Alignment 4 - OpDecorate %53 Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %tid Alignment 4 + OpDecorate %shared_value_addr Alignment 4 + OpDecorate %local_id_addr Alignment 4 + OpDecorate %shared_value_addr_0 Alignment 4 + OpDecorate %local_id_addr_0 Alignment 4 + OpDecorate %shared_value_addr_1 Alignment 4 + OpDecorate %local_id_addr_1 Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_528 = OpConstant %uint 528 @@ -44,82 +69,81 @@ %_ptr_Input_v3uint = OpTypePointer Input %v3uint %void = OpTypeVoid %_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint - %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint + %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %_ptr_Function_uint = OpTypePointer Function %uint + %24 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint %bool = OpTypeBool - %48 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %__spirv_BuiltInWorkgroupId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input -%synchronized_increment = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %uint - %13 = OpLabel - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - OpStore %17 %11 Aligned 4 - OpStore %19 %12 Aligned 4 - OpControlBarrier %uint_2 %uint_2 %uint_528 - %22 = OpLoad %uint %19 Aligned 4 - %25 = OpIEqual %bool %22 %uint_0 - OpBranchConditional %25 %14 %15 - %14 = OpLabel - %26 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %27 = OpLoad %uint %26 Aligned 4 - %29 = OpIAdd %uint %27 %uint_1 - OpStore %26 %29 Aligned 4 - OpBranch %15 - %15 = OpLabel - OpControlBarrier %uint_2 %uint_2 %uint_528 + %10 = OpFunction %void DontInline %9 + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %tid = OpVariable %_ptr_Function_uint Function + OpStore %x_addr %x Aligned 4 + %17 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 + %call = OpCompositeExtract %uint %17 0 + OpStore %tid %call Aligned 4 + %19 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %20 = OpLoad %uint %tid Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %19 %20 + %22 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 + %call1 = OpCompositeExtract %uint %22 0 + %28 = OpFunctionCall %void %agent_function2 %arrayidx %call1 + %29 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %30 = OpLoad %uint %tid Aligned 4 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %29 %30 + %32 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 + %call3 = OpCompositeExtract %uint %32 0 + %34 = OpFunctionCall %void %agent_function2 %arrayidx2 %call3 OpReturn OpFunctionEnd -%agent_function1 = OpFunction %void DontInline %9 - %31 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %32 = OpFunctionParameter %uint - %33 = OpLabel - %34 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %35 = OpVariable %_ptr_Function_uint Function - OpStore %34 %31 Aligned 4 - OpStore %35 %32 Aligned 4 - %36 = OpLoad %_ptr_CrossWorkgroup_uint %34 Aligned 4 - %37 = OpLoad %uint %35 Aligned 4 - %38 = OpFunctionCall %void %synchronized_increment %36 %37 +%agent_function2 = OpFunction %void DontInline %24 +%shared_value = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %local_id = OpFunctionParameter %uint + %entry_0 = OpLabel +%shared_value_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%local_id_addr = OpVariable %_ptr_Function_uint Function + OpStore %shared_value_addr %shared_value Aligned 4 + OpStore %local_id_addr %local_id Aligned 4 + %38 = OpLoad %_ptr_CrossWorkgroup_uint %shared_value_addr Aligned 4 + %39 = OpLoad %uint %local_id_addr Aligned 4 + %43 = OpFunctionCall %void %agent_function1 %38 %39 OpReturn OpFunctionEnd -%agent_function2 = OpFunction %void DontInline %9 - %40 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %41 = OpFunctionParameter %uint - %42 = OpLabel - %43 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %44 = OpVariable %_ptr_Function_uint Function - OpStore %43 %40 Aligned 4 - OpStore %44 %41 Aligned 4 - %45 = OpLoad %_ptr_CrossWorkgroup_uint %43 Aligned 4 - %46 = OpLoad %uint %44 Aligned 4 - %47 = OpFunctionCall %void %agent_function1 %45 %46 +%agent_function1 = OpFunction %void DontInline %24 +%shared_value_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %local_id_0 = OpFunctionParameter %uint + %entry_1 = OpLabel +%shared_value_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%local_id_addr_0 = OpVariable %_ptr_Function_uint Function + OpStore %shared_value_addr_0 %shared_value_0 Aligned 4 + OpStore %local_id_addr_0 %local_id_0 Aligned 4 + %47 = OpLoad %_ptr_CrossWorkgroup_uint %shared_value_addr_0 Aligned 4 + %48 = OpLoad %uint %local_id_addr_0 Aligned 4 + %52 = OpFunctionCall %void %synchronized_increment %47 %48 OpReturn OpFunctionEnd - %49 = OpFunction %void DontInline %48 - %50 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %51 = OpLabel - %52 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %53 = OpVariable %_ptr_Function_uint Function - OpStore %52 %50 Aligned 4 - %54 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %55 = OpCompositeExtract %uint %54 0 - OpStore %53 %55 Aligned 4 - %56 = OpLoad %_ptr_CrossWorkgroup_uint %52 Aligned 4 - %57 = OpLoad %uint %53 Aligned 4 - %58 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %56 %57 - %59 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %60 = OpCompositeExtract %uint %59 0 - %61 = OpFunctionCall %void %agent_function2 %58 %60 - %62 = OpLoad %_ptr_CrossWorkgroup_uint %52 Aligned 4 - %63 = OpLoad %uint %53 Aligned 4 - %64 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %62 %63 - %65 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %66 = OpCompositeExtract %uint %65 0 - %67 = OpFunctionCall %void %agent_function2 %64 %66 +%synchronized_increment = OpFunction %void DontInline %24 +%shared_value_1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %local_id_1 = OpFunctionParameter %uint + %entry_2 = OpLabel +%shared_value_addr_1 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%local_id_addr_1 = OpVariable %_ptr_Function_uint Function + OpStore %shared_value_addr_1 %shared_value_1 Aligned 4 + OpStore %local_id_addr_1 %local_id_1 Aligned 4 + OpControlBarrier %uint_2 %uint_2 %uint_528 + %60 = OpLoad %uint %local_id_addr_1 Aligned 4 + %cmp = OpIEqual %bool %60 %uint_0 + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel + %64 = OpLoad %_ptr_CrossWorkgroup_uint %shared_value_addr_1 Aligned 4 + %65 = OpLoad %uint %64 Aligned 4 + %inc = OpIAdd %uint %65 %uint_1 + OpStore %64 %inc Aligned 4 + OpBranch %if_end + %if_end = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_528 OpReturn OpFunctionEnd - diff --git a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-3-forall-correct.spvasm b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-3-forall-correct.spvasm index ce6bbfc13b..0fd92ce630 100644 --- a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-3-forall-correct.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-3-forall-correct.spvasm @@ -1,5 +1,5 @@ -; @Input: %50 = {0, 0} -; @Output: forall (%50[0]==2 and %50[1]==2) +; @Input: %x = {0, 0} +; @Output: forall (%x[0]==2 and %x[1]==2) ; @Config: 2, 1, 2 ; SPIR-V ; Version: 1.0 @@ -11,30 +11,55 @@ OpCapability Kernel %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical32 OpenCL - OpEntryPoint Kernel %49 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId + OpEntryPoint Kernel %10 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInWorkgroupId "__spirv_BuiltInWorkgroupId" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" - OpName %synchronized_increment "synchronized_increment" - OpName %agent_function1 "agent_function1" + OpName %x "x" + OpName %entry "entry" + OpName %x_addr "x.addr" + OpName %tid "tid" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" OpName %agent_function2 "agent_function2" + OpName %shared_value "shared_value" + OpName %local_id "local_id" + OpName %arrayidx2 "arrayidx2" + OpName %call3 "call3" + OpName %entry_0 "entry" + OpName %shared_value_addr "shared_value.addr" + OpName %local_id_addr "local_id.addr" + OpName %agent_function1 "agent_function1" + OpName %shared_value_0 "shared_value" + OpName %local_id_0 "local_id" + OpName %entry_1 "entry" + OpName %shared_value_addr_0 "shared_value.addr" + OpName %local_id_addr_0 "local_id.addr" + OpName %synchronized_increment "synchronized_increment" + OpName %shared_value_1 "shared_value" + OpName %local_id_1 "local_id" + OpName %entry_2 "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %shared_value_addr_1 "shared_value.addr" + OpName %local_id_addr_1 "local_id.addr" + OpName %cmp "cmp" + OpName %inc "inc" OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInWorkgroupId Constant OpDecorate %__spirv_BuiltInLocalInvocationId Constant - OpDecorate %agent_function1 LinkageAttributes "agent_function1" Export - OpDecorate %agent_function2 LinkageAttributes "agent_function2" Export - OpDecorate %synchronized_increment LinkageAttributes "synchronized_increment" Export OpDecorate %__spirv_BuiltInWorkgroupId LinkageAttributes "__spirv_BuiltInWorkgroupId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %34 Alignment 4 - OpDecorate %35 Alignment 4 - OpDecorate %43 Alignment 4 - OpDecorate %44 Alignment 4 - OpDecorate %52 Alignment 4 - OpDecorate %53 Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %tid Alignment 4 + OpDecorate %shared_value_addr Alignment 4 + OpDecorate %local_id_addr Alignment 4 + OpDecorate %shared_value_addr_0 Alignment 4 + OpDecorate %local_id_addr_0 Alignment 4 + OpDecorate %shared_value_addr_1 Alignment 4 + OpDecorate %local_id_addr_1 Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_528 = OpConstant %uint 528 @@ -44,82 +69,81 @@ %_ptr_Input_v3uint = OpTypePointer Input %v3uint %void = OpTypeVoid %_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint - %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint + %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %_ptr_Function_uint = OpTypePointer Function %uint + %24 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint %bool = OpTypeBool - %48 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %__spirv_BuiltInWorkgroupId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input -%synchronized_increment = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %uint - %13 = OpLabel - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - OpStore %17 %11 Aligned 4 - OpStore %19 %12 Aligned 4 - OpControlBarrier %uint_2 %uint_2 %uint_528 - %22 = OpLoad %uint %19 Aligned 4 - %25 = OpIEqual %bool %22 %uint_0 - OpBranchConditional %25 %14 %15 - %14 = OpLabel - %26 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %27 = OpLoad %uint %26 Aligned 4 - %29 = OpIAdd %uint %27 %uint_1 - OpStore %26 %29 Aligned 4 - OpBranch %15 - %15 = OpLabel - OpControlBarrier %uint_2 %uint_2 %uint_528 + %10 = OpFunction %void DontInline %9 + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %tid = OpVariable %_ptr_Function_uint Function + OpStore %x_addr %x Aligned 4 + %17 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 + %call = OpCompositeExtract %uint %17 0 + OpStore %tid %call Aligned 4 + %19 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %20 = OpLoad %uint %tid Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %19 %20 + %22 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 + %call1 = OpCompositeExtract %uint %22 0 + %28 = OpFunctionCall %void %agent_function2 %arrayidx %call1 + %29 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %30 = OpLoad %uint %tid Aligned 4 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %29 %30 + %32 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 + %call3 = OpCompositeExtract %uint %32 0 + %34 = OpFunctionCall %void %agent_function2 %arrayidx2 %call3 OpReturn OpFunctionEnd -%agent_function1 = OpFunction %void DontInline %9 - %31 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %32 = OpFunctionParameter %uint - %33 = OpLabel - %34 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %35 = OpVariable %_ptr_Function_uint Function - OpStore %34 %31 Aligned 4 - OpStore %35 %32 Aligned 4 - %36 = OpLoad %_ptr_CrossWorkgroup_uint %34 Aligned 4 - %37 = OpLoad %uint %35 Aligned 4 - %38 = OpFunctionCall %void %synchronized_increment %36 %37 +%agent_function2 = OpFunction %void DontInline %24 +%shared_value = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %local_id = OpFunctionParameter %uint + %entry_0 = OpLabel +%shared_value_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%local_id_addr = OpVariable %_ptr_Function_uint Function + OpStore %shared_value_addr %shared_value Aligned 4 + OpStore %local_id_addr %local_id Aligned 4 + %38 = OpLoad %_ptr_CrossWorkgroup_uint %shared_value_addr Aligned 4 + %39 = OpLoad %uint %local_id_addr Aligned 4 + %43 = OpFunctionCall %void %agent_function1 %38 %39 OpReturn OpFunctionEnd -%agent_function2 = OpFunction %void DontInline %9 - %40 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %41 = OpFunctionParameter %uint - %42 = OpLabel - %43 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %44 = OpVariable %_ptr_Function_uint Function - OpStore %43 %40 Aligned 4 - OpStore %44 %41 Aligned 4 - %45 = OpLoad %_ptr_CrossWorkgroup_uint %43 Aligned 4 - %46 = OpLoad %uint %44 Aligned 4 - %47 = OpFunctionCall %void %agent_function1 %45 %46 +%agent_function1 = OpFunction %void DontInline %24 +%shared_value_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %local_id_0 = OpFunctionParameter %uint + %entry_1 = OpLabel +%shared_value_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%local_id_addr_0 = OpVariable %_ptr_Function_uint Function + OpStore %shared_value_addr_0 %shared_value_0 Aligned 4 + OpStore %local_id_addr_0 %local_id_0 Aligned 4 + %47 = OpLoad %_ptr_CrossWorkgroup_uint %shared_value_addr_0 Aligned 4 + %48 = OpLoad %uint %local_id_addr_0 Aligned 4 + %52 = OpFunctionCall %void %synchronized_increment %47 %48 OpReturn OpFunctionEnd - %49 = OpFunction %void DontInline %48 - %50 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %51 = OpLabel - %52 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %53 = OpVariable %_ptr_Function_uint Function - OpStore %52 %50 Aligned 4 - %54 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %55 = OpCompositeExtract %uint %54 0 - OpStore %53 %55 Aligned 4 - %56 = OpLoad %_ptr_CrossWorkgroup_uint %52 Aligned 4 - %57 = OpLoad %uint %53 Aligned 4 - %58 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %56 %57 - %59 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %60 = OpCompositeExtract %uint %59 0 - %61 = OpFunctionCall %void %agent_function2 %58 %60 - %62 = OpLoad %_ptr_CrossWorkgroup_uint %52 Aligned 4 - %63 = OpLoad %uint %53 Aligned 4 - %64 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %62 %63 - %65 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %66 = OpCompositeExtract %uint %65 0 - %67 = OpFunctionCall %void %agent_function2 %64 %66 +%synchronized_increment = OpFunction %void DontInline %24 +%shared_value_1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %local_id_1 = OpFunctionParameter %uint + %entry_2 = OpLabel +%shared_value_addr_1 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%local_id_addr_1 = OpVariable %_ptr_Function_uint Function + OpStore %shared_value_addr_1 %shared_value_1 Aligned 4 + OpStore %local_id_addr_1 %local_id_1 Aligned 4 + OpControlBarrier %uint_2 %uint_2 %uint_528 + %60 = OpLoad %uint %local_id_addr_1 Aligned 4 + %cmp = OpIEqual %bool %60 %uint_0 + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel + %64 = OpLoad %_ptr_CrossWorkgroup_uint %shared_value_addr_1 Aligned 4 + %65 = OpLoad %uint %64 Aligned 4 + %inc = OpIAdd %uint %65 %uint_1 + OpStore %64 %inc Aligned 4 + OpBranch %if_end + %if_end = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_528 OpReturn OpFunctionEnd - diff --git a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-3-forall-wrong.spvasm b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-3-forall-wrong.spvasm index 66e73427f1..a495c93f60 100644 --- a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-3-forall-wrong.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-3-forall-wrong.spvasm @@ -1,5 +1,5 @@ -; @Input: %50 = {0, 0} -; @Output: forall (%50[0]==0 and %50[1]==0) +; @Input: %x = {0, 0} +; @Output: forall (%x[0]==0 and %x[1]==0) ; @Config: 2, 1, 2 ; SPIR-V ; Version: 1.0 @@ -11,30 +11,55 @@ OpCapability Kernel %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical32 OpenCL - OpEntryPoint Kernel %49 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId + OpEntryPoint Kernel %10 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInWorkgroupId "__spirv_BuiltInWorkgroupId" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" - OpName %synchronized_increment "synchronized_increment" - OpName %agent_function1 "agent_function1" + OpName %x "x" + OpName %entry "entry" + OpName %x_addr "x.addr" + OpName %tid "tid" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" OpName %agent_function2 "agent_function2" + OpName %shared_value "shared_value" + OpName %local_id "local_id" + OpName %arrayidx2 "arrayidx2" + OpName %call3 "call3" + OpName %entry_0 "entry" + OpName %shared_value_addr "shared_value.addr" + OpName %local_id_addr "local_id.addr" + OpName %agent_function1 "agent_function1" + OpName %shared_value_0 "shared_value" + OpName %local_id_0 "local_id" + OpName %entry_1 "entry" + OpName %shared_value_addr_0 "shared_value.addr" + OpName %local_id_addr_0 "local_id.addr" + OpName %synchronized_increment "synchronized_increment" + OpName %shared_value_1 "shared_value" + OpName %local_id_1 "local_id" + OpName %entry_2 "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %shared_value_addr_1 "shared_value.addr" + OpName %local_id_addr_1 "local_id.addr" + OpName %cmp "cmp" + OpName %inc "inc" OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInWorkgroupId Constant OpDecorate %__spirv_BuiltInLocalInvocationId Constant - OpDecorate %agent_function1 LinkageAttributes "agent_function1" Export - OpDecorate %agent_function2 LinkageAttributes "agent_function2" Export - OpDecorate %synchronized_increment LinkageAttributes "synchronized_increment" Export OpDecorate %__spirv_BuiltInWorkgroupId LinkageAttributes "__spirv_BuiltInWorkgroupId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %34 Alignment 4 - OpDecorate %35 Alignment 4 - OpDecorate %43 Alignment 4 - OpDecorate %44 Alignment 4 - OpDecorate %52 Alignment 4 - OpDecorate %53 Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %tid Alignment 4 + OpDecorate %shared_value_addr Alignment 4 + OpDecorate %local_id_addr Alignment 4 + OpDecorate %shared_value_addr_0 Alignment 4 + OpDecorate %local_id_addr_0 Alignment 4 + OpDecorate %shared_value_addr_1 Alignment 4 + OpDecorate %local_id_addr_1 Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_528 = OpConstant %uint 528 @@ -44,82 +69,81 @@ %_ptr_Input_v3uint = OpTypePointer Input %v3uint %void = OpTypeVoid %_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint - %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint + %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %_ptr_Function_uint = OpTypePointer Function %uint + %24 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint %bool = OpTypeBool - %48 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %__spirv_BuiltInWorkgroupId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input -%synchronized_increment = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %uint - %13 = OpLabel - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - OpStore %17 %11 Aligned 4 - OpStore %19 %12 Aligned 4 - OpControlBarrier %uint_2 %uint_2 %uint_528 - %22 = OpLoad %uint %19 Aligned 4 - %25 = OpIEqual %bool %22 %uint_0 - OpBranchConditional %25 %14 %15 - %14 = OpLabel - %26 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %27 = OpLoad %uint %26 Aligned 4 - %29 = OpIAdd %uint %27 %uint_1 - OpStore %26 %29 Aligned 4 - OpBranch %15 - %15 = OpLabel - OpControlBarrier %uint_2 %uint_2 %uint_528 + %10 = OpFunction %void DontInline %9 + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %tid = OpVariable %_ptr_Function_uint Function + OpStore %x_addr %x Aligned 4 + %17 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 + %call = OpCompositeExtract %uint %17 0 + OpStore %tid %call Aligned 4 + %19 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %20 = OpLoad %uint %tid Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %19 %20 + %22 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 + %call1 = OpCompositeExtract %uint %22 0 + %28 = OpFunctionCall %void %agent_function2 %arrayidx %call1 + %29 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %30 = OpLoad %uint %tid Aligned 4 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %29 %30 + %32 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 + %call3 = OpCompositeExtract %uint %32 0 + %34 = OpFunctionCall %void %agent_function2 %arrayidx2 %call3 OpReturn OpFunctionEnd -%agent_function1 = OpFunction %void DontInline %9 - %31 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %32 = OpFunctionParameter %uint - %33 = OpLabel - %34 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %35 = OpVariable %_ptr_Function_uint Function - OpStore %34 %31 Aligned 4 - OpStore %35 %32 Aligned 4 - %36 = OpLoad %_ptr_CrossWorkgroup_uint %34 Aligned 4 - %37 = OpLoad %uint %35 Aligned 4 - %38 = OpFunctionCall %void %synchronized_increment %36 %37 +%agent_function2 = OpFunction %void DontInline %24 +%shared_value = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %local_id = OpFunctionParameter %uint + %entry_0 = OpLabel +%shared_value_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%local_id_addr = OpVariable %_ptr_Function_uint Function + OpStore %shared_value_addr %shared_value Aligned 4 + OpStore %local_id_addr %local_id Aligned 4 + %38 = OpLoad %_ptr_CrossWorkgroup_uint %shared_value_addr Aligned 4 + %39 = OpLoad %uint %local_id_addr Aligned 4 + %43 = OpFunctionCall %void %agent_function1 %38 %39 OpReturn OpFunctionEnd -%agent_function2 = OpFunction %void DontInline %9 - %40 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %41 = OpFunctionParameter %uint - %42 = OpLabel - %43 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %44 = OpVariable %_ptr_Function_uint Function - OpStore %43 %40 Aligned 4 - OpStore %44 %41 Aligned 4 - %45 = OpLoad %_ptr_CrossWorkgroup_uint %43 Aligned 4 - %46 = OpLoad %uint %44 Aligned 4 - %47 = OpFunctionCall %void %agent_function1 %45 %46 +%agent_function1 = OpFunction %void DontInline %24 +%shared_value_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %local_id_0 = OpFunctionParameter %uint + %entry_1 = OpLabel +%shared_value_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%local_id_addr_0 = OpVariable %_ptr_Function_uint Function + OpStore %shared_value_addr_0 %shared_value_0 Aligned 4 + OpStore %local_id_addr_0 %local_id_0 Aligned 4 + %47 = OpLoad %_ptr_CrossWorkgroup_uint %shared_value_addr_0 Aligned 4 + %48 = OpLoad %uint %local_id_addr_0 Aligned 4 + %52 = OpFunctionCall %void %synchronized_increment %47 %48 OpReturn OpFunctionEnd - %49 = OpFunction %void DontInline %48 - %50 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %51 = OpLabel - %52 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %53 = OpVariable %_ptr_Function_uint Function - OpStore %52 %50 Aligned 4 - %54 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %55 = OpCompositeExtract %uint %54 0 - OpStore %53 %55 Aligned 4 - %56 = OpLoad %_ptr_CrossWorkgroup_uint %52 Aligned 4 - %57 = OpLoad %uint %53 Aligned 4 - %58 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %56 %57 - %59 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %60 = OpCompositeExtract %uint %59 0 - %61 = OpFunctionCall %void %agent_function2 %58 %60 - %62 = OpLoad %_ptr_CrossWorkgroup_uint %52 Aligned 4 - %63 = OpLoad %uint %53 Aligned 4 - %64 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %62 %63 - %65 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %66 = OpCompositeExtract %uint %65 0 - %67 = OpFunctionCall %void %agent_function2 %64 %66 +%synchronized_increment = OpFunction %void DontInline %24 +%shared_value_1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %local_id_1 = OpFunctionParameter %uint + %entry_2 = OpLabel +%shared_value_addr_1 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%local_id_addr_1 = OpVariable %_ptr_Function_uint Function + OpStore %shared_value_addr_1 %shared_value_1 Aligned 4 + OpStore %local_id_addr_1 %local_id_1 Aligned 4 + OpControlBarrier %uint_2 %uint_2 %uint_528 + %60 = OpLoad %uint %local_id_addr_1 Aligned 4 + %cmp = OpIEqual %bool %60 %uint_0 + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel + %64 = OpLoad %_ptr_CrossWorkgroup_uint %shared_value_addr_1 Aligned 4 + %65 = OpLoad %uint %64 Aligned 4 + %inc = OpIAdd %uint %65 %uint_1 + OpStore %64 %inc Aligned 4 + OpBranch %if_end + %if_end = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_528 OpReturn OpFunctionEnd - diff --git a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-4-exists-correct.spvasm b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-4-exists-correct.spvasm index dc8b118de4..026b4c09b9 100644 --- a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-4-exists-correct.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-4-exists-correct.spvasm @@ -1,5 +1,5 @@ -; @Input: %41 = {0, 0} -; @Output: exists (%41[0]==2 and %41[1]==2) +; @Input: %x = {0, 0} +; @Output: exists (%x[0]==2 and %x[1]==2) ; @Config: 2, 1, 2 ; SPIR-V ; Version: 1.0 @@ -11,23 +11,45 @@ OpCapability Kernel %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical32 OpenCL - OpEntryPoint Kernel %40 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId + OpEntryPoint Kernel %10 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInWorkgroupId "__spirv_BuiltInWorkgroupId" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %x "x" + OpName %entry "entry" + OpName %x_addr "x.addr" + OpName %tid "tid" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" OpName %synchronized_increment "synchronized_increment" + OpName %shared_value "shared_value" + OpName %local_id "local_id" + OpName %entry_0 "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %shared_value_addr "shared_value.addr" + OpName %local_id_addr "local_id.addr" + OpName %i "i" + OpName %cmp "cmp" + OpName %cmp1 "cmp1" + OpName %inc "inc" + OpName %inc2 "inc2" OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInWorkgroupId Constant OpDecorate %__spirv_BuiltInLocalInvocationId Constant - OpDecorate %synchronized_increment LinkageAttributes "synchronized_increment" Export OpDecorate %__spirv_BuiltInWorkgroupId LinkageAttributes "__spirv_BuiltInWorkgroupId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %21 Alignment 4 - OpDecorate %23 Alignment 4 - OpDecorate %24 Alignment 4 - OpDecorate %43 Alignment 4 - OpDecorate %44 Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %tid Alignment 4 + OpDecorate %shared_value_addr Alignment 4 + OpDecorate %local_id_addr Alignment 4 + OpDecorate %i Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_2 = OpConstant %uint 2 @@ -37,64 +59,64 @@ %_ptr_Input_v3uint = OpTypePointer Input %v3uint %void = OpTypeVoid %_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint - %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint + %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %_ptr_Function_uint = OpTypePointer Function %uint + %24 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint %bool = OpTypeBool - %39 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %__spirv_BuiltInWorkgroupId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input -%synchronized_increment = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %uint - %13 = OpLabel - %21 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %23 = OpVariable %_ptr_Function_uint Function - %24 = OpVariable %_ptr_Function_uint Function - OpStore %21 %11 Aligned 4 - OpStore %23 %12 Aligned 4 - OpStore %24 %uint_0 Aligned 4 - OpBranch %14 - %14 = OpLabel - %26 = OpLoad %uint %24 Aligned 4 - %29 = OpSLessThan %bool %26 %uint_2 - OpBranchConditional %29 %15 %19 - %15 = OpLabel - OpControlBarrier %uint_2 %uint_2 %uint_528 - %31 = OpLoad %uint %23 Aligned 4 - %32 = OpIEqual %bool %31 %uint_0 - OpBranchConditional %32 %16 %17 - %16 = OpLabel - %33 = OpLoad %_ptr_CrossWorkgroup_uint %21 Aligned 4 - %34 = OpLoad %uint %33 Aligned 4 - %36 = OpIAdd %uint %34 %uint_1 - OpStore %33 %36 Aligned 4 - OpBranch %17 - %17 = OpLabel - OpControlBarrier %uint_2 %uint_2 %uint_528 - OpBranch %18 - %18 = OpLabel - %37 = OpLoad %uint %24 Aligned 4 - %38 = OpIAdd %uint %37 %uint_1 - OpStore %24 %38 Aligned 4 - OpBranch %14 - %19 = OpLabel + %10 = OpFunction %void DontInline %9 + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %tid = OpVariable %_ptr_Function_uint Function + OpStore %x_addr %x Aligned 4 + %17 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 + %call = OpCompositeExtract %uint %17 0 + OpStore %tid %call Aligned 4 + %19 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %20 = OpLoad %uint %tid Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %19 %20 + %22 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 + %call1 = OpCompositeExtract %uint %22 0 + %28 = OpFunctionCall %void %synchronized_increment %arrayidx %call1 OpReturn OpFunctionEnd - %40 = OpFunction %void DontInline %39 - %41 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %42 = OpLabel - %43 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %44 = OpVariable %_ptr_Function_uint Function - OpStore %43 %41 Aligned 4 - %45 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %46 = OpCompositeExtract %uint %45 0 - OpStore %44 %46 Aligned 4 - %47 = OpLoad %_ptr_CrossWorkgroup_uint %43 Aligned 4 - %48 = OpLoad %uint %44 Aligned 4 - %49 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %47 %48 - %50 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %51 = OpCompositeExtract %uint %50 0 - %52 = OpFunctionCall %void %synchronized_increment %49 %51 +%synchronized_increment = OpFunction %void DontInline %24 +%shared_value = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %local_id = OpFunctionParameter %uint + %entry_0 = OpLabel +%shared_value_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%local_id_addr = OpVariable %_ptr_Function_uint Function + %i = OpVariable %_ptr_Function_uint Function + OpStore %shared_value_addr %shared_value Aligned 4 + OpStore %local_id_addr %local_id Aligned 4 + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %40 = OpLoad %uint %i Aligned 4 + %cmp = OpSLessThan %bool %40 %uint_2 + OpBranchConditional %cmp %for_body %for_end + %for_body = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_528 + %45 = OpLoad %uint %local_id_addr Aligned 4 + %cmp1 = OpIEqual %bool %45 %uint_0 + OpBranchConditional %cmp1 %if_then %if_end + %if_then = OpLabel + %47 = OpLoad %_ptr_CrossWorkgroup_uint %shared_value_addr Aligned 4 + %48 = OpLoad %uint %47 Aligned 4 + %inc = OpIAdd %uint %48 %uint_1 + OpStore %47 %inc Aligned 4 + OpBranch %if_end + %if_end = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_528 + OpBranch %for_inc + %for_inc = OpLabel + %51 = OpLoad %uint %i Aligned 4 + %inc2 = OpIAdd %uint %51 %uint_1 + OpStore %i %inc2 Aligned 4 + OpBranch %for_cond + %for_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-4-exists-wrong.spvasm b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-4-exists-wrong.spvasm index 33ca240f87..ae32851254 100644 --- a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-4-exists-wrong.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-4-exists-wrong.spvasm @@ -1,5 +1,5 @@ -; @Input: %41 = {0, 0} -; @Output: exists (%41[0]==0 and %41[1]==0) +; @Input: %x = {0, 0} +; @Output: exists (%x[0]==0 and %x[1]==0) ; @Config: 2, 1, 2 ; SPIR-V ; Version: 1.0 @@ -11,23 +11,45 @@ OpCapability Kernel %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical32 OpenCL - OpEntryPoint Kernel %40 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId + OpEntryPoint Kernel %10 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInWorkgroupId "__spirv_BuiltInWorkgroupId" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %x "x" + OpName %entry "entry" + OpName %x_addr "x.addr" + OpName %tid "tid" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" OpName %synchronized_increment "synchronized_increment" + OpName %shared_value "shared_value" + OpName %local_id "local_id" + OpName %entry_0 "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %shared_value_addr "shared_value.addr" + OpName %local_id_addr "local_id.addr" + OpName %i "i" + OpName %cmp "cmp" + OpName %cmp1 "cmp1" + OpName %inc "inc" + OpName %inc2 "inc2" OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInWorkgroupId Constant OpDecorate %__spirv_BuiltInLocalInvocationId Constant - OpDecorate %synchronized_increment LinkageAttributes "synchronized_increment" Export OpDecorate %__spirv_BuiltInWorkgroupId LinkageAttributes "__spirv_BuiltInWorkgroupId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %21 Alignment 4 - OpDecorate %23 Alignment 4 - OpDecorate %24 Alignment 4 - OpDecorate %43 Alignment 4 - OpDecorate %44 Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %tid Alignment 4 + OpDecorate %shared_value_addr Alignment 4 + OpDecorate %local_id_addr Alignment 4 + OpDecorate %i Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_2 = OpConstant %uint 2 @@ -37,64 +59,64 @@ %_ptr_Input_v3uint = OpTypePointer Input %v3uint %void = OpTypeVoid %_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint - %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint + %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %_ptr_Function_uint = OpTypePointer Function %uint + %24 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint %bool = OpTypeBool - %39 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %__spirv_BuiltInWorkgroupId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input -%synchronized_increment = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %uint - %13 = OpLabel - %21 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %23 = OpVariable %_ptr_Function_uint Function - %24 = OpVariable %_ptr_Function_uint Function - OpStore %21 %11 Aligned 4 - OpStore %23 %12 Aligned 4 - OpStore %24 %uint_0 Aligned 4 - OpBranch %14 - %14 = OpLabel - %26 = OpLoad %uint %24 Aligned 4 - %29 = OpSLessThan %bool %26 %uint_2 - OpBranchConditional %29 %15 %19 - %15 = OpLabel - OpControlBarrier %uint_2 %uint_2 %uint_528 - %31 = OpLoad %uint %23 Aligned 4 - %32 = OpIEqual %bool %31 %uint_0 - OpBranchConditional %32 %16 %17 - %16 = OpLabel - %33 = OpLoad %_ptr_CrossWorkgroup_uint %21 Aligned 4 - %34 = OpLoad %uint %33 Aligned 4 - %36 = OpIAdd %uint %34 %uint_1 - OpStore %33 %36 Aligned 4 - OpBranch %17 - %17 = OpLabel - OpControlBarrier %uint_2 %uint_2 %uint_528 - OpBranch %18 - %18 = OpLabel - %37 = OpLoad %uint %24 Aligned 4 - %38 = OpIAdd %uint %37 %uint_1 - OpStore %24 %38 Aligned 4 - OpBranch %14 - %19 = OpLabel + %10 = OpFunction %void DontInline %9 + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %tid = OpVariable %_ptr_Function_uint Function + OpStore %x_addr %x Aligned 4 + %17 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 + %call = OpCompositeExtract %uint %17 0 + OpStore %tid %call Aligned 4 + %19 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %20 = OpLoad %uint %tid Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %19 %20 + %22 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 + %call1 = OpCompositeExtract %uint %22 0 + %28 = OpFunctionCall %void %synchronized_increment %arrayidx %call1 OpReturn OpFunctionEnd - %40 = OpFunction %void DontInline %39 - %41 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %42 = OpLabel - %43 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %44 = OpVariable %_ptr_Function_uint Function - OpStore %43 %41 Aligned 4 - %45 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %46 = OpCompositeExtract %uint %45 0 - OpStore %44 %46 Aligned 4 - %47 = OpLoad %_ptr_CrossWorkgroup_uint %43 Aligned 4 - %48 = OpLoad %uint %44 Aligned 4 - %49 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %47 %48 - %50 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %51 = OpCompositeExtract %uint %50 0 - %52 = OpFunctionCall %void %synchronized_increment %49 %51 +%synchronized_increment = OpFunction %void DontInline %24 +%shared_value = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %local_id = OpFunctionParameter %uint + %entry_0 = OpLabel +%shared_value_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%local_id_addr = OpVariable %_ptr_Function_uint Function + %i = OpVariable %_ptr_Function_uint Function + OpStore %shared_value_addr %shared_value Aligned 4 + OpStore %local_id_addr %local_id Aligned 4 + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %40 = OpLoad %uint %i Aligned 4 + %cmp = OpSLessThan %bool %40 %uint_2 + OpBranchConditional %cmp %for_body %for_end + %for_body = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_528 + %45 = OpLoad %uint %local_id_addr Aligned 4 + %cmp1 = OpIEqual %bool %45 %uint_0 + OpBranchConditional %cmp1 %if_then %if_end + %if_then = OpLabel + %47 = OpLoad %_ptr_CrossWorkgroup_uint %shared_value_addr Aligned 4 + %48 = OpLoad %uint %47 Aligned 4 + %inc = OpIAdd %uint %48 %uint_1 + OpStore %47 %inc Aligned 4 + OpBranch %if_end + %if_end = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_528 + OpBranch %for_inc + %for_inc = OpLabel + %51 = OpLoad %uint %i Aligned 4 + %inc2 = OpIAdd %uint %51 %uint_1 + OpStore %i %inc2 Aligned 4 + OpBranch %for_cond + %for_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-4-forall-correct.spvasm b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-4-forall-correct.spvasm index 9ce7ec7487..07018520a5 100644 --- a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-4-forall-correct.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-4-forall-correct.spvasm @@ -1,5 +1,5 @@ -; @Input: %41 = {0, 0} -; @Output: forall (%41[0]==2 and %41[1]==2) +; @Input: %x = {0, 0} +; @Output: forall (%x[0]==2 and %x[1]==2) ; @Config: 2, 1, 2 ; SPIR-V ; Version: 1.0 @@ -11,23 +11,45 @@ OpCapability Kernel %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical32 OpenCL - OpEntryPoint Kernel %40 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId + OpEntryPoint Kernel %10 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInWorkgroupId "__spirv_BuiltInWorkgroupId" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %x "x" + OpName %entry "entry" + OpName %x_addr "x.addr" + OpName %tid "tid" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" OpName %synchronized_increment "synchronized_increment" + OpName %shared_value "shared_value" + OpName %local_id "local_id" + OpName %entry_0 "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %shared_value_addr "shared_value.addr" + OpName %local_id_addr "local_id.addr" + OpName %i "i" + OpName %cmp "cmp" + OpName %cmp1 "cmp1" + OpName %inc "inc" + OpName %inc2 "inc2" OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInWorkgroupId Constant OpDecorate %__spirv_BuiltInLocalInvocationId Constant - OpDecorate %synchronized_increment LinkageAttributes "synchronized_increment" Export OpDecorate %__spirv_BuiltInWorkgroupId LinkageAttributes "__spirv_BuiltInWorkgroupId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %21 Alignment 4 - OpDecorate %23 Alignment 4 - OpDecorate %24 Alignment 4 - OpDecorate %43 Alignment 4 - OpDecorate %44 Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %tid Alignment 4 + OpDecorate %shared_value_addr Alignment 4 + OpDecorate %local_id_addr Alignment 4 + OpDecorate %i Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_2 = OpConstant %uint 2 @@ -37,64 +59,64 @@ %_ptr_Input_v3uint = OpTypePointer Input %v3uint %void = OpTypeVoid %_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint - %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint + %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %_ptr_Function_uint = OpTypePointer Function %uint + %24 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint %bool = OpTypeBool - %39 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %__spirv_BuiltInWorkgroupId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input -%synchronized_increment = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %uint - %13 = OpLabel - %21 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %23 = OpVariable %_ptr_Function_uint Function - %24 = OpVariable %_ptr_Function_uint Function - OpStore %21 %11 Aligned 4 - OpStore %23 %12 Aligned 4 - OpStore %24 %uint_0 Aligned 4 - OpBranch %14 - %14 = OpLabel - %26 = OpLoad %uint %24 Aligned 4 - %29 = OpSLessThan %bool %26 %uint_2 - OpBranchConditional %29 %15 %19 - %15 = OpLabel - OpControlBarrier %uint_2 %uint_2 %uint_528 - %31 = OpLoad %uint %23 Aligned 4 - %32 = OpIEqual %bool %31 %uint_0 - OpBranchConditional %32 %16 %17 - %16 = OpLabel - %33 = OpLoad %_ptr_CrossWorkgroup_uint %21 Aligned 4 - %34 = OpLoad %uint %33 Aligned 4 - %36 = OpIAdd %uint %34 %uint_1 - OpStore %33 %36 Aligned 4 - OpBranch %17 - %17 = OpLabel - OpControlBarrier %uint_2 %uint_2 %uint_528 - OpBranch %18 - %18 = OpLabel - %37 = OpLoad %uint %24 Aligned 4 - %38 = OpIAdd %uint %37 %uint_1 - OpStore %24 %38 Aligned 4 - OpBranch %14 - %19 = OpLabel + %10 = OpFunction %void DontInline %9 + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %tid = OpVariable %_ptr_Function_uint Function + OpStore %x_addr %x Aligned 4 + %17 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 + %call = OpCompositeExtract %uint %17 0 + OpStore %tid %call Aligned 4 + %19 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %20 = OpLoad %uint %tid Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %19 %20 + %22 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 + %call1 = OpCompositeExtract %uint %22 0 + %28 = OpFunctionCall %void %synchronized_increment %arrayidx %call1 OpReturn OpFunctionEnd - %40 = OpFunction %void DontInline %39 - %41 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %42 = OpLabel - %43 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %44 = OpVariable %_ptr_Function_uint Function - OpStore %43 %41 Aligned 4 - %45 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %46 = OpCompositeExtract %uint %45 0 - OpStore %44 %46 Aligned 4 - %47 = OpLoad %_ptr_CrossWorkgroup_uint %43 Aligned 4 - %48 = OpLoad %uint %44 Aligned 4 - %49 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %47 %48 - %50 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %51 = OpCompositeExtract %uint %50 0 - %52 = OpFunctionCall %void %synchronized_increment %49 %51 +%synchronized_increment = OpFunction %void DontInline %24 +%shared_value = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %local_id = OpFunctionParameter %uint + %entry_0 = OpLabel +%shared_value_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%local_id_addr = OpVariable %_ptr_Function_uint Function + %i = OpVariable %_ptr_Function_uint Function + OpStore %shared_value_addr %shared_value Aligned 4 + OpStore %local_id_addr %local_id Aligned 4 + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %40 = OpLoad %uint %i Aligned 4 + %cmp = OpSLessThan %bool %40 %uint_2 + OpBranchConditional %cmp %for_body %for_end + %for_body = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_528 + %45 = OpLoad %uint %local_id_addr Aligned 4 + %cmp1 = OpIEqual %bool %45 %uint_0 + OpBranchConditional %cmp1 %if_then %if_end + %if_then = OpLabel + %47 = OpLoad %_ptr_CrossWorkgroup_uint %shared_value_addr Aligned 4 + %48 = OpLoad %uint %47 Aligned 4 + %inc = OpIAdd %uint %48 %uint_1 + OpStore %47 %inc Aligned 4 + OpBranch %if_end + %if_end = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_528 + OpBranch %for_inc + %for_inc = OpLabel + %51 = OpLoad %uint %i Aligned 4 + %inc2 = OpIAdd %uint %51 %uint_1 + OpStore %i %inc2 Aligned 4 + OpBranch %for_cond + %for_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-4-forall-wrong.spvasm b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-4-forall-wrong.spvasm index 8d95fb0e9a..a5a4be6293 100644 --- a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-4-forall-wrong.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-4-forall-wrong.spvasm @@ -1,5 +1,5 @@ -; @Input: %41 = {0, 0} -; @Output: forall (%41[0]==0 and %41[1]==0) +; @Input: %x = {0, 0} +; @Output: forall (%x[0]==0 and %x[1]==0) ; @Config: 2, 1, 2 ; SPIR-V ; Version: 1.0 @@ -11,23 +11,45 @@ OpCapability Kernel %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical32 OpenCL - OpEntryPoint Kernel %40 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId + OpEntryPoint Kernel %10 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInWorkgroupId "__spirv_BuiltInWorkgroupId" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %x "x" + OpName %entry "entry" + OpName %x_addr "x.addr" + OpName %tid "tid" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" OpName %synchronized_increment "synchronized_increment" + OpName %shared_value "shared_value" + OpName %local_id "local_id" + OpName %entry_0 "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %shared_value_addr "shared_value.addr" + OpName %local_id_addr "local_id.addr" + OpName %i "i" + OpName %cmp "cmp" + OpName %cmp1 "cmp1" + OpName %inc "inc" + OpName %inc2 "inc2" OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInWorkgroupId Constant OpDecorate %__spirv_BuiltInLocalInvocationId Constant - OpDecorate %synchronized_increment LinkageAttributes "synchronized_increment" Export OpDecorate %__spirv_BuiltInWorkgroupId LinkageAttributes "__spirv_BuiltInWorkgroupId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %21 Alignment 4 - OpDecorate %23 Alignment 4 - OpDecorate %24 Alignment 4 - OpDecorate %43 Alignment 4 - OpDecorate %44 Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %tid Alignment 4 + OpDecorate %shared_value_addr Alignment 4 + OpDecorate %local_id_addr Alignment 4 + OpDecorate %i Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_2 = OpConstant %uint 2 @@ -37,64 +59,64 @@ %_ptr_Input_v3uint = OpTypePointer Input %v3uint %void = OpTypeVoid %_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint - %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint + %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %_ptr_Function_uint = OpTypePointer Function %uint + %24 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint %bool = OpTypeBool - %39 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %__spirv_BuiltInWorkgroupId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input -%synchronized_increment = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %uint - %13 = OpLabel - %21 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %23 = OpVariable %_ptr_Function_uint Function - %24 = OpVariable %_ptr_Function_uint Function - OpStore %21 %11 Aligned 4 - OpStore %23 %12 Aligned 4 - OpStore %24 %uint_0 Aligned 4 - OpBranch %14 - %14 = OpLabel - %26 = OpLoad %uint %24 Aligned 4 - %29 = OpSLessThan %bool %26 %uint_2 - OpBranchConditional %29 %15 %19 - %15 = OpLabel - OpControlBarrier %uint_2 %uint_2 %uint_528 - %31 = OpLoad %uint %23 Aligned 4 - %32 = OpIEqual %bool %31 %uint_0 - OpBranchConditional %32 %16 %17 - %16 = OpLabel - %33 = OpLoad %_ptr_CrossWorkgroup_uint %21 Aligned 4 - %34 = OpLoad %uint %33 Aligned 4 - %36 = OpIAdd %uint %34 %uint_1 - OpStore %33 %36 Aligned 4 - OpBranch %17 - %17 = OpLabel - OpControlBarrier %uint_2 %uint_2 %uint_528 - OpBranch %18 - %18 = OpLabel - %37 = OpLoad %uint %24 Aligned 4 - %38 = OpIAdd %uint %37 %uint_1 - OpStore %24 %38 Aligned 4 - OpBranch %14 - %19 = OpLabel + %10 = OpFunction %void DontInline %9 + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %tid = OpVariable %_ptr_Function_uint Function + OpStore %x_addr %x Aligned 4 + %17 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 + %call = OpCompositeExtract %uint %17 0 + OpStore %tid %call Aligned 4 + %19 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %20 = OpLoad %uint %tid Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %19 %20 + %22 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 + %call1 = OpCompositeExtract %uint %22 0 + %28 = OpFunctionCall %void %synchronized_increment %arrayidx %call1 OpReturn OpFunctionEnd - %40 = OpFunction %void DontInline %39 - %41 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %42 = OpLabel - %43 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %44 = OpVariable %_ptr_Function_uint Function - OpStore %43 %41 Aligned 4 - %45 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %46 = OpCompositeExtract %uint %45 0 - OpStore %44 %46 Aligned 4 - %47 = OpLoad %_ptr_CrossWorkgroup_uint %43 Aligned 4 - %48 = OpLoad %uint %44 Aligned 4 - %49 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %47 %48 - %50 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %51 = OpCompositeExtract %uint %50 0 - %52 = OpFunctionCall %void %synchronized_increment %49 %51 +%synchronized_increment = OpFunction %void DontInline %24 +%shared_value = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %local_id = OpFunctionParameter %uint + %entry_0 = OpLabel +%shared_value_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%local_id_addr = OpVariable %_ptr_Function_uint Function + %i = OpVariable %_ptr_Function_uint Function + OpStore %shared_value_addr %shared_value Aligned 4 + OpStore %local_id_addr %local_id Aligned 4 + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %40 = OpLoad %uint %i Aligned 4 + %cmp = OpSLessThan %bool %40 %uint_2 + OpBranchConditional %cmp %for_body %for_end + %for_body = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_528 + %45 = OpLoad %uint %local_id_addr Aligned 4 + %cmp1 = OpIEqual %bool %45 %uint_0 + OpBranchConditional %cmp1 %if_then %if_end + %if_then = OpLabel + %47 = OpLoad %_ptr_CrossWorkgroup_uint %shared_value_addr Aligned 4 + %48 = OpLoad %uint %47 Aligned 4 + %inc = OpIAdd %uint %48 %uint_1 + OpStore %47 %inc Aligned 4 + OpBranch %if_end + %if_end = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_528 + OpBranch %for_inc + %for_inc = OpLabel + %51 = OpLoad %uint %i Aligned 4 + %inc2 = OpIAdd %uint %51 %uint_1 + OpStore %i %inc2 Aligned 4 + OpBranch %for_cond + %for_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-5-exists-correct.spvasm b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-5-exists-correct.spvasm index ce01554ac1..be9b366961 100644 --- a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-5-exists-correct.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-5-exists-correct.spvasm @@ -1,5 +1,5 @@ -; @Input: %32 = {0, 0} -; @Output: exists (%32[0]==2 and %32[1]==2) +; @Input: %x = {0, 0} +; @Output: exists (%x[0]==2 and %x[1]==2) ; @Config: 2, 1, 2 ; SPIR-V ; Version: 1.0 @@ -11,90 +11,112 @@ OpCapability Kernel %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical32 OpenCL - OpEntryPoint Kernel %31 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId + OpEntryPoint Kernel %10 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInWorkgroupId "__spirv_BuiltInWorkgroupId" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %x "x" + OpName %entry "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %x_addr "x.addr" + OpName %tid "tid" + OpName %i "i" + OpName %call "call" + OpName %cmp "cmp" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" OpName %synchronized_increment "synchronized_increment" + OpName %shared_value "shared_value" + OpName %local_id "local_id" + OpName %inc "inc" + OpName %entry_0 "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %shared_value_addr "shared_value.addr" + OpName %local_id_addr "local_id.addr" + OpName %cmp_0 "cmp" + OpName %inc_0 "inc" OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInWorkgroupId Constant OpDecorate %__spirv_BuiltInLocalInvocationId Constant - OpDecorate %synchronized_increment LinkageAttributes "synchronized_increment" Export OpDecorate %__spirv_BuiltInWorkgroupId LinkageAttributes "__spirv_BuiltInWorkgroupId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %38 Alignment 4 - OpDecorate %39 Alignment 4 - OpDecorate %40 Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %tid Alignment 4 + OpDecorate %i Alignment 4 + OpDecorate %shared_value_addr Alignment 4 + OpDecorate %local_id_addr Alignment 4 %uint = OpTypeInt 32 0 - %uint_2 = OpConstant %uint 2 - %uint_528 = OpConstant %uint 528 %uint_0 = OpConstant %uint 0 + %uint_2 = OpConstant %uint 2 %uint_1 = OpConstant %uint 1 + %uint_528 = OpConstant %uint 528 %v3uint = OpTypeVector %uint 3 %_ptr_Input_v3uint = OpTypePointer Input %v3uint %void = OpTypeVoid %_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint - %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint + %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %_ptr_Function_uint = OpTypePointer Function %uint %bool = OpTypeBool - %30 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint + %34 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint %__spirv_BuiltInWorkgroupId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input -%synchronized_increment = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %uint - %13 = OpLabel - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - OpStore %17 %11 Aligned 4 - OpStore %19 %12 Aligned 4 - OpControlBarrier %uint_2 %uint_2 %uint_528 - %22 = OpLoad %uint %19 Aligned 4 - %25 = OpIEqual %bool %22 %uint_0 - OpBranchConditional %25 %14 %15 - %14 = OpLabel - %26 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %27 = OpLoad %uint %26 Aligned 4 - %29 = OpIAdd %uint %27 %uint_1 - OpStore %26 %29 Aligned 4 - OpBranch %15 - %15 = OpLabel - OpControlBarrier %uint_2 %uint_2 %uint_528 + %10 = OpFunction %void DontInline %9 + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %tid = OpVariable %_ptr_Function_uint Function + %i = OpVariable %_ptr_Function_uint Function + OpStore %x_addr %x Aligned 4 + %22 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 + %call = OpCompositeExtract %uint %22 0 + OpStore %tid %call Aligned 4 + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %25 = OpLoad %uint %i Aligned 4 + %cmp = OpSLessThan %bool %25 %uint_2 + OpBranchConditional %cmp %for_body %for_end + %for_body = OpLabel + %29 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %30 = OpLoad %uint %tid Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %29 %30 + %32 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 + %call1 = OpCompositeExtract %uint %32 0 + %38 = OpFunctionCall %void %synchronized_increment %arrayidx %call1 + OpBranch %for_inc + %for_inc = OpLabel + %39 = OpLoad %uint %i Aligned 4 + %inc = OpIAdd %uint %39 %uint_1 + OpStore %i %inc Aligned 4 + OpBranch %for_cond + %for_end = OpLabel OpReturn OpFunctionEnd - %31 = OpFunction %void DontInline %30 - %32 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %33 = OpLabel - %38 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %39 = OpVariable %_ptr_Function_uint Function - %40 = OpVariable %_ptr_Function_uint Function - OpStore %38 %32 Aligned 4 - %41 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %42 = OpCompositeExtract %uint %41 0 - OpStore %39 %42 Aligned 4 - OpStore %40 %uint_0 Aligned 4 - OpBranch %34 - %34 = OpLabel - %43 = OpLoad %uint %40 Aligned 4 - %44 = OpSLessThan %bool %43 %uint_2 - OpBranchConditional %44 %35 %37 - %35 = OpLabel - %45 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %46 = OpLoad %uint %39 Aligned 4 - %47 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %45 %46 - %48 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %49 = OpCompositeExtract %uint %48 0 - %50 = OpFunctionCall %void %synchronized_increment %47 %49 - OpBranch %36 - %36 = OpLabel - %51 = OpLoad %uint %40 Aligned 4 - %52 = OpIAdd %uint %51 %uint_1 - OpStore %40 %52 Aligned 4 - OpBranch %34 - %37 = OpLabel +%synchronized_increment = OpFunction %void DontInline %34 +%shared_value = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %local_id = OpFunctionParameter %uint + %entry_0 = OpLabel +%shared_value_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%local_id_addr = OpVariable %_ptr_Function_uint Function + OpStore %shared_value_addr %shared_value Aligned 4 + OpStore %local_id_addr %local_id Aligned 4 + OpControlBarrier %uint_2 %uint_2 %uint_528 + %48 = OpLoad %uint %local_id_addr Aligned 4 + %cmp_0 = OpIEqual %bool %48 %uint_0 + OpBranchConditional %cmp_0 %if_then %if_end + %if_then = OpLabel + %50 = OpLoad %_ptr_CrossWorkgroup_uint %shared_value_addr Aligned 4 + %51 = OpLoad %uint %50 Aligned 4 + %inc_0 = OpIAdd %uint %51 %uint_1 + OpStore %50 %inc_0 Aligned 4 + OpBranch %if_end + %if_end = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_528 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-5-exists-wrong.spvasm b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-5-exists-wrong.spvasm index 12eed75b73..f5a878abd7 100644 --- a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-5-exists-wrong.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-5-exists-wrong.spvasm @@ -1,5 +1,5 @@ -; @Input: %32 = {0, 0} -; @Output: exists (%32[0]==0 and %32[1]==0) +; @Input: %x = {0, 0} +; @Output: exists (%x[0]==0 and %x[1]==0) ; @Config: 2, 1, 2 ; SPIR-V ; Version: 1.0 @@ -11,90 +11,112 @@ OpCapability Kernel %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical32 OpenCL - OpEntryPoint Kernel %31 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId + OpEntryPoint Kernel %10 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInWorkgroupId "__spirv_BuiltInWorkgroupId" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %x "x" + OpName %entry "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %x_addr "x.addr" + OpName %tid "tid" + OpName %i "i" + OpName %call "call" + OpName %cmp "cmp" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" OpName %synchronized_increment "synchronized_increment" + OpName %shared_value "shared_value" + OpName %local_id "local_id" + OpName %inc "inc" + OpName %entry_0 "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %shared_value_addr "shared_value.addr" + OpName %local_id_addr "local_id.addr" + OpName %cmp_0 "cmp" + OpName %inc_0 "inc" OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInWorkgroupId Constant OpDecorate %__spirv_BuiltInLocalInvocationId Constant - OpDecorate %synchronized_increment LinkageAttributes "synchronized_increment" Export OpDecorate %__spirv_BuiltInWorkgroupId LinkageAttributes "__spirv_BuiltInWorkgroupId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %38 Alignment 4 - OpDecorate %39 Alignment 4 - OpDecorate %40 Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %tid Alignment 4 + OpDecorate %i Alignment 4 + OpDecorate %shared_value_addr Alignment 4 + OpDecorate %local_id_addr Alignment 4 %uint = OpTypeInt 32 0 - %uint_2 = OpConstant %uint 2 - %uint_528 = OpConstant %uint 528 %uint_0 = OpConstant %uint 0 + %uint_2 = OpConstant %uint 2 %uint_1 = OpConstant %uint 1 + %uint_528 = OpConstant %uint 528 %v3uint = OpTypeVector %uint 3 %_ptr_Input_v3uint = OpTypePointer Input %v3uint %void = OpTypeVoid %_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint - %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint + %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %_ptr_Function_uint = OpTypePointer Function %uint %bool = OpTypeBool - %30 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint + %34 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint %__spirv_BuiltInWorkgroupId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input -%synchronized_increment = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %uint - %13 = OpLabel - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - OpStore %17 %11 Aligned 4 - OpStore %19 %12 Aligned 4 - OpControlBarrier %uint_2 %uint_2 %uint_528 - %22 = OpLoad %uint %19 Aligned 4 - %25 = OpIEqual %bool %22 %uint_0 - OpBranchConditional %25 %14 %15 - %14 = OpLabel - %26 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %27 = OpLoad %uint %26 Aligned 4 - %29 = OpIAdd %uint %27 %uint_1 - OpStore %26 %29 Aligned 4 - OpBranch %15 - %15 = OpLabel - OpControlBarrier %uint_2 %uint_2 %uint_528 + %10 = OpFunction %void DontInline %9 + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %tid = OpVariable %_ptr_Function_uint Function + %i = OpVariable %_ptr_Function_uint Function + OpStore %x_addr %x Aligned 4 + %22 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 + %call = OpCompositeExtract %uint %22 0 + OpStore %tid %call Aligned 4 + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %25 = OpLoad %uint %i Aligned 4 + %cmp = OpSLessThan %bool %25 %uint_2 + OpBranchConditional %cmp %for_body %for_end + %for_body = OpLabel + %29 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %30 = OpLoad %uint %tid Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %29 %30 + %32 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 + %call1 = OpCompositeExtract %uint %32 0 + %38 = OpFunctionCall %void %synchronized_increment %arrayidx %call1 + OpBranch %for_inc + %for_inc = OpLabel + %39 = OpLoad %uint %i Aligned 4 + %inc = OpIAdd %uint %39 %uint_1 + OpStore %i %inc Aligned 4 + OpBranch %for_cond + %for_end = OpLabel OpReturn OpFunctionEnd - %31 = OpFunction %void DontInline %30 - %32 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %33 = OpLabel - %38 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %39 = OpVariable %_ptr_Function_uint Function - %40 = OpVariable %_ptr_Function_uint Function - OpStore %38 %32 Aligned 4 - %41 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %42 = OpCompositeExtract %uint %41 0 - OpStore %39 %42 Aligned 4 - OpStore %40 %uint_0 Aligned 4 - OpBranch %34 - %34 = OpLabel - %43 = OpLoad %uint %40 Aligned 4 - %44 = OpSLessThan %bool %43 %uint_2 - OpBranchConditional %44 %35 %37 - %35 = OpLabel - %45 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %46 = OpLoad %uint %39 Aligned 4 - %47 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %45 %46 - %48 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %49 = OpCompositeExtract %uint %48 0 - %50 = OpFunctionCall %void %synchronized_increment %47 %49 - OpBranch %36 - %36 = OpLabel - %51 = OpLoad %uint %40 Aligned 4 - %52 = OpIAdd %uint %51 %uint_1 - OpStore %40 %52 Aligned 4 - OpBranch %34 - %37 = OpLabel +%synchronized_increment = OpFunction %void DontInline %34 +%shared_value = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %local_id = OpFunctionParameter %uint + %entry_0 = OpLabel +%shared_value_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%local_id_addr = OpVariable %_ptr_Function_uint Function + OpStore %shared_value_addr %shared_value Aligned 4 + OpStore %local_id_addr %local_id Aligned 4 + OpControlBarrier %uint_2 %uint_2 %uint_528 + %48 = OpLoad %uint %local_id_addr Aligned 4 + %cmp_0 = OpIEqual %bool %48 %uint_0 + OpBranchConditional %cmp_0 %if_then %if_end + %if_then = OpLabel + %50 = OpLoad %_ptr_CrossWorkgroup_uint %shared_value_addr Aligned 4 + %51 = OpLoad %uint %50 Aligned 4 + %inc_0 = OpIAdd %uint %51 %uint_1 + OpStore %50 %inc_0 Aligned 4 + OpBranch %if_end + %if_end = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_528 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-5-forall-correct.spvasm b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-5-forall-correct.spvasm index e9eb1d62b0..a5eb448710 100644 --- a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-5-forall-correct.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-5-forall-correct.spvasm @@ -1,5 +1,5 @@ -; @Input: %32 = {0, 0} -; @Output: forall (%32[0]==2 and %32[1]==2) +; @Input: %x = {0, 0} +; @Output: forall (%x[0]==2 and %x[1]==2) ; @Config: 2, 1, 2 ; SPIR-V ; Version: 1.0 @@ -11,90 +11,112 @@ OpCapability Kernel %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical32 OpenCL - OpEntryPoint Kernel %31 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId + OpEntryPoint Kernel %10 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInWorkgroupId "__spirv_BuiltInWorkgroupId" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %x "x" + OpName %entry "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %x_addr "x.addr" + OpName %tid "tid" + OpName %i "i" + OpName %call "call" + OpName %cmp "cmp" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" OpName %synchronized_increment "synchronized_increment" + OpName %shared_value "shared_value" + OpName %local_id "local_id" + OpName %inc "inc" + OpName %entry_0 "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %shared_value_addr "shared_value.addr" + OpName %local_id_addr "local_id.addr" + OpName %cmp_0 "cmp" + OpName %inc_0 "inc" OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInWorkgroupId Constant OpDecorate %__spirv_BuiltInLocalInvocationId Constant - OpDecorate %synchronized_increment LinkageAttributes "synchronized_increment" Export OpDecorate %__spirv_BuiltInWorkgroupId LinkageAttributes "__spirv_BuiltInWorkgroupId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %38 Alignment 4 - OpDecorate %39 Alignment 4 - OpDecorate %40 Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %tid Alignment 4 + OpDecorate %i Alignment 4 + OpDecorate %shared_value_addr Alignment 4 + OpDecorate %local_id_addr Alignment 4 %uint = OpTypeInt 32 0 - %uint_2 = OpConstant %uint 2 - %uint_528 = OpConstant %uint 528 %uint_0 = OpConstant %uint 0 + %uint_2 = OpConstant %uint 2 %uint_1 = OpConstant %uint 1 + %uint_528 = OpConstant %uint 528 %v3uint = OpTypeVector %uint 3 %_ptr_Input_v3uint = OpTypePointer Input %v3uint %void = OpTypeVoid %_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint - %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint + %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %_ptr_Function_uint = OpTypePointer Function %uint %bool = OpTypeBool - %30 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint + %34 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint %__spirv_BuiltInWorkgroupId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input -%synchronized_increment = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %uint - %13 = OpLabel - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - OpStore %17 %11 Aligned 4 - OpStore %19 %12 Aligned 4 - OpControlBarrier %uint_2 %uint_2 %uint_528 - %22 = OpLoad %uint %19 Aligned 4 - %25 = OpIEqual %bool %22 %uint_0 - OpBranchConditional %25 %14 %15 - %14 = OpLabel - %26 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %27 = OpLoad %uint %26 Aligned 4 - %29 = OpIAdd %uint %27 %uint_1 - OpStore %26 %29 Aligned 4 - OpBranch %15 - %15 = OpLabel - OpControlBarrier %uint_2 %uint_2 %uint_528 + %10 = OpFunction %void DontInline %9 + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %tid = OpVariable %_ptr_Function_uint Function + %i = OpVariable %_ptr_Function_uint Function + OpStore %x_addr %x Aligned 4 + %22 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 + %call = OpCompositeExtract %uint %22 0 + OpStore %tid %call Aligned 4 + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %25 = OpLoad %uint %i Aligned 4 + %cmp = OpSLessThan %bool %25 %uint_2 + OpBranchConditional %cmp %for_body %for_end + %for_body = OpLabel + %29 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %30 = OpLoad %uint %tid Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %29 %30 + %32 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 + %call1 = OpCompositeExtract %uint %32 0 + %38 = OpFunctionCall %void %synchronized_increment %arrayidx %call1 + OpBranch %for_inc + %for_inc = OpLabel + %39 = OpLoad %uint %i Aligned 4 + %inc = OpIAdd %uint %39 %uint_1 + OpStore %i %inc Aligned 4 + OpBranch %for_cond + %for_end = OpLabel OpReturn OpFunctionEnd - %31 = OpFunction %void DontInline %30 - %32 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %33 = OpLabel - %38 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %39 = OpVariable %_ptr_Function_uint Function - %40 = OpVariable %_ptr_Function_uint Function - OpStore %38 %32 Aligned 4 - %41 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %42 = OpCompositeExtract %uint %41 0 - OpStore %39 %42 Aligned 4 - OpStore %40 %uint_0 Aligned 4 - OpBranch %34 - %34 = OpLabel - %43 = OpLoad %uint %40 Aligned 4 - %44 = OpSLessThan %bool %43 %uint_2 - OpBranchConditional %44 %35 %37 - %35 = OpLabel - %45 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %46 = OpLoad %uint %39 Aligned 4 - %47 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %45 %46 - %48 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %49 = OpCompositeExtract %uint %48 0 - %50 = OpFunctionCall %void %synchronized_increment %47 %49 - OpBranch %36 - %36 = OpLabel - %51 = OpLoad %uint %40 Aligned 4 - %52 = OpIAdd %uint %51 %uint_1 - OpStore %40 %52 Aligned 4 - OpBranch %34 - %37 = OpLabel +%synchronized_increment = OpFunction %void DontInline %34 +%shared_value = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %local_id = OpFunctionParameter %uint + %entry_0 = OpLabel +%shared_value_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%local_id_addr = OpVariable %_ptr_Function_uint Function + OpStore %shared_value_addr %shared_value Aligned 4 + OpStore %local_id_addr %local_id Aligned 4 + OpControlBarrier %uint_2 %uint_2 %uint_528 + %48 = OpLoad %uint %local_id_addr Aligned 4 + %cmp_0 = OpIEqual %bool %48 %uint_0 + OpBranchConditional %cmp_0 %if_then %if_end + %if_then = OpLabel + %50 = OpLoad %_ptr_CrossWorkgroup_uint %shared_value_addr Aligned 4 + %51 = OpLoad %uint %50 Aligned 4 + %inc_0 = OpIAdd %uint %51 %uint_1 + OpStore %50 %inc_0 Aligned 4 + OpBranch %if_end + %if_end = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_528 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-5-forall-wrong.spvasm b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-5-forall-wrong.spvasm index fbf5fc0f5b..b8d80d1514 100644 --- a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-5-forall-wrong.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-inlining-5-forall-wrong.spvasm @@ -1,5 +1,5 @@ -; @Input: %32 = {0, 0} -; @Output: forall (%32[0]==0 and %32[1]==0) +; @Input: %x = {0, 0} +; @Output: forall (%x[0]==0 and %x[1]==0) ; @Config: 2, 1, 2 ; SPIR-V ; Version: 1.0 @@ -11,90 +11,112 @@ OpCapability Kernel %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical32 OpenCL - OpEntryPoint Kernel %31 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId + OpEntryPoint Kernel %10 "test" %__spirv_BuiltInWorkgroupId %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInWorkgroupId "__spirv_BuiltInWorkgroupId" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %x "x" + OpName %entry "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %x_addr "x.addr" + OpName %tid "tid" + OpName %i "i" + OpName %call "call" + OpName %cmp "cmp" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" OpName %synchronized_increment "synchronized_increment" + OpName %shared_value "shared_value" + OpName %local_id "local_id" + OpName %inc "inc" + OpName %entry_0 "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %shared_value_addr "shared_value.addr" + OpName %local_id_addr "local_id.addr" + OpName %cmp_0 "cmp" + OpName %inc_0 "inc" OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInWorkgroupId Constant OpDecorate %__spirv_BuiltInLocalInvocationId Constant - OpDecorate %synchronized_increment LinkageAttributes "synchronized_increment" Export OpDecorate %__spirv_BuiltInWorkgroupId LinkageAttributes "__spirv_BuiltInWorkgroupId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %38 Alignment 4 - OpDecorate %39 Alignment 4 - OpDecorate %40 Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %tid Alignment 4 + OpDecorate %i Alignment 4 + OpDecorate %shared_value_addr Alignment 4 + OpDecorate %local_id_addr Alignment 4 %uint = OpTypeInt 32 0 - %uint_2 = OpConstant %uint 2 - %uint_528 = OpConstant %uint 528 %uint_0 = OpConstant %uint 0 + %uint_2 = OpConstant %uint 2 %uint_1 = OpConstant %uint 1 + %uint_528 = OpConstant %uint 528 %v3uint = OpTypeVector %uint 3 %_ptr_Input_v3uint = OpTypePointer Input %v3uint %void = OpTypeVoid %_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint - %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint + %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %_ptr_Function_uint = OpTypePointer Function %uint %bool = OpTypeBool - %30 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint + %34 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint %__spirv_BuiltInWorkgroupId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input -%synchronized_increment = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %uint - %13 = OpLabel - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - OpStore %17 %11 Aligned 4 - OpStore %19 %12 Aligned 4 - OpControlBarrier %uint_2 %uint_2 %uint_528 - %22 = OpLoad %uint %19 Aligned 4 - %25 = OpIEqual %bool %22 %uint_0 - OpBranchConditional %25 %14 %15 - %14 = OpLabel - %26 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %27 = OpLoad %uint %26 Aligned 4 - %29 = OpIAdd %uint %27 %uint_1 - OpStore %26 %29 Aligned 4 - OpBranch %15 - %15 = OpLabel - OpControlBarrier %uint_2 %uint_2 %uint_528 + %10 = OpFunction %void DontInline %9 + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %tid = OpVariable %_ptr_Function_uint Function + %i = OpVariable %_ptr_Function_uint Function + OpStore %x_addr %x Aligned 4 + %22 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 + %call = OpCompositeExtract %uint %22 0 + OpStore %tid %call Aligned 4 + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %25 = OpLoad %uint %i Aligned 4 + %cmp = OpSLessThan %bool %25 %uint_2 + OpBranchConditional %cmp %for_body %for_end + %for_body = OpLabel + %29 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %30 = OpLoad %uint %tid Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %29 %30 + %32 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 + %call1 = OpCompositeExtract %uint %32 0 + %38 = OpFunctionCall %void %synchronized_increment %arrayidx %call1 + OpBranch %for_inc + %for_inc = OpLabel + %39 = OpLoad %uint %i Aligned 4 + %inc = OpIAdd %uint %39 %uint_1 + OpStore %i %inc Aligned 4 + OpBranch %for_cond + %for_end = OpLabel OpReturn OpFunctionEnd - %31 = OpFunction %void DontInline %30 - %32 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %33 = OpLabel - %38 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %39 = OpVariable %_ptr_Function_uint Function - %40 = OpVariable %_ptr_Function_uint Function - OpStore %38 %32 Aligned 4 - %41 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %42 = OpCompositeExtract %uint %41 0 - OpStore %39 %42 Aligned 4 - OpStore %40 %uint_0 Aligned 4 - OpBranch %34 - %34 = OpLabel - %43 = OpLoad %uint %40 Aligned 4 - %44 = OpSLessThan %bool %43 %uint_2 - OpBranchConditional %44 %35 %37 - %35 = OpLabel - %45 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %46 = OpLoad %uint %39 Aligned 4 - %47 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %45 %46 - %48 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %49 = OpCompositeExtract %uint %48 0 - %50 = OpFunctionCall %void %synchronized_increment %47 %49 - OpBranch %36 - %36 = OpLabel - %51 = OpLoad %uint %40 Aligned 4 - %52 = OpIAdd %uint %51 %uint_1 - OpStore %40 %52 Aligned 4 - OpBranch %34 - %37 = OpLabel +%synchronized_increment = OpFunction %void DontInline %34 +%shared_value = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %local_id = OpFunctionParameter %uint + %entry_0 = OpLabel +%shared_value_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%local_id_addr = OpVariable %_ptr_Function_uint Function + OpStore %shared_value_addr %shared_value Aligned 4 + OpStore %local_id_addr %local_id Aligned 4 + OpControlBarrier %uint_2 %uint_2 %uint_528 + %48 = OpLoad %uint %local_id_addr Aligned 4 + %cmp_0 = OpIEqual %bool %48 %uint_0 + OpBranchConditional %cmp_0 %if_then %if_end + %if_then = OpLabel + %50 = OpLoad %_ptr_CrossWorkgroup_uint %shared_value_addr Aligned 4 + %51 = OpLoad %uint %50 Aligned 4 + %inc_0 = OpIAdd %uint %51 %uint_1 + OpStore %50 %inc_0 Aligned 4 + OpBranch %if_end + %if_end = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_528 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-no-inlining-1-exists-correct.spvasm b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-no-inlining-1-exists-correct.spvasm index ba5e92c331..4ed21589a1 100644 --- a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-no-inlining-1-exists-correct.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-no-inlining-1-exists-correct.spvasm @@ -1,5 +1,5 @@ -; @Input: %11 = {0, 0} -; @Output: exists (%11[0]==2 and %11[1]==2) +; @Input: %x = {0, 0} +; @Output: exists (%x[0]==2 and %x[1]==2) ; @Config: 2, 1, 2 ; SPIR-V ; Version: 1.0 @@ -15,14 +15,31 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInWorkgroupId "__spirv_BuiltInWorkgroupId" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %x "x" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %if_then4 "if.then4" + OpName %if_end7 "if.end7" + OpName %x_addr "x.addr" + OpName %tid "tid" + OpName %call "call" + OpName %call1 "call1" + OpName %cmp "cmp" + OpName %arrayidx "arrayidx" + OpName %add "add" + OpName %call2 "call2" + OpName %cmp3 "cmp3" + OpName %arrayidx5 "arrayidx5" + OpName %add6 "add6" OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInWorkgroupId Constant OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInWorkgroupId LinkageAttributes "__spirv_BuiltInWorkgroupId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %18 Alignment 4 - OpDecorate %20 Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %tid Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_528 = OpConstant %uint 528 @@ -39,42 +56,42 @@ %__spirv_BuiltInWorkgroupId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %10 = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpLabel - %18 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %20 = OpVariable %_ptr_Function_uint Function - OpStore %18 %11 Aligned 4 + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %tid = OpVariable %_ptr_Function_uint Function + OpStore %x_addr %x Aligned 4 %21 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %22 = OpCompositeExtract %uint %21 0 - OpStore %20 %22 Aligned 4 + %call = OpCompositeExtract %uint %21 0 + OpStore %tid %call Aligned 4 OpControlBarrier %uint_2 %uint_2 %uint_528 %25 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %26 = OpCompositeExtract %uint %25 0 - %29 = OpIEqual %bool %26 %uint_0 - OpBranchConditional %29 %13 %14 - %13 = OpLabel - %30 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %31 = OpLoad %uint %20 Aligned 4 - %32 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %30 %31 - %33 = OpLoad %uint %32 Aligned 4 - %35 = OpIAdd %uint %33 %uint_1 - OpStore %32 %35 Aligned 4 - OpBranch %14 - %14 = OpLabel + %call1 = OpCompositeExtract %uint %25 0 + %cmp = OpIEqual %bool %call1 %uint_0 + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel + %30 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %31 = OpLoad %uint %tid Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %30 %31 + %33 = OpLoad %uint %arrayidx Aligned 4 + %add = OpIAdd %uint %33 %uint_1 + OpStore %arrayidx %add Aligned 4 + OpBranch %if_end + %if_end = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 %36 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %37 = OpCompositeExtract %uint %36 0 - %38 = OpIEqual %bool %37 %uint_0 - OpBranchConditional %38 %15 %16 - %15 = OpLabel - %39 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %40 = OpLoad %uint %20 Aligned 4 - %41 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %39 %40 - %42 = OpLoad %uint %41 Aligned 4 - %43 = OpIAdd %uint %42 %uint_1 - OpStore %41 %43 Aligned 4 - OpBranch %16 - %16 = OpLabel + %call2 = OpCompositeExtract %uint %36 0 + %cmp3 = OpIEqual %bool %call2 %uint_0 + OpBranchConditional %cmp3 %if_then4 %if_end7 + %if_then4 = OpLabel + %39 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %40 = OpLoad %uint %tid Aligned 4 + %arrayidx5 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %39 %40 + %42 = OpLoad %uint %arrayidx5 Aligned 4 + %add6 = OpIAdd %uint %42 %uint_1 + OpStore %arrayidx5 %add6 Aligned 4 + OpBranch %if_end7 + %if_end7 = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-no-inlining-1-exists-wrong.spvasm b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-no-inlining-1-exists-wrong.spvasm index 1227f8fc66..9ee84dfead 100644 --- a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-no-inlining-1-exists-wrong.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-no-inlining-1-exists-wrong.spvasm @@ -1,5 +1,5 @@ -; @Input: %11 = {0, 0} -; @Output: exists (%11[0]==0 and %11[1]==0) +; @Input: %x = {0, 0} +; @Output: exists (%x[0]==0 and %x[1]==0) ; @Config: 2, 1, 2 ; SPIR-V ; Version: 1.0 @@ -15,14 +15,31 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInWorkgroupId "__spirv_BuiltInWorkgroupId" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %x "x" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %if_then4 "if.then4" + OpName %if_end7 "if.end7" + OpName %x_addr "x.addr" + OpName %tid "tid" + OpName %call "call" + OpName %call1 "call1" + OpName %cmp "cmp" + OpName %arrayidx "arrayidx" + OpName %add "add" + OpName %call2 "call2" + OpName %cmp3 "cmp3" + OpName %arrayidx5 "arrayidx5" + OpName %add6 "add6" OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInWorkgroupId Constant OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInWorkgroupId LinkageAttributes "__spirv_BuiltInWorkgroupId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %18 Alignment 4 - OpDecorate %20 Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %tid Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_528 = OpConstant %uint 528 @@ -39,42 +56,42 @@ %__spirv_BuiltInWorkgroupId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %10 = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpLabel - %18 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %20 = OpVariable %_ptr_Function_uint Function - OpStore %18 %11 Aligned 4 + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %tid = OpVariable %_ptr_Function_uint Function + OpStore %x_addr %x Aligned 4 %21 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %22 = OpCompositeExtract %uint %21 0 - OpStore %20 %22 Aligned 4 + %call = OpCompositeExtract %uint %21 0 + OpStore %tid %call Aligned 4 OpControlBarrier %uint_2 %uint_2 %uint_528 %25 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %26 = OpCompositeExtract %uint %25 0 - %29 = OpIEqual %bool %26 %uint_0 - OpBranchConditional %29 %13 %14 - %13 = OpLabel - %30 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %31 = OpLoad %uint %20 Aligned 4 - %32 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %30 %31 - %33 = OpLoad %uint %32 Aligned 4 - %35 = OpIAdd %uint %33 %uint_1 - OpStore %32 %35 Aligned 4 - OpBranch %14 - %14 = OpLabel + %call1 = OpCompositeExtract %uint %25 0 + %cmp = OpIEqual %bool %call1 %uint_0 + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel + %30 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %31 = OpLoad %uint %tid Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %30 %31 + %33 = OpLoad %uint %arrayidx Aligned 4 + %add = OpIAdd %uint %33 %uint_1 + OpStore %arrayidx %add Aligned 4 + OpBranch %if_end + %if_end = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 %36 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %37 = OpCompositeExtract %uint %36 0 - %38 = OpIEqual %bool %37 %uint_0 - OpBranchConditional %38 %15 %16 - %15 = OpLabel - %39 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %40 = OpLoad %uint %20 Aligned 4 - %41 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %39 %40 - %42 = OpLoad %uint %41 Aligned 4 - %43 = OpIAdd %uint %42 %uint_1 - OpStore %41 %43 Aligned 4 - OpBranch %16 - %16 = OpLabel + %call2 = OpCompositeExtract %uint %36 0 + %cmp3 = OpIEqual %bool %call2 %uint_0 + OpBranchConditional %cmp3 %if_then4 %if_end7 + %if_then4 = OpLabel + %39 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %40 = OpLoad %uint %tid Aligned 4 + %arrayidx5 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %39 %40 + %42 = OpLoad %uint %arrayidx5 Aligned 4 + %add6 = OpIAdd %uint %42 %uint_1 + OpStore %arrayidx5 %add6 Aligned 4 + OpBranch %if_end7 + %if_end7 = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-no-inlining-1-forall-correct.spvasm b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-no-inlining-1-forall-correct.spvasm index f528f7fcd8..9cb32ef38e 100644 --- a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-no-inlining-1-forall-correct.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-no-inlining-1-forall-correct.spvasm @@ -1,5 +1,5 @@ -; @Input: %11 = {0, 0} -; @Output: forall (%11[0]==2 and %11[1]==2) +; @Input: %x = {0, 0} +; @Output: forall (%x[0]==2 and %x[1]==2) ; @Config: 2, 1, 2 ; SPIR-V ; Version: 1.0 @@ -15,14 +15,31 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInWorkgroupId "__spirv_BuiltInWorkgroupId" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %x "x" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %if_then4 "if.then4" + OpName %if_end7 "if.end7" + OpName %x_addr "x.addr" + OpName %tid "tid" + OpName %call "call" + OpName %call1 "call1" + OpName %cmp "cmp" + OpName %arrayidx "arrayidx" + OpName %add "add" + OpName %call2 "call2" + OpName %cmp3 "cmp3" + OpName %arrayidx5 "arrayidx5" + OpName %add6 "add6" OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInWorkgroupId Constant OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInWorkgroupId LinkageAttributes "__spirv_BuiltInWorkgroupId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %18 Alignment 4 - OpDecorate %20 Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %tid Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_528 = OpConstant %uint 528 @@ -39,42 +56,42 @@ %__spirv_BuiltInWorkgroupId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %10 = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpLabel - %18 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %20 = OpVariable %_ptr_Function_uint Function - OpStore %18 %11 Aligned 4 + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %tid = OpVariable %_ptr_Function_uint Function + OpStore %x_addr %x Aligned 4 %21 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %22 = OpCompositeExtract %uint %21 0 - OpStore %20 %22 Aligned 4 + %call = OpCompositeExtract %uint %21 0 + OpStore %tid %call Aligned 4 OpControlBarrier %uint_2 %uint_2 %uint_528 %25 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %26 = OpCompositeExtract %uint %25 0 - %29 = OpIEqual %bool %26 %uint_0 - OpBranchConditional %29 %13 %14 - %13 = OpLabel - %30 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %31 = OpLoad %uint %20 Aligned 4 - %32 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %30 %31 - %33 = OpLoad %uint %32 Aligned 4 - %35 = OpIAdd %uint %33 %uint_1 - OpStore %32 %35 Aligned 4 - OpBranch %14 - %14 = OpLabel + %call1 = OpCompositeExtract %uint %25 0 + %cmp = OpIEqual %bool %call1 %uint_0 + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel + %30 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %31 = OpLoad %uint %tid Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %30 %31 + %33 = OpLoad %uint %arrayidx Aligned 4 + %add = OpIAdd %uint %33 %uint_1 + OpStore %arrayidx %add Aligned 4 + OpBranch %if_end + %if_end = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 %36 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %37 = OpCompositeExtract %uint %36 0 - %38 = OpIEqual %bool %37 %uint_0 - OpBranchConditional %38 %15 %16 - %15 = OpLabel - %39 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %40 = OpLoad %uint %20 Aligned 4 - %41 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %39 %40 - %42 = OpLoad %uint %41 Aligned 4 - %43 = OpIAdd %uint %42 %uint_1 - OpStore %41 %43 Aligned 4 - OpBranch %16 - %16 = OpLabel + %call2 = OpCompositeExtract %uint %36 0 + %cmp3 = OpIEqual %bool %call2 %uint_0 + OpBranchConditional %cmp3 %if_then4 %if_end7 + %if_then4 = OpLabel + %39 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %40 = OpLoad %uint %tid Aligned 4 + %arrayidx5 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %39 %40 + %42 = OpLoad %uint %arrayidx5 Aligned 4 + %add6 = OpIAdd %uint %42 %uint_1 + OpStore %arrayidx5 %add6 Aligned 4 + OpBranch %if_end7 + %if_end7 = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-no-inlining-1-forall-wrong.spvasm b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-no-inlining-1-forall-wrong.spvasm index e50243ceec..db45575028 100644 --- a/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-no-inlining-1-forall-wrong.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/barrier/inlining/barrier-no-inlining-1-forall-wrong.spvasm @@ -1,5 +1,5 @@ -; @Input: %11 = {0, 0} -; @Output: forall (%11[0]==0 and %11[1]==0) +; @Input: %x = {0, 0} +; @Output: forall (%x[0]==0 and %x[1]==0) ; @Config: 2, 1, 2 ; SPIR-V ; Version: 1.0 @@ -15,14 +15,31 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInWorkgroupId "__spirv_BuiltInWorkgroupId" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %x "x" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %if_then4 "if.then4" + OpName %if_end7 "if.end7" + OpName %x_addr "x.addr" + OpName %tid "tid" + OpName %call "call" + OpName %call1 "call1" + OpName %cmp "cmp" + OpName %arrayidx "arrayidx" + OpName %add "add" + OpName %call2 "call2" + OpName %cmp3 "cmp3" + OpName %arrayidx5 "arrayidx5" + OpName %add6 "add6" OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInWorkgroupId Constant OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInWorkgroupId LinkageAttributes "__spirv_BuiltInWorkgroupId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %18 Alignment 4 - OpDecorate %20 Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %tid Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_528 = OpConstant %uint 528 @@ -39,42 +56,42 @@ %__spirv_BuiltInWorkgroupId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %10 = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpLabel - %18 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %20 = OpVariable %_ptr_Function_uint Function - OpStore %18 %11 Aligned 4 + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %tid = OpVariable %_ptr_Function_uint Function + OpStore %x_addr %x Aligned 4 %21 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %22 = OpCompositeExtract %uint %21 0 - OpStore %20 %22 Aligned 4 + %call = OpCompositeExtract %uint %21 0 + OpStore %tid %call Aligned 4 OpControlBarrier %uint_2 %uint_2 %uint_528 %25 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %26 = OpCompositeExtract %uint %25 0 - %29 = OpIEqual %bool %26 %uint_0 - OpBranchConditional %29 %13 %14 - %13 = OpLabel - %30 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %31 = OpLoad %uint %20 Aligned 4 - %32 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %30 %31 - %33 = OpLoad %uint %32 Aligned 4 - %35 = OpIAdd %uint %33 %uint_1 - OpStore %32 %35 Aligned 4 - OpBranch %14 - %14 = OpLabel + %call1 = OpCompositeExtract %uint %25 0 + %cmp = OpIEqual %bool %call1 %uint_0 + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel + %30 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %31 = OpLoad %uint %tid Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %30 %31 + %33 = OpLoad %uint %arrayidx Aligned 4 + %add = OpIAdd %uint %33 %uint_1 + OpStore %arrayidx %add Aligned 4 + OpBranch %if_end + %if_end = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 %36 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %37 = OpCompositeExtract %uint %36 0 - %38 = OpIEqual %bool %37 %uint_0 - OpBranchConditional %38 %15 %16 - %15 = OpLabel - %39 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %40 = OpLoad %uint %20 Aligned 4 - %41 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %39 %40 - %42 = OpLoad %uint %41 Aligned 4 - %43 = OpIAdd %uint %42 %uint_1 - OpStore %41 %43 Aligned 4 - OpBranch %16 - %16 = OpLabel + %call2 = OpCompositeExtract %uint %36 0 + %cmp3 = OpIEqual %bool %call2 %uint_0 + OpBranchConditional %cmp3 %if_then4 %if_end7 + %if_then4 = OpLabel + %39 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %40 = OpLoad %uint %tid Aligned 4 + %arrayidx5 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %39 %40 + %42 = OpLoad %uint %arrayidx5 Aligned 4 + %add6 = OpIAdd %uint %42 %uint_1 + OpStore %arrayidx5 %add6 Aligned 4 + OpBranch %if_end7 + %if_end7 = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/benchmarks/caslock-1.1.2.spvasm b/dartagnan/src/test/resources/spirv/opencl/benchmarks/caslock-1.1.2.spvasm index d6d35be41a..954e20fc68 100644 --- a/dartagnan/src/test/resources/spirv/opencl/benchmarks/caslock-1.1.2.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/benchmarks/caslock-1.1.2.spvasm @@ -1,7 +1,7 @@ -; @Input: %10 = {0} -; @Input: %11 = {0} -; @Input: %12 = {-1, -1} -; @Output: forall (%12[0] == -1 or %12[1] == -1 or %12[0] != %12[1]) +; @Input: %l = {0} +; @Input: %x = {0} +; @Input: %A = {-1, -1} +; @Output: forall (%A[0] == -1 or %A[1] == -1 or %A[0] != %A[1]) ; @Config: 1, 1, 2 ; SPIR-V ; Version: 1.0 @@ -17,19 +17,45 @@ OpEntryPoint Kernel %9 "mutex_test" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %l "l" + OpName %x "x" + OpName %A "A" + OpName %entry "entry" + OpName %l_addr "l.addr" + OpName %x_addr "x.addr" + OpName %A_addr "A.addr" + OpName %a "a" OpName %lock "lock" + OpName %l_0 "l" + OpName %add "add" OpName %unlock "unlock" + OpName %l_1 "l" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %entry_0 "entry" + OpName %while_cond "while.cond" + OpName %while_body "while.body" + OpName %while_end "while.end" + OpName %l_addr_0 "l.addr" + OpName %e "e" + OpName %e_ascast "e.ascast" OpName %exp "exp" + OpName %call1 "call1" + OpName %call_0 "call" + OpName %conv "conv" + OpName %cmp "cmp" + OpName %entry_1 "entry" + OpName %l_addr_1 "l.addr" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %15 Alignment 4 - OpDecorate %16 Alignment 4 - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %44 Alignment 4 - OpDecorate %45 Alignment 4 - OpDecorate %59 Alignment 4 + OpDecorate %l_addr Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %a Alignment 4 + OpDecorate %l_addr_0 Alignment 4 + OpDecorate %e Alignment 4 + OpDecorate %l_addr_1 Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 @@ -47,67 +73,67 @@ %bool = OpTypeBool %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpLabel - %15 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %16 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - OpStore %15 %10 Aligned 4 - OpStore %16 %11 Aligned 4 - OpStore %17 %12 Aligned 4 - %20 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 + %l = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %l_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %a = OpVariable %_ptr_Function_uint Function + OpStore %l_addr %l Aligned 4 + OpStore %x_addr %x Aligned 4 + OpStore %A_addr %A Aligned 4 + %20 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 %24 = OpFunctionCall %void %lock %20 - %25 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 + %25 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 %26 = OpLoad %uint %25 Aligned 4 - OpStore %19 %26 Aligned 4 - %27 = OpLoad %uint %19 Aligned 4 - %29 = OpIAdd %uint %27 %uint_1 - %30 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 - OpStore %30 %29 Aligned 4 - %31 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 + OpStore %a %26 Aligned 4 + %27 = OpLoad %uint %a Aligned 4 + %add = OpIAdd %uint %27 %uint_1 + %30 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + OpStore %30 %add Aligned 4 + %31 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 %34 = OpFunctionCall %void %unlock %31 - %35 = OpLoad %uint %19 Aligned 4 - %36 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 + %35 = OpLoad %uint %a Aligned 4 + %36 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %37 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %38 = OpCompositeExtract %uint %37 0 - %39 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %38 - OpStore %39 %35 Aligned 4 + %call = OpCompositeExtract %uint %37 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %call + OpStore %arrayidx %35 Aligned 4 OpReturn OpFunctionEnd %lock = OpFunction %void DontInline %21 - %23 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %40 = OpLabel - %44 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %45 = OpVariable %_ptr_Function_uint Function - OpStore %44 %23 Aligned 4 - OpStore %45 %uint_0 Aligned 4 - OpBranch %41 - %41 = OpLabel - %47 = OpLoad %_ptr_CrossWorkgroup_uint %44 Aligned 4 + %l_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_0 = OpLabel + %l_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %e = OpVariable %_ptr_Function_uint Function + OpStore %l_addr_0 %l_0 Aligned 4 + OpStore %e %uint_0 Aligned 4 + OpBranch %while_cond + %while_cond = OpLabel + %47 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 %49 = OpPtrCastToGeneric %_ptr_Generic_uint %47 - %50 = OpPtrCastToGeneric %_ptr_Generic_uint %45 - %exp = OpLoad %uint %50 Aligned 4 - %53 = OpAtomicCompareExchange %uint %49 %uint_1 %uint_2 %uint_2 %uint_1 %exp - OpStore %50 %53 Aligned 4 - %55 = OpIEqual %bool %53 %exp - %56 = OpSelect %uint %55 %uint_1 %uint_0 - %57 = OpIEqual %bool %56 %uint_0 - OpBranchConditional %57 %42 %43 - %42 = OpLabel - OpStore %45 %uint_0 Aligned 4 - OpBranch %41 - %43 = OpLabel + %e_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %e + %exp = OpLoad %uint %e_ascast Aligned 4 + %call1 = OpAtomicCompareExchange %uint %49 %uint_1 %uint_2 %uint_2 %uint_1 %exp + OpStore %e_ascast %call1 Aligned 4 + %call_0 = OpIEqual %bool %call1 %exp + %conv = OpSelect %uint %call_0 %uint_1 %uint_0 + %cmp = OpIEqual %bool %conv %uint_0 + OpBranchConditional %cmp %while_body %while_end + %while_body = OpLabel + OpStore %e %uint_0 Aligned 4 + OpBranch %while_cond + %while_end = OpLabel OpReturn OpFunctionEnd %unlock = OpFunction %void DontInline %21 - %33 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %58 = OpLabel - %59 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %59 %33 Aligned 4 - %60 = OpLoad %_ptr_CrossWorkgroup_uint %59 Aligned 4 + %l_1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_1 = OpLabel + %l_addr_1 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_1 %l_1 Aligned 4 + %60 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_1 Aligned 4 %61 = OpPtrCastToGeneric %_ptr_Generic_uint %60 OpAtomicStore %61 %uint_1 %uint_4 %uint_0 OpReturn diff --git a/dartagnan/src/test/resources/spirv/opencl/benchmarks/caslock-2.1.1.spvasm b/dartagnan/src/test/resources/spirv/opencl/benchmarks/caslock-2.1.1.spvasm index 4dfa5821f0..3760405e53 100644 --- a/dartagnan/src/test/resources/spirv/opencl/benchmarks/caslock-2.1.1.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/benchmarks/caslock-2.1.1.spvasm @@ -1,7 +1,7 @@ -; @Input: %10 = {0} -; @Input: %11 = {0} -; @Input: %12 = {-1, -1} -; @Output: forall (%12[0] == -1 or %12[1] == -1 or %12[0] != %12[1]) +; @Input: %l = {0} +; @Input: %x = {0} +; @Input: %A = {-1, -1} +; @Output: forall (%A[0] == -1 or %A[1] == -1 or %A[0] != %A[1]) ; @Config: 2, 1, 1 ; SPIR-V ; Version: 1.0 @@ -17,19 +17,45 @@ OpEntryPoint Kernel %9 "mutex_test" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %l "l" + OpName %x "x" + OpName %A "A" + OpName %entry "entry" + OpName %l_addr "l.addr" + OpName %x_addr "x.addr" + OpName %A_addr "A.addr" + OpName %a "a" OpName %lock "lock" + OpName %l_0 "l" + OpName %add "add" OpName %unlock "unlock" + OpName %l_1 "l" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %entry_0 "entry" + OpName %while_cond "while.cond" + OpName %while_body "while.body" + OpName %while_end "while.end" + OpName %l_addr_0 "l.addr" + OpName %e "e" + OpName %e_ascast "e.ascast" OpName %exp "exp" + OpName %call1 "call1" + OpName %call_0 "call" + OpName %conv "conv" + OpName %cmp "cmp" + OpName %entry_1 "entry" + OpName %l_addr_1 "l.addr" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %15 Alignment 4 - OpDecorate %16 Alignment 4 - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %44 Alignment 4 - OpDecorate %45 Alignment 4 - OpDecorate %59 Alignment 4 + OpDecorate %l_addr Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %a Alignment 4 + OpDecorate %l_addr_0 Alignment 4 + OpDecorate %e Alignment 4 + OpDecorate %l_addr_1 Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 @@ -47,67 +73,67 @@ %bool = OpTypeBool %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpLabel - %15 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %16 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - OpStore %15 %10 Aligned 4 - OpStore %16 %11 Aligned 4 - OpStore %17 %12 Aligned 4 - %20 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 + %l = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %l_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %a = OpVariable %_ptr_Function_uint Function + OpStore %l_addr %l Aligned 4 + OpStore %x_addr %x Aligned 4 + OpStore %A_addr %A Aligned 4 + %20 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 %24 = OpFunctionCall %void %lock %20 - %25 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 + %25 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 %26 = OpLoad %uint %25 Aligned 4 - OpStore %19 %26 Aligned 4 - %27 = OpLoad %uint %19 Aligned 4 - %29 = OpIAdd %uint %27 %uint_1 - %30 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 - OpStore %30 %29 Aligned 4 - %31 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 + OpStore %a %26 Aligned 4 + %27 = OpLoad %uint %a Aligned 4 + %add = OpIAdd %uint %27 %uint_1 + %30 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + OpStore %30 %add Aligned 4 + %31 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 %34 = OpFunctionCall %void %unlock %31 - %35 = OpLoad %uint %19 Aligned 4 - %36 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 + %35 = OpLoad %uint %a Aligned 4 + %36 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %37 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %38 = OpCompositeExtract %uint %37 0 - %39 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %38 - OpStore %39 %35 Aligned 4 + %call = OpCompositeExtract %uint %37 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %call + OpStore %arrayidx %35 Aligned 4 OpReturn OpFunctionEnd %lock = OpFunction %void DontInline %21 - %23 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %40 = OpLabel - %44 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %45 = OpVariable %_ptr_Function_uint Function - OpStore %44 %23 Aligned 4 - OpStore %45 %uint_0 Aligned 4 - OpBranch %41 - %41 = OpLabel - %47 = OpLoad %_ptr_CrossWorkgroup_uint %44 Aligned 4 + %l_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_0 = OpLabel + %l_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %e = OpVariable %_ptr_Function_uint Function + OpStore %l_addr_0 %l_0 Aligned 4 + OpStore %e %uint_0 Aligned 4 + OpBranch %while_cond + %while_cond = OpLabel + %47 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 %49 = OpPtrCastToGeneric %_ptr_Generic_uint %47 - %50 = OpPtrCastToGeneric %_ptr_Generic_uint %45 - %exp = OpLoad %uint %50 Aligned 4 - %53 = OpAtomicCompareExchange %uint %49 %uint_1 %uint_2 %uint_2 %uint_1 %exp - OpStore %50 %53 Aligned 4 - %55 = OpIEqual %bool %53 %exp - %56 = OpSelect %uint %55 %uint_1 %uint_0 - %57 = OpIEqual %bool %56 %uint_0 - OpBranchConditional %57 %42 %43 - %42 = OpLabel - OpStore %45 %uint_0 Aligned 4 - OpBranch %41 - %43 = OpLabel + %e_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %e + %exp = OpLoad %uint %e_ascast Aligned 4 + %call1 = OpAtomicCompareExchange %uint %49 %uint_1 %uint_2 %uint_2 %uint_1 %exp + OpStore %e_ascast %call1 Aligned 4 + %call_0 = OpIEqual %bool %call1 %exp + %conv = OpSelect %uint %call_0 %uint_1 %uint_0 + %cmp = OpIEqual %bool %conv %uint_0 + OpBranchConditional %cmp %while_body %while_end + %while_body = OpLabel + OpStore %e %uint_0 Aligned 4 + OpBranch %while_cond + %while_end = OpLabel OpReturn OpFunctionEnd %unlock = OpFunction %void DontInline %21 - %33 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %58 = OpLabel - %59 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %59 %33 Aligned 4 - %60 = OpLoad %_ptr_CrossWorkgroup_uint %59 Aligned 4 + %l_1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_1 = OpLabel + %l_addr_1 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_1 %l_1 Aligned 4 + %60 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_1 Aligned 4 %61 = OpPtrCastToGeneric %_ptr_Generic_uint %60 OpAtomicStore %61 %uint_1 %uint_4 %uint_0 OpReturn diff --git a/dartagnan/src/test/resources/spirv/opencl/benchmarks/caslock-acq2rx.spvasm b/dartagnan/src/test/resources/spirv/opencl/benchmarks/caslock-acq2rx.spvasm index 3781f3048c..f0db9caf28 100644 --- a/dartagnan/src/test/resources/spirv/opencl/benchmarks/caslock-acq2rx.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/benchmarks/caslock-acq2rx.spvasm @@ -1,7 +1,7 @@ -; @Input: %10 = {0} -; @Input: %11 = {0} -; @Input: %12 = {-1, -1} -; @Output: forall (%12[0] == -1 or %12[1] == -1 or %12[0] != %12[1]) +; @Input: %l = {0} +; @Input: %s = {0} +; @Input: %A = {-1, -1} +; @Output: forall (%A[0] == -1 or %A[1] == -1 or %A[0] != %A[1]) ; @Config: 2, 1, 1 ; SPIR-V ; Version: 1.0 @@ -17,19 +17,45 @@ OpEntryPoint Kernel %9 "mutex_test" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %l "l" + OpName %x "x" + OpName %A "A" + OpName %entry "entry" + OpName %l_addr "l.addr" + OpName %x_addr "x.addr" + OpName %A_addr "A.addr" + OpName %a "a" OpName %lock "lock" + OpName %l_0 "l" + OpName %add "add" OpName %unlock "unlock" + OpName %l_1 "l" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %entry_0 "entry" + OpName %while_cond "while.cond" + OpName %while_body "while.body" + OpName %while_end "while.end" + OpName %l_addr_0 "l.addr" + OpName %e "e" + OpName %e_ascast "e.ascast" OpName %exp "exp" + OpName %call1 "call1" + OpName %call_0 "call" + OpName %conv "conv" + OpName %cmp "cmp" + OpName %entry_1 "entry" + OpName %l_addr_1 "l.addr" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %15 Alignment 4 - OpDecorate %16 Alignment 4 - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %44 Alignment 4 - OpDecorate %45 Alignment 4 - OpDecorate %58 Alignment 4 + OpDecorate %l_addr Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %a Alignment 4 + OpDecorate %l_addr_0 Alignment 4 + OpDecorate %e Alignment 4 + OpDecorate %l_addr_1 Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 @@ -46,67 +72,67 @@ %bool = OpTypeBool %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpLabel - %15 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %16 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - OpStore %15 %10 Aligned 4 - OpStore %16 %11 Aligned 4 - OpStore %17 %12 Aligned 4 - %20 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 + %l = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %l_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %a = OpVariable %_ptr_Function_uint Function + OpStore %l_addr %l Aligned 4 + OpStore %x_addr %x Aligned 4 + OpStore %A_addr %A Aligned 4 + %20 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 %24 = OpFunctionCall %void %lock %20 - %25 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 + %25 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 %26 = OpLoad %uint %25 Aligned 4 - OpStore %19 %26 Aligned 4 - %27 = OpLoad %uint %19 Aligned 4 - %29 = OpIAdd %uint %27 %uint_1 - %30 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 - OpStore %30 %29 Aligned 4 - %31 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 + OpStore %a %26 Aligned 4 + %27 = OpLoad %uint %a Aligned 4 + %add = OpIAdd %uint %27 %uint_1 + %30 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + OpStore %30 %add Aligned 4 + %31 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 %34 = OpFunctionCall %void %unlock %31 - %35 = OpLoad %uint %19 Aligned 4 - %36 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 + %35 = OpLoad %uint %a Aligned 4 + %36 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %37 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %38 = OpCompositeExtract %uint %37 0 - %39 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %38 - OpStore %39 %35 Aligned 4 + %call = OpCompositeExtract %uint %37 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %call + OpStore %arrayidx %35 Aligned 4 OpReturn OpFunctionEnd %lock = OpFunction %void DontInline %21 - %23 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %40 = OpLabel - %44 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %45 = OpVariable %_ptr_Function_uint Function - OpStore %44 %23 Aligned 4 - OpStore %45 %uint_0 Aligned 4 - OpBranch %41 - %41 = OpLabel - %47 = OpLoad %_ptr_CrossWorkgroup_uint %44 Aligned 4 + %l_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_0 = OpLabel + %l_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %e = OpVariable %_ptr_Function_uint Function + OpStore %l_addr_0 %l_0 Aligned 4 + OpStore %e %uint_0 Aligned 4 + OpBranch %while_cond + %while_cond = OpLabel + %47 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 %49 = OpPtrCastToGeneric %_ptr_Generic_uint %47 - %50 = OpPtrCastToGeneric %_ptr_Generic_uint %45 - %exp = OpLoad %uint %50 Aligned 4 - %52 = OpAtomicCompareExchange %uint %49 %uint_1 %uint_0 %uint_0 %uint_1 %exp - OpStore %50 %52 Aligned 4 - %54 = OpIEqual %bool %52 %exp - %55 = OpSelect %uint %54 %uint_1 %uint_0 - %56 = OpIEqual %bool %55 %uint_0 - OpBranchConditional %56 %42 %43 - %42 = OpLabel - OpStore %45 %uint_0 Aligned 4 - OpBranch %41 - %43 = OpLabel + %e_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %e + %exp = OpLoad %uint %e_ascast Aligned 4 + %call1 = OpAtomicCompareExchange %uint %49 %uint_1 %uint_0 %uint_0 %uint_1 %exp + OpStore %e_ascast %call1 Aligned 4 + %call_0 = OpIEqual %bool %call1 %exp + %conv = OpSelect %uint %call_0 %uint_1 %uint_0 + %cmp = OpIEqual %bool %conv %uint_0 + OpBranchConditional %cmp %while_body %while_end + %while_body = OpLabel + OpStore %e %uint_0 Aligned 4 + OpBranch %while_cond + %while_end = OpLabel OpReturn OpFunctionEnd %unlock = OpFunction %void DontInline %21 - %33 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %57 = OpLabel - %58 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %58 %33 Aligned 4 - %59 = OpLoad %_ptr_CrossWorkgroup_uint %58 Aligned 4 + %l_1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_1 = OpLabel + %l_addr_1 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_1 %l_1 Aligned 4 + %59 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_1 Aligned 4 %60 = OpPtrCastToGeneric %_ptr_Generic_uint %59 OpAtomicStore %60 %uint_1 %uint_4 %uint_0 OpReturn diff --git a/dartagnan/src/test/resources/spirv/opencl/benchmarks/caslock-dv2wg-1.1.2.spvasm b/dartagnan/src/test/resources/spirv/opencl/benchmarks/caslock-dv2wg-1.1.2.spvasm index 2e3d146d55..0c47568b84 100644 --- a/dartagnan/src/test/resources/spirv/opencl/benchmarks/caslock-dv2wg-1.1.2.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/benchmarks/caslock-dv2wg-1.1.2.spvasm @@ -1,7 +1,7 @@ -; @Input: %10 = {0} -; @Input: %11 = {0} -; @Input: %12 = {-1, -1} -; @Output: forall (%12[0] == -1 or %12[1] == -1 or %12[0] != %12[1]) +; @Input: %l = {0} +; @Input: %s = {0} +; @Input: %A = {-1, -1} +; @Output: forall (%A[0] == -1 or %A[1] == -1 or %A[0] != %A[1]) ; @Config: 1, 1, 2 ; SPIR-V ; Version: 1.0 @@ -17,19 +17,45 @@ OpEntryPoint Kernel %9 "mutex_test" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %l "l" + OpName %x "x" + OpName %A "A" + OpName %entry "entry" + OpName %l_addr "l.addr" + OpName %x_addr "x.addr" + OpName %A_addr "A.addr" + OpName %a "a" OpName %lock "lock" + OpName %l_0 "l" + OpName %add "add" OpName %unlock "unlock" + OpName %l_1 "l" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %entry_0 "entry" + OpName %while_cond "while.cond" + OpName %while_body "while.body" + OpName %while_end "while.end" + OpName %l_addr_0 "l.addr" + OpName %e "e" + OpName %e_ascast "e.ascast" OpName %exp "exp" + OpName %call1 "call1" + OpName %call_0 "call" + OpName %conv "conv" + OpName %cmp "cmp" + OpName %entry_1 "entry" + OpName %l_addr_1 "l.addr" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %15 Alignment 4 - OpDecorate %16 Alignment 4 - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %44 Alignment 4 - OpDecorate %45 Alignment 4 - OpDecorate %59 Alignment 4 + OpDecorate %l_addr Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %a Alignment 4 + OpDecorate %l_addr_0 Alignment 4 + OpDecorate %e Alignment 4 + OpDecorate %l_addr_1 Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 @@ -47,67 +73,67 @@ %bool = OpTypeBool %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpLabel - %15 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %16 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - OpStore %15 %10 Aligned 4 - OpStore %16 %11 Aligned 4 - OpStore %17 %12 Aligned 4 - %20 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 + %l = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %l_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %a = OpVariable %_ptr_Function_uint Function + OpStore %l_addr %l Aligned 4 + OpStore %x_addr %x Aligned 4 + OpStore %A_addr %A Aligned 4 + %20 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 %24 = OpFunctionCall %void %lock %20 - %25 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 + %25 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 %26 = OpLoad %uint %25 Aligned 4 - OpStore %19 %26 Aligned 4 - %27 = OpLoad %uint %19 Aligned 4 - %29 = OpIAdd %uint %27 %uint_1 - %30 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 - OpStore %30 %29 Aligned 4 - %31 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 + OpStore %a %26 Aligned 4 + %27 = OpLoad %uint %a Aligned 4 + %add = OpIAdd %uint %27 %uint_1 + %30 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + OpStore %30 %add Aligned 4 + %31 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 %34 = OpFunctionCall %void %unlock %31 - %35 = OpLoad %uint %19 Aligned 4 - %36 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 + %35 = OpLoad %uint %a Aligned 4 + %36 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %37 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %38 = OpCompositeExtract %uint %37 0 - %39 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %38 - OpStore %39 %35 Aligned 4 + %call = OpCompositeExtract %uint %37 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %call + OpStore %arrayidx %35 Aligned 4 OpReturn OpFunctionEnd %lock = OpFunction %void DontInline %21 - %23 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %40 = OpLabel - %44 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %45 = OpVariable %_ptr_Function_uint Function - OpStore %44 %23 Aligned 4 - OpStore %45 %uint_0 Aligned 4 - OpBranch %41 - %41 = OpLabel - %47 = OpLoad %_ptr_CrossWorkgroup_uint %44 Aligned 4 + %l_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_0 = OpLabel + %l_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %e = OpVariable %_ptr_Function_uint Function + OpStore %l_addr_0 %l_0 Aligned 4 + OpStore %e %uint_0 Aligned 4 + OpBranch %while_cond + %while_cond = OpLabel + %47 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 %49 = OpPtrCastToGeneric %_ptr_Generic_uint %47 - %50 = OpPtrCastToGeneric %_ptr_Generic_uint %45 - %exp = OpLoad %uint %50 Aligned 4 - %53 = OpAtomicCompareExchange %uint %49 %uint_2 %uint_2 %uint_2 %uint_1 %exp - OpStore %50 %53 Aligned 4 - %55 = OpIEqual %bool %53 %exp - %56 = OpSelect %uint %55 %uint_1 %uint_0 - %57 = OpIEqual %bool %56 %uint_0 - OpBranchConditional %57 %42 %43 - %42 = OpLabel - OpStore %45 %uint_0 Aligned 4 - OpBranch %41 - %43 = OpLabel + %e_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %e + %exp = OpLoad %uint %e_ascast Aligned 4 + %call1 = OpAtomicCompareExchange %uint %49 %uint_2 %uint_2 %uint_2 %uint_1 %exp + OpStore %e_ascast %call1 Aligned 4 + %call_0 = OpIEqual %bool %call1 %exp + %conv = OpSelect %uint %call_0 %uint_1 %uint_0 + %cmp = OpIEqual %bool %conv %uint_0 + OpBranchConditional %cmp %while_body %while_end + %while_body = OpLabel + OpStore %e %uint_0 Aligned 4 + OpBranch %while_cond + %while_end = OpLabel OpReturn OpFunctionEnd %unlock = OpFunction %void DontInline %21 - %33 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %58 = OpLabel - %59 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %59 %33 Aligned 4 - %60 = OpLoad %_ptr_CrossWorkgroup_uint %59 Aligned 4 + %l_1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_1 = OpLabel + %l_addr_1 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_1 %l_1 Aligned 4 + %60 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_1 Aligned 4 %61 = OpPtrCastToGeneric %_ptr_Generic_uint %60 OpAtomicStore %61 %uint_2 %uint_4 %uint_0 OpReturn diff --git a/dartagnan/src/test/resources/spirv/opencl/benchmarks/caslock-dv2wg-2.1.1.spvasm b/dartagnan/src/test/resources/spirv/opencl/benchmarks/caslock-dv2wg-2.1.1.spvasm index b425f88b1c..e1bb00086d 100644 --- a/dartagnan/src/test/resources/spirv/opencl/benchmarks/caslock-dv2wg-2.1.1.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/benchmarks/caslock-dv2wg-2.1.1.spvasm @@ -1,7 +1,7 @@ -; @Input: %10 = {0} -; @Input: %11 = {0} -; @Input: %12 = {-1, -1} -; @Output: forall (%12[0] == -1 or %12[1] == -1 or %12[0] != %12[1]) +; @Input: %l = {0} +; @Input: %s = {0} +; @Input: %A = {-1, -1} +; @Output: forall (%A[0] == -1 or %A[1] == -1 or %A[0] != %A[1]) ; @Config: 2, 1, 1 ; SPIR-V ; Version: 1.0 @@ -17,19 +17,45 @@ OpEntryPoint Kernel %9 "mutex_test" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %l "l" + OpName %x "x" + OpName %A "A" + OpName %entry "entry" + OpName %l_addr "l.addr" + OpName %x_addr "x.addr" + OpName %A_addr "A.addr" + OpName %a "a" OpName %lock "lock" + OpName %l_0 "l" + OpName %add "add" OpName %unlock "unlock" + OpName %l_1 "l" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %entry_0 "entry" + OpName %while_cond "while.cond" + OpName %while_body "while.body" + OpName %while_end "while.end" + OpName %l_addr_0 "l.addr" + OpName %e "e" + OpName %e_ascast "e.ascast" OpName %exp "exp" + OpName %call1 "call1" + OpName %call_0 "call" + OpName %conv "conv" + OpName %cmp "cmp" + OpName %entry_1 "entry" + OpName %l_addr_1 "l.addr" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %15 Alignment 4 - OpDecorate %16 Alignment 4 - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %44 Alignment 4 - OpDecorate %45 Alignment 4 - OpDecorate %59 Alignment 4 + OpDecorate %l_addr Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %a Alignment 4 + OpDecorate %l_addr_0 Alignment 4 + OpDecorate %e Alignment 4 + OpDecorate %l_addr_1 Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 @@ -47,67 +73,67 @@ %bool = OpTypeBool %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpLabel - %15 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %16 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - OpStore %15 %10 Aligned 4 - OpStore %16 %11 Aligned 4 - OpStore %17 %12 Aligned 4 - %20 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 + %l = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %l_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %a = OpVariable %_ptr_Function_uint Function + OpStore %l_addr %l Aligned 4 + OpStore %x_addr %x Aligned 4 + OpStore %A_addr %A Aligned 4 + %20 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 %24 = OpFunctionCall %void %lock %20 - %25 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 + %25 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 %26 = OpLoad %uint %25 Aligned 4 - OpStore %19 %26 Aligned 4 - %27 = OpLoad %uint %19 Aligned 4 - %29 = OpIAdd %uint %27 %uint_1 - %30 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 - OpStore %30 %29 Aligned 4 - %31 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 + OpStore %a %26 Aligned 4 + %27 = OpLoad %uint %a Aligned 4 + %add = OpIAdd %uint %27 %uint_1 + %30 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + OpStore %30 %add Aligned 4 + %31 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 %34 = OpFunctionCall %void %unlock %31 - %35 = OpLoad %uint %19 Aligned 4 - %36 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 + %35 = OpLoad %uint %a Aligned 4 + %36 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %37 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %38 = OpCompositeExtract %uint %37 0 - %39 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %38 - OpStore %39 %35 Aligned 4 + %call = OpCompositeExtract %uint %37 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %call + OpStore %arrayidx %35 Aligned 4 OpReturn OpFunctionEnd %lock = OpFunction %void DontInline %21 - %23 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %40 = OpLabel - %44 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %45 = OpVariable %_ptr_Function_uint Function - OpStore %44 %23 Aligned 4 - OpStore %45 %uint_0 Aligned 4 - OpBranch %41 - %41 = OpLabel - %47 = OpLoad %_ptr_CrossWorkgroup_uint %44 Aligned 4 + %l_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_0 = OpLabel + %l_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %e = OpVariable %_ptr_Function_uint Function + OpStore %l_addr_0 %l_0 Aligned 4 + OpStore %e %uint_0 Aligned 4 + OpBranch %while_cond + %while_cond = OpLabel + %47 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 %49 = OpPtrCastToGeneric %_ptr_Generic_uint %47 - %50 = OpPtrCastToGeneric %_ptr_Generic_uint %45 - %exp = OpLoad %uint %50 Aligned 4 - %53 = OpAtomicCompareExchange %uint %49 %uint_2 %uint_2 %uint_2 %uint_1 %exp - OpStore %50 %53 Aligned 4 - %55 = OpIEqual %bool %53 %exp - %56 = OpSelect %uint %55 %uint_1 %uint_0 - %57 = OpIEqual %bool %56 %uint_0 - OpBranchConditional %57 %42 %43 - %42 = OpLabel - OpStore %45 %uint_0 Aligned 4 - OpBranch %41 - %43 = OpLabel + %e_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %e + %exp = OpLoad %uint %e_ascast Aligned 4 + %call1 = OpAtomicCompareExchange %uint %49 %uint_2 %uint_2 %uint_2 %uint_1 %exp + OpStore %e_ascast %call1 Aligned 4 + %call_0 = OpIEqual %bool %call1 %exp + %conv = OpSelect %uint %call_0 %uint_1 %uint_0 + %cmp = OpIEqual %bool %conv %uint_0 + OpBranchConditional %cmp %while_body %while_end + %while_body = OpLabel + OpStore %e %uint_0 Aligned 4 + OpBranch %while_cond + %while_end = OpLabel OpReturn OpFunctionEnd %unlock = OpFunction %void DontInline %21 - %33 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %58 = OpLabel - %59 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %59 %33 Aligned 4 - %60 = OpLoad %_ptr_CrossWorkgroup_uint %59 Aligned 4 + %l_1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_1 = OpLabel + %l_addr_1 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_1 %l_1 Aligned 4 + %60 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_1 Aligned 4 %61 = OpPtrCastToGeneric %_ptr_Generic_uint %60 OpAtomicStore %61 %uint_2 %uint_4 %uint_0 OpReturn diff --git a/dartagnan/src/test/resources/spirv/opencl/benchmarks/caslock-dv2wg-2.2.1.spvasm b/dartagnan/src/test/resources/spirv/opencl/benchmarks/caslock-dv2wg-2.2.1.spvasm index b425f88b1c..e1bb00086d 100644 --- a/dartagnan/src/test/resources/spirv/opencl/benchmarks/caslock-dv2wg-2.2.1.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/benchmarks/caslock-dv2wg-2.2.1.spvasm @@ -1,7 +1,7 @@ -; @Input: %10 = {0} -; @Input: %11 = {0} -; @Input: %12 = {-1, -1} -; @Output: forall (%12[0] == -1 or %12[1] == -1 or %12[0] != %12[1]) +; @Input: %l = {0} +; @Input: %s = {0} +; @Input: %A = {-1, -1} +; @Output: forall (%A[0] == -1 or %A[1] == -1 or %A[0] != %A[1]) ; @Config: 2, 1, 1 ; SPIR-V ; Version: 1.0 @@ -17,19 +17,45 @@ OpEntryPoint Kernel %9 "mutex_test" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %l "l" + OpName %x "x" + OpName %A "A" + OpName %entry "entry" + OpName %l_addr "l.addr" + OpName %x_addr "x.addr" + OpName %A_addr "A.addr" + OpName %a "a" OpName %lock "lock" + OpName %l_0 "l" + OpName %add "add" OpName %unlock "unlock" + OpName %l_1 "l" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %entry_0 "entry" + OpName %while_cond "while.cond" + OpName %while_body "while.body" + OpName %while_end "while.end" + OpName %l_addr_0 "l.addr" + OpName %e "e" + OpName %e_ascast "e.ascast" OpName %exp "exp" + OpName %call1 "call1" + OpName %call_0 "call" + OpName %conv "conv" + OpName %cmp "cmp" + OpName %entry_1 "entry" + OpName %l_addr_1 "l.addr" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %15 Alignment 4 - OpDecorate %16 Alignment 4 - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %44 Alignment 4 - OpDecorate %45 Alignment 4 - OpDecorate %59 Alignment 4 + OpDecorate %l_addr Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %a Alignment 4 + OpDecorate %l_addr_0 Alignment 4 + OpDecorate %e Alignment 4 + OpDecorate %l_addr_1 Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 @@ -47,67 +73,67 @@ %bool = OpTypeBool %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpLabel - %15 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %16 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - OpStore %15 %10 Aligned 4 - OpStore %16 %11 Aligned 4 - OpStore %17 %12 Aligned 4 - %20 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 + %l = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %l_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %a = OpVariable %_ptr_Function_uint Function + OpStore %l_addr %l Aligned 4 + OpStore %x_addr %x Aligned 4 + OpStore %A_addr %A Aligned 4 + %20 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 %24 = OpFunctionCall %void %lock %20 - %25 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 + %25 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 %26 = OpLoad %uint %25 Aligned 4 - OpStore %19 %26 Aligned 4 - %27 = OpLoad %uint %19 Aligned 4 - %29 = OpIAdd %uint %27 %uint_1 - %30 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 - OpStore %30 %29 Aligned 4 - %31 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 + OpStore %a %26 Aligned 4 + %27 = OpLoad %uint %a Aligned 4 + %add = OpIAdd %uint %27 %uint_1 + %30 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + OpStore %30 %add Aligned 4 + %31 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 %34 = OpFunctionCall %void %unlock %31 - %35 = OpLoad %uint %19 Aligned 4 - %36 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 + %35 = OpLoad %uint %a Aligned 4 + %36 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %37 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %38 = OpCompositeExtract %uint %37 0 - %39 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %38 - OpStore %39 %35 Aligned 4 + %call = OpCompositeExtract %uint %37 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %call + OpStore %arrayidx %35 Aligned 4 OpReturn OpFunctionEnd %lock = OpFunction %void DontInline %21 - %23 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %40 = OpLabel - %44 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %45 = OpVariable %_ptr_Function_uint Function - OpStore %44 %23 Aligned 4 - OpStore %45 %uint_0 Aligned 4 - OpBranch %41 - %41 = OpLabel - %47 = OpLoad %_ptr_CrossWorkgroup_uint %44 Aligned 4 + %l_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_0 = OpLabel + %l_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %e = OpVariable %_ptr_Function_uint Function + OpStore %l_addr_0 %l_0 Aligned 4 + OpStore %e %uint_0 Aligned 4 + OpBranch %while_cond + %while_cond = OpLabel + %47 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 %49 = OpPtrCastToGeneric %_ptr_Generic_uint %47 - %50 = OpPtrCastToGeneric %_ptr_Generic_uint %45 - %exp = OpLoad %uint %50 Aligned 4 - %53 = OpAtomicCompareExchange %uint %49 %uint_2 %uint_2 %uint_2 %uint_1 %exp - OpStore %50 %53 Aligned 4 - %55 = OpIEqual %bool %53 %exp - %56 = OpSelect %uint %55 %uint_1 %uint_0 - %57 = OpIEqual %bool %56 %uint_0 - OpBranchConditional %57 %42 %43 - %42 = OpLabel - OpStore %45 %uint_0 Aligned 4 - OpBranch %41 - %43 = OpLabel + %e_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %e + %exp = OpLoad %uint %e_ascast Aligned 4 + %call1 = OpAtomicCompareExchange %uint %49 %uint_2 %uint_2 %uint_2 %uint_1 %exp + OpStore %e_ascast %call1 Aligned 4 + %call_0 = OpIEqual %bool %call1 %exp + %conv = OpSelect %uint %call_0 %uint_1 %uint_0 + %cmp = OpIEqual %bool %conv %uint_0 + OpBranchConditional %cmp %while_body %while_end + %while_body = OpLabel + OpStore %e %uint_0 Aligned 4 + OpBranch %while_cond + %while_end = OpLabel OpReturn OpFunctionEnd %unlock = OpFunction %void DontInline %21 - %33 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %58 = OpLabel - %59 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %59 %33 Aligned 4 - %60 = OpLoad %_ptr_CrossWorkgroup_uint %59 Aligned 4 + %l_1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_1 = OpLabel + %l_addr_1 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_1 %l_1 Aligned 4 + %60 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_1 Aligned 4 %61 = OpPtrCastToGeneric %_ptr_Generic_uint %60 OpAtomicStore %61 %uint_2 %uint_4 %uint_0 OpReturn diff --git a/dartagnan/src/test/resources/spirv/opencl/benchmarks/caslock-dv2wg-2.2.2.spvasm b/dartagnan/src/test/resources/spirv/opencl/benchmarks/caslock-dv2wg-2.2.2.spvasm index 824465950f..93b5a65825 100644 --- a/dartagnan/src/test/resources/spirv/opencl/benchmarks/caslock-dv2wg-2.2.2.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/benchmarks/caslock-dv2wg-2.2.2.spvasm @@ -1,7 +1,7 @@ -; @Input: %10 = {0} -; @Input: %11 = {0} -; @Input: %12 = {-1, -1} -; @Output: forall (%12[0] == -1 or %12[1] == -1 or %12[0] != %12[1]) +; @Input: %l = {0} +; @Input: %s = {0} +; @Input: %A = {-1, -1} +; @Output: forall (%A[0] == -1 or %A[1] == -1 or %A[0] != %A[1]) ; @Config: 2, 2, 2 ; SPIR-V ; Version: 1.0 @@ -17,19 +17,45 @@ OpEntryPoint Kernel %9 "mutex_test" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %l "l" + OpName %x "x" + OpName %A "A" + OpName %entry "entry" + OpName %l_addr "l.addr" + OpName %x_addr "x.addr" + OpName %A_addr "A.addr" + OpName %a "a" OpName %lock "lock" + OpName %l_0 "l" + OpName %add "add" OpName %unlock "unlock" + OpName %l_1 "l" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %entry_0 "entry" + OpName %while_cond "while.cond" + OpName %while_body "while.body" + OpName %while_end "while.end" + OpName %l_addr_0 "l.addr" + OpName %e "e" + OpName %e_ascast "e.ascast" OpName %exp "exp" + OpName %call1 "call1" + OpName %call_0 "call" + OpName %conv "conv" + OpName %cmp "cmp" + OpName %entry_1 "entry" + OpName %l_addr_1 "l.addr" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %15 Alignment 4 - OpDecorate %16 Alignment 4 - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %44 Alignment 4 - OpDecorate %45 Alignment 4 - OpDecorate %59 Alignment 4 + OpDecorate %l_addr Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %a Alignment 4 + OpDecorate %l_addr_0 Alignment 4 + OpDecorate %e Alignment 4 + OpDecorate %l_addr_1 Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 @@ -47,67 +73,67 @@ %bool = OpTypeBool %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpLabel - %15 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %16 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - OpStore %15 %10 Aligned 4 - OpStore %16 %11 Aligned 4 - OpStore %17 %12 Aligned 4 - %20 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 + %l = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %l_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %a = OpVariable %_ptr_Function_uint Function + OpStore %l_addr %l Aligned 4 + OpStore %x_addr %x Aligned 4 + OpStore %A_addr %A Aligned 4 + %20 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 %24 = OpFunctionCall %void %lock %20 - %25 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 + %25 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 %26 = OpLoad %uint %25 Aligned 4 - OpStore %19 %26 Aligned 4 - %27 = OpLoad %uint %19 Aligned 4 - %29 = OpIAdd %uint %27 %uint_1 - %30 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 - OpStore %30 %29 Aligned 4 - %31 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 + OpStore %a %26 Aligned 4 + %27 = OpLoad %uint %a Aligned 4 + %add = OpIAdd %uint %27 %uint_1 + %30 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + OpStore %30 %add Aligned 4 + %31 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 %34 = OpFunctionCall %void %unlock %31 - %35 = OpLoad %uint %19 Aligned 4 - %36 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 + %35 = OpLoad %uint %a Aligned 4 + %36 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %37 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %38 = OpCompositeExtract %uint %37 0 - %39 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %38 - OpStore %39 %35 Aligned 4 + %call = OpCompositeExtract %uint %37 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %call + OpStore %arrayidx %35 Aligned 4 OpReturn OpFunctionEnd %lock = OpFunction %void DontInline %21 - %23 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %40 = OpLabel - %44 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %45 = OpVariable %_ptr_Function_uint Function - OpStore %44 %23 Aligned 4 - OpStore %45 %uint_0 Aligned 4 - OpBranch %41 - %41 = OpLabel - %47 = OpLoad %_ptr_CrossWorkgroup_uint %44 Aligned 4 + %l_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_0 = OpLabel + %l_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %e = OpVariable %_ptr_Function_uint Function + OpStore %l_addr_0 %l_0 Aligned 4 + OpStore %e %uint_0 Aligned 4 + OpBranch %while_cond + %while_cond = OpLabel + %47 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 %49 = OpPtrCastToGeneric %_ptr_Generic_uint %47 - %50 = OpPtrCastToGeneric %_ptr_Generic_uint %45 - %exp = OpLoad %uint %50 Aligned 4 - %53 = OpAtomicCompareExchange %uint %49 %uint_2 %uint_2 %uint_2 %uint_1 %exp - OpStore %50 %53 Aligned 4 - %55 = OpIEqual %bool %53 %exp - %56 = OpSelect %uint %55 %uint_1 %uint_0 - %57 = OpIEqual %bool %56 %uint_0 - OpBranchConditional %57 %42 %43 - %42 = OpLabel - OpStore %45 %uint_0 Aligned 4 - OpBranch %41 - %43 = OpLabel + %e_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %e + %exp = OpLoad %uint %e_ascast Aligned 4 + %call1 = OpAtomicCompareExchange %uint %49 %uint_2 %uint_2 %uint_2 %uint_1 %exp + OpStore %e_ascast %call1 Aligned 4 + %call_0 = OpIEqual %bool %call1 %exp + %conv = OpSelect %uint %call_0 %uint_1 %uint_0 + %cmp = OpIEqual %bool %conv %uint_0 + OpBranchConditional %cmp %while_body %while_end + %while_body = OpLabel + OpStore %e %uint_0 Aligned 4 + OpBranch %while_cond + %while_end = OpLabel OpReturn OpFunctionEnd %unlock = OpFunction %void DontInline %21 - %33 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %58 = OpLabel - %59 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %59 %33 Aligned 4 - %60 = OpLoad %_ptr_CrossWorkgroup_uint %59 Aligned 4 + %l_1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_1 = OpLabel + %l_addr_1 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_1 %l_1 Aligned 4 + %60 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_1 Aligned 4 %61 = OpPtrCastToGeneric %_ptr_Generic_uint %60 OpAtomicStore %61 %uint_2 %uint_4 %uint_0 OpReturn diff --git a/dartagnan/src/test/resources/spirv/opencl/benchmarks/caslock-rel2rx.spvasm b/dartagnan/src/test/resources/spirv/opencl/benchmarks/caslock-rel2rx.spvasm index ff355e3bce..ebf13051e3 100644 --- a/dartagnan/src/test/resources/spirv/opencl/benchmarks/caslock-rel2rx.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/benchmarks/caslock-rel2rx.spvasm @@ -1,7 +1,7 @@ -; @Input: %10 = {0} -; @Input: %11 = {0} -; @Input: %12 = {-1, -1} -; @Output: forall (%12[0] == -1 or %12[1] == -1 or %12[0] != %12[1]) +; @Input: %l = {0} +; @Input: %s = {0} +; @Input: %A = {-1, -1} +; @Output: forall (%A[0] == -1 or %A[1] == -1 or %A[0] != %A[1]) ; @Config: 2, 1, 1 ; SPIR-V ; Version: 1.0 @@ -17,19 +17,45 @@ OpEntryPoint Kernel %9 "mutex_test" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %l "l" + OpName %x "x" + OpName %A "A" + OpName %entry "entry" + OpName %l_addr "l.addr" + OpName %x_addr "x.addr" + OpName %A_addr "A.addr" + OpName %a "a" OpName %lock "lock" + OpName %l_0 "l" + OpName %add "add" OpName %unlock "unlock" + OpName %l_1 "l" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %entry_0 "entry" + OpName %while_cond "while.cond" + OpName %while_body "while.body" + OpName %while_end "while.end" + OpName %l_addr_0 "l.addr" + OpName %e "e" + OpName %e_ascast "e.ascast" OpName %exp "exp" + OpName %call1 "call1" + OpName %call_0 "call" + OpName %conv "conv" + OpName %cmp "cmp" + OpName %entry_1 "entry" + OpName %l_addr_1 "l.addr" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %15 Alignment 4 - OpDecorate %16 Alignment 4 - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %44 Alignment 4 - OpDecorate %45 Alignment 4 - OpDecorate %59 Alignment 4 + OpDecorate %l_addr Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %a Alignment 4 + OpDecorate %l_addr_0 Alignment 4 + OpDecorate %e Alignment 4 + OpDecorate %l_addr_1 Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 @@ -46,67 +72,67 @@ %bool = OpTypeBool %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpLabel - %15 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %16 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - OpStore %15 %10 Aligned 4 - OpStore %16 %11 Aligned 4 - OpStore %17 %12 Aligned 4 - %20 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 + %l = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %l_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %a = OpVariable %_ptr_Function_uint Function + OpStore %l_addr %l Aligned 4 + OpStore %x_addr %x Aligned 4 + OpStore %A_addr %A Aligned 4 + %20 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 %24 = OpFunctionCall %void %lock %20 - %25 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 + %25 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 %26 = OpLoad %uint %25 Aligned 4 - OpStore %19 %26 Aligned 4 - %27 = OpLoad %uint %19 Aligned 4 - %29 = OpIAdd %uint %27 %uint_1 - %30 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 - OpStore %30 %29 Aligned 4 - %31 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 + OpStore %a %26 Aligned 4 + %27 = OpLoad %uint %a Aligned 4 + %add = OpIAdd %uint %27 %uint_1 + %30 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + OpStore %30 %add Aligned 4 + %31 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 %34 = OpFunctionCall %void %unlock %31 - %35 = OpLoad %uint %19 Aligned 4 - %36 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 + %35 = OpLoad %uint %a Aligned 4 + %36 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %37 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %38 = OpCompositeExtract %uint %37 0 - %39 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %38 - OpStore %39 %35 Aligned 4 + %call = OpCompositeExtract %uint %37 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %call + OpStore %arrayidx %35 Aligned 4 OpReturn OpFunctionEnd %lock = OpFunction %void DontInline %21 - %23 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %40 = OpLabel - %44 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %45 = OpVariable %_ptr_Function_uint Function - OpStore %44 %23 Aligned 4 - OpStore %45 %uint_0 Aligned 4 - OpBranch %41 - %41 = OpLabel - %47 = OpLoad %_ptr_CrossWorkgroup_uint %44 Aligned 4 + %l_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_0 = OpLabel + %l_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %e = OpVariable %_ptr_Function_uint Function + OpStore %l_addr_0 %l_0 Aligned 4 + OpStore %e %uint_0 Aligned 4 + OpBranch %while_cond + %while_cond = OpLabel + %47 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 %49 = OpPtrCastToGeneric %_ptr_Generic_uint %47 - %50 = OpPtrCastToGeneric %_ptr_Generic_uint %45 - %exp = OpLoad %uint %50 Aligned 4 - %53 = OpAtomicCompareExchange %uint %49 %uint_1 %uint_2 %uint_2 %uint_1 %exp - OpStore %50 %53 Aligned 4 - %55 = OpIEqual %bool %53 %exp - %56 = OpSelect %uint %55 %uint_1 %uint_0 - %57 = OpIEqual %bool %56 %uint_0 - OpBranchConditional %57 %42 %43 - %42 = OpLabel - OpStore %45 %uint_0 Aligned 4 - OpBranch %41 - %43 = OpLabel + %e_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %e + %exp = OpLoad %uint %e_ascast Aligned 4 + %call1 = OpAtomicCompareExchange %uint %49 %uint_1 %uint_2 %uint_2 %uint_1 %exp + OpStore %e_ascast %call1 Aligned 4 + %call_0 = OpIEqual %bool %call1 %exp + %conv = OpSelect %uint %call_0 %uint_1 %uint_0 + %cmp = OpIEqual %bool %conv %uint_0 + OpBranchConditional %cmp %while_body %while_end + %while_body = OpLabel + OpStore %e %uint_0 Aligned 4 + OpBranch %while_cond + %while_end = OpLabel OpReturn OpFunctionEnd %unlock = OpFunction %void DontInline %21 - %33 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %58 = OpLabel - %59 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %59 %33 Aligned 4 - %60 = OpLoad %_ptr_CrossWorkgroup_uint %59 Aligned 4 + %l_1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_1 = OpLabel + %l_addr_1 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_1 %l_1 Aligned 4 + %60 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_1 Aligned 4 %61 = OpPtrCastToGeneric %_ptr_Generic_uint %60 OpAtomicStore %61 %uint_1 %uint_0 %uint_0 OpReturn diff --git a/dartagnan/src/test/resources/spirv/opencl/benchmarks/caslock-sc.spvasm b/dartagnan/src/test/resources/spirv/opencl/benchmarks/caslock-sc.spvasm index 204b2b78e3..e04272c3fd 100644 --- a/dartagnan/src/test/resources/spirv/opencl/benchmarks/caslock-sc.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/benchmarks/caslock-sc.spvasm @@ -12,18 +12,41 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %lock "lock" + OpName %l "l" + OpName %entry "entry" + OpName %while_cond "while.cond" + OpName %while_body "while.body" + OpName %while_end "while.end" + OpName %l_addr "l.addr" + OpName %call "call" + OpName %cmp "cmp" OpName %unlock "unlock" + OpName %l_0 "l" + OpName %entry_0 "entry" + OpName %l_addr_0 "l.addr" + OpName %call_0 "call" + OpName %l_1 "l" + OpName %x "x" + OpName %A "A" + OpName %entry_1 "entry" + OpName %l_addr_1 "l.addr" + OpName %x_addr "x.addr" + OpName %A_addr "A.addr" + OpName %a "a" + OpName %add "add" + OpName %call_1 "call" + OpName %arrayidx "arrayidx" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %lock LinkageAttributes "lock" Export OpDecorate %unlock LinkageAttributes "unlock" Export OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %16 Alignment 4 - OpDecorate %27 Alignment 4 - OpDecorate %36 Alignment 4 - OpDecorate %37 Alignment 4 - OpDecorate %38 Alignment 4 - OpDecorate %40 Alignment 4 + OpDecorate %l_addr Alignment 4 + OpDecorate %l_addr_0 Alignment 4 + OpDecorate %l_addr_1 Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %a Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_0 = OpConstant %uint 0 @@ -39,58 +62,58 @@ %_ptr_Function_uint = OpTypePointer Function %uint %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %lock = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpLabel - %16 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %16 %10 Aligned 4 - OpBranch %12 - %12 = OpLabel - %17 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 - %21 = OpAtomicCompareExchange %uint %17 %uint_2 %uint_0 %uint_0 %uint_1 %uint_0 - %23 = OpIEqual %bool %21 %uint_1 - OpBranchConditional %23 %13 %14 - %13 = OpLabel - OpBranch %12 - %14 = OpLabel + %l = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %l_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr %l Aligned 4 + OpBranch %while_cond + %while_cond = OpLabel + %17 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 + %call = OpAtomicCompareExchange %uint %17 %uint_2 %uint_0 %uint_0 %uint_1 %uint_0 + %cmp = OpIEqual %bool %call %uint_1 + OpBranchConditional %cmp %while_body %while_end + %while_body = OpLabel + OpBranch %while_cond + %while_end = OpLabel OpReturn OpFunctionEnd %unlock = OpFunction %void DontInline %8 - %25 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %26 = OpLabel - %27 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %27 %25 Aligned 4 - %28 = OpLoad %_ptr_CrossWorkgroup_uint %27 Aligned 4 - %29 = OpAtomicExchange %uint %28 %uint_2 %uint_0 %uint_0 + %l_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_0 = OpLabel + %l_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_0 %l_0 Aligned 4 + %28 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 + %call_0 = OpAtomicExchange %uint %28 %uint_2 %uint_0 %uint_0 OpReturn OpFunctionEnd %31 = OpFunction %void DontInline %30 - %32 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %33 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %34 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %35 = OpLabel - %36 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %37 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %38 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %40 = OpVariable %_ptr_Function_uint Function - OpStore %36 %32 Aligned 4 - OpStore %37 %33 Aligned 4 - OpStore %38 %34 Aligned 4 - %41 = OpLoad %_ptr_CrossWorkgroup_uint %36 Aligned 4 + %l_1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_1 = OpLabel + %l_addr_1 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %a = OpVariable %_ptr_Function_uint Function + OpStore %l_addr_1 %l_1 Aligned 4 + OpStore %x_addr %x Aligned 4 + OpStore %A_addr %A Aligned 4 + %41 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_1 Aligned 4 %42 = OpFunctionCall %void %lock %41 - %43 = OpLoad %_ptr_CrossWorkgroup_uint %37 Aligned 4 + %43 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 %44 = OpLoad %uint %43 Aligned 4 - OpStore %40 %44 Aligned 4 - %45 = OpLoad %uint %40 Aligned 4 - %46 = OpIAdd %uint %45 %uint_1 - %47 = OpLoad %_ptr_CrossWorkgroup_uint %37 Aligned 4 - OpStore %47 %46 Aligned 4 - %48 = OpLoad %_ptr_CrossWorkgroup_uint %36 Aligned 4 + OpStore %a %44 Aligned 4 + %45 = OpLoad %uint %a Aligned 4 + %add = OpIAdd %uint %45 %uint_1 + %47 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + OpStore %47 %add Aligned 4 + %48 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_1 Aligned 4 %49 = OpFunctionCall %void %unlock %48 - %50 = OpLoad %uint %40 Aligned 4 - %51 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 + %50 = OpLoad %uint %a Aligned 4 + %51 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %52 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %53 = OpCompositeExtract %uint %52 0 - %54 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %51 %53 - OpStore %54 %50 Aligned 4 + %call_1 = OpCompositeExtract %uint %52 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %51 %call_1 + OpStore %arrayidx %50 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/benchmarks/ticketlock-1.1.2.spvasm b/dartagnan/src/test/resources/spirv/opencl/benchmarks/ticketlock-1.1.2.spvasm index f8e7c7b66a..6c1ed1dbaa 100644 --- a/dartagnan/src/test/resources/spirv/opencl/benchmarks/ticketlock-1.1.2.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/benchmarks/ticketlock-1.1.2.spvasm @@ -1,8 +1,8 @@ -; @Input: %10 = {0} -; @Input: %11 = {0} -; @Input: %12 = {0} -; @Input: %13 = {-1, -1} -; @Output: forall (%13[0] == -1 or %13[1] == -1 or %13[0] != %13[1]) +; @Input: %owner = {0} +; @Input: %next = {0} +; @Input: %x = {0} +; @Input: %A = {-1, -1} +; @Output: forall (%A[0] == -1 or %A[1] == -1 or %A[0] != %A[1]) ; @Config: 1, 1, 2 ; SPIR-V ; Version: 1.0 @@ -18,21 +18,52 @@ OpEntryPoint Kernel %9 "mutex_test" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %owner "owner" + OpName %next "next" + OpName %x "x" + OpName %A "A" + OpName %entry "entry" + OpName %owner_addr "owner.addr" + OpName %next_addr "next.addr" + OpName %x_addr "x.addr" + OpName %A_addr "A.addr" + OpName %a "a" OpName %lock "lock" + OpName %owner_0 "owner" + OpName %next_0 "next" + OpName %add "add" OpName %unlock "unlock" + OpName %owner_1 "owner" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %entry_0 "entry" + OpName %while_cond "while.cond" + OpName %while_body "while.body" + OpName %while_end "while.end" + OpName %owner_addr_0 "owner.addr" + OpName %next_addr_0 "next.addr" + OpName %ticket "ticket" + OpName %call_0 "call" + OpName %call1 "call1" + OpName %cmp "cmp" + OpName %entry_1 "entry" + OpName %owner_addr_1 "owner.addr" + OpName %current "current" + OpName %call_1 "call" + OpName %add_0 "add" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %16 Alignment 4 - OpDecorate %17 Alignment 4 - OpDecorate %18 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %21 Alignment 4 - OpDecorate %49 Alignment 4 - OpDecorate %50 Alignment 4 - OpDecorate %51 Alignment 4 - OpDecorate %65 Alignment 4 - OpDecorate %66 Alignment 4 + OpDecorate %owner_addr Alignment 4 + OpDecorate %next_addr Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %a Alignment 4 + OpDecorate %owner_addr_0 Alignment 4 + OpDecorate %next_addr_0 Alignment 4 + OpDecorate %ticket Alignment 4 + OpDecorate %owner_addr_1 Alignment 4 + OpDecorate %current Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 @@ -51,80 +82,80 @@ %bool = OpTypeBool %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %14 = OpLabel - %16 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %18 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %21 = OpVariable %_ptr_Function_uint Function - OpStore %16 %10 Aligned 4 - OpStore %17 %11 Aligned 4 - OpStore %18 %12 Aligned 4 - OpStore %19 %13 Aligned 4 - %22 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 - %23 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 + %owner = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %next = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %owner_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %next_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %a = OpVariable %_ptr_Function_uint Function + OpStore %owner_addr %owner Aligned 4 + OpStore %next_addr %next Aligned 4 + OpStore %x_addr %x Aligned 4 + OpStore %A_addr %A Aligned 4 + %22 = OpLoad %_ptr_CrossWorkgroup_uint %owner_addr Aligned 4 + %23 = OpLoad %_ptr_CrossWorkgroup_uint %next_addr Aligned 4 %28 = OpFunctionCall %void %lock %22 %23 - %29 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 + %29 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 %30 = OpLoad %uint %29 Aligned 4 - OpStore %21 %30 Aligned 4 - %31 = OpLoad %uint %21 Aligned 4 - %33 = OpIAdd %uint %31 %uint_1 - %34 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - OpStore %34 %33 Aligned 4 - %35 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 + OpStore %a %30 Aligned 4 + %31 = OpLoad %uint %a Aligned 4 + %add = OpIAdd %uint %31 %uint_1 + %34 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + OpStore %34 %add Aligned 4 + %35 = OpLoad %_ptr_CrossWorkgroup_uint %owner_addr Aligned 4 %39 = OpFunctionCall %void %unlock %35 - %40 = OpLoad %uint %21 Aligned 4 - %41 = OpLoad %_ptr_CrossWorkgroup_uint %19 Aligned 4 + %40 = OpLoad %uint %a Aligned 4 + %41 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %42 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %43 = OpCompositeExtract %uint %42 0 - %44 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %41 %43 - OpStore %44 %40 Aligned 4 + %call = OpCompositeExtract %uint %42 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %41 %call + OpStore %arrayidx %40 Aligned 4 OpReturn OpFunctionEnd %lock = OpFunction %void DontInline %24 - %26 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %27 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %45 = OpLabel - %49 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %50 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %51 = OpVariable %_ptr_Function_uint Function - OpStore %49 %26 Aligned 4 - OpStore %50 %27 Aligned 4 - %52 = OpLoad %_ptr_CrossWorkgroup_uint %50 Aligned 4 + %owner_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %next_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_0 = OpLabel +%owner_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%next_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %ticket = OpVariable %_ptr_Function_uint Function + OpStore %owner_addr_0 %owner_0 Aligned 4 + OpStore %next_addr_0 %next_0 Aligned 4 + %52 = OpLoad %_ptr_CrossWorkgroup_uint %next_addr_0 Aligned 4 %54 = OpPtrCastToGeneric %_ptr_Generic_uint %52 - %56 = OpAtomicIAdd %uint %54 %uint_1 %uint_0 %uint_1 - OpStore %51 %56 Aligned 4 - OpBranch %46 - %46 = OpLabel - %57 = OpLoad %_ptr_CrossWorkgroup_uint %49 Aligned 4 + %call_0 = OpAtomicIAdd %uint %54 %uint_1 %uint_0 %uint_1 + OpStore %ticket %call_0 Aligned 4 + OpBranch %while_cond + %while_cond = OpLabel + %57 = OpLoad %_ptr_CrossWorkgroup_uint %owner_addr_0 Aligned 4 %58 = OpPtrCastToGeneric %_ptr_Generic_uint %57 - %60 = OpAtomicLoad %uint %58 %uint_1 %uint_2 - %61 = OpLoad %uint %51 Aligned 4 - %63 = OpINotEqual %bool %60 %61 - OpBranchConditional %63 %47 %48 - %47 = OpLabel - OpBranch %46 - %48 = OpLabel + %call1 = OpAtomicLoad %uint %58 %uint_1 %uint_2 + %61 = OpLoad %uint %ticket Aligned 4 + %cmp = OpINotEqual %bool %call1 %61 + OpBranchConditional %cmp %while_body %while_end + %while_body = OpLabel + OpBranch %while_cond + %while_end = OpLabel OpReturn OpFunctionEnd %unlock = OpFunction %void DontInline %36 - %38 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %64 = OpLabel - %65 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %66 = OpVariable %_ptr_Function_uint Function - OpStore %65 %38 Aligned 4 - %67 = OpLoad %_ptr_CrossWorkgroup_uint %65 Aligned 4 + %owner_1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_1 = OpLabel +%owner_addr_1 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %current = OpVariable %_ptr_Function_uint Function + OpStore %owner_addr_1 %owner_1 Aligned 4 + %67 = OpLoad %_ptr_CrossWorkgroup_uint %owner_addr_1 Aligned 4 %68 = OpPtrCastToGeneric %_ptr_Generic_uint %67 - %69 = OpAtomicLoad %uint %68 %uint_1 %uint_0 - OpStore %66 %69 Aligned 4 - %70 = OpLoad %_ptr_CrossWorkgroup_uint %65 Aligned 4 + %call_1 = OpAtomicLoad %uint %68 %uint_1 %uint_0 + OpStore %current %call_1 Aligned 4 + %70 = OpLoad %_ptr_CrossWorkgroup_uint %owner_addr_1 Aligned 4 %71 = OpPtrCastToGeneric %_ptr_Generic_uint %70 - %72 = OpLoad %uint %66 Aligned 4 - %73 = OpIAdd %uint %72 %uint_1 - OpAtomicStore %71 %uint_1 %uint_4 %73 + %72 = OpLoad %uint %current Aligned 4 + %add_0 = OpIAdd %uint %72 %uint_1 + OpAtomicStore %71 %uint_1 %uint_4 %add_0 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/benchmarks/ticketlock-2.1.1.spvasm b/dartagnan/src/test/resources/spirv/opencl/benchmarks/ticketlock-2.1.1.spvasm index 988f6cd57c..518410033f 100644 --- a/dartagnan/src/test/resources/spirv/opencl/benchmarks/ticketlock-2.1.1.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/benchmarks/ticketlock-2.1.1.spvasm @@ -1,8 +1,8 @@ -; @Input: %10 = {0} -; @Input: %11 = {0} -; @Input: %12 = {0} -; @Input: %13 = {-1, -1} -; @Output: forall (%13[0] == -1 or %13[1] == -1 or %13[0] != %13[1]) +; @Input: %owner = {0} +; @Input: %next = {0} +; @Input: %x = {0} +; @Input: %A = {-1, -1} +; @Output: forall (%A[0] == -1 or %A[1] == -1 or %A[0] != %A[1]) ; @Config: 2, 1, 1 ; SPIR-V ; Version: 1.0 @@ -18,21 +18,52 @@ OpEntryPoint Kernel %9 "mutex_test" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %owner "owner" + OpName %next "next" + OpName %x "x" + OpName %A "A" + OpName %entry "entry" + OpName %owner_addr "owner.addr" + OpName %next_addr "next.addr" + OpName %x_addr "x.addr" + OpName %A_addr "A.addr" + OpName %a "a" OpName %lock "lock" + OpName %owner_0 "owner" + OpName %next_0 "next" + OpName %add "add" OpName %unlock "unlock" + OpName %owner_1 "owner" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %entry_0 "entry" + OpName %while_cond "while.cond" + OpName %while_body "while.body" + OpName %while_end "while.end" + OpName %owner_addr_0 "owner.addr" + OpName %next_addr_0 "next.addr" + OpName %ticket "ticket" + OpName %call_0 "call" + OpName %call1 "call1" + OpName %cmp "cmp" + OpName %entry_1 "entry" + OpName %owner_addr_1 "owner.addr" + OpName %current "current" + OpName %call_1 "call" + OpName %add_0 "add" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %16 Alignment 4 - OpDecorate %17 Alignment 4 - OpDecorate %18 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %21 Alignment 4 - OpDecorate %49 Alignment 4 - OpDecorate %50 Alignment 4 - OpDecorate %51 Alignment 4 - OpDecorate %65 Alignment 4 - OpDecorate %66 Alignment 4 + OpDecorate %owner_addr Alignment 4 + OpDecorate %next_addr Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %a Alignment 4 + OpDecorate %owner_addr_0 Alignment 4 + OpDecorate %next_addr_0 Alignment 4 + OpDecorate %ticket Alignment 4 + OpDecorate %owner_addr_1 Alignment 4 + OpDecorate %current Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 @@ -51,80 +82,80 @@ %bool = OpTypeBool %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %14 = OpLabel - %16 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %18 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %21 = OpVariable %_ptr_Function_uint Function - OpStore %16 %10 Aligned 4 - OpStore %17 %11 Aligned 4 - OpStore %18 %12 Aligned 4 - OpStore %19 %13 Aligned 4 - %22 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 - %23 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 + %owner = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %next = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %owner_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %next_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %a = OpVariable %_ptr_Function_uint Function + OpStore %owner_addr %owner Aligned 4 + OpStore %next_addr %next Aligned 4 + OpStore %x_addr %x Aligned 4 + OpStore %A_addr %A Aligned 4 + %22 = OpLoad %_ptr_CrossWorkgroup_uint %owner_addr Aligned 4 + %23 = OpLoad %_ptr_CrossWorkgroup_uint %next_addr Aligned 4 %28 = OpFunctionCall %void %lock %22 %23 - %29 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 + %29 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 %30 = OpLoad %uint %29 Aligned 4 - OpStore %21 %30 Aligned 4 - %31 = OpLoad %uint %21 Aligned 4 - %33 = OpIAdd %uint %31 %uint_1 - %34 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - OpStore %34 %33 Aligned 4 - %35 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 + OpStore %a %30 Aligned 4 + %31 = OpLoad %uint %a Aligned 4 + %add = OpIAdd %uint %31 %uint_1 + %34 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + OpStore %34 %add Aligned 4 + %35 = OpLoad %_ptr_CrossWorkgroup_uint %owner_addr Aligned 4 %39 = OpFunctionCall %void %unlock %35 - %40 = OpLoad %uint %21 Aligned 4 - %41 = OpLoad %_ptr_CrossWorkgroup_uint %19 Aligned 4 + %40 = OpLoad %uint %a Aligned 4 + %41 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %42 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %43 = OpCompositeExtract %uint %42 0 - %44 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %41 %43 - OpStore %44 %40 Aligned 4 + %call = OpCompositeExtract %uint %42 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %41 %call + OpStore %arrayidx %40 Aligned 4 OpReturn OpFunctionEnd %lock = OpFunction %void DontInline %24 - %26 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %27 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %45 = OpLabel - %49 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %50 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %51 = OpVariable %_ptr_Function_uint Function - OpStore %49 %26 Aligned 4 - OpStore %50 %27 Aligned 4 - %52 = OpLoad %_ptr_CrossWorkgroup_uint %50 Aligned 4 + %owner_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %next_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_0 = OpLabel +%owner_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%next_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %ticket = OpVariable %_ptr_Function_uint Function + OpStore %owner_addr_0 %owner_0 Aligned 4 + OpStore %next_addr_0 %next_0 Aligned 4 + %52 = OpLoad %_ptr_CrossWorkgroup_uint %next_addr_0 Aligned 4 %54 = OpPtrCastToGeneric %_ptr_Generic_uint %52 - %56 = OpAtomicIAdd %uint %54 %uint_1 %uint_0 %uint_1 - OpStore %51 %56 Aligned 4 - OpBranch %46 - %46 = OpLabel - %57 = OpLoad %_ptr_CrossWorkgroup_uint %49 Aligned 4 + %call_0 = OpAtomicIAdd %uint %54 %uint_1 %uint_0 %uint_1 + OpStore %ticket %call_0 Aligned 4 + OpBranch %while_cond + %while_cond = OpLabel + %57 = OpLoad %_ptr_CrossWorkgroup_uint %owner_addr_0 Aligned 4 %58 = OpPtrCastToGeneric %_ptr_Generic_uint %57 - %60 = OpAtomicLoad %uint %58 %uint_1 %uint_2 - %61 = OpLoad %uint %51 Aligned 4 - %63 = OpINotEqual %bool %60 %61 - OpBranchConditional %63 %47 %48 - %47 = OpLabel - OpBranch %46 - %48 = OpLabel + %call1 = OpAtomicLoad %uint %58 %uint_1 %uint_2 + %61 = OpLoad %uint %ticket Aligned 4 + %cmp = OpINotEqual %bool %call1 %61 + OpBranchConditional %cmp %while_body %while_end + %while_body = OpLabel + OpBranch %while_cond + %while_end = OpLabel OpReturn OpFunctionEnd %unlock = OpFunction %void DontInline %36 - %38 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %64 = OpLabel - %65 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %66 = OpVariable %_ptr_Function_uint Function - OpStore %65 %38 Aligned 4 - %67 = OpLoad %_ptr_CrossWorkgroup_uint %65 Aligned 4 + %owner_1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_1 = OpLabel +%owner_addr_1 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %current = OpVariable %_ptr_Function_uint Function + OpStore %owner_addr_1 %owner_1 Aligned 4 + %67 = OpLoad %_ptr_CrossWorkgroup_uint %owner_addr_1 Aligned 4 %68 = OpPtrCastToGeneric %_ptr_Generic_uint %67 - %69 = OpAtomicLoad %uint %68 %uint_1 %uint_0 - OpStore %66 %69 Aligned 4 - %70 = OpLoad %_ptr_CrossWorkgroup_uint %65 Aligned 4 + %call_1 = OpAtomicLoad %uint %68 %uint_1 %uint_0 + OpStore %current %call_1 Aligned 4 + %70 = OpLoad %_ptr_CrossWorkgroup_uint %owner_addr_1 Aligned 4 %71 = OpPtrCastToGeneric %_ptr_Generic_uint %70 - %72 = OpLoad %uint %66 Aligned 4 - %73 = OpIAdd %uint %72 %uint_1 - OpAtomicStore %71 %uint_1 %uint_4 %73 + %72 = OpLoad %uint %current Aligned 4 + %add_0 = OpIAdd %uint %72 %uint_1 + OpAtomicStore %71 %uint_1 %uint_4 %add_0 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/benchmarks/ticketlock-acq2rx.spvasm b/dartagnan/src/test/resources/spirv/opencl/benchmarks/ticketlock-acq2rx.spvasm index 3371f2176d..a7b062608f 100644 --- a/dartagnan/src/test/resources/spirv/opencl/benchmarks/ticketlock-acq2rx.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/benchmarks/ticketlock-acq2rx.spvasm @@ -1,13 +1,13 @@ -; @Input: %10 = {0} -; @Input: %11 = {0} -; @Input: %12 = {0} -; @Input: %13 = {-1, -1} -; @Output: forall (%13[0] == -1 or %13[1] == -1 or %13[0] != %13[1]) +; @Input: %owner = {0} +; @Input: %next = {0} +; @Input: %x = {0} +; @Input: %A = {-1, -1} +; @Output: forall (%A[0] == -1 or %A[1] == -1 or %A[0] != %A[1]) ; @Config: 2, 1, 1 ; SPIR-V ; Version: 1.0 ; Generator: Khronos LLVM/SPIR-V Translator; 14 -; Bound: 74 +; Bound: 64 ; Schema: 0 OpCapability Addresses OpCapability Linkage @@ -18,21 +18,44 @@ OpEntryPoint Kernel %9 "mutex_test" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %l "l" + OpName %x "x" + OpName %A "A" + OpName %entry "entry" + OpName %l_addr "l.addr" + OpName %x_addr "x.addr" + OpName %A_addr "A.addr" + OpName %a "a" OpName %lock "lock" + OpName %l_0 "l" + OpName %add "add" OpName %unlock "unlock" + OpName %l_1 "l" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %entry_0 "entry" + OpName %while_body "while.body" + OpName %while_cond1 "while.cond1" + OpName %while_body2 "while.body2" + OpName %while_end "while.end" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %l_addr_0 "l.addr" + OpName %call_0 "call" + OpName %cmp "cmp" + OpName %call3 "call3" + OpName %tobool "tobool" + OpName %entry_1 "entry" + OpName %l_addr_1 "l.addr" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %16 Alignment 4 - OpDecorate %17 Alignment 4 - OpDecorate %18 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %21 Alignment 4 - OpDecorate %49 Alignment 4 - OpDecorate %50 Alignment 4 - OpDecorate %51 Alignment 4 - OpDecorate %64 Alignment 4 - OpDecorate %65 Alignment 4 + OpDecorate %l_addr Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %a Alignment 4 + OpDecorate %l_addr_0 Alignment 4 + OpDecorate %l_addr_1 Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 @@ -41,89 +64,78 @@ %_ptr_Input_v3uint = OpTypePointer Input %v3uint %void = OpTypeVoid %_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint - %8 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint + %8 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %_ptr_Function_uint = OpTypePointer Function %uint - %24 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint - %36 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint + %21 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_Generic_uint = OpTypePointer Generic %uint %bool = OpTypeBool %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %14 = OpLabel - %16 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %18 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %21 = OpVariable %_ptr_Function_uint Function - OpStore %16 %10 Aligned 4 - OpStore %17 %11 Aligned 4 - OpStore %18 %12 Aligned 4 - OpStore %19 %13 Aligned 4 - %22 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 - %23 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %28 = OpFunctionCall %void %lock %22 %23 - %29 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %30 = OpLoad %uint %29 Aligned 4 - OpStore %21 %30 Aligned 4 - %31 = OpLoad %uint %21 Aligned 4 - %33 = OpIAdd %uint %31 %uint_1 - %34 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - OpStore %34 %33 Aligned 4 - %35 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 - %39 = OpFunctionCall %void %unlock %35 - %40 = OpLoad %uint %21 Aligned 4 - %41 = OpLoad %_ptr_CrossWorkgroup_uint %19 Aligned 4 - %42 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %43 = OpCompositeExtract %uint %42 0 - %44 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %41 %43 - OpStore %44 %40 Aligned 4 + %l = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %l_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %a = OpVariable %_ptr_Function_uint Function + OpStore %l_addr %l Aligned 4 + OpStore %x_addr %x Aligned 4 + OpStore %A_addr %A Aligned 4 + %20 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 + %24 = OpFunctionCall %void %lock %20 + %25 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %26 = OpLoad %uint %25 Aligned 4 + OpStore %a %26 Aligned 4 + %27 = OpLoad %uint %a Aligned 4 + %add = OpIAdd %uint %27 %uint_1 + %30 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + OpStore %30 %add Aligned 4 + %31 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 + %34 = OpFunctionCall %void %unlock %31 + %35 = OpLoad %uint %a Aligned 4 + %36 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 + %37 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 + %call = OpCompositeExtract %uint %37 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %call + OpStore %arrayidx %35 Aligned 4 OpReturn OpFunctionEnd - %lock = OpFunction %void DontInline %24 - %26 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %27 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %45 = OpLabel - %49 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %50 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %51 = OpVariable %_ptr_Function_uint Function - OpStore %49 %26 Aligned 4 - OpStore %50 %27 Aligned 4 - %52 = OpLoad %_ptr_CrossWorkgroup_uint %50 Aligned 4 - %54 = OpPtrCastToGeneric %_ptr_Generic_uint %52 - %56 = OpAtomicIAdd %uint %54 %uint_1 %uint_0 %uint_1 - OpStore %51 %56 Aligned 4 - OpBranch %46 - %46 = OpLabel - %57 = OpLoad %_ptr_CrossWorkgroup_uint %49 Aligned 4 - %58 = OpPtrCastToGeneric %_ptr_Generic_uint %57 - %59 = OpAtomicLoad %uint %58 %uint_1 %uint_0 - %60 = OpLoad %uint %51 Aligned 4 - %62 = OpINotEqual %bool %59 %60 - OpBranchConditional %62 %47 %48 - %47 = OpLabel - OpBranch %46 - %48 = OpLabel + %lock = OpFunction %void DontInline %21 + %l_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_0 = OpLabel + %l_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_0 %l_0 Aligned 4 + OpBranch %while_body + %while_body = OpLabel + OpBranch %while_cond1 +%while_cond1 = OpLabel + %48 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 + %50 = OpPtrCastToGeneric %_ptr_Generic_uint %48 + %call_0 = OpAtomicLoad %uint %50 %uint_1 %uint_0 + %cmp = OpINotEqual %bool %call_0 %uint_0 + OpBranchConditional %cmp %while_body2 %while_end +%while_body2 = OpLabel + OpBranch %while_cond1 + %while_end = OpLabel + %55 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 + %56 = OpPtrCastToGeneric %_ptr_Generic_uint %55 + %call3 = OpAtomicExchange %uint %56 %uint_1 %uint_0 %uint_1 + %tobool = OpINotEqual %bool %call3 %uint_0 + OpBranchConditional %tobool %if_end %if_then + %if_then = OpLabel OpReturn + %if_end = OpLabel + OpBranch %while_body OpFunctionEnd - %unlock = OpFunction %void DontInline %36 - %38 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %63 = OpLabel - %64 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %65 = OpVariable %_ptr_Function_uint Function - OpStore %64 %38 Aligned 4 - %66 = OpLoad %_ptr_CrossWorkgroup_uint %64 Aligned 4 - %67 = OpPtrCastToGeneric %_ptr_Generic_uint %66 - %68 = OpAtomicLoad %uint %67 %uint_1 %uint_0 - OpStore %65 %68 Aligned 4 - %69 = OpLoad %_ptr_CrossWorkgroup_uint %64 Aligned 4 - %70 = OpPtrCastToGeneric %_ptr_Generic_uint %69 - %71 = OpLoad %uint %65 Aligned 4 - %72 = OpIAdd %uint %71 %uint_1 - OpAtomicStore %70 %uint_1 %uint_4 %72 + %unlock = OpFunction %void DontInline %21 + %l_1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_1 = OpLabel + %l_addr_1 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_1 %l_1 Aligned 4 + %61 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_1 Aligned 4 + %62 = OpPtrCastToGeneric %_ptr_Generic_uint %61 + OpAtomicStore %62 %uint_1 %uint_4 %uint_0 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/benchmarks/ticketlock-dv2wg-1.1.2.spvasm b/dartagnan/src/test/resources/spirv/opencl/benchmarks/ticketlock-dv2wg-1.1.2.spvasm index eaf961d084..f30d043f8a 100644 --- a/dartagnan/src/test/resources/spirv/opencl/benchmarks/ticketlock-dv2wg-1.1.2.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/benchmarks/ticketlock-dv2wg-1.1.2.spvasm @@ -1,13 +1,13 @@ -; @Input: %10 = {0} -; @Input: %11 = {0} -; @Input: %12 = {0} -; @Input: %13 = {-1, -1} -; @Output: forall (%13[0] == -1 or %13[1] == -1 or %13[0] != %13[1]) +; @Input: %owner = {0} +; @Input: %next = {0} +; @Input: %x = {0} +; @Input: %A = {-1, -1} +; @Output: forall (%A[0] == -1 or %A[1] == -1 or %A[0] != %A[1]) ; @Config: 1, 1, 2 ; SPIR-V ; Version: 1.0 ; Generator: Khronos LLVM/SPIR-V Translator; 14 -; Bound: 75 +; Bound: 65 ; Schema: 0 OpCapability Addresses OpCapability Linkage @@ -18,21 +18,44 @@ OpEntryPoint Kernel %9 "mutex_test" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %l "l" + OpName %x "x" + OpName %A "A" + OpName %entry "entry" + OpName %l_addr "l.addr" + OpName %x_addr "x.addr" + OpName %A_addr "A.addr" + OpName %a "a" OpName %lock "lock" + OpName %l_0 "l" + OpName %add "add" OpName %unlock "unlock" + OpName %l_1 "l" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %entry_0 "entry" + OpName %while_body "while.body" + OpName %while_cond1 "while.cond1" + OpName %while_body2 "while.body2" + OpName %while_end "while.end" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %l_addr_0 "l.addr" + OpName %call_0 "call" + OpName %cmp "cmp" + OpName %call3 "call3" + OpName %tobool "tobool" + OpName %entry_1 "entry" + OpName %l_addr_1 "l.addr" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %16 Alignment 4 - OpDecorate %17 Alignment 4 - OpDecorate %18 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %21 Alignment 4 - OpDecorate %49 Alignment 4 - OpDecorate %50 Alignment 4 - OpDecorate %51 Alignment 4 - OpDecorate %65 Alignment 4 - OpDecorate %66 Alignment 4 + OpDecorate %l_addr Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %a Alignment 4 + OpDecorate %l_addr_0 Alignment 4 + OpDecorate %l_addr_1 Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_2 = OpConstant %uint 2 @@ -42,89 +65,78 @@ %_ptr_Input_v3uint = OpTypePointer Input %v3uint %void = OpTypeVoid %_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint - %8 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint + %8 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %_ptr_Function_uint = OpTypePointer Function %uint - %24 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint - %36 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint + %21 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_Generic_uint = OpTypePointer Generic %uint %bool = OpTypeBool %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %14 = OpLabel - %16 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %18 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %21 = OpVariable %_ptr_Function_uint Function - OpStore %16 %10 Aligned 4 - OpStore %17 %11 Aligned 4 - OpStore %18 %12 Aligned 4 - OpStore %19 %13 Aligned 4 - %22 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 - %23 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %28 = OpFunctionCall %void %lock %22 %23 - %29 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %30 = OpLoad %uint %29 Aligned 4 - OpStore %21 %30 Aligned 4 - %31 = OpLoad %uint %21 Aligned 4 - %33 = OpIAdd %uint %31 %uint_1 - %34 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - OpStore %34 %33 Aligned 4 - %35 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 - %39 = OpFunctionCall %void %unlock %35 - %40 = OpLoad %uint %21 Aligned 4 - %41 = OpLoad %_ptr_CrossWorkgroup_uint %19 Aligned 4 - %42 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %43 = OpCompositeExtract %uint %42 0 - %44 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %41 %43 - OpStore %44 %40 Aligned 4 + %l = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %l_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %a = OpVariable %_ptr_Function_uint Function + OpStore %l_addr %l Aligned 4 + OpStore %x_addr %x Aligned 4 + OpStore %A_addr %A Aligned 4 + %20 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 + %24 = OpFunctionCall %void %lock %20 + %25 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %26 = OpLoad %uint %25 Aligned 4 + OpStore %a %26 Aligned 4 + %27 = OpLoad %uint %a Aligned 4 + %add = OpIAdd %uint %27 %uint_1 + %30 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + OpStore %30 %add Aligned 4 + %31 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 + %34 = OpFunctionCall %void %unlock %31 + %35 = OpLoad %uint %a Aligned 4 + %36 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 + %37 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 + %call = OpCompositeExtract %uint %37 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %call + OpStore %arrayidx %35 Aligned 4 OpReturn OpFunctionEnd - %lock = OpFunction %void DontInline %24 - %26 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %27 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %45 = OpLabel - %49 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %50 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %51 = OpVariable %_ptr_Function_uint Function - OpStore %49 %26 Aligned 4 - OpStore %50 %27 Aligned 4 - %52 = OpLoad %_ptr_CrossWorkgroup_uint %50 Aligned 4 - %54 = OpPtrCastToGeneric %_ptr_Generic_uint %52 - %57 = OpAtomicIAdd %uint %54 %uint_2 %uint_0 %uint_1 - OpStore %51 %57 Aligned 4 - OpBranch %46 - %46 = OpLabel - %58 = OpLoad %_ptr_CrossWorkgroup_uint %49 Aligned 4 - %59 = OpPtrCastToGeneric %_ptr_Generic_uint %58 - %60 = OpAtomicLoad %uint %59 %uint_2 %uint_2 - %61 = OpLoad %uint %51 Aligned 4 - %63 = OpINotEqual %bool %60 %61 - OpBranchConditional %63 %47 %48 - %47 = OpLabel - OpBranch %46 - %48 = OpLabel + %lock = OpFunction %void DontInline %21 + %l_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_0 = OpLabel + %l_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_0 %l_0 Aligned 4 + OpBranch %while_body + %while_body = OpLabel + OpBranch %while_cond1 +%while_cond1 = OpLabel + %48 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 + %50 = OpPtrCastToGeneric %_ptr_Generic_uint %48 + %call_0 = OpAtomicLoad %uint %50 %uint_2 %uint_0 + %cmp = OpINotEqual %bool %call_0 %uint_0 + OpBranchConditional %cmp %while_body2 %while_end +%while_body2 = OpLabel + OpBranch %while_cond1 + %while_end = OpLabel + %56 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 + %57 = OpPtrCastToGeneric %_ptr_Generic_uint %56 + %call3 = OpAtomicExchange %uint %57 %uint_2 %uint_2 %uint_1 + %tobool = OpINotEqual %bool %call3 %uint_0 + OpBranchConditional %tobool %if_end %if_then + %if_then = OpLabel OpReturn + %if_end = OpLabel + OpBranch %while_body OpFunctionEnd - %unlock = OpFunction %void DontInline %36 - %38 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %64 = OpLabel - %65 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %66 = OpVariable %_ptr_Function_uint Function - OpStore %65 %38 Aligned 4 - %67 = OpLoad %_ptr_CrossWorkgroup_uint %65 Aligned 4 - %68 = OpPtrCastToGeneric %_ptr_Generic_uint %67 - %69 = OpAtomicLoad %uint %68 %uint_2 %uint_0 - OpStore %66 %69 Aligned 4 - %70 = OpLoad %_ptr_CrossWorkgroup_uint %65 Aligned 4 - %71 = OpPtrCastToGeneric %_ptr_Generic_uint %70 - %72 = OpLoad %uint %66 Aligned 4 - %73 = OpIAdd %uint %72 %uint_1 - OpAtomicStore %71 %uint_2 %uint_4 %73 + %unlock = OpFunction %void DontInline %21 + %l_1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_1 = OpLabel + %l_addr_1 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_1 %l_1 Aligned 4 + %62 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_1 Aligned 4 + %63 = OpPtrCastToGeneric %_ptr_Generic_uint %62 + OpAtomicStore %63 %uint_2 %uint_4 %uint_0 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/benchmarks/ticketlock-dv2wg-2.1.1.spvasm b/dartagnan/src/test/resources/spirv/opencl/benchmarks/ticketlock-dv2wg-2.1.1.spvasm index d010e6adac..8bf3bcdf8e 100644 --- a/dartagnan/src/test/resources/spirv/opencl/benchmarks/ticketlock-dv2wg-2.1.1.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/benchmarks/ticketlock-dv2wg-2.1.1.spvasm @@ -1,13 +1,13 @@ -; @Input: %10 = {0} -; @Input: %11 = {0} -; @Input: %12 = {0} -; @Input: %13 = {-1, -1} -; @Output: forall (%13[0] == -1 or %13[1] == -1 or %13[0] != %13[1]) +; @Input: %owner = {0} +; @Input: %next = {0} +; @Input: %x = {0} +; @Input: %A = {-1, -1} +; @Output: forall (%A[0] == -1 or %A[1] == -1 or %A[0] != %A[1]) ; @Config: 2, 1, 1 ; SPIR-V ; Version: 1.0 ; Generator: Khronos LLVM/SPIR-V Translator; 14 -; Bound: 75 +; Bound: 65 ; Schema: 0 OpCapability Addresses OpCapability Linkage @@ -18,21 +18,44 @@ OpEntryPoint Kernel %9 "mutex_test" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %l "l" + OpName %x "x" + OpName %A "A" + OpName %entry "entry" + OpName %l_addr "l.addr" + OpName %x_addr "x.addr" + OpName %A_addr "A.addr" + OpName %a "a" OpName %lock "lock" + OpName %l_0 "l" + OpName %add "add" OpName %unlock "unlock" + OpName %l_1 "l" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %entry_0 "entry" + OpName %while_body "while.body" + OpName %while_cond1 "while.cond1" + OpName %while_body2 "while.body2" + OpName %while_end "while.end" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %l_addr_0 "l.addr" + OpName %call_0 "call" + OpName %cmp "cmp" + OpName %call3 "call3" + OpName %tobool "tobool" + OpName %entry_1 "entry" + OpName %l_addr_1 "l.addr" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %16 Alignment 4 - OpDecorate %17 Alignment 4 - OpDecorate %18 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %21 Alignment 4 - OpDecorate %49 Alignment 4 - OpDecorate %50 Alignment 4 - OpDecorate %51 Alignment 4 - OpDecorate %65 Alignment 4 - OpDecorate %66 Alignment 4 + OpDecorate %l_addr Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %a Alignment 4 + OpDecorate %l_addr_0 Alignment 4 + OpDecorate %l_addr_1 Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_2 = OpConstant %uint 2 @@ -42,89 +65,78 @@ %_ptr_Input_v3uint = OpTypePointer Input %v3uint %void = OpTypeVoid %_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint - %8 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint + %8 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %_ptr_Function_uint = OpTypePointer Function %uint - %24 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint - %36 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint + %21 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_Generic_uint = OpTypePointer Generic %uint %bool = OpTypeBool %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %14 = OpLabel - %16 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %18 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %21 = OpVariable %_ptr_Function_uint Function - OpStore %16 %10 Aligned 4 - OpStore %17 %11 Aligned 4 - OpStore %18 %12 Aligned 4 - OpStore %19 %13 Aligned 4 - %22 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 - %23 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %28 = OpFunctionCall %void %lock %22 %23 - %29 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %30 = OpLoad %uint %29 Aligned 4 - OpStore %21 %30 Aligned 4 - %31 = OpLoad %uint %21 Aligned 4 - %33 = OpIAdd %uint %31 %uint_1 - %34 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - OpStore %34 %33 Aligned 4 - %35 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 - %39 = OpFunctionCall %void %unlock %35 - %40 = OpLoad %uint %21 Aligned 4 - %41 = OpLoad %_ptr_CrossWorkgroup_uint %19 Aligned 4 - %42 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %43 = OpCompositeExtract %uint %42 0 - %44 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %41 %43 - OpStore %44 %40 Aligned 4 + %l = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %l_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %a = OpVariable %_ptr_Function_uint Function + OpStore %l_addr %l Aligned 4 + OpStore %x_addr %x Aligned 4 + OpStore %A_addr %A Aligned 4 + %20 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 + %24 = OpFunctionCall %void %lock %20 + %25 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %26 = OpLoad %uint %25 Aligned 4 + OpStore %a %26 Aligned 4 + %27 = OpLoad %uint %a Aligned 4 + %add = OpIAdd %uint %27 %uint_1 + %30 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + OpStore %30 %add Aligned 4 + %31 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 + %34 = OpFunctionCall %void %unlock %31 + %35 = OpLoad %uint %a Aligned 4 + %36 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 + %37 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 + %call = OpCompositeExtract %uint %37 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %call + OpStore %arrayidx %35 Aligned 4 OpReturn OpFunctionEnd - %lock = OpFunction %void DontInline %24 - %26 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %27 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %45 = OpLabel - %49 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %50 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %51 = OpVariable %_ptr_Function_uint Function - OpStore %49 %26 Aligned 4 - OpStore %50 %27 Aligned 4 - %52 = OpLoad %_ptr_CrossWorkgroup_uint %50 Aligned 4 - %54 = OpPtrCastToGeneric %_ptr_Generic_uint %52 - %57 = OpAtomicIAdd %uint %54 %uint_2 %uint_0 %uint_1 - OpStore %51 %57 Aligned 4 - OpBranch %46 - %46 = OpLabel - %58 = OpLoad %_ptr_CrossWorkgroup_uint %49 Aligned 4 - %59 = OpPtrCastToGeneric %_ptr_Generic_uint %58 - %60 = OpAtomicLoad %uint %59 %uint_2 %uint_2 - %61 = OpLoad %uint %51 Aligned 4 - %63 = OpINotEqual %bool %60 %61 - OpBranchConditional %63 %47 %48 - %47 = OpLabel - OpBranch %46 - %48 = OpLabel + %lock = OpFunction %void DontInline %21 + %l_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_0 = OpLabel + %l_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_0 %l_0 Aligned 4 + OpBranch %while_body + %while_body = OpLabel + OpBranch %while_cond1 +%while_cond1 = OpLabel + %48 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 + %50 = OpPtrCastToGeneric %_ptr_Generic_uint %48 + %call_0 = OpAtomicLoad %uint %50 %uint_2 %uint_0 + %cmp = OpINotEqual %bool %call_0 %uint_0 + OpBranchConditional %cmp %while_body2 %while_end +%while_body2 = OpLabel + OpBranch %while_cond1 + %while_end = OpLabel + %56 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 + %57 = OpPtrCastToGeneric %_ptr_Generic_uint %56 + %call3 = OpAtomicExchange %uint %57 %uint_2 %uint_2 %uint_1 + %tobool = OpINotEqual %bool %call3 %uint_0 + OpBranchConditional %tobool %if_end %if_then + %if_then = OpLabel OpReturn + %if_end = OpLabel + OpBranch %while_body OpFunctionEnd - %unlock = OpFunction %void DontInline %36 - %38 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %64 = OpLabel - %65 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %66 = OpVariable %_ptr_Function_uint Function - OpStore %65 %38 Aligned 4 - %67 = OpLoad %_ptr_CrossWorkgroup_uint %65 Aligned 4 - %68 = OpPtrCastToGeneric %_ptr_Generic_uint %67 - %69 = OpAtomicLoad %uint %68 %uint_2 %uint_0 - OpStore %66 %69 Aligned 4 - %70 = OpLoad %_ptr_CrossWorkgroup_uint %65 Aligned 4 - %71 = OpPtrCastToGeneric %_ptr_Generic_uint %70 - %72 = OpLoad %uint %66 Aligned 4 - %73 = OpIAdd %uint %72 %uint_1 - OpAtomicStore %71 %uint_2 %uint_4 %73 + %unlock = OpFunction %void DontInline %21 + %l_1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_1 = OpLabel + %l_addr_1 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_1 %l_1 Aligned 4 + %62 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_1 Aligned 4 + %63 = OpPtrCastToGeneric %_ptr_Generic_uint %62 + OpAtomicStore %63 %uint_2 %uint_4 %uint_0 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/benchmarks/ticketlock-dv2wg-2.2.1.spvasm b/dartagnan/src/test/resources/spirv/opencl/benchmarks/ticketlock-dv2wg-2.2.1.spvasm index 1fb62d3c6e..373229da5b 100644 --- a/dartagnan/src/test/resources/spirv/opencl/benchmarks/ticketlock-dv2wg-2.2.1.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/benchmarks/ticketlock-dv2wg-2.2.1.spvasm @@ -1,8 +1,8 @@ -; @Input: %10 = {0} -; @Input: %11 = {0} -; @Input: %12 = {0} -; @Input: %13 = {-1, -1} -; @Output: forall (%13[0] == -1 or %13[1] == -1 or %13[0] != %13[1]) +; @Input: %owner = {0} +; @Input: %next = {0} +; @Input: %x = {0} +; @Input: %A = {-1, -1} +; @Output: forall (%A[0] == -1 or %A[1] == -1 or %A[0] != %A[1]) ; @Config: 2, 2, 1 ; SPIR-V ; Version: 1.0 @@ -18,21 +18,52 @@ OpEntryPoint Kernel %9 "mutex_test" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %owner "owner" + OpName %next "next" + OpName %x "x" + OpName %A "A" + OpName %entry "entry" + OpName %owner_addr "owner.addr" + OpName %next_addr "next.addr" + OpName %x_addr "x.addr" + OpName %A_addr "A.addr" + OpName %a "a" OpName %lock "lock" + OpName %owner_0 "owner" + OpName %next_0 "next" + OpName %add "add" OpName %unlock "unlock" + OpName %owner_1 "owner" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %entry_0 "entry" + OpName %while_cond "while.cond" + OpName %while_body "while.body" + OpName %while_end "while.end" + OpName %owner_addr_0 "owner.addr" + OpName %next_addr_0 "next.addr" + OpName %ticket "ticket" + OpName %call_0 "call" + OpName %call1 "call1" + OpName %cmp "cmp" + OpName %entry_1 "entry" + OpName %owner_addr_1 "owner.addr" + OpName %current "current" + OpName %call_1 "call" + OpName %add_0 "add" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %16 Alignment 4 - OpDecorate %17 Alignment 4 - OpDecorate %18 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %21 Alignment 4 - OpDecorate %49 Alignment 4 - OpDecorate %50 Alignment 4 - OpDecorate %51 Alignment 4 - OpDecorate %65 Alignment 4 - OpDecorate %66 Alignment 4 + OpDecorate %owner_addr Alignment 4 + OpDecorate %next_addr Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %a Alignment 4 + OpDecorate %owner_addr_0 Alignment 4 + OpDecorate %next_addr_0 Alignment 4 + OpDecorate %ticket Alignment 4 + OpDecorate %owner_addr_1 Alignment 4 + OpDecorate %current Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_2 = OpConstant %uint 2 @@ -51,80 +82,80 @@ %bool = OpTypeBool %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %14 = OpLabel - %16 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %18 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %21 = OpVariable %_ptr_Function_uint Function - OpStore %16 %10 Aligned 4 - OpStore %17 %11 Aligned 4 - OpStore %18 %12 Aligned 4 - OpStore %19 %13 Aligned 4 - %22 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 - %23 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 + %owner = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %next = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %owner_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %next_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %a = OpVariable %_ptr_Function_uint Function + OpStore %owner_addr %owner Aligned 4 + OpStore %next_addr %next Aligned 4 + OpStore %x_addr %x Aligned 4 + OpStore %A_addr %A Aligned 4 + %22 = OpLoad %_ptr_CrossWorkgroup_uint %owner_addr Aligned 4 + %23 = OpLoad %_ptr_CrossWorkgroup_uint %next_addr Aligned 4 %28 = OpFunctionCall %void %lock %22 %23 - %29 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 + %29 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 %30 = OpLoad %uint %29 Aligned 4 - OpStore %21 %30 Aligned 4 - %31 = OpLoad %uint %21 Aligned 4 - %33 = OpIAdd %uint %31 %uint_1 - %34 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - OpStore %34 %33 Aligned 4 - %35 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 + OpStore %a %30 Aligned 4 + %31 = OpLoad %uint %a Aligned 4 + %add = OpIAdd %uint %31 %uint_1 + %34 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + OpStore %34 %add Aligned 4 + %35 = OpLoad %_ptr_CrossWorkgroup_uint %owner_addr Aligned 4 %39 = OpFunctionCall %void %unlock %35 - %40 = OpLoad %uint %21 Aligned 4 - %41 = OpLoad %_ptr_CrossWorkgroup_uint %19 Aligned 4 + %40 = OpLoad %uint %a Aligned 4 + %41 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %42 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %43 = OpCompositeExtract %uint %42 0 - %44 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %41 %43 - OpStore %44 %40 Aligned 4 + %call = OpCompositeExtract %uint %42 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %41 %call + OpStore %arrayidx %40 Aligned 4 OpReturn OpFunctionEnd %lock = OpFunction %void DontInline %24 - %26 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %27 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %45 = OpLabel - %49 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %50 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %51 = OpVariable %_ptr_Function_uint Function - OpStore %49 %26 Aligned 4 - OpStore %50 %27 Aligned 4 - %52 = OpLoad %_ptr_CrossWorkgroup_uint %50 Aligned 4 + %owner_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %next_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_0 = OpLabel +%owner_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%next_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %ticket = OpVariable %_ptr_Function_uint Function + OpStore %owner_addr_0 %owner_0 Aligned 4 + OpStore %next_addr_0 %next_0 Aligned 4 + %52 = OpLoad %_ptr_CrossWorkgroup_uint %next_addr_0 Aligned 4 %54 = OpPtrCastToGeneric %_ptr_Generic_uint %52 - %57 = OpAtomicIAdd %uint %54 %uint_2 %uint_0 %uint_1 - OpStore %51 %57 Aligned 4 - OpBranch %46 - %46 = OpLabel - %58 = OpLoad %_ptr_CrossWorkgroup_uint %49 Aligned 4 + %call_0 = OpAtomicIAdd %uint %54 %uint_2 %uint_0 %uint_1 + OpStore %ticket %call_0 Aligned 4 + OpBranch %while_cond + %while_cond = OpLabel + %58 = OpLoad %_ptr_CrossWorkgroup_uint %owner_addr_0 Aligned 4 %59 = OpPtrCastToGeneric %_ptr_Generic_uint %58 - %60 = OpAtomicLoad %uint %59 %uint_2 %uint_2 - %61 = OpLoad %uint %51 Aligned 4 - %63 = OpINotEqual %bool %60 %61 - OpBranchConditional %63 %47 %48 - %47 = OpLabel - OpBranch %46 - %48 = OpLabel + %call1 = OpAtomicLoad %uint %59 %uint_2 %uint_2 + %61 = OpLoad %uint %ticket Aligned 4 + %cmp = OpINotEqual %bool %call1 %61 + OpBranchConditional %cmp %while_body %while_end + %while_body = OpLabel + OpBranch %while_cond + %while_end = OpLabel OpReturn OpFunctionEnd %unlock = OpFunction %void DontInline %36 - %38 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %64 = OpLabel - %65 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %66 = OpVariable %_ptr_Function_uint Function - OpStore %65 %38 Aligned 4 - %67 = OpLoad %_ptr_CrossWorkgroup_uint %65 Aligned 4 + %owner_1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_1 = OpLabel +%owner_addr_1 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %current = OpVariable %_ptr_Function_uint Function + OpStore %owner_addr_1 %owner_1 Aligned 4 + %67 = OpLoad %_ptr_CrossWorkgroup_uint %owner_addr_1 Aligned 4 %68 = OpPtrCastToGeneric %_ptr_Generic_uint %67 - %69 = OpAtomicLoad %uint %68 %uint_2 %uint_0 - OpStore %66 %69 Aligned 4 - %70 = OpLoad %_ptr_CrossWorkgroup_uint %65 Aligned 4 + %call_1 = OpAtomicLoad %uint %68 %uint_2 %uint_0 + OpStore %current %call_1 Aligned 4 + %70 = OpLoad %_ptr_CrossWorkgroup_uint %owner_addr_1 Aligned 4 %71 = OpPtrCastToGeneric %_ptr_Generic_uint %70 - %72 = OpLoad %uint %66 Aligned 4 - %73 = OpIAdd %uint %72 %uint_1 - OpAtomicStore %71 %uint_2 %uint_4 %73 + %72 = OpLoad %uint %current Aligned 4 + %add_0 = OpIAdd %uint %72 %uint_1 + OpAtomicStore %71 %uint_2 %uint_4 %add_0 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/benchmarks/ticketlock-dv2wg-2.2.2.spvasm b/dartagnan/src/test/resources/spirv/opencl/benchmarks/ticketlock-dv2wg-2.2.2.spvasm index bca09557f9..910a932076 100644 --- a/dartagnan/src/test/resources/spirv/opencl/benchmarks/ticketlock-dv2wg-2.2.2.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/benchmarks/ticketlock-dv2wg-2.2.2.spvasm @@ -1,13 +1,13 @@ -; @Input: %10 = {0} -; @Input: %11 = {0} -; @Input: %12 = {0} -; @Input: %13 = {-1, -1} -; @Output: forall (%13[0] == -1 or %13[1] == -1 or %13[0] != %13[1]) +; @Input: %owner = {0} +; @Input: %next = {0} +; @Input: %x = {0} +; @Input: %A = {-1, -1} +; @Output: forall (%A[0] == -1 or %A[1] == -1 or %A[0] != %A[1]) ; @Config: 2, 2, 2 ; SPIR-V ; Version: 1.0 ; Generator: Khronos LLVM/SPIR-V Translator; 14 -; Bound: 75 +; Bound: 65 ; Schema: 0 OpCapability Addresses OpCapability Linkage @@ -18,21 +18,44 @@ OpEntryPoint Kernel %9 "mutex_test" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %l "l" + OpName %x "x" + OpName %A "A" + OpName %entry "entry" + OpName %l_addr "l.addr" + OpName %x_addr "x.addr" + OpName %A_addr "A.addr" + OpName %a "a" OpName %lock "lock" + OpName %l_0 "l" + OpName %add "add" OpName %unlock "unlock" + OpName %l_1 "l" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %entry_0 "entry" + OpName %while_body "while.body" + OpName %while_cond1 "while.cond1" + OpName %while_body2 "while.body2" + OpName %while_end "while.end" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %l_addr_0 "l.addr" + OpName %call_0 "call" + OpName %cmp "cmp" + OpName %call3 "call3" + OpName %tobool "tobool" + OpName %entry_1 "entry" + OpName %l_addr_1 "l.addr" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %16 Alignment 4 - OpDecorate %17 Alignment 4 - OpDecorate %18 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %21 Alignment 4 - OpDecorate %49 Alignment 4 - OpDecorate %50 Alignment 4 - OpDecorate %51 Alignment 4 - OpDecorate %65 Alignment 4 - OpDecorate %66 Alignment 4 + OpDecorate %l_addr Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %a Alignment 4 + OpDecorate %l_addr_0 Alignment 4 + OpDecorate %l_addr_1 Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_2 = OpConstant %uint 2 @@ -42,89 +65,78 @@ %_ptr_Input_v3uint = OpTypePointer Input %v3uint %void = OpTypeVoid %_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint - %8 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint + %8 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %_ptr_Function_uint = OpTypePointer Function %uint - %24 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint - %36 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint + %21 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_Generic_uint = OpTypePointer Generic %uint %bool = OpTypeBool %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %14 = OpLabel - %16 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %18 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %21 = OpVariable %_ptr_Function_uint Function - OpStore %16 %10 Aligned 4 - OpStore %17 %11 Aligned 4 - OpStore %18 %12 Aligned 4 - OpStore %19 %13 Aligned 4 - %22 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 - %23 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %28 = OpFunctionCall %void %lock %22 %23 - %29 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %30 = OpLoad %uint %29 Aligned 4 - OpStore %21 %30 Aligned 4 - %31 = OpLoad %uint %21 Aligned 4 - %33 = OpIAdd %uint %31 %uint_1 - %34 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - OpStore %34 %33 Aligned 4 - %35 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 - %39 = OpFunctionCall %void %unlock %35 - %40 = OpLoad %uint %21 Aligned 4 - %41 = OpLoad %_ptr_CrossWorkgroup_uint %19 Aligned 4 - %42 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %43 = OpCompositeExtract %uint %42 0 - %44 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %41 %43 - OpStore %44 %40 Aligned 4 + %l = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %l_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %a = OpVariable %_ptr_Function_uint Function + OpStore %l_addr %l Aligned 4 + OpStore %x_addr %x Aligned 4 + OpStore %A_addr %A Aligned 4 + %20 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 + %24 = OpFunctionCall %void %lock %20 + %25 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %26 = OpLoad %uint %25 Aligned 4 + OpStore %a %26 Aligned 4 + %27 = OpLoad %uint %a Aligned 4 + %add = OpIAdd %uint %27 %uint_1 + %30 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + OpStore %30 %add Aligned 4 + %31 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 + %34 = OpFunctionCall %void %unlock %31 + %35 = OpLoad %uint %a Aligned 4 + %36 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 + %37 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 + %call = OpCompositeExtract %uint %37 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %call + OpStore %arrayidx %35 Aligned 4 OpReturn OpFunctionEnd - %lock = OpFunction %void DontInline %24 - %26 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %27 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %45 = OpLabel - %49 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %50 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %51 = OpVariable %_ptr_Function_uint Function - OpStore %49 %26 Aligned 4 - OpStore %50 %27 Aligned 4 - %52 = OpLoad %_ptr_CrossWorkgroup_uint %50 Aligned 4 - %54 = OpPtrCastToGeneric %_ptr_Generic_uint %52 - %57 = OpAtomicIAdd %uint %54 %uint_2 %uint_0 %uint_1 - OpStore %51 %57 Aligned 4 - OpBranch %46 - %46 = OpLabel - %58 = OpLoad %_ptr_CrossWorkgroup_uint %49 Aligned 4 - %59 = OpPtrCastToGeneric %_ptr_Generic_uint %58 - %60 = OpAtomicLoad %uint %59 %uint_2 %uint_2 - %61 = OpLoad %uint %51 Aligned 4 - %63 = OpINotEqual %bool %60 %61 - OpBranchConditional %63 %47 %48 - %47 = OpLabel - OpBranch %46 - %48 = OpLabel + %lock = OpFunction %void DontInline %21 + %l_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_0 = OpLabel + %l_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_0 %l_0 Aligned 4 + OpBranch %while_body + %while_body = OpLabel + OpBranch %while_cond1 +%while_cond1 = OpLabel + %48 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 + %50 = OpPtrCastToGeneric %_ptr_Generic_uint %48 + %call_0 = OpAtomicLoad %uint %50 %uint_2 %uint_0 + %cmp = OpINotEqual %bool %call_0 %uint_0 + OpBranchConditional %cmp %while_body2 %while_end +%while_body2 = OpLabel + OpBranch %while_cond1 + %while_end = OpLabel + %56 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 + %57 = OpPtrCastToGeneric %_ptr_Generic_uint %56 + %call3 = OpAtomicExchange %uint %57 %uint_2 %uint_2 %uint_1 + %tobool = OpINotEqual %bool %call3 %uint_0 + OpBranchConditional %tobool %if_end %if_then + %if_then = OpLabel OpReturn + %if_end = OpLabel + OpBranch %while_body OpFunctionEnd - %unlock = OpFunction %void DontInline %36 - %38 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %64 = OpLabel - %65 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %66 = OpVariable %_ptr_Function_uint Function - OpStore %65 %38 Aligned 4 - %67 = OpLoad %_ptr_CrossWorkgroup_uint %65 Aligned 4 - %68 = OpPtrCastToGeneric %_ptr_Generic_uint %67 - %69 = OpAtomicLoad %uint %68 %uint_2 %uint_0 - OpStore %66 %69 Aligned 4 - %70 = OpLoad %_ptr_CrossWorkgroup_uint %65 Aligned 4 - %71 = OpPtrCastToGeneric %_ptr_Generic_uint %70 - %72 = OpLoad %uint %66 Aligned 4 - %73 = OpIAdd %uint %72 %uint_1 - OpAtomicStore %71 %uint_2 %uint_4 %73 + %unlock = OpFunction %void DontInline %21 + %l_1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_1 = OpLabel + %l_addr_1 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_1 %l_1 Aligned 4 + %62 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_1 Aligned 4 + %63 = OpPtrCastToGeneric %_ptr_Generic_uint %62 + OpAtomicStore %63 %uint_2 %uint_4 %uint_0 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/benchmarks/ticketlock-dv2wg.spvasm b/dartagnan/src/test/resources/spirv/opencl/benchmarks/ticketlock-dv2wg.spvasm index d010e6adac..8bf3bcdf8e 100644 --- a/dartagnan/src/test/resources/spirv/opencl/benchmarks/ticketlock-dv2wg.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/benchmarks/ticketlock-dv2wg.spvasm @@ -1,13 +1,13 @@ -; @Input: %10 = {0} -; @Input: %11 = {0} -; @Input: %12 = {0} -; @Input: %13 = {-1, -1} -; @Output: forall (%13[0] == -1 or %13[1] == -1 or %13[0] != %13[1]) +; @Input: %owner = {0} +; @Input: %next = {0} +; @Input: %x = {0} +; @Input: %A = {-1, -1} +; @Output: forall (%A[0] == -1 or %A[1] == -1 or %A[0] != %A[1]) ; @Config: 2, 1, 1 ; SPIR-V ; Version: 1.0 ; Generator: Khronos LLVM/SPIR-V Translator; 14 -; Bound: 75 +; Bound: 65 ; Schema: 0 OpCapability Addresses OpCapability Linkage @@ -18,21 +18,44 @@ OpEntryPoint Kernel %9 "mutex_test" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %l "l" + OpName %x "x" + OpName %A "A" + OpName %entry "entry" + OpName %l_addr "l.addr" + OpName %x_addr "x.addr" + OpName %A_addr "A.addr" + OpName %a "a" OpName %lock "lock" + OpName %l_0 "l" + OpName %add "add" OpName %unlock "unlock" + OpName %l_1 "l" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %entry_0 "entry" + OpName %while_body "while.body" + OpName %while_cond1 "while.cond1" + OpName %while_body2 "while.body2" + OpName %while_end "while.end" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %l_addr_0 "l.addr" + OpName %call_0 "call" + OpName %cmp "cmp" + OpName %call3 "call3" + OpName %tobool "tobool" + OpName %entry_1 "entry" + OpName %l_addr_1 "l.addr" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %16 Alignment 4 - OpDecorate %17 Alignment 4 - OpDecorate %18 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %21 Alignment 4 - OpDecorate %49 Alignment 4 - OpDecorate %50 Alignment 4 - OpDecorate %51 Alignment 4 - OpDecorate %65 Alignment 4 - OpDecorate %66 Alignment 4 + OpDecorate %l_addr Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %a Alignment 4 + OpDecorate %l_addr_0 Alignment 4 + OpDecorate %l_addr_1 Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_2 = OpConstant %uint 2 @@ -42,89 +65,78 @@ %_ptr_Input_v3uint = OpTypePointer Input %v3uint %void = OpTypeVoid %_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint - %8 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint + %8 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %_ptr_Function_uint = OpTypePointer Function %uint - %24 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint - %36 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint + %21 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_Generic_uint = OpTypePointer Generic %uint %bool = OpTypeBool %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %14 = OpLabel - %16 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %18 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %21 = OpVariable %_ptr_Function_uint Function - OpStore %16 %10 Aligned 4 - OpStore %17 %11 Aligned 4 - OpStore %18 %12 Aligned 4 - OpStore %19 %13 Aligned 4 - %22 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 - %23 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %28 = OpFunctionCall %void %lock %22 %23 - %29 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %30 = OpLoad %uint %29 Aligned 4 - OpStore %21 %30 Aligned 4 - %31 = OpLoad %uint %21 Aligned 4 - %33 = OpIAdd %uint %31 %uint_1 - %34 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - OpStore %34 %33 Aligned 4 - %35 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 - %39 = OpFunctionCall %void %unlock %35 - %40 = OpLoad %uint %21 Aligned 4 - %41 = OpLoad %_ptr_CrossWorkgroup_uint %19 Aligned 4 - %42 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %43 = OpCompositeExtract %uint %42 0 - %44 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %41 %43 - OpStore %44 %40 Aligned 4 + %l = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %l_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %a = OpVariable %_ptr_Function_uint Function + OpStore %l_addr %l Aligned 4 + OpStore %x_addr %x Aligned 4 + OpStore %A_addr %A Aligned 4 + %20 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 + %24 = OpFunctionCall %void %lock %20 + %25 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %26 = OpLoad %uint %25 Aligned 4 + OpStore %a %26 Aligned 4 + %27 = OpLoad %uint %a Aligned 4 + %add = OpIAdd %uint %27 %uint_1 + %30 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + OpStore %30 %add Aligned 4 + %31 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 + %34 = OpFunctionCall %void %unlock %31 + %35 = OpLoad %uint %a Aligned 4 + %36 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 + %37 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 + %call = OpCompositeExtract %uint %37 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %call + OpStore %arrayidx %35 Aligned 4 OpReturn OpFunctionEnd - %lock = OpFunction %void DontInline %24 - %26 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %27 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %45 = OpLabel - %49 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %50 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %51 = OpVariable %_ptr_Function_uint Function - OpStore %49 %26 Aligned 4 - OpStore %50 %27 Aligned 4 - %52 = OpLoad %_ptr_CrossWorkgroup_uint %50 Aligned 4 - %54 = OpPtrCastToGeneric %_ptr_Generic_uint %52 - %57 = OpAtomicIAdd %uint %54 %uint_2 %uint_0 %uint_1 - OpStore %51 %57 Aligned 4 - OpBranch %46 - %46 = OpLabel - %58 = OpLoad %_ptr_CrossWorkgroup_uint %49 Aligned 4 - %59 = OpPtrCastToGeneric %_ptr_Generic_uint %58 - %60 = OpAtomicLoad %uint %59 %uint_2 %uint_2 - %61 = OpLoad %uint %51 Aligned 4 - %63 = OpINotEqual %bool %60 %61 - OpBranchConditional %63 %47 %48 - %47 = OpLabel - OpBranch %46 - %48 = OpLabel + %lock = OpFunction %void DontInline %21 + %l_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_0 = OpLabel + %l_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_0 %l_0 Aligned 4 + OpBranch %while_body + %while_body = OpLabel + OpBranch %while_cond1 +%while_cond1 = OpLabel + %48 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 + %50 = OpPtrCastToGeneric %_ptr_Generic_uint %48 + %call_0 = OpAtomicLoad %uint %50 %uint_2 %uint_0 + %cmp = OpINotEqual %bool %call_0 %uint_0 + OpBranchConditional %cmp %while_body2 %while_end +%while_body2 = OpLabel + OpBranch %while_cond1 + %while_end = OpLabel + %56 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 + %57 = OpPtrCastToGeneric %_ptr_Generic_uint %56 + %call3 = OpAtomicExchange %uint %57 %uint_2 %uint_2 %uint_1 + %tobool = OpINotEqual %bool %call3 %uint_0 + OpBranchConditional %tobool %if_end %if_then + %if_then = OpLabel OpReturn + %if_end = OpLabel + OpBranch %while_body OpFunctionEnd - %unlock = OpFunction %void DontInline %36 - %38 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %64 = OpLabel - %65 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %66 = OpVariable %_ptr_Function_uint Function - OpStore %65 %38 Aligned 4 - %67 = OpLoad %_ptr_CrossWorkgroup_uint %65 Aligned 4 - %68 = OpPtrCastToGeneric %_ptr_Generic_uint %67 - %69 = OpAtomicLoad %uint %68 %uint_2 %uint_0 - OpStore %66 %69 Aligned 4 - %70 = OpLoad %_ptr_CrossWorkgroup_uint %65 Aligned 4 - %71 = OpPtrCastToGeneric %_ptr_Generic_uint %70 - %72 = OpLoad %uint %66 Aligned 4 - %73 = OpIAdd %uint %72 %uint_1 - OpAtomicStore %71 %uint_2 %uint_4 %73 + %unlock = OpFunction %void DontInline %21 + %l_1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_1 = OpLabel + %l_addr_1 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_1 %l_1 Aligned 4 + %62 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_1 Aligned 4 + %63 = OpPtrCastToGeneric %_ptr_Generic_uint %62 + OpAtomicStore %63 %uint_2 %uint_4 %uint_0 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/benchmarks/ticketlock-rel2rx.spvasm b/dartagnan/src/test/resources/spirv/opencl/benchmarks/ticketlock-rel2rx.spvasm index b9549bab6f..e1d82f77e1 100644 --- a/dartagnan/src/test/resources/spirv/opencl/benchmarks/ticketlock-rel2rx.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/benchmarks/ticketlock-rel2rx.spvasm @@ -1,13 +1,13 @@ -; @Input: %10 = {0} -; @Input: %11 = {0} -; @Input: %12 = {0} -; @Input: %13 = {-1, -1} -; @Output: forall (%13[0] == -1 or %13[1] == -1 or %13[0] != %13[1]) +; @Input: %owner = {0} +; @Input: %next = {0} +; @Input: %x = {0} +; @Input: %A = {-1, -1} +; @Output: forall (%A[0] == -1 or %A[1] == -1 or %A[0] != %A[1]) ; @Config: 2, 1, 1 ; SPIR-V ; Version: 1.0 ; Generator: Khronos LLVM/SPIR-V Translator; 14 -; Bound: 74 +; Bound: 64 ; Schema: 0 OpCapability Addresses OpCapability Linkage @@ -18,21 +18,44 @@ OpEntryPoint Kernel %9 "mutex_test" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %l "l" + OpName %x "x" + OpName %A "A" + OpName %entry "entry" + OpName %l_addr "l.addr" + OpName %x_addr "x.addr" + OpName %A_addr "A.addr" + OpName %a "a" OpName %lock "lock" + OpName %l_0 "l" + OpName %add "add" OpName %unlock "unlock" + OpName %l_1 "l" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %entry_0 "entry" + OpName %while_body "while.body" + OpName %while_cond1 "while.cond1" + OpName %while_body2 "while.body2" + OpName %while_end "while.end" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %l_addr_0 "l.addr" + OpName %call_0 "call" + OpName %cmp "cmp" + OpName %call3 "call3" + OpName %tobool "tobool" + OpName %entry_1 "entry" + OpName %l_addr_1 "l.addr" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %16 Alignment 4 - OpDecorate %17 Alignment 4 - OpDecorate %18 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %21 Alignment 4 - OpDecorate %49 Alignment 4 - OpDecorate %50 Alignment 4 - OpDecorate %51 Alignment 4 - OpDecorate %65 Alignment 4 - OpDecorate %66 Alignment 4 + OpDecorate %l_addr Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %a Alignment 4 + OpDecorate %l_addr_0 Alignment 4 + OpDecorate %l_addr_1 Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 @@ -41,89 +64,78 @@ %_ptr_Input_v3uint = OpTypePointer Input %v3uint %void = OpTypeVoid %_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint - %8 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint + %8 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %_ptr_Function_uint = OpTypePointer Function %uint - %24 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint - %36 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint + %21 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_Generic_uint = OpTypePointer Generic %uint %bool = OpTypeBool %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %14 = OpLabel - %16 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %18 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %21 = OpVariable %_ptr_Function_uint Function - OpStore %16 %10 Aligned 4 - OpStore %17 %11 Aligned 4 - OpStore %18 %12 Aligned 4 - OpStore %19 %13 Aligned 4 - %22 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 - %23 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %28 = OpFunctionCall %void %lock %22 %23 - %29 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %30 = OpLoad %uint %29 Aligned 4 - OpStore %21 %30 Aligned 4 - %31 = OpLoad %uint %21 Aligned 4 - %33 = OpIAdd %uint %31 %uint_1 - %34 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - OpStore %34 %33 Aligned 4 - %35 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 - %39 = OpFunctionCall %void %unlock %35 - %40 = OpLoad %uint %21 Aligned 4 - %41 = OpLoad %_ptr_CrossWorkgroup_uint %19 Aligned 4 - %42 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %43 = OpCompositeExtract %uint %42 0 - %44 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %41 %43 - OpStore %44 %40 Aligned 4 + %l = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %l_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %a = OpVariable %_ptr_Function_uint Function + OpStore %l_addr %l Aligned 4 + OpStore %x_addr %x Aligned 4 + OpStore %A_addr %A Aligned 4 + %20 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 + %24 = OpFunctionCall %void %lock %20 + %25 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + %26 = OpLoad %uint %25 Aligned 4 + OpStore %a %26 Aligned 4 + %27 = OpLoad %uint %a Aligned 4 + %add = OpIAdd %uint %27 %uint_1 + %30 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + OpStore %30 %add Aligned 4 + %31 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 + %34 = OpFunctionCall %void %unlock %31 + %35 = OpLoad %uint %a Aligned 4 + %36 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 + %37 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 + %call = OpCompositeExtract %uint %37 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %call + OpStore %arrayidx %35 Aligned 4 OpReturn OpFunctionEnd - %lock = OpFunction %void DontInline %24 - %26 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %27 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %45 = OpLabel - %49 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %50 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %51 = OpVariable %_ptr_Function_uint Function - OpStore %49 %26 Aligned 4 - OpStore %50 %27 Aligned 4 - %52 = OpLoad %_ptr_CrossWorkgroup_uint %50 Aligned 4 - %54 = OpPtrCastToGeneric %_ptr_Generic_uint %52 - %56 = OpAtomicIAdd %uint %54 %uint_1 %uint_0 %uint_1 - OpStore %51 %56 Aligned 4 - OpBranch %46 - %46 = OpLabel - %57 = OpLoad %_ptr_CrossWorkgroup_uint %49 Aligned 4 - %58 = OpPtrCastToGeneric %_ptr_Generic_uint %57 - %60 = OpAtomicLoad %uint %58 %uint_1 %uint_2 - %61 = OpLoad %uint %51 Aligned 4 - %63 = OpINotEqual %bool %60 %61 - OpBranchConditional %63 %47 %48 - %47 = OpLabel - OpBranch %46 - %48 = OpLabel + %lock = OpFunction %void DontInline %21 + %l_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_0 = OpLabel + %l_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_0 %l_0 Aligned 4 + OpBranch %while_body + %while_body = OpLabel + OpBranch %while_cond1 +%while_cond1 = OpLabel + %48 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 + %50 = OpPtrCastToGeneric %_ptr_Generic_uint %48 + %call_0 = OpAtomicLoad %uint %50 %uint_1 %uint_0 + %cmp = OpINotEqual %bool %call_0 %uint_0 + OpBranchConditional %cmp %while_body2 %while_end +%while_body2 = OpLabel + OpBranch %while_cond1 + %while_end = OpLabel + %55 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 + %56 = OpPtrCastToGeneric %_ptr_Generic_uint %55 + %call3 = OpAtomicExchange %uint %56 %uint_1 %uint_2 %uint_1 + %tobool = OpINotEqual %bool %call3 %uint_0 + OpBranchConditional %tobool %if_end %if_then + %if_then = OpLabel OpReturn + %if_end = OpLabel + OpBranch %while_body OpFunctionEnd - %unlock = OpFunction %void DontInline %36 - %38 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %64 = OpLabel - %65 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %66 = OpVariable %_ptr_Function_uint Function - OpStore %65 %38 Aligned 4 - %67 = OpLoad %_ptr_CrossWorkgroup_uint %65 Aligned 4 - %68 = OpPtrCastToGeneric %_ptr_Generic_uint %67 - %69 = OpAtomicLoad %uint %68 %uint_1 %uint_0 - OpStore %66 %69 Aligned 4 - %70 = OpLoad %_ptr_CrossWorkgroup_uint %65 Aligned 4 - %71 = OpPtrCastToGeneric %_ptr_Generic_uint %70 - %72 = OpLoad %uint %66 Aligned 4 - %73 = OpIAdd %uint %72 %uint_1 - OpAtomicStore %71 %uint_1 %uint_0 %73 + %unlock = OpFunction %void DontInline %21 + %l_1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_1 = OpLabel + %l_addr_1 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_1 %l_1 Aligned 4 + %62 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_1 Aligned 4 + %63 = OpPtrCastToGeneric %_ptr_Generic_uint %62 + OpAtomicStore %63 %uint_1 %uint_0 %uint_0 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/benchmarks/ttaslock-1.1.2.spvasm b/dartagnan/src/test/resources/spirv/opencl/benchmarks/ttaslock-1.1.2.spvasm index 2810b31ac6..8900302590 100644 --- a/dartagnan/src/test/resources/spirv/opencl/benchmarks/ttaslock-1.1.2.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/benchmarks/ttaslock-1.1.2.spvasm @@ -1,7 +1,7 @@ -; @Input: %10 = {0} -; @Input: %11 = {0} -; @Input: %12 = {-1, -1} -; @Output: forall (%12[0] == -1 or %12[1] == -1 or %12[0] != %12[1]) +; @Input: %l = {0} +; @Input: %x = {0} +; @Input: %A = {-1, -1} +; @Output: forall (%A[0] == -1 or %A[1] == -1 or %A[0] != %A[1]) ; @Config: 1, 1, 2 ; SPIR-V ; Version: 1.0 @@ -17,17 +17,44 @@ OpEntryPoint Kernel %9 "mutex_test" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %l "l" + OpName %x "x" + OpName %A "A" + OpName %entry "entry" + OpName %l_addr "l.addr" + OpName %x_addr "x.addr" + OpName %A_addr "A.addr" + OpName %a "a" OpName %lock "lock" + OpName %l_0 "l" + OpName %add "add" OpName %unlock "unlock" + OpName %l_1 "l" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %entry_0 "entry" + OpName %while_body "while.body" + OpName %while_cond1 "while.cond1" + OpName %while_body2 "while.body2" + OpName %while_end "while.end" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %l_addr_0 "l.addr" + OpName %call_0 "call" + OpName %cmp "cmp" + OpName %call3 "call3" + OpName %tobool "tobool" + OpName %entry_1 "entry" + OpName %l_addr_1 "l.addr" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %15 Alignment 4 - OpDecorate %16 Alignment 4 - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %47 Alignment 4 - OpDecorate %61 Alignment 4 + OpDecorate %l_addr Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %a Alignment 4 + OpDecorate %l_addr_0 Alignment 4 + OpDecorate %l_addr_1 Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 @@ -45,69 +72,69 @@ %bool = OpTypeBool %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpLabel - %15 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %16 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - OpStore %15 %10 Aligned 4 - OpStore %16 %11 Aligned 4 - OpStore %17 %12 Aligned 4 - %20 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 + %l = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %l_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %a = OpVariable %_ptr_Function_uint Function + OpStore %l_addr %l Aligned 4 + OpStore %x_addr %x Aligned 4 + OpStore %A_addr %A Aligned 4 + %20 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 %24 = OpFunctionCall %void %lock %20 - %25 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 + %25 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 %26 = OpLoad %uint %25 Aligned 4 - OpStore %19 %26 Aligned 4 - %27 = OpLoad %uint %19 Aligned 4 - %29 = OpIAdd %uint %27 %uint_1 - %30 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 - OpStore %30 %29 Aligned 4 - %31 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 + OpStore %a %26 Aligned 4 + %27 = OpLoad %uint %a Aligned 4 + %add = OpIAdd %uint %27 %uint_1 + %30 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + OpStore %30 %add Aligned 4 + %31 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 %34 = OpFunctionCall %void %unlock %31 - %35 = OpLoad %uint %19 Aligned 4 - %36 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 + %35 = OpLoad %uint %a Aligned 4 + %36 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %37 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %38 = OpCompositeExtract %uint %37 0 - %39 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %38 - OpStore %39 %35 Aligned 4 + %call = OpCompositeExtract %uint %37 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %call + OpStore %arrayidx %35 Aligned 4 OpReturn OpFunctionEnd %lock = OpFunction %void DontInline %21 - %23 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %40 = OpLabel - %47 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %47 %23 Aligned 4 - OpBranch %41 - %41 = OpLabel - OpBranch %42 - %42 = OpLabel - %48 = OpLoad %_ptr_CrossWorkgroup_uint %47 Aligned 4 + %l_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_0 = OpLabel + %l_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_0 %l_0 Aligned 4 + OpBranch %while_body + %while_body = OpLabel + OpBranch %while_cond1 +%while_cond1 = OpLabel + %48 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 %50 = OpPtrCastToGeneric %_ptr_Generic_uint %48 - %52 = OpAtomicLoad %uint %50 %uint_1 %uint_0 - %54 = OpINotEqual %bool %52 %uint_0 - OpBranchConditional %54 %43 %44 - %43 = OpLabel - OpBranch %42 - %44 = OpLabel - %55 = OpLoad %_ptr_CrossWorkgroup_uint %47 Aligned 4 + %call_0 = OpAtomicLoad %uint %50 %uint_1 %uint_0 + %cmp = OpINotEqual %bool %call_0 %uint_0 + OpBranchConditional %cmp %while_body2 %while_end +%while_body2 = OpLabel + OpBranch %while_cond1 + %while_end = OpLabel + %55 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 %56 = OpPtrCastToGeneric %_ptr_Generic_uint %55 - %58 = OpAtomicExchange %uint %56 %uint_1 %uint_2 %uint_1 - %59 = OpINotEqual %bool %58 %uint_0 - OpBranchConditional %59 %46 %45 - %45 = OpLabel + %call3 = OpAtomicExchange %uint %56 %uint_1 %uint_2 %uint_1 + %tobool = OpINotEqual %bool %call3 %uint_0 + OpBranchConditional %tobool %if_end %if_then + %if_then = OpLabel OpReturn - %46 = OpLabel - OpBranch %41 + %if_end = OpLabel + OpBranch %while_body OpFunctionEnd %unlock = OpFunction %void DontInline %21 - %33 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %60 = OpLabel - %61 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %61 %33 Aligned 4 - %62 = OpLoad %_ptr_CrossWorkgroup_uint %61 Aligned 4 + %l_1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_1 = OpLabel + %l_addr_1 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_1 %l_1 Aligned 4 + %62 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_1 Aligned 4 %63 = OpPtrCastToGeneric %_ptr_Generic_uint %62 OpAtomicStore %63 %uint_1 %uint_4 %uint_0 OpReturn diff --git a/dartagnan/src/test/resources/spirv/opencl/benchmarks/ttaslock-2.1.1.spvasm b/dartagnan/src/test/resources/spirv/opencl/benchmarks/ttaslock-2.1.1.spvasm index dd70044b44..8d3e107328 100644 --- a/dartagnan/src/test/resources/spirv/opencl/benchmarks/ttaslock-2.1.1.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/benchmarks/ttaslock-2.1.1.spvasm @@ -1,7 +1,7 @@ -; @Input: %10 = {0} -; @Input: %11 = {0} -; @Input: %12 = {-1, -1} -; @Output: forall (%12[0] == -1 or %12[1] == -1 or %12[0] != %12[1]) +; @Input: %l = {0} +; @Input: %x = {0} +; @Input: %A = {-1, -1} +; @Output: forall (%A[0] == -1 or %A[1] == -1 or %A[0] != %A[1]) ; @Config: 2, 1, 1 ; SPIR-V ; Version: 1.0 @@ -17,17 +17,44 @@ OpEntryPoint Kernel %9 "mutex_test" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %l "l" + OpName %x "x" + OpName %A "A" + OpName %entry "entry" + OpName %l_addr "l.addr" + OpName %x_addr "x.addr" + OpName %A_addr "A.addr" + OpName %a "a" OpName %lock "lock" + OpName %l_0 "l" + OpName %add "add" OpName %unlock "unlock" + OpName %l_1 "l" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %entry_0 "entry" + OpName %while_body "while.body" + OpName %while_cond1 "while.cond1" + OpName %while_body2 "while.body2" + OpName %while_end "while.end" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %l_addr_0 "l.addr" + OpName %call_0 "call" + OpName %cmp "cmp" + OpName %call3 "call3" + OpName %tobool "tobool" + OpName %entry_1 "entry" + OpName %l_addr_1 "l.addr" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %15 Alignment 4 - OpDecorate %16 Alignment 4 - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %47 Alignment 4 - OpDecorate %61 Alignment 4 + OpDecorate %l_addr Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %a Alignment 4 + OpDecorate %l_addr_0 Alignment 4 + OpDecorate %l_addr_1 Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 @@ -45,69 +72,69 @@ %bool = OpTypeBool %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpLabel - %15 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %16 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - OpStore %15 %10 Aligned 4 - OpStore %16 %11 Aligned 4 - OpStore %17 %12 Aligned 4 - %20 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 + %l = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %l_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %a = OpVariable %_ptr_Function_uint Function + OpStore %l_addr %l Aligned 4 + OpStore %x_addr %x Aligned 4 + OpStore %A_addr %A Aligned 4 + %20 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 %24 = OpFunctionCall %void %lock %20 - %25 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 + %25 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 %26 = OpLoad %uint %25 Aligned 4 - OpStore %19 %26 Aligned 4 - %27 = OpLoad %uint %19 Aligned 4 - %29 = OpIAdd %uint %27 %uint_1 - %30 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 - OpStore %30 %29 Aligned 4 - %31 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 + OpStore %a %26 Aligned 4 + %27 = OpLoad %uint %a Aligned 4 + %add = OpIAdd %uint %27 %uint_1 + %30 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + OpStore %30 %add Aligned 4 + %31 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 %34 = OpFunctionCall %void %unlock %31 - %35 = OpLoad %uint %19 Aligned 4 - %36 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 + %35 = OpLoad %uint %a Aligned 4 + %36 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %37 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %38 = OpCompositeExtract %uint %37 0 - %39 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %38 - OpStore %39 %35 Aligned 4 + %call = OpCompositeExtract %uint %37 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %call + OpStore %arrayidx %35 Aligned 4 OpReturn OpFunctionEnd %lock = OpFunction %void DontInline %21 - %23 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %40 = OpLabel - %47 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %47 %23 Aligned 4 - OpBranch %41 - %41 = OpLabel - OpBranch %42 - %42 = OpLabel - %48 = OpLoad %_ptr_CrossWorkgroup_uint %47 Aligned 4 + %l_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_0 = OpLabel + %l_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_0 %l_0 Aligned 4 + OpBranch %while_body + %while_body = OpLabel + OpBranch %while_cond1 +%while_cond1 = OpLabel + %48 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 %50 = OpPtrCastToGeneric %_ptr_Generic_uint %48 - %52 = OpAtomicLoad %uint %50 %uint_1 %uint_0 - %54 = OpINotEqual %bool %52 %uint_0 - OpBranchConditional %54 %43 %44 - %43 = OpLabel - OpBranch %42 - %44 = OpLabel - %55 = OpLoad %_ptr_CrossWorkgroup_uint %47 Aligned 4 + %call_0 = OpAtomicLoad %uint %50 %uint_1 %uint_0 + %cmp = OpINotEqual %bool %call_0 %uint_0 + OpBranchConditional %cmp %while_body2 %while_end +%while_body2 = OpLabel + OpBranch %while_cond1 + %while_end = OpLabel + %55 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 %56 = OpPtrCastToGeneric %_ptr_Generic_uint %55 - %58 = OpAtomicExchange %uint %56 %uint_1 %uint_2 %uint_1 - %59 = OpINotEqual %bool %58 %uint_0 - OpBranchConditional %59 %46 %45 - %45 = OpLabel + %call3 = OpAtomicExchange %uint %56 %uint_1 %uint_2 %uint_1 + %tobool = OpINotEqual %bool %call3 %uint_0 + OpBranchConditional %tobool %if_end %if_then + %if_then = OpLabel OpReturn - %46 = OpLabel - OpBranch %41 + %if_end = OpLabel + OpBranch %while_body OpFunctionEnd %unlock = OpFunction %void DontInline %21 - %33 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %60 = OpLabel - %61 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %61 %33 Aligned 4 - %62 = OpLoad %_ptr_CrossWorkgroup_uint %61 Aligned 4 + %l_1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_1 = OpLabel + %l_addr_1 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_1 %l_1 Aligned 4 + %62 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_1 Aligned 4 %63 = OpPtrCastToGeneric %_ptr_Generic_uint %62 OpAtomicStore %63 %uint_1 %uint_4 %uint_0 OpReturn diff --git a/dartagnan/src/test/resources/spirv/opencl/benchmarks/ttaslock-acq2rx.spvasm b/dartagnan/src/test/resources/spirv/opencl/benchmarks/ttaslock-acq2rx.spvasm index 7cf7ee3e5b..c274ebd71f 100644 --- a/dartagnan/src/test/resources/spirv/opencl/benchmarks/ttaslock-acq2rx.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/benchmarks/ttaslock-acq2rx.spvasm @@ -1,7 +1,7 @@ -; @Input: %10 = {0} -; @Input: %11 = {0} -; @Input: %12 = {-1, -1} -; @Output: forall (%12[0] == -1 or %12[1] == -1 or %12[0] != %12[1]) +; @Input: %l = {0} +; @Input: %x = {0} +; @Input: %A = {-1, -1} +; @Output: forall (%A[0] == -1 or %A[1] == -1 or %A[0] != %A[1]) ; @Config: 2, 1, 1 ; SPIR-V ; Version: 1.0 @@ -17,17 +17,44 @@ OpEntryPoint Kernel %9 "mutex_test" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %l "l" + OpName %x "x" + OpName %A "A" + OpName %entry "entry" + OpName %l_addr "l.addr" + OpName %x_addr "x.addr" + OpName %A_addr "A.addr" + OpName %a "a" OpName %lock "lock" + OpName %l_0 "l" + OpName %add "add" OpName %unlock "unlock" + OpName %l_1 "l" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %entry_0 "entry" + OpName %while_body "while.body" + OpName %while_cond1 "while.cond1" + OpName %while_body2 "while.body2" + OpName %while_end "while.end" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %l_addr_0 "l.addr" + OpName %call_0 "call" + OpName %cmp "cmp" + OpName %call3 "call3" + OpName %tobool "tobool" + OpName %entry_1 "entry" + OpName %l_addr_1 "l.addr" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %15 Alignment 4 - OpDecorate %16 Alignment 4 - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %47 Alignment 4 - OpDecorate %60 Alignment 4 + OpDecorate %l_addr Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %a Alignment 4 + OpDecorate %l_addr_0 Alignment 4 + OpDecorate %l_addr_1 Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 @@ -44,69 +71,69 @@ %bool = OpTypeBool %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpLabel - %15 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %16 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - OpStore %15 %10 Aligned 4 - OpStore %16 %11 Aligned 4 - OpStore %17 %12 Aligned 4 - %20 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 + %l = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %l_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %a = OpVariable %_ptr_Function_uint Function + OpStore %l_addr %l Aligned 4 + OpStore %x_addr %x Aligned 4 + OpStore %A_addr %A Aligned 4 + %20 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 %24 = OpFunctionCall %void %lock %20 - %25 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 + %25 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 %26 = OpLoad %uint %25 Aligned 4 - OpStore %19 %26 Aligned 4 - %27 = OpLoad %uint %19 Aligned 4 - %29 = OpIAdd %uint %27 %uint_1 - %30 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 - OpStore %30 %29 Aligned 4 - %31 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 + OpStore %a %26 Aligned 4 + %27 = OpLoad %uint %a Aligned 4 + %add = OpIAdd %uint %27 %uint_1 + %30 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + OpStore %30 %add Aligned 4 + %31 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 %34 = OpFunctionCall %void %unlock %31 - %35 = OpLoad %uint %19 Aligned 4 - %36 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 + %35 = OpLoad %uint %a Aligned 4 + %36 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %37 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %38 = OpCompositeExtract %uint %37 0 - %39 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %38 - OpStore %39 %35 Aligned 4 + %call = OpCompositeExtract %uint %37 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %call + OpStore %arrayidx %35 Aligned 4 OpReturn OpFunctionEnd %lock = OpFunction %void DontInline %21 - %23 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %40 = OpLabel - %47 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %47 %23 Aligned 4 - OpBranch %41 - %41 = OpLabel - OpBranch %42 - %42 = OpLabel - %48 = OpLoad %_ptr_CrossWorkgroup_uint %47 Aligned 4 + %l_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_0 = OpLabel + %l_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_0 %l_0 Aligned 4 + OpBranch %while_body + %while_body = OpLabel + OpBranch %while_cond1 +%while_cond1 = OpLabel + %48 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 %50 = OpPtrCastToGeneric %_ptr_Generic_uint %48 - %52 = OpAtomicLoad %uint %50 %uint_1 %uint_0 - %54 = OpINotEqual %bool %52 %uint_0 - OpBranchConditional %54 %43 %44 - %43 = OpLabel - OpBranch %42 - %44 = OpLabel - %55 = OpLoad %_ptr_CrossWorkgroup_uint %47 Aligned 4 + %call_0 = OpAtomicLoad %uint %50 %uint_1 %uint_0 + %cmp = OpINotEqual %bool %call_0 %uint_0 + OpBranchConditional %cmp %while_body2 %while_end +%while_body2 = OpLabel + OpBranch %while_cond1 + %while_end = OpLabel + %55 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 %56 = OpPtrCastToGeneric %_ptr_Generic_uint %55 - %57 = OpAtomicExchange %uint %56 %uint_1 %uint_0 %uint_1 - %58 = OpINotEqual %bool %57 %uint_0 - OpBranchConditional %58 %46 %45 - %45 = OpLabel + %call3 = OpAtomicExchange %uint %56 %uint_1 %uint_0 %uint_1 + %tobool = OpINotEqual %bool %call3 %uint_0 + OpBranchConditional %tobool %if_end %if_then + %if_then = OpLabel OpReturn - %46 = OpLabel - OpBranch %41 + %if_end = OpLabel + OpBranch %while_body OpFunctionEnd %unlock = OpFunction %void DontInline %21 - %33 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %59 = OpLabel - %60 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %60 %33 Aligned 4 - %61 = OpLoad %_ptr_CrossWorkgroup_uint %60 Aligned 4 + %l_1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_1 = OpLabel + %l_addr_1 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_1 %l_1 Aligned 4 + %61 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_1 Aligned 4 %62 = OpPtrCastToGeneric %_ptr_Generic_uint %61 OpAtomicStore %62 %uint_1 %uint_4 %uint_0 OpReturn diff --git a/dartagnan/src/test/resources/spirv/opencl/benchmarks/ttaslock-dv2wg-1.1.2.spvasm b/dartagnan/src/test/resources/spirv/opencl/benchmarks/ttaslock-dv2wg-1.1.2.spvasm index 45e8c77a7f..39343050d9 100644 --- a/dartagnan/src/test/resources/spirv/opencl/benchmarks/ttaslock-dv2wg-1.1.2.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/benchmarks/ttaslock-dv2wg-1.1.2.spvasm @@ -1,7 +1,7 @@ -; @Input: %10 = {0} -; @Input: %11 = {0} -; @Input: %12 = {-1, -1} -; @Output: forall (%12[0] == -1 or %12[1] == -1 or %12[0] != %12[1]) +; @Input: %l = {0} +; @Input: %x = {0} +; @Input: %A = {-1, -1} +; @Output: forall (%A[0] == -1 or %A[1] == -1 or %A[0] != %A[1]) ; @Config: 1, 1, 2 ; SPIR-V ; Version: 1.0 @@ -17,17 +17,44 @@ OpEntryPoint Kernel %9 "mutex_test" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %l "l" + OpName %x "x" + OpName %A "A" + OpName %entry "entry" + OpName %l_addr "l.addr" + OpName %x_addr "x.addr" + OpName %A_addr "A.addr" + OpName %a "a" OpName %lock "lock" + OpName %l_0 "l" + OpName %add "add" OpName %unlock "unlock" + OpName %l_1 "l" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %entry_0 "entry" + OpName %while_body "while.body" + OpName %while_cond1 "while.cond1" + OpName %while_body2 "while.body2" + OpName %while_end "while.end" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %l_addr_0 "l.addr" + OpName %call_0 "call" + OpName %cmp "cmp" + OpName %call3 "call3" + OpName %tobool "tobool" + OpName %entry_1 "entry" + OpName %l_addr_1 "l.addr" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %15 Alignment 4 - OpDecorate %16 Alignment 4 - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %47 Alignment 4 - OpDecorate %61 Alignment 4 + OpDecorate %l_addr Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %a Alignment 4 + OpDecorate %l_addr_0 Alignment 4 + OpDecorate %l_addr_1 Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_2 = OpConstant %uint 2 @@ -45,69 +72,69 @@ %bool = OpTypeBool %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpLabel - %15 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %16 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - OpStore %15 %10 Aligned 4 - OpStore %16 %11 Aligned 4 - OpStore %17 %12 Aligned 4 - %20 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 + %l = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %l_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %a = OpVariable %_ptr_Function_uint Function + OpStore %l_addr %l Aligned 4 + OpStore %x_addr %x Aligned 4 + OpStore %A_addr %A Aligned 4 + %20 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 %24 = OpFunctionCall %void %lock %20 - %25 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 + %25 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 %26 = OpLoad %uint %25 Aligned 4 - OpStore %19 %26 Aligned 4 - %27 = OpLoad %uint %19 Aligned 4 - %29 = OpIAdd %uint %27 %uint_1 - %30 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 - OpStore %30 %29 Aligned 4 - %31 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 + OpStore %a %26 Aligned 4 + %27 = OpLoad %uint %a Aligned 4 + %add = OpIAdd %uint %27 %uint_1 + %30 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + OpStore %30 %add Aligned 4 + %31 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 %34 = OpFunctionCall %void %unlock %31 - %35 = OpLoad %uint %19 Aligned 4 - %36 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 + %35 = OpLoad %uint %a Aligned 4 + %36 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %37 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %38 = OpCompositeExtract %uint %37 0 - %39 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %38 - OpStore %39 %35 Aligned 4 + %call = OpCompositeExtract %uint %37 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %call + OpStore %arrayidx %35 Aligned 4 OpReturn OpFunctionEnd %lock = OpFunction %void DontInline %21 - %23 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %40 = OpLabel - %47 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %47 %23 Aligned 4 - OpBranch %41 - %41 = OpLabel - OpBranch %42 - %42 = OpLabel - %48 = OpLoad %_ptr_CrossWorkgroup_uint %47 Aligned 4 + %l_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_0 = OpLabel + %l_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_0 %l_0 Aligned 4 + OpBranch %while_body + %while_body = OpLabel + OpBranch %while_cond1 +%while_cond1 = OpLabel + %48 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 %50 = OpPtrCastToGeneric %_ptr_Generic_uint %48 - %53 = OpAtomicLoad %uint %50 %uint_2 %uint_0 - %55 = OpINotEqual %bool %53 %uint_0 - OpBranchConditional %55 %43 %44 - %43 = OpLabel - OpBranch %42 - %44 = OpLabel - %56 = OpLoad %_ptr_CrossWorkgroup_uint %47 Aligned 4 + %call_0 = OpAtomicLoad %uint %50 %uint_2 %uint_0 + %cmp = OpINotEqual %bool %call_0 %uint_0 + OpBranchConditional %cmp %while_body2 %while_end +%while_body2 = OpLabel + OpBranch %while_cond1 + %while_end = OpLabel + %56 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 %57 = OpPtrCastToGeneric %_ptr_Generic_uint %56 - %58 = OpAtomicExchange %uint %57 %uint_2 %uint_2 %uint_1 - %59 = OpINotEqual %bool %58 %uint_0 - OpBranchConditional %59 %46 %45 - %45 = OpLabel + %call3 = OpAtomicExchange %uint %57 %uint_2 %uint_2 %uint_1 + %tobool = OpINotEqual %bool %call3 %uint_0 + OpBranchConditional %tobool %if_end %if_then + %if_then = OpLabel OpReturn - %46 = OpLabel - OpBranch %41 + %if_end = OpLabel + OpBranch %while_body OpFunctionEnd %unlock = OpFunction %void DontInline %21 - %33 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %60 = OpLabel - %61 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %61 %33 Aligned 4 - %62 = OpLoad %_ptr_CrossWorkgroup_uint %61 Aligned 4 + %l_1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_1 = OpLabel + %l_addr_1 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_1 %l_1 Aligned 4 + %62 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_1 Aligned 4 %63 = OpPtrCastToGeneric %_ptr_Generic_uint %62 OpAtomicStore %63 %uint_2 %uint_4 %uint_0 OpReturn diff --git a/dartagnan/src/test/resources/spirv/opencl/benchmarks/ttaslock-dv2wg-2.1.1.spvasm b/dartagnan/src/test/resources/spirv/opencl/benchmarks/ttaslock-dv2wg-2.1.1.spvasm index 2978fe516a..f8f80fbd6b 100644 --- a/dartagnan/src/test/resources/spirv/opencl/benchmarks/ttaslock-dv2wg-2.1.1.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/benchmarks/ttaslock-dv2wg-2.1.1.spvasm @@ -1,7 +1,7 @@ -; @Input: %10 = {0} -; @Input: %11 = {0} -; @Input: %12 = {-1, -1} -; @Output: forall (%12[0] == -1 or %12[1] == -1 or %12[0] != %12[1]) +; @Input: %l = {0} +; @Input: %x = {0} +; @Input: %A = {-1, -1} +; @Output: forall (%A[0] == -1 or %A[1] == -1 or %A[0] != %A[1]) ; @Config: 2, 1, 1 ; SPIR-V ; Version: 1.0 @@ -17,17 +17,44 @@ OpEntryPoint Kernel %9 "mutex_test" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %l "l" + OpName %x "x" + OpName %A "A" + OpName %entry "entry" + OpName %l_addr "l.addr" + OpName %x_addr "x.addr" + OpName %A_addr "A.addr" + OpName %a "a" OpName %lock "lock" + OpName %l_0 "l" + OpName %add "add" OpName %unlock "unlock" + OpName %l_1 "l" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %entry_0 "entry" + OpName %while_body "while.body" + OpName %while_cond1 "while.cond1" + OpName %while_body2 "while.body2" + OpName %while_end "while.end" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %l_addr_0 "l.addr" + OpName %call_0 "call" + OpName %cmp "cmp" + OpName %call3 "call3" + OpName %tobool "tobool" + OpName %entry_1 "entry" + OpName %l_addr_1 "l.addr" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %15 Alignment 4 - OpDecorate %16 Alignment 4 - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %47 Alignment 4 - OpDecorate %61 Alignment 4 + OpDecorate %l_addr Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %a Alignment 4 + OpDecorate %l_addr_0 Alignment 4 + OpDecorate %l_addr_1 Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_2 = OpConstant %uint 2 @@ -45,69 +72,69 @@ %bool = OpTypeBool %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpLabel - %15 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %16 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - OpStore %15 %10 Aligned 4 - OpStore %16 %11 Aligned 4 - OpStore %17 %12 Aligned 4 - %20 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 + %l = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %l_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %a = OpVariable %_ptr_Function_uint Function + OpStore %l_addr %l Aligned 4 + OpStore %x_addr %x Aligned 4 + OpStore %A_addr %A Aligned 4 + %20 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 %24 = OpFunctionCall %void %lock %20 - %25 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 + %25 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 %26 = OpLoad %uint %25 Aligned 4 - OpStore %19 %26 Aligned 4 - %27 = OpLoad %uint %19 Aligned 4 - %29 = OpIAdd %uint %27 %uint_1 - %30 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 - OpStore %30 %29 Aligned 4 - %31 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 + OpStore %a %26 Aligned 4 + %27 = OpLoad %uint %a Aligned 4 + %add = OpIAdd %uint %27 %uint_1 + %30 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + OpStore %30 %add Aligned 4 + %31 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 %34 = OpFunctionCall %void %unlock %31 - %35 = OpLoad %uint %19 Aligned 4 - %36 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 + %35 = OpLoad %uint %a Aligned 4 + %36 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %37 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %38 = OpCompositeExtract %uint %37 0 - %39 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %38 - OpStore %39 %35 Aligned 4 + %call = OpCompositeExtract %uint %37 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %call + OpStore %arrayidx %35 Aligned 4 OpReturn OpFunctionEnd %lock = OpFunction %void DontInline %21 - %23 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %40 = OpLabel - %47 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %47 %23 Aligned 4 - OpBranch %41 - %41 = OpLabel - OpBranch %42 - %42 = OpLabel - %48 = OpLoad %_ptr_CrossWorkgroup_uint %47 Aligned 4 + %l_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_0 = OpLabel + %l_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_0 %l_0 Aligned 4 + OpBranch %while_body + %while_body = OpLabel + OpBranch %while_cond1 +%while_cond1 = OpLabel + %48 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 %50 = OpPtrCastToGeneric %_ptr_Generic_uint %48 - %53 = OpAtomicLoad %uint %50 %uint_2 %uint_0 - %55 = OpINotEqual %bool %53 %uint_0 - OpBranchConditional %55 %43 %44 - %43 = OpLabel - OpBranch %42 - %44 = OpLabel - %56 = OpLoad %_ptr_CrossWorkgroup_uint %47 Aligned 4 + %call_0 = OpAtomicLoad %uint %50 %uint_2 %uint_0 + %cmp = OpINotEqual %bool %call_0 %uint_0 + OpBranchConditional %cmp %while_body2 %while_end +%while_body2 = OpLabel + OpBranch %while_cond1 + %while_end = OpLabel + %56 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 %57 = OpPtrCastToGeneric %_ptr_Generic_uint %56 - %58 = OpAtomicExchange %uint %57 %uint_2 %uint_2 %uint_1 - %59 = OpINotEqual %bool %58 %uint_0 - OpBranchConditional %59 %46 %45 - %45 = OpLabel + %call3 = OpAtomicExchange %uint %57 %uint_2 %uint_2 %uint_1 + %tobool = OpINotEqual %bool %call3 %uint_0 + OpBranchConditional %tobool %if_end %if_then + %if_then = OpLabel OpReturn - %46 = OpLabel - OpBranch %41 + %if_end = OpLabel + OpBranch %while_body OpFunctionEnd %unlock = OpFunction %void DontInline %21 - %33 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %60 = OpLabel - %61 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %61 %33 Aligned 4 - %62 = OpLoad %_ptr_CrossWorkgroup_uint %61 Aligned 4 + %l_1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_1 = OpLabel + %l_addr_1 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_1 %l_1 Aligned 4 + %62 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_1 Aligned 4 %63 = OpPtrCastToGeneric %_ptr_Generic_uint %62 OpAtomicStore %63 %uint_2 %uint_4 %uint_0 OpReturn diff --git a/dartagnan/src/test/resources/spirv/opencl/benchmarks/ttaslock-dv2wg-2.2.1.spvasm b/dartagnan/src/test/resources/spirv/opencl/benchmarks/ttaslock-dv2wg-2.2.1.spvasm index 0bc53fe60f..e44dc5dc44 100644 --- a/dartagnan/src/test/resources/spirv/opencl/benchmarks/ttaslock-dv2wg-2.2.1.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/benchmarks/ttaslock-dv2wg-2.2.1.spvasm @@ -1,7 +1,7 @@ -; @Input: %10 = {0} -; @Input: %11 = {0} -; @Input: %12 = {-1, -1} -; @Output: forall (%12[0] == -1 or %12[1] == -1 or %12[0] != %12[1]) +; @Input: %l = {0} +; @Input: %x = {0} +; @Input: %A = {-1, -1} +; @Output: forall (%A[0] == -1 or %A[1] == -1 or %A[0] != %A[1]) ; @Config: 2, 2, 1 ; SPIR-V ; Version: 1.0 @@ -17,17 +17,44 @@ OpEntryPoint Kernel %9 "mutex_test" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %l "l" + OpName %x "x" + OpName %A "A" + OpName %entry "entry" + OpName %l_addr "l.addr" + OpName %x_addr "x.addr" + OpName %A_addr "A.addr" + OpName %a "a" OpName %lock "lock" + OpName %l_0 "l" + OpName %add "add" OpName %unlock "unlock" + OpName %l_1 "l" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %entry_0 "entry" + OpName %while_body "while.body" + OpName %while_cond1 "while.cond1" + OpName %while_body2 "while.body2" + OpName %while_end "while.end" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %l_addr_0 "l.addr" + OpName %call_0 "call" + OpName %cmp "cmp" + OpName %call3 "call3" + OpName %tobool "tobool" + OpName %entry_1 "entry" + OpName %l_addr_1 "l.addr" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %15 Alignment 4 - OpDecorate %16 Alignment 4 - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %47 Alignment 4 - OpDecorate %61 Alignment 4 + OpDecorate %l_addr Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %a Alignment 4 + OpDecorate %l_addr_0 Alignment 4 + OpDecorate %l_addr_1 Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_2 = OpConstant %uint 2 @@ -45,69 +72,69 @@ %bool = OpTypeBool %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpLabel - %15 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %16 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - OpStore %15 %10 Aligned 4 - OpStore %16 %11 Aligned 4 - OpStore %17 %12 Aligned 4 - %20 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 + %l = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %l_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %a = OpVariable %_ptr_Function_uint Function + OpStore %l_addr %l Aligned 4 + OpStore %x_addr %x Aligned 4 + OpStore %A_addr %A Aligned 4 + %20 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 %24 = OpFunctionCall %void %lock %20 - %25 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 + %25 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 %26 = OpLoad %uint %25 Aligned 4 - OpStore %19 %26 Aligned 4 - %27 = OpLoad %uint %19 Aligned 4 - %29 = OpIAdd %uint %27 %uint_1 - %30 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 - OpStore %30 %29 Aligned 4 - %31 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 + OpStore %a %26 Aligned 4 + %27 = OpLoad %uint %a Aligned 4 + %add = OpIAdd %uint %27 %uint_1 + %30 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + OpStore %30 %add Aligned 4 + %31 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 %34 = OpFunctionCall %void %unlock %31 - %35 = OpLoad %uint %19 Aligned 4 - %36 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 + %35 = OpLoad %uint %a Aligned 4 + %36 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %37 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %38 = OpCompositeExtract %uint %37 0 - %39 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %38 - OpStore %39 %35 Aligned 4 + %call = OpCompositeExtract %uint %37 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %call + OpStore %arrayidx %35 Aligned 4 OpReturn OpFunctionEnd %lock = OpFunction %void DontInline %21 - %23 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %40 = OpLabel - %47 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %47 %23 Aligned 4 - OpBranch %41 - %41 = OpLabel - OpBranch %42 - %42 = OpLabel - %48 = OpLoad %_ptr_CrossWorkgroup_uint %47 Aligned 4 + %l_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_0 = OpLabel + %l_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_0 %l_0 Aligned 4 + OpBranch %while_body + %while_body = OpLabel + OpBranch %while_cond1 +%while_cond1 = OpLabel + %48 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 %50 = OpPtrCastToGeneric %_ptr_Generic_uint %48 - %53 = OpAtomicLoad %uint %50 %uint_2 %uint_0 - %55 = OpINotEqual %bool %53 %uint_0 - OpBranchConditional %55 %43 %44 - %43 = OpLabel - OpBranch %42 - %44 = OpLabel - %56 = OpLoad %_ptr_CrossWorkgroup_uint %47 Aligned 4 + %call_0 = OpAtomicLoad %uint %50 %uint_2 %uint_0 + %cmp = OpINotEqual %bool %call_0 %uint_0 + OpBranchConditional %cmp %while_body2 %while_end +%while_body2 = OpLabel + OpBranch %while_cond1 + %while_end = OpLabel + %56 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 %57 = OpPtrCastToGeneric %_ptr_Generic_uint %56 - %58 = OpAtomicExchange %uint %57 %uint_2 %uint_2 %uint_1 - %59 = OpINotEqual %bool %58 %uint_0 - OpBranchConditional %59 %46 %45 - %45 = OpLabel + %call3 = OpAtomicExchange %uint %57 %uint_2 %uint_2 %uint_1 + %tobool = OpINotEqual %bool %call3 %uint_0 + OpBranchConditional %tobool %if_end %if_then + %if_then = OpLabel OpReturn - %46 = OpLabel - OpBranch %41 + %if_end = OpLabel + OpBranch %while_body OpFunctionEnd %unlock = OpFunction %void DontInline %21 - %33 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %60 = OpLabel - %61 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %61 %33 Aligned 4 - %62 = OpLoad %_ptr_CrossWorkgroup_uint %61 Aligned 4 + %l_1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_1 = OpLabel + %l_addr_1 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_1 %l_1 Aligned 4 + %62 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_1 Aligned 4 %63 = OpPtrCastToGeneric %_ptr_Generic_uint %62 OpAtomicStore %63 %uint_2 %uint_4 %uint_0 OpReturn diff --git a/dartagnan/src/test/resources/spirv/opencl/benchmarks/ttaslock-dv2wg-2.2.2.spvasm b/dartagnan/src/test/resources/spirv/opencl/benchmarks/ttaslock-dv2wg-2.2.2.spvasm index 62523f64f1..099c1649e1 100644 --- a/dartagnan/src/test/resources/spirv/opencl/benchmarks/ttaslock-dv2wg-2.2.2.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/benchmarks/ttaslock-dv2wg-2.2.2.spvasm @@ -1,7 +1,7 @@ -; @Input: %10 = {0} -; @Input: %11 = {0} -; @Input: %12 = {-1, -1} -; @Output: forall (%12[0] == -1 or %12[1] == -1 or %12[0] != %12[1]) +; @Input: %l = {0} +; @Input: %x = {0} +; @Input: %A = {-1, -1} +; @Output: forall (%A[0] == -1 or %A[1] == -1 or %A[0] != %A[1]) ; @Config: 2, 2, 2 ; SPIR-V ; Version: 1.0 @@ -17,17 +17,44 @@ OpEntryPoint Kernel %9 "mutex_test" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %l "l" + OpName %x "x" + OpName %A "A" + OpName %entry "entry" + OpName %l_addr "l.addr" + OpName %x_addr "x.addr" + OpName %A_addr "A.addr" + OpName %a "a" OpName %lock "lock" + OpName %l_0 "l" + OpName %add "add" OpName %unlock "unlock" + OpName %l_1 "l" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %entry_0 "entry" + OpName %while_body "while.body" + OpName %while_cond1 "while.cond1" + OpName %while_body2 "while.body2" + OpName %while_end "while.end" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %l_addr_0 "l.addr" + OpName %call_0 "call" + OpName %cmp "cmp" + OpName %call3 "call3" + OpName %tobool "tobool" + OpName %entry_1 "entry" + OpName %l_addr_1 "l.addr" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %15 Alignment 4 - OpDecorate %16 Alignment 4 - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %47 Alignment 4 - OpDecorate %61 Alignment 4 + OpDecorate %l_addr Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %a Alignment 4 + OpDecorate %l_addr_0 Alignment 4 + OpDecorate %l_addr_1 Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_2 = OpConstant %uint 2 @@ -45,69 +72,69 @@ %bool = OpTypeBool %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpLabel - %15 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %16 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - OpStore %15 %10 Aligned 4 - OpStore %16 %11 Aligned 4 - OpStore %17 %12 Aligned 4 - %20 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 + %l = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %l_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %a = OpVariable %_ptr_Function_uint Function + OpStore %l_addr %l Aligned 4 + OpStore %x_addr %x Aligned 4 + OpStore %A_addr %A Aligned 4 + %20 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 %24 = OpFunctionCall %void %lock %20 - %25 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 + %25 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 %26 = OpLoad %uint %25 Aligned 4 - OpStore %19 %26 Aligned 4 - %27 = OpLoad %uint %19 Aligned 4 - %29 = OpIAdd %uint %27 %uint_1 - %30 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 - OpStore %30 %29 Aligned 4 - %31 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 + OpStore %a %26 Aligned 4 + %27 = OpLoad %uint %a Aligned 4 + %add = OpIAdd %uint %27 %uint_1 + %30 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + OpStore %30 %add Aligned 4 + %31 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 %34 = OpFunctionCall %void %unlock %31 - %35 = OpLoad %uint %19 Aligned 4 - %36 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 + %35 = OpLoad %uint %a Aligned 4 + %36 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %37 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %38 = OpCompositeExtract %uint %37 0 - %39 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %38 - OpStore %39 %35 Aligned 4 + %call = OpCompositeExtract %uint %37 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %call + OpStore %arrayidx %35 Aligned 4 OpReturn OpFunctionEnd %lock = OpFunction %void DontInline %21 - %23 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %40 = OpLabel - %47 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %47 %23 Aligned 4 - OpBranch %41 - %41 = OpLabel - OpBranch %42 - %42 = OpLabel - %48 = OpLoad %_ptr_CrossWorkgroup_uint %47 Aligned 4 + %l_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_0 = OpLabel + %l_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_0 %l_0 Aligned 4 + OpBranch %while_body + %while_body = OpLabel + OpBranch %while_cond1 +%while_cond1 = OpLabel + %48 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 %50 = OpPtrCastToGeneric %_ptr_Generic_uint %48 - %53 = OpAtomicLoad %uint %50 %uint_2 %uint_0 - %55 = OpINotEqual %bool %53 %uint_0 - OpBranchConditional %55 %43 %44 - %43 = OpLabel - OpBranch %42 - %44 = OpLabel - %56 = OpLoad %_ptr_CrossWorkgroup_uint %47 Aligned 4 + %call_0 = OpAtomicLoad %uint %50 %uint_2 %uint_0 + %cmp = OpINotEqual %bool %call_0 %uint_0 + OpBranchConditional %cmp %while_body2 %while_end +%while_body2 = OpLabel + OpBranch %while_cond1 + %while_end = OpLabel + %56 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 %57 = OpPtrCastToGeneric %_ptr_Generic_uint %56 - %58 = OpAtomicExchange %uint %57 %uint_2 %uint_2 %uint_1 - %59 = OpINotEqual %bool %58 %uint_0 - OpBranchConditional %59 %46 %45 - %45 = OpLabel + %call3 = OpAtomicExchange %uint %57 %uint_2 %uint_2 %uint_1 + %tobool = OpINotEqual %bool %call3 %uint_0 + OpBranchConditional %tobool %if_end %if_then + %if_then = OpLabel OpReturn - %46 = OpLabel - OpBranch %41 + %if_end = OpLabel + OpBranch %while_body OpFunctionEnd %unlock = OpFunction %void DontInline %21 - %33 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %60 = OpLabel - %61 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %61 %33 Aligned 4 - %62 = OpLoad %_ptr_CrossWorkgroup_uint %61 Aligned 4 + %l_1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_1 = OpLabel + %l_addr_1 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_1 %l_1 Aligned 4 + %62 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_1 Aligned 4 %63 = OpPtrCastToGeneric %_ptr_Generic_uint %62 OpAtomicStore %63 %uint_2 %uint_4 %uint_0 OpReturn diff --git a/dartagnan/src/test/resources/spirv/opencl/benchmarks/ttaslock-rel2rx.spvasm b/dartagnan/src/test/resources/spirv/opencl/benchmarks/ttaslock-rel2rx.spvasm index 3589da5c39..84cf5d1db2 100644 --- a/dartagnan/src/test/resources/spirv/opencl/benchmarks/ttaslock-rel2rx.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/benchmarks/ttaslock-rel2rx.spvasm @@ -1,7 +1,7 @@ -; @Input: %10 = {0} -; @Input: %11 = {0} -; @Input: %12 = {-1, -1} -; @Output: forall (%12[0] == -1 or %12[1] == -1 or %12[0] != %12[1]) +; @Input: %l = {0} +; @Input: %x = {0} +; @Input: %A = {-1, -1} +; @Output: forall (%A[0] == -1 or %A[1] == -1 or %A[0] != %A[1]) ; @Config: 2, 1, 1 ; SPIR-V ; Version: 1.0 @@ -17,17 +17,44 @@ OpEntryPoint Kernel %9 "mutex_test" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %l "l" + OpName %x "x" + OpName %A "A" + OpName %entry "entry" + OpName %l_addr "l.addr" + OpName %x_addr "x.addr" + OpName %A_addr "A.addr" + OpName %a "a" OpName %lock "lock" + OpName %l_0 "l" + OpName %add "add" OpName %unlock "unlock" + OpName %l_1 "l" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %entry_0 "entry" + OpName %while_body "while.body" + OpName %while_cond1 "while.cond1" + OpName %while_body2 "while.body2" + OpName %while_end "while.end" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %l_addr_0 "l.addr" + OpName %call_0 "call" + OpName %cmp "cmp" + OpName %call3 "call3" + OpName %tobool "tobool" + OpName %entry_1 "entry" + OpName %l_addr_1 "l.addr" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %15 Alignment 4 - OpDecorate %16 Alignment 4 - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %47 Alignment 4 - OpDecorate %61 Alignment 4 + OpDecorate %l_addr Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %a Alignment 4 + OpDecorate %l_addr_0 Alignment 4 + OpDecorate %l_addr_1 Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 @@ -44,69 +71,69 @@ %bool = OpTypeBool %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpLabel - %15 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %16 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - OpStore %15 %10 Aligned 4 - OpStore %16 %11 Aligned 4 - OpStore %17 %12 Aligned 4 - %20 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 + %l = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %l_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %a = OpVariable %_ptr_Function_uint Function + OpStore %l_addr %l Aligned 4 + OpStore %x_addr %x Aligned 4 + OpStore %A_addr %A Aligned 4 + %20 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 %24 = OpFunctionCall %void %lock %20 - %25 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 + %25 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 %26 = OpLoad %uint %25 Aligned 4 - OpStore %19 %26 Aligned 4 - %27 = OpLoad %uint %19 Aligned 4 - %29 = OpIAdd %uint %27 %uint_1 - %30 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 - OpStore %30 %29 Aligned 4 - %31 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 + OpStore %a %26 Aligned 4 + %27 = OpLoad %uint %a Aligned 4 + %add = OpIAdd %uint %27 %uint_1 + %30 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 + OpStore %30 %add Aligned 4 + %31 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr Aligned 4 %34 = OpFunctionCall %void %unlock %31 - %35 = OpLoad %uint %19 Aligned 4 - %36 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 + %35 = OpLoad %uint %a Aligned 4 + %36 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %37 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %38 = OpCompositeExtract %uint %37 0 - %39 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %38 - OpStore %39 %35 Aligned 4 + %call = OpCompositeExtract %uint %37 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %call + OpStore %arrayidx %35 Aligned 4 OpReturn OpFunctionEnd %lock = OpFunction %void DontInline %21 - %23 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %40 = OpLabel - %47 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %47 %23 Aligned 4 - OpBranch %41 - %41 = OpLabel - OpBranch %42 - %42 = OpLabel - %48 = OpLoad %_ptr_CrossWorkgroup_uint %47 Aligned 4 + %l_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_0 = OpLabel + %l_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_0 %l_0 Aligned 4 + OpBranch %while_body + %while_body = OpLabel + OpBranch %while_cond1 +%while_cond1 = OpLabel + %48 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 %50 = OpPtrCastToGeneric %_ptr_Generic_uint %48 - %52 = OpAtomicLoad %uint %50 %uint_1 %uint_0 - %54 = OpINotEqual %bool %52 %uint_0 - OpBranchConditional %54 %43 %44 - %43 = OpLabel - OpBranch %42 - %44 = OpLabel - %55 = OpLoad %_ptr_CrossWorkgroup_uint %47 Aligned 4 + %call_0 = OpAtomicLoad %uint %50 %uint_1 %uint_0 + %cmp = OpINotEqual %bool %call_0 %uint_0 + OpBranchConditional %cmp %while_body2 %while_end +%while_body2 = OpLabel + OpBranch %while_cond1 + %while_end = OpLabel + %55 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_0 Aligned 4 %56 = OpPtrCastToGeneric %_ptr_Generic_uint %55 - %58 = OpAtomicExchange %uint %56 %uint_1 %uint_2 %uint_1 - %59 = OpINotEqual %bool %58 %uint_0 - OpBranchConditional %59 %46 %45 - %45 = OpLabel + %call3 = OpAtomicExchange %uint %56 %uint_1 %uint_2 %uint_1 + %tobool = OpINotEqual %bool %call3 %uint_0 + OpBranchConditional %tobool %if_end %if_then + %if_then = OpLabel OpReturn - %46 = OpLabel - OpBranch %41 + %if_end = OpLabel + OpBranch %while_body OpFunctionEnd %unlock = OpFunction %void DontInline %21 - %33 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %60 = OpLabel - %61 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %61 %33 Aligned 4 - %62 = OpLoad %_ptr_CrossWorkgroup_uint %61 Aligned 4 + %l_1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_1 = OpLabel + %l_addr_1 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %l_addr_1 %l_1 Aligned 4 + %62 = OpLoad %_ptr_CrossWorkgroup_uint %l_addr_1 Aligned 4 %63 = OpPtrCastToGeneric %_ptr_Generic_uint %62 OpAtomicStore %63 %uint_1 %uint_0 %uint_0 OpReturn diff --git a/dartagnan/src/test/resources/spirv/opencl/benchmarks/xf-barrier-1.1.2.spvasm b/dartagnan/src/test/resources/spirv/opencl/benchmarks/xf-barrier-1.1.2.spvasm index 0c13015252..f097e95821 100644 --- a/dartagnan/src/test/resources/spirv/opencl/benchmarks/xf-barrier-1.1.2.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/benchmarks/xf-barrier-1.1.2.spvasm @@ -1,9 +1,9 @@ ; flag -; @Input: %14 = {0, 0, 0, 0, 0, 0, 0, 0} +; @Input: %flag = {0, 0, 0, 0, 0, 0, 0, 0} ; data -; @Input: %15 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} -; @Input: %16 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} -; @Output: forall (%16[0] == 2 and %16[1] == 2) +; @Input: %in = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +; @Input: %out = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +; @Output: forall (%out[0] == 2 and %out[1] == 2) ; @Config: 1, 1, 2 ; SPIR-V ; Version: 1.0 @@ -23,6 +23,69 @@ OpName %__spirv_BuiltInNumWorkgroups "__spirv_BuiltInNumWorkgroups" OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %__spirv_BuiltInGlobalSize "__spirv_BuiltInGlobalSize" + OpName %flag "flag" + OpName %in "in" + OpName %out "out" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_then6 "if.then6" + OpName %while_cond "while.cond" + OpName %while_body "while.body" + OpName %while_end "while.end" + OpName %if_end "if.end" + OpName %if_then13 "if.then13" + OpName %if_end16 "if.end16" + OpName %if_else "if.else" + OpName %if_then18 "if.then18" + OpName %while_cond20 "while.cond20" + OpName %while_body24 "while.body24" + OpName %while_end25 "while.end25" + OpName %if_end26 "if.end26" + OpName %if_end27 "if.end27" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %flag_addr "flag.addr" + OpName %in_addr "in.addr" + OpName %out_addr "out.addr" + OpName %group_id "group_id" + OpName %local_id "local_id" + OpName %num_groups "num_groups" + OpName %global_id "global_id" + OpName %global_size "global_size" + OpName %i "i" + OpName %call "call" + OpName %call1 "call1" + OpName %call2 "call2" + OpName %call3 "call3" + OpName %call4 "call4" + OpName %arrayidx "arrayidx" + OpName %cmp "cmp" + OpName %add "add" + OpName %cmp5 "cmp5" + OpName %add7 "add7" + OpName %arrayidx8 "arrayidx8" + OpName %arrayidx8_ascast "arrayidx8.ascast" + OpName %call9 "call9" + OpName %cmp10 "cmp10" + OpName %add11 "add11" + OpName %cmp12 "cmp12" + OpName %add14 "add14" + OpName %arrayidx15 "arrayidx15" + OpName %arrayidx15_ascast "arrayidx15.ascast" + OpName %cmp17 "cmp17" + OpName %arrayidx19 "arrayidx19" + OpName %arrayidx19_ascast "arrayidx19.ascast" + OpName %arrayidx21 "arrayidx21" + OpName %arrayidx21_ascast "arrayidx21.ascast" + OpName %call22 "call22" + OpName %cmp23 "cmp23" + OpName %cmp28 "cmp28" + OpName %arrayidx29 "arrayidx29" + OpName %arrayidx30 "arrayidx30" + OpName %add31 "add31" + OpName %inc "inc" OpDecorate %__spirv_BuiltInNumWorkgroups BuiltIn NumWorkgroups OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId @@ -38,15 +101,15 @@ OpDecorate %__spirv_BuiltInNumWorkgroups LinkageAttributes "__spirv_BuiltInNumWorkgroups" Import OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %38 Alignment 4 - OpDecorate %39 Alignment 4 - OpDecorate %40 Alignment 4 - OpDecorate %42 Alignment 4 - OpDecorate %43 Alignment 4 - OpDecorate %44 Alignment 4 - OpDecorate %45 Alignment 4 - OpDecorate %46 Alignment 4 - OpDecorate %47 Alignment 4 + OpDecorate %flag_addr Alignment 4 + OpDecorate %in_addr Alignment 4 + OpDecorate %out_addr Alignment 4 + OpDecorate %group_id Alignment 4 + OpDecorate %local_id Alignment 4 + OpDecorate %num_groups Alignment 4 + OpDecorate %global_id Alignment 4 + OpDecorate %global_size Alignment 4 + OpDecorate %i Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 @@ -68,134 +131,134 @@ %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInGlobalSize = OpVariable %_ptr_Input_v3uint Input %13 = OpFunction %void DontInline %12 - %14 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %15 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %16 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %17 = OpLabel - %38 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %39 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %40 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %42 = OpVariable %_ptr_Function_uint Function - %43 = OpVariable %_ptr_Function_uint Function - %44 = OpVariable %_ptr_Function_uint Function - %45 = OpVariable %_ptr_Function_uint Function - %46 = OpVariable %_ptr_Function_uint Function - %47 = OpVariable %_ptr_Function_uint Function - OpStore %38 %14 Aligned 4 - OpStore %39 %15 Aligned 4 - OpStore %40 %16 Aligned 4 + %flag = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %in = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %out = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %flag_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %in_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %out_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %group_id = OpVariable %_ptr_Function_uint Function + %local_id = OpVariable %_ptr_Function_uint Function + %num_groups = OpVariable %_ptr_Function_uint Function + %global_id = OpVariable %_ptr_Function_uint Function +%global_size = OpVariable %_ptr_Function_uint Function + %i = OpVariable %_ptr_Function_uint Function + OpStore %flag_addr %flag Aligned 4 + OpStore %in_addr %in Aligned 4 + OpStore %out_addr %out Aligned 4 %48 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %49 = OpCompositeExtract %uint %48 0 - OpStore %42 %49 Aligned 4 + %call = OpCompositeExtract %uint %48 0 + OpStore %group_id %call Aligned 4 %50 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %51 = OpCompositeExtract %uint %50 0 - OpStore %43 %51 Aligned 4 + %call1 = OpCompositeExtract %uint %50 0 + OpStore %local_id %call1 Aligned 4 %52 = OpLoad %v3uint %__spirv_BuiltInNumWorkgroups Aligned 16 - %53 = OpCompositeExtract %uint %52 0 - OpStore %44 %53 Aligned 4 + %call2 = OpCompositeExtract %uint %52 0 + OpStore %num_groups %call2 Aligned 4 %54 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %55 = OpCompositeExtract %uint %54 0 - OpStore %45 %55 Aligned 4 + %call3 = OpCompositeExtract %uint %54 0 + OpStore %global_id %call3 Aligned 4 %56 = OpLoad %v3uint %__spirv_BuiltInGlobalSize Aligned 16 - %57 = OpCompositeExtract %uint %56 0 - OpStore %46 %57 Aligned 4 - %58 = OpLoad %_ptr_CrossWorkgroup_uint %39 Aligned 4 - %59 = OpLoad %uint %45 Aligned 4 - %60 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %58 %59 - OpStore %60 %uint_1 Aligned 4 - %62 = OpLoad %uint %42 Aligned 4 - %65 = OpIEqual %bool %62 %uint_0 - OpBranchConditional %65 %18 %26 - %18 = OpLabel - %66 = OpLoad %uint %43 Aligned 4 - %67 = OpIAdd %uint %66 %uint_1 - %68 = OpLoad %uint %44 Aligned 4 - %69 = OpULessThan %bool %67 %68 - OpBranchConditional %69 %19 %23 - %19 = OpLabel - OpBranch %20 - %20 = OpLabel - %70 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %71 = OpLoad %uint %43 Aligned 4 - %72 = OpIAdd %uint %71 %uint_1 - %73 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %70 %72 - %75 = OpPtrCastToGeneric %_ptr_Generic_uint %73 - %77 = OpAtomicLoad %uint %75 %uint_1 %uint_2 - %78 = OpIEqual %bool %77 %uint_0 - OpBranchConditional %78 %21 %22 - %21 = OpLabel - OpBranch %20 - %22 = OpLabel - OpBranch %23 - %23 = OpLabel + %call4 = OpCompositeExtract %uint %56 0 + OpStore %global_size %call4 Aligned 4 + %58 = OpLoad %_ptr_CrossWorkgroup_uint %in_addr Aligned 4 + %59 = OpLoad %uint %global_id Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %58 %59 + OpStore %arrayidx %uint_1 Aligned 4 + %62 = OpLoad %uint %group_id Aligned 4 + %cmp = OpIEqual %bool %62 %uint_0 + OpBranchConditional %cmp %if_then %if_else + %if_then = OpLabel + %66 = OpLoad %uint %local_id Aligned 4 + %add = OpIAdd %uint %66 %uint_1 + %68 = OpLoad %uint %num_groups Aligned 4 + %cmp5 = OpULessThan %bool %add %68 + OpBranchConditional %cmp5 %if_then6 %if_end + %if_then6 = OpLabel + OpBranch %while_cond + %while_cond = OpLabel + %70 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %71 = OpLoad %uint %local_id Aligned 4 + %add7 = OpIAdd %uint %71 %uint_1 + %arrayidx8 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %70 %add7 +%arrayidx8_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %arrayidx8 + %call9 = OpAtomicLoad %uint %arrayidx8_ascast %uint_1 %uint_2 + %cmp10 = OpIEqual %bool %call9 %uint_0 + OpBranchConditional %cmp10 %while_body %while_end + %while_body = OpLabel + OpBranch %while_cond + %while_end = OpLabel + OpBranch %if_end + %if_end = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 - %80 = OpLoad %uint %43 Aligned 4 - %81 = OpIAdd %uint %80 %uint_1 - %82 = OpLoad %uint %44 Aligned 4 - %83 = OpULessThan %bool %81 %82 - OpBranchConditional %83 %24 %25 - %24 = OpLabel - %84 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %85 = OpLoad %uint %43 Aligned 4 - %86 = OpIAdd %uint %85 %uint_1 - %87 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %84 %86 - %88 = OpPtrCastToGeneric %_ptr_Generic_uint %87 - OpAtomicStore %88 %uint_1 %uint_4 %uint_0 - OpBranch %25 - %25 = OpLabel - OpBranch %32 - %26 = OpLabel + %80 = OpLoad %uint %local_id Aligned 4 + %add11 = OpIAdd %uint %80 %uint_1 + %82 = OpLoad %uint %num_groups Aligned 4 + %cmp12 = OpULessThan %bool %add11 %82 + OpBranchConditional %cmp12 %if_then13 %if_end16 + %if_then13 = OpLabel + %84 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %85 = OpLoad %uint %local_id Aligned 4 + %add14 = OpIAdd %uint %85 %uint_1 + %arrayidx15 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %84 %add14 +%arrayidx15_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %arrayidx15 + OpAtomicStore %arrayidx15_ascast %uint_1 %uint_4 %uint_0 + OpBranch %if_end16 + %if_end16 = OpLabel + OpBranch %if_end27 + %if_else = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 - %90 = OpLoad %uint %43 Aligned 4 - %91 = OpIEqual %bool %90 %uint_0 - OpBranchConditional %91 %27 %31 - %27 = OpLabel - %92 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %93 = OpLoad %uint %42 Aligned 4 - %94 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %92 %93 - %95 = OpPtrCastToGeneric %_ptr_Generic_uint %94 - OpAtomicStore %95 %uint_1 %uint_4 %uint_1 - OpBranch %28 - %28 = OpLabel - %96 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %97 = OpLoad %uint %42 Aligned 4 - %98 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %96 %97 - %99 = OpPtrCastToGeneric %_ptr_Generic_uint %98 - %100 = OpAtomicLoad %uint %99 %uint_1 %uint_2 - %101 = OpIEqual %bool %100 %uint_1 - OpBranchConditional %101 %29 %30 - %29 = OpLabel - OpBranch %28 - %30 = OpLabel - OpBranch %31 - %31 = OpLabel + %90 = OpLoad %uint %local_id Aligned 4 + %cmp17 = OpIEqual %bool %90 %uint_0 + OpBranchConditional %cmp17 %if_then18 %if_end26 + %if_then18 = OpLabel + %92 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %93 = OpLoad %uint %group_id Aligned 4 + %arrayidx19 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %92 %93 +%arrayidx19_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %arrayidx19 + OpAtomicStore %arrayidx19_ascast %uint_1 %uint_4 %uint_1 + OpBranch %while_cond20 +%while_cond20 = OpLabel + %96 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %97 = OpLoad %uint %group_id Aligned 4 + %arrayidx21 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %96 %97 +%arrayidx21_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %arrayidx21 + %call22 = OpAtomicLoad %uint %arrayidx21_ascast %uint_1 %uint_2 + %cmp23 = OpIEqual %bool %call22 %uint_1 + OpBranchConditional %cmp23 %while_body24 %while_end25 +%while_body24 = OpLabel + OpBranch %while_cond20 +%while_end25 = OpLabel + OpBranch %if_end26 + %if_end26 = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 - OpBranch %32 - %32 = OpLabel - OpStore %47 %uint_0 Aligned 4 - OpBranch %33 - %33 = OpLabel - %102 = OpLoad %uint %47 Aligned 4 - %103 = OpLoad %uint %46 Aligned 4 - %104 = OpULessThan %bool %102 %103 - OpBranchConditional %104 %34 %36 - %34 = OpLabel - %105 = OpLoad %_ptr_CrossWorkgroup_uint %39 Aligned 4 - %106 = OpLoad %uint %47 Aligned 4 - %107 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %105 %106 - %108 = OpLoad %uint %107 Aligned 4 - %109 = OpLoad %_ptr_CrossWorkgroup_uint %40 Aligned 4 - %110 = OpLoad %uint %45 Aligned 4 - %111 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %109 %110 - %112 = OpLoad %uint %111 Aligned 4 - %113 = OpIAdd %uint %112 %108 - OpStore %111 %113 Aligned 4 - OpBranch %35 - %35 = OpLabel - %114 = OpLoad %uint %47 Aligned 4 - %115 = OpIAdd %uint %114 %uint_1 - OpStore %47 %115 Aligned 4 - OpBranch %33 - %36 = OpLabel + OpBranch %if_end27 + %if_end27 = OpLabel + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %102 = OpLoad %uint %i Aligned 4 + %103 = OpLoad %uint %global_size Aligned 4 + %cmp28 = OpULessThan %bool %102 %103 + OpBranchConditional %cmp28 %for_body %for_end + %for_body = OpLabel + %105 = OpLoad %_ptr_CrossWorkgroup_uint %in_addr Aligned 4 + %106 = OpLoad %uint %i Aligned 4 + %arrayidx29 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %105 %106 + %108 = OpLoad %uint %arrayidx29 Aligned 4 + %109 = OpLoad %_ptr_CrossWorkgroup_uint %out_addr Aligned 4 + %110 = OpLoad %uint %global_id Aligned 4 + %arrayidx30 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %109 %110 + %112 = OpLoad %uint %arrayidx30 Aligned 4 + %add31 = OpIAdd %uint %112 %108 + OpStore %arrayidx30 %add31 Aligned 4 + OpBranch %for_inc + %for_inc = OpLabel + %114 = OpLoad %uint %i Aligned 4 + %inc = OpIAdd %uint %114 %uint_1 + OpStore %i %inc Aligned 4 + OpBranch %for_cond + %for_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/benchmarks/xf-barrier-2.1.1.spvasm b/dartagnan/src/test/resources/spirv/opencl/benchmarks/xf-barrier-2.1.1.spvasm index 134842f7fd..bff12405d3 100644 --- a/dartagnan/src/test/resources/spirv/opencl/benchmarks/xf-barrier-2.1.1.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/benchmarks/xf-barrier-2.1.1.spvasm @@ -1,9 +1,9 @@ ; flag -; @Input: %14 = {0, 0, 0, 0, 0, 0, 0, 0} +; @Input: %flag = {0, 0, 0, 0, 0, 0, 0, 0} ; data -; @Input: %15 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} -; @Input: %16 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} -; @Output: forall (%16[0] == 2 and %16[1] == 2) +; @Input: %in = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +; @Input: %out = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +; @Output: forall (%out[0] == 2 and %out[1] == 2) ; @Config: 2, 1, 1 ; SPIR-V ; Version: 1.0 @@ -23,6 +23,69 @@ OpName %__spirv_BuiltInNumWorkgroups "__spirv_BuiltInNumWorkgroups" OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %__spirv_BuiltInGlobalSize "__spirv_BuiltInGlobalSize" + OpName %flag "flag" + OpName %in "in" + OpName %out "out" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_then6 "if.then6" + OpName %while_cond "while.cond" + OpName %while_body "while.body" + OpName %while_end "while.end" + OpName %if_end "if.end" + OpName %if_then13 "if.then13" + OpName %if_end16 "if.end16" + OpName %if_else "if.else" + OpName %if_then18 "if.then18" + OpName %while_cond20 "while.cond20" + OpName %while_body24 "while.body24" + OpName %while_end25 "while.end25" + OpName %if_end26 "if.end26" + OpName %if_end27 "if.end27" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %flag_addr "flag.addr" + OpName %in_addr "in.addr" + OpName %out_addr "out.addr" + OpName %group_id "group_id" + OpName %local_id "local_id" + OpName %num_groups "num_groups" + OpName %global_id "global_id" + OpName %global_size "global_size" + OpName %i "i" + OpName %call "call" + OpName %call1 "call1" + OpName %call2 "call2" + OpName %call3 "call3" + OpName %call4 "call4" + OpName %arrayidx "arrayidx" + OpName %cmp "cmp" + OpName %add "add" + OpName %cmp5 "cmp5" + OpName %add7 "add7" + OpName %arrayidx8 "arrayidx8" + OpName %arrayidx8_ascast "arrayidx8.ascast" + OpName %call9 "call9" + OpName %cmp10 "cmp10" + OpName %add11 "add11" + OpName %cmp12 "cmp12" + OpName %add14 "add14" + OpName %arrayidx15 "arrayidx15" + OpName %arrayidx15_ascast "arrayidx15.ascast" + OpName %cmp17 "cmp17" + OpName %arrayidx19 "arrayidx19" + OpName %arrayidx19_ascast "arrayidx19.ascast" + OpName %arrayidx21 "arrayidx21" + OpName %arrayidx21_ascast "arrayidx21.ascast" + OpName %call22 "call22" + OpName %cmp23 "cmp23" + OpName %cmp28 "cmp28" + OpName %arrayidx29 "arrayidx29" + OpName %arrayidx30 "arrayidx30" + OpName %add31 "add31" + OpName %inc "inc" OpDecorate %__spirv_BuiltInNumWorkgroups BuiltIn NumWorkgroups OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId @@ -38,15 +101,15 @@ OpDecorate %__spirv_BuiltInNumWorkgroups LinkageAttributes "__spirv_BuiltInNumWorkgroups" Import OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %38 Alignment 4 - OpDecorate %39 Alignment 4 - OpDecorate %40 Alignment 4 - OpDecorate %42 Alignment 4 - OpDecorate %43 Alignment 4 - OpDecorate %44 Alignment 4 - OpDecorate %45 Alignment 4 - OpDecorate %46 Alignment 4 - OpDecorate %47 Alignment 4 + OpDecorate %flag_addr Alignment 4 + OpDecorate %in_addr Alignment 4 + OpDecorate %out_addr Alignment 4 + OpDecorate %group_id Alignment 4 + OpDecorate %local_id Alignment 4 + OpDecorate %num_groups Alignment 4 + OpDecorate %global_id Alignment 4 + OpDecorate %global_size Alignment 4 + OpDecorate %i Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 @@ -68,134 +131,134 @@ %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInGlobalSize = OpVariable %_ptr_Input_v3uint Input %13 = OpFunction %void DontInline %12 - %14 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %15 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %16 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %17 = OpLabel - %38 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %39 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %40 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %42 = OpVariable %_ptr_Function_uint Function - %43 = OpVariable %_ptr_Function_uint Function - %44 = OpVariable %_ptr_Function_uint Function - %45 = OpVariable %_ptr_Function_uint Function - %46 = OpVariable %_ptr_Function_uint Function - %47 = OpVariable %_ptr_Function_uint Function - OpStore %38 %14 Aligned 4 - OpStore %39 %15 Aligned 4 - OpStore %40 %16 Aligned 4 + %flag = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %in = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %out = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %flag_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %in_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %out_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %group_id = OpVariable %_ptr_Function_uint Function + %local_id = OpVariable %_ptr_Function_uint Function + %num_groups = OpVariable %_ptr_Function_uint Function + %global_id = OpVariable %_ptr_Function_uint Function +%global_size = OpVariable %_ptr_Function_uint Function + %i = OpVariable %_ptr_Function_uint Function + OpStore %flag_addr %flag Aligned 4 + OpStore %in_addr %in Aligned 4 + OpStore %out_addr %out Aligned 4 %48 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %49 = OpCompositeExtract %uint %48 0 - OpStore %42 %49 Aligned 4 + %call = OpCompositeExtract %uint %48 0 + OpStore %group_id %call Aligned 4 %50 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %51 = OpCompositeExtract %uint %50 0 - OpStore %43 %51 Aligned 4 + %call1 = OpCompositeExtract %uint %50 0 + OpStore %local_id %call1 Aligned 4 %52 = OpLoad %v3uint %__spirv_BuiltInNumWorkgroups Aligned 16 - %53 = OpCompositeExtract %uint %52 0 - OpStore %44 %53 Aligned 4 + %call2 = OpCompositeExtract %uint %52 0 + OpStore %num_groups %call2 Aligned 4 %54 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %55 = OpCompositeExtract %uint %54 0 - OpStore %45 %55 Aligned 4 + %call3 = OpCompositeExtract %uint %54 0 + OpStore %global_id %call3 Aligned 4 %56 = OpLoad %v3uint %__spirv_BuiltInGlobalSize Aligned 16 - %57 = OpCompositeExtract %uint %56 0 - OpStore %46 %57 Aligned 4 - %58 = OpLoad %_ptr_CrossWorkgroup_uint %39 Aligned 4 - %59 = OpLoad %uint %45 Aligned 4 - %60 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %58 %59 - OpStore %60 %uint_1 Aligned 4 - %62 = OpLoad %uint %42 Aligned 4 - %65 = OpIEqual %bool %62 %uint_0 - OpBranchConditional %65 %18 %26 - %18 = OpLabel - %66 = OpLoad %uint %43 Aligned 4 - %67 = OpIAdd %uint %66 %uint_1 - %68 = OpLoad %uint %44 Aligned 4 - %69 = OpULessThan %bool %67 %68 - OpBranchConditional %69 %19 %23 - %19 = OpLabel - OpBranch %20 - %20 = OpLabel - %70 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %71 = OpLoad %uint %43 Aligned 4 - %72 = OpIAdd %uint %71 %uint_1 - %73 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %70 %72 - %75 = OpPtrCastToGeneric %_ptr_Generic_uint %73 - %77 = OpAtomicLoad %uint %75 %uint_1 %uint_2 - %78 = OpIEqual %bool %77 %uint_0 - OpBranchConditional %78 %21 %22 - %21 = OpLabel - OpBranch %20 - %22 = OpLabel - OpBranch %23 - %23 = OpLabel + %call4 = OpCompositeExtract %uint %56 0 + OpStore %global_size %call4 Aligned 4 + %58 = OpLoad %_ptr_CrossWorkgroup_uint %in_addr Aligned 4 + %59 = OpLoad %uint %global_id Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %58 %59 + OpStore %arrayidx %uint_1 Aligned 4 + %62 = OpLoad %uint %group_id Aligned 4 + %cmp = OpIEqual %bool %62 %uint_0 + OpBranchConditional %cmp %if_then %if_else + %if_then = OpLabel + %66 = OpLoad %uint %local_id Aligned 4 + %add = OpIAdd %uint %66 %uint_1 + %68 = OpLoad %uint %num_groups Aligned 4 + %cmp5 = OpULessThan %bool %add %68 + OpBranchConditional %cmp5 %if_then6 %if_end + %if_then6 = OpLabel + OpBranch %while_cond + %while_cond = OpLabel + %70 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %71 = OpLoad %uint %local_id Aligned 4 + %add7 = OpIAdd %uint %71 %uint_1 + %arrayidx8 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %70 %add7 +%arrayidx8_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %arrayidx8 + %call9 = OpAtomicLoad %uint %arrayidx8_ascast %uint_1 %uint_2 + %cmp10 = OpIEqual %bool %call9 %uint_0 + OpBranchConditional %cmp10 %while_body %while_end + %while_body = OpLabel + OpBranch %while_cond + %while_end = OpLabel + OpBranch %if_end + %if_end = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 - %80 = OpLoad %uint %43 Aligned 4 - %81 = OpIAdd %uint %80 %uint_1 - %82 = OpLoad %uint %44 Aligned 4 - %83 = OpULessThan %bool %81 %82 - OpBranchConditional %83 %24 %25 - %24 = OpLabel - %84 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %85 = OpLoad %uint %43 Aligned 4 - %86 = OpIAdd %uint %85 %uint_1 - %87 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %84 %86 - %88 = OpPtrCastToGeneric %_ptr_Generic_uint %87 - OpAtomicStore %88 %uint_1 %uint_4 %uint_0 - OpBranch %25 - %25 = OpLabel - OpBranch %32 - %26 = OpLabel + %80 = OpLoad %uint %local_id Aligned 4 + %add11 = OpIAdd %uint %80 %uint_1 + %82 = OpLoad %uint %num_groups Aligned 4 + %cmp12 = OpULessThan %bool %add11 %82 + OpBranchConditional %cmp12 %if_then13 %if_end16 + %if_then13 = OpLabel + %84 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %85 = OpLoad %uint %local_id Aligned 4 + %add14 = OpIAdd %uint %85 %uint_1 + %arrayidx15 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %84 %add14 +%arrayidx15_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %arrayidx15 + OpAtomicStore %arrayidx15_ascast %uint_1 %uint_4 %uint_0 + OpBranch %if_end16 + %if_end16 = OpLabel + OpBranch %if_end27 + %if_else = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 - %90 = OpLoad %uint %43 Aligned 4 - %91 = OpIEqual %bool %90 %uint_0 - OpBranchConditional %91 %27 %31 - %27 = OpLabel - %92 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %93 = OpLoad %uint %42 Aligned 4 - %94 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %92 %93 - %95 = OpPtrCastToGeneric %_ptr_Generic_uint %94 - OpAtomicStore %95 %uint_1 %uint_4 %uint_1 - OpBranch %28 - %28 = OpLabel - %96 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %97 = OpLoad %uint %42 Aligned 4 - %98 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %96 %97 - %99 = OpPtrCastToGeneric %_ptr_Generic_uint %98 - %100 = OpAtomicLoad %uint %99 %uint_1 %uint_2 - %101 = OpIEqual %bool %100 %uint_1 - OpBranchConditional %101 %29 %30 - %29 = OpLabel - OpBranch %28 - %30 = OpLabel - OpBranch %31 - %31 = OpLabel + %90 = OpLoad %uint %local_id Aligned 4 + %cmp17 = OpIEqual %bool %90 %uint_0 + OpBranchConditional %cmp17 %if_then18 %if_end26 + %if_then18 = OpLabel + %92 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %93 = OpLoad %uint %group_id Aligned 4 + %arrayidx19 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %92 %93 +%arrayidx19_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %arrayidx19 + OpAtomicStore %arrayidx19_ascast %uint_1 %uint_4 %uint_1 + OpBranch %while_cond20 +%while_cond20 = OpLabel + %96 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %97 = OpLoad %uint %group_id Aligned 4 + %arrayidx21 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %96 %97 +%arrayidx21_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %arrayidx21 + %call22 = OpAtomicLoad %uint %arrayidx21_ascast %uint_1 %uint_2 + %cmp23 = OpIEqual %bool %call22 %uint_1 + OpBranchConditional %cmp23 %while_body24 %while_end25 +%while_body24 = OpLabel + OpBranch %while_cond20 +%while_end25 = OpLabel + OpBranch %if_end26 + %if_end26 = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 - OpBranch %32 - %32 = OpLabel - OpStore %47 %uint_0 Aligned 4 - OpBranch %33 - %33 = OpLabel - %102 = OpLoad %uint %47 Aligned 4 - %103 = OpLoad %uint %46 Aligned 4 - %104 = OpULessThan %bool %102 %103 - OpBranchConditional %104 %34 %36 - %34 = OpLabel - %105 = OpLoad %_ptr_CrossWorkgroup_uint %39 Aligned 4 - %106 = OpLoad %uint %47 Aligned 4 - %107 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %105 %106 - %108 = OpLoad %uint %107 Aligned 4 - %109 = OpLoad %_ptr_CrossWorkgroup_uint %40 Aligned 4 - %110 = OpLoad %uint %45 Aligned 4 - %111 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %109 %110 - %112 = OpLoad %uint %111 Aligned 4 - %113 = OpIAdd %uint %112 %108 - OpStore %111 %113 Aligned 4 - OpBranch %35 - %35 = OpLabel - %114 = OpLoad %uint %47 Aligned 4 - %115 = OpIAdd %uint %114 %uint_1 - OpStore %47 %115 Aligned 4 - OpBranch %33 - %36 = OpLabel + OpBranch %if_end27 + %if_end27 = OpLabel + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %102 = OpLoad %uint %i Aligned 4 + %103 = OpLoad %uint %global_size Aligned 4 + %cmp28 = OpULessThan %bool %102 %103 + OpBranchConditional %cmp28 %for_body %for_end + %for_body = OpLabel + %105 = OpLoad %_ptr_CrossWorkgroup_uint %in_addr Aligned 4 + %106 = OpLoad %uint %i Aligned 4 + %arrayidx29 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %105 %106 + %108 = OpLoad %uint %arrayidx29 Aligned 4 + %109 = OpLoad %_ptr_CrossWorkgroup_uint %out_addr Aligned 4 + %110 = OpLoad %uint %global_id Aligned 4 + %arrayidx30 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %109 %110 + %112 = OpLoad %uint %arrayidx30 Aligned 4 + %add31 = OpIAdd %uint %112 %108 + OpStore %arrayidx30 %add31 Aligned 4 + OpBranch %for_inc + %for_inc = OpLabel + %114 = OpLoad %uint %i Aligned 4 + %inc = OpIAdd %uint %114 %uint_1 + OpStore %i %inc Aligned 4 + OpBranch %for_cond + %for_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/benchmarks/xf-barrier-2.1.2.spvasm b/dartagnan/src/test/resources/spirv/opencl/benchmarks/xf-barrier-2.1.2.spvasm index 79155033e3..83f9e2406f 100644 --- a/dartagnan/src/test/resources/spirv/opencl/benchmarks/xf-barrier-2.1.2.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/benchmarks/xf-barrier-2.1.2.spvasm @@ -1,9 +1,9 @@ ; flag -; @Input: %14 = {0, 0, 0, 0, 0, 0, 0, 0} +; @Input: %flag = {0, 0, 0, 0, 0, 0, 0, 0} ; data -; @Input: %15 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} -; @Input: %16 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} -; @Output: forall (%16[0] == 4 and %16[1] == 4 and %16[2] == 4 and %16[3] == 4) +; @Input: %in = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +; @Input: %out = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +; @Output: forall (%out[0] == 4 and %out[1] == 4 and %out[2] == 4 and %out[3] == 4) ; @Config: 2, 1, 2 ; SPIR-V ; Version: 1.0 @@ -23,6 +23,69 @@ OpName %__spirv_BuiltInNumWorkgroups "__spirv_BuiltInNumWorkgroups" OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %__spirv_BuiltInGlobalSize "__spirv_BuiltInGlobalSize" + OpName %flag "flag" + OpName %in "in" + OpName %out "out" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_then6 "if.then6" + OpName %while_cond "while.cond" + OpName %while_body "while.body" + OpName %while_end "while.end" + OpName %if_end "if.end" + OpName %if_then13 "if.then13" + OpName %if_end16 "if.end16" + OpName %if_else "if.else" + OpName %if_then18 "if.then18" + OpName %while_cond20 "while.cond20" + OpName %while_body24 "while.body24" + OpName %while_end25 "while.end25" + OpName %if_end26 "if.end26" + OpName %if_end27 "if.end27" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %flag_addr "flag.addr" + OpName %in_addr "in.addr" + OpName %out_addr "out.addr" + OpName %group_id "group_id" + OpName %local_id "local_id" + OpName %num_groups "num_groups" + OpName %global_id "global_id" + OpName %global_size "global_size" + OpName %i "i" + OpName %call "call" + OpName %call1 "call1" + OpName %call2 "call2" + OpName %call3 "call3" + OpName %call4 "call4" + OpName %arrayidx "arrayidx" + OpName %cmp "cmp" + OpName %add "add" + OpName %cmp5 "cmp5" + OpName %add7 "add7" + OpName %arrayidx8 "arrayidx8" + OpName %arrayidx8_ascast "arrayidx8.ascast" + OpName %call9 "call9" + OpName %cmp10 "cmp10" + OpName %add11 "add11" + OpName %cmp12 "cmp12" + OpName %add14 "add14" + OpName %arrayidx15 "arrayidx15" + OpName %arrayidx15_ascast "arrayidx15.ascast" + OpName %cmp17 "cmp17" + OpName %arrayidx19 "arrayidx19" + OpName %arrayidx19_ascast "arrayidx19.ascast" + OpName %arrayidx21 "arrayidx21" + OpName %arrayidx21_ascast "arrayidx21.ascast" + OpName %call22 "call22" + OpName %cmp23 "cmp23" + OpName %cmp28 "cmp28" + OpName %arrayidx29 "arrayidx29" + OpName %arrayidx30 "arrayidx30" + OpName %add31 "add31" + OpName %inc "inc" OpDecorate %__spirv_BuiltInNumWorkgroups BuiltIn NumWorkgroups OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId @@ -38,15 +101,15 @@ OpDecorate %__spirv_BuiltInNumWorkgroups LinkageAttributes "__spirv_BuiltInNumWorkgroups" Import OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %38 Alignment 4 - OpDecorate %39 Alignment 4 - OpDecorate %40 Alignment 4 - OpDecorate %42 Alignment 4 - OpDecorate %43 Alignment 4 - OpDecorate %44 Alignment 4 - OpDecorate %45 Alignment 4 - OpDecorate %46 Alignment 4 - OpDecorate %47 Alignment 4 + OpDecorate %flag_addr Alignment 4 + OpDecorate %in_addr Alignment 4 + OpDecorate %out_addr Alignment 4 + OpDecorate %group_id Alignment 4 + OpDecorate %local_id Alignment 4 + OpDecorate %num_groups Alignment 4 + OpDecorate %global_id Alignment 4 + OpDecorate %global_size Alignment 4 + OpDecorate %i Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 @@ -68,134 +131,134 @@ %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInGlobalSize = OpVariable %_ptr_Input_v3uint Input %13 = OpFunction %void DontInline %12 - %14 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %15 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %16 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %17 = OpLabel - %38 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %39 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %40 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %42 = OpVariable %_ptr_Function_uint Function - %43 = OpVariable %_ptr_Function_uint Function - %44 = OpVariable %_ptr_Function_uint Function - %45 = OpVariable %_ptr_Function_uint Function - %46 = OpVariable %_ptr_Function_uint Function - %47 = OpVariable %_ptr_Function_uint Function - OpStore %38 %14 Aligned 4 - OpStore %39 %15 Aligned 4 - OpStore %40 %16 Aligned 4 + %flag = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %in = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %out = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %flag_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %in_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %out_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %group_id = OpVariable %_ptr_Function_uint Function + %local_id = OpVariable %_ptr_Function_uint Function + %num_groups = OpVariable %_ptr_Function_uint Function + %global_id = OpVariable %_ptr_Function_uint Function +%global_size = OpVariable %_ptr_Function_uint Function + %i = OpVariable %_ptr_Function_uint Function + OpStore %flag_addr %flag Aligned 4 + OpStore %in_addr %in Aligned 4 + OpStore %out_addr %out Aligned 4 %48 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %49 = OpCompositeExtract %uint %48 0 - OpStore %42 %49 Aligned 4 + %call = OpCompositeExtract %uint %48 0 + OpStore %group_id %call Aligned 4 %50 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %51 = OpCompositeExtract %uint %50 0 - OpStore %43 %51 Aligned 4 + %call1 = OpCompositeExtract %uint %50 0 + OpStore %local_id %call1 Aligned 4 %52 = OpLoad %v3uint %__spirv_BuiltInNumWorkgroups Aligned 16 - %53 = OpCompositeExtract %uint %52 0 - OpStore %44 %53 Aligned 4 + %call2 = OpCompositeExtract %uint %52 0 + OpStore %num_groups %call2 Aligned 4 %54 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %55 = OpCompositeExtract %uint %54 0 - OpStore %45 %55 Aligned 4 + %call3 = OpCompositeExtract %uint %54 0 + OpStore %global_id %call3 Aligned 4 %56 = OpLoad %v3uint %__spirv_BuiltInGlobalSize Aligned 16 - %57 = OpCompositeExtract %uint %56 0 - OpStore %46 %57 Aligned 4 - %58 = OpLoad %_ptr_CrossWorkgroup_uint %39 Aligned 4 - %59 = OpLoad %uint %45 Aligned 4 - %60 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %58 %59 - OpStore %60 %uint_1 Aligned 4 - %62 = OpLoad %uint %42 Aligned 4 - %65 = OpIEqual %bool %62 %uint_0 - OpBranchConditional %65 %18 %26 - %18 = OpLabel - %66 = OpLoad %uint %43 Aligned 4 - %67 = OpIAdd %uint %66 %uint_1 - %68 = OpLoad %uint %44 Aligned 4 - %69 = OpULessThan %bool %67 %68 - OpBranchConditional %69 %19 %23 - %19 = OpLabel - OpBranch %20 - %20 = OpLabel - %70 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %71 = OpLoad %uint %43 Aligned 4 - %72 = OpIAdd %uint %71 %uint_1 - %73 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %70 %72 - %75 = OpPtrCastToGeneric %_ptr_Generic_uint %73 - %77 = OpAtomicLoad %uint %75 %uint_1 %uint_2 - %78 = OpIEqual %bool %77 %uint_0 - OpBranchConditional %78 %21 %22 - %21 = OpLabel - OpBranch %20 - %22 = OpLabel - OpBranch %23 - %23 = OpLabel + %call4 = OpCompositeExtract %uint %56 0 + OpStore %global_size %call4 Aligned 4 + %58 = OpLoad %_ptr_CrossWorkgroup_uint %in_addr Aligned 4 + %59 = OpLoad %uint %global_id Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %58 %59 + OpStore %arrayidx %uint_1 Aligned 4 + %62 = OpLoad %uint %group_id Aligned 4 + %cmp = OpIEqual %bool %62 %uint_0 + OpBranchConditional %cmp %if_then %if_else + %if_then = OpLabel + %66 = OpLoad %uint %local_id Aligned 4 + %add = OpIAdd %uint %66 %uint_1 + %68 = OpLoad %uint %num_groups Aligned 4 + %cmp5 = OpULessThan %bool %add %68 + OpBranchConditional %cmp5 %if_then6 %if_end + %if_then6 = OpLabel + OpBranch %while_cond + %while_cond = OpLabel + %70 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %71 = OpLoad %uint %local_id Aligned 4 + %add7 = OpIAdd %uint %71 %uint_1 + %arrayidx8 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %70 %add7 +%arrayidx8_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %arrayidx8 + %call9 = OpAtomicLoad %uint %arrayidx8_ascast %uint_1 %uint_2 + %cmp10 = OpIEqual %bool %call9 %uint_0 + OpBranchConditional %cmp10 %while_body %while_end + %while_body = OpLabel + OpBranch %while_cond + %while_end = OpLabel + OpBranch %if_end + %if_end = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 - %80 = OpLoad %uint %43 Aligned 4 - %81 = OpIAdd %uint %80 %uint_1 - %82 = OpLoad %uint %44 Aligned 4 - %83 = OpULessThan %bool %81 %82 - OpBranchConditional %83 %24 %25 - %24 = OpLabel - %84 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %85 = OpLoad %uint %43 Aligned 4 - %86 = OpIAdd %uint %85 %uint_1 - %87 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %84 %86 - %88 = OpPtrCastToGeneric %_ptr_Generic_uint %87 - OpAtomicStore %88 %uint_1 %uint_4 %uint_0 - OpBranch %25 - %25 = OpLabel - OpBranch %32 - %26 = OpLabel + %80 = OpLoad %uint %local_id Aligned 4 + %add11 = OpIAdd %uint %80 %uint_1 + %82 = OpLoad %uint %num_groups Aligned 4 + %cmp12 = OpULessThan %bool %add11 %82 + OpBranchConditional %cmp12 %if_then13 %if_end16 + %if_then13 = OpLabel + %84 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %85 = OpLoad %uint %local_id Aligned 4 + %add14 = OpIAdd %uint %85 %uint_1 + %arrayidx15 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %84 %add14 +%arrayidx15_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %arrayidx15 + OpAtomicStore %arrayidx15_ascast %uint_1 %uint_4 %uint_0 + OpBranch %if_end16 + %if_end16 = OpLabel + OpBranch %if_end27 + %if_else = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 - %90 = OpLoad %uint %43 Aligned 4 - %91 = OpIEqual %bool %90 %uint_0 - OpBranchConditional %91 %27 %31 - %27 = OpLabel - %92 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %93 = OpLoad %uint %42 Aligned 4 - %94 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %92 %93 - %95 = OpPtrCastToGeneric %_ptr_Generic_uint %94 - OpAtomicStore %95 %uint_1 %uint_4 %uint_1 - OpBranch %28 - %28 = OpLabel - %96 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %97 = OpLoad %uint %42 Aligned 4 - %98 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %96 %97 - %99 = OpPtrCastToGeneric %_ptr_Generic_uint %98 - %100 = OpAtomicLoad %uint %99 %uint_1 %uint_2 - %101 = OpIEqual %bool %100 %uint_1 - OpBranchConditional %101 %29 %30 - %29 = OpLabel - OpBranch %28 - %30 = OpLabel - OpBranch %31 - %31 = OpLabel + %90 = OpLoad %uint %local_id Aligned 4 + %cmp17 = OpIEqual %bool %90 %uint_0 + OpBranchConditional %cmp17 %if_then18 %if_end26 + %if_then18 = OpLabel + %92 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %93 = OpLoad %uint %group_id Aligned 4 + %arrayidx19 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %92 %93 +%arrayidx19_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %arrayidx19 + OpAtomicStore %arrayidx19_ascast %uint_1 %uint_4 %uint_1 + OpBranch %while_cond20 +%while_cond20 = OpLabel + %96 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %97 = OpLoad %uint %group_id Aligned 4 + %arrayidx21 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %96 %97 +%arrayidx21_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %arrayidx21 + %call22 = OpAtomicLoad %uint %arrayidx21_ascast %uint_1 %uint_2 + %cmp23 = OpIEqual %bool %call22 %uint_1 + OpBranchConditional %cmp23 %while_body24 %while_end25 +%while_body24 = OpLabel + OpBranch %while_cond20 +%while_end25 = OpLabel + OpBranch %if_end26 + %if_end26 = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 - OpBranch %32 - %32 = OpLabel - OpStore %47 %uint_0 Aligned 4 - OpBranch %33 - %33 = OpLabel - %102 = OpLoad %uint %47 Aligned 4 - %103 = OpLoad %uint %46 Aligned 4 - %104 = OpULessThan %bool %102 %103 - OpBranchConditional %104 %34 %36 - %34 = OpLabel - %105 = OpLoad %_ptr_CrossWorkgroup_uint %39 Aligned 4 - %106 = OpLoad %uint %47 Aligned 4 - %107 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %105 %106 - %108 = OpLoad %uint %107 Aligned 4 - %109 = OpLoad %_ptr_CrossWorkgroup_uint %40 Aligned 4 - %110 = OpLoad %uint %45 Aligned 4 - %111 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %109 %110 - %112 = OpLoad %uint %111 Aligned 4 - %113 = OpIAdd %uint %112 %108 - OpStore %111 %113 Aligned 4 - OpBranch %35 - %35 = OpLabel - %114 = OpLoad %uint %47 Aligned 4 - %115 = OpIAdd %uint %114 %uint_1 - OpStore %47 %115 Aligned 4 - OpBranch %33 - %36 = OpLabel + OpBranch %if_end27 + %if_end27 = OpLabel + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %102 = OpLoad %uint %i Aligned 4 + %103 = OpLoad %uint %global_size Aligned 4 + %cmp28 = OpULessThan %bool %102 %103 + OpBranchConditional %cmp28 %for_body %for_end + %for_body = OpLabel + %105 = OpLoad %_ptr_CrossWorkgroup_uint %in_addr Aligned 4 + %106 = OpLoad %uint %i Aligned 4 + %arrayidx29 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %105 %106 + %108 = OpLoad %uint %arrayidx29 Aligned 4 + %109 = OpLoad %_ptr_CrossWorkgroup_uint %out_addr Aligned 4 + %110 = OpLoad %uint %global_id Aligned 4 + %arrayidx30 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %109 %110 + %112 = OpLoad %uint %arrayidx30 Aligned 4 + %add31 = OpIAdd %uint %112 %108 + OpStore %arrayidx30 %add31 Aligned 4 + OpBranch %for_inc + %for_inc = OpLabel + %114 = OpLoad %uint %i Aligned 4 + %inc = OpIAdd %uint %114 %uint_1 + OpStore %i %inc Aligned 4 + OpBranch %for_cond + %for_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/benchmarks/xf-barrier-3.1.3.spvasm b/dartagnan/src/test/resources/spirv/opencl/benchmarks/xf-barrier-3.1.3.spvasm index ff1a531501..c45e8bc7be 100644 --- a/dartagnan/src/test/resources/spirv/opencl/benchmarks/xf-barrier-3.1.3.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/benchmarks/xf-barrier-3.1.3.spvasm @@ -1,11 +1,11 @@ ; flag -; @Input: %14 = {0, 0, 0, 0, 0, 0, 0, 0} +; @Input: %flag = {0, 0, 0, 0, 0, 0, 0, 0} ; data -; @Input: %15 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} -; @Input: %16 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} -; @Output: forall (%16[0] == 9 and %16[1] == 9 and %16[2] == 9) -; @Output: forall (%16[3] == 9 and %16[4] == 9 and %16[5] == 9) -; @Output: forall (%16[6] == 9 and %16[7] == 9 and %16[8] == 9) +; @Input: %in = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +; @Input: %out = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +; @Output: forall (%out[0] == 9 and %out[1] == 9 and %out[2] == 9) +; @Output: forall (%out[3] == 9 and %out[4] == 9 and %out[5] == 9) +; @Output: forall (%out[6] == 9 and %out[7] == 9 and %out[8] == 9) ; @Config: 3, 1, 3 ; SPIR-V ; Version: 1.0 @@ -25,6 +25,69 @@ OpName %__spirv_BuiltInNumWorkgroups "__spirv_BuiltInNumWorkgroups" OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %__spirv_BuiltInGlobalSize "__spirv_BuiltInGlobalSize" + OpName %flag "flag" + OpName %in "in" + OpName %out "out" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_then6 "if.then6" + OpName %while_cond "while.cond" + OpName %while_body "while.body" + OpName %while_end "while.end" + OpName %if_end "if.end" + OpName %if_then13 "if.then13" + OpName %if_end16 "if.end16" + OpName %if_else "if.else" + OpName %if_then18 "if.then18" + OpName %while_cond20 "while.cond20" + OpName %while_body24 "while.body24" + OpName %while_end25 "while.end25" + OpName %if_end26 "if.end26" + OpName %if_end27 "if.end27" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %flag_addr "flag.addr" + OpName %in_addr "in.addr" + OpName %out_addr "out.addr" + OpName %group_id "group_id" + OpName %local_id "local_id" + OpName %num_groups "num_groups" + OpName %global_id "global_id" + OpName %global_size "global_size" + OpName %i "i" + OpName %call "call" + OpName %call1 "call1" + OpName %call2 "call2" + OpName %call3 "call3" + OpName %call4 "call4" + OpName %arrayidx "arrayidx" + OpName %cmp "cmp" + OpName %add "add" + OpName %cmp5 "cmp5" + OpName %add7 "add7" + OpName %arrayidx8 "arrayidx8" + OpName %arrayidx8_ascast "arrayidx8.ascast" + OpName %call9 "call9" + OpName %cmp10 "cmp10" + OpName %add11 "add11" + OpName %cmp12 "cmp12" + OpName %add14 "add14" + OpName %arrayidx15 "arrayidx15" + OpName %arrayidx15_ascast "arrayidx15.ascast" + OpName %cmp17 "cmp17" + OpName %arrayidx19 "arrayidx19" + OpName %arrayidx19_ascast "arrayidx19.ascast" + OpName %arrayidx21 "arrayidx21" + OpName %arrayidx21_ascast "arrayidx21.ascast" + OpName %call22 "call22" + OpName %cmp23 "cmp23" + OpName %cmp28 "cmp28" + OpName %arrayidx29 "arrayidx29" + OpName %arrayidx30 "arrayidx30" + OpName %add31 "add31" + OpName %inc "inc" OpDecorate %__spirv_BuiltInNumWorkgroups BuiltIn NumWorkgroups OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId @@ -40,15 +103,15 @@ OpDecorate %__spirv_BuiltInNumWorkgroups LinkageAttributes "__spirv_BuiltInNumWorkgroups" Import OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %38 Alignment 4 - OpDecorate %39 Alignment 4 - OpDecorate %40 Alignment 4 - OpDecorate %42 Alignment 4 - OpDecorate %43 Alignment 4 - OpDecorate %44 Alignment 4 - OpDecorate %45 Alignment 4 - OpDecorate %46 Alignment 4 - OpDecorate %47 Alignment 4 + OpDecorate %flag_addr Alignment 4 + OpDecorate %in_addr Alignment 4 + OpDecorate %out_addr Alignment 4 + OpDecorate %group_id Alignment 4 + OpDecorate %local_id Alignment 4 + OpDecorate %num_groups Alignment 4 + OpDecorate %global_id Alignment 4 + OpDecorate %global_size Alignment 4 + OpDecorate %i Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 @@ -70,134 +133,134 @@ %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInGlobalSize = OpVariable %_ptr_Input_v3uint Input %13 = OpFunction %void DontInline %12 - %14 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %15 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %16 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %17 = OpLabel - %38 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %39 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %40 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %42 = OpVariable %_ptr_Function_uint Function - %43 = OpVariable %_ptr_Function_uint Function - %44 = OpVariable %_ptr_Function_uint Function - %45 = OpVariable %_ptr_Function_uint Function - %46 = OpVariable %_ptr_Function_uint Function - %47 = OpVariable %_ptr_Function_uint Function - OpStore %38 %14 Aligned 4 - OpStore %39 %15 Aligned 4 - OpStore %40 %16 Aligned 4 + %flag = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %in = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %out = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %flag_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %in_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %out_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %group_id = OpVariable %_ptr_Function_uint Function + %local_id = OpVariable %_ptr_Function_uint Function + %num_groups = OpVariable %_ptr_Function_uint Function + %global_id = OpVariable %_ptr_Function_uint Function +%global_size = OpVariable %_ptr_Function_uint Function + %i = OpVariable %_ptr_Function_uint Function + OpStore %flag_addr %flag Aligned 4 + OpStore %in_addr %in Aligned 4 + OpStore %out_addr %out Aligned 4 %48 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %49 = OpCompositeExtract %uint %48 0 - OpStore %42 %49 Aligned 4 + %call = OpCompositeExtract %uint %48 0 + OpStore %group_id %call Aligned 4 %50 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %51 = OpCompositeExtract %uint %50 0 - OpStore %43 %51 Aligned 4 + %call1 = OpCompositeExtract %uint %50 0 + OpStore %local_id %call1 Aligned 4 %52 = OpLoad %v3uint %__spirv_BuiltInNumWorkgroups Aligned 16 - %53 = OpCompositeExtract %uint %52 0 - OpStore %44 %53 Aligned 4 + %call2 = OpCompositeExtract %uint %52 0 + OpStore %num_groups %call2 Aligned 4 %54 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %55 = OpCompositeExtract %uint %54 0 - OpStore %45 %55 Aligned 4 + %call3 = OpCompositeExtract %uint %54 0 + OpStore %global_id %call3 Aligned 4 %56 = OpLoad %v3uint %__spirv_BuiltInGlobalSize Aligned 16 - %57 = OpCompositeExtract %uint %56 0 - OpStore %46 %57 Aligned 4 - %58 = OpLoad %_ptr_CrossWorkgroup_uint %39 Aligned 4 - %59 = OpLoad %uint %45 Aligned 4 - %60 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %58 %59 - OpStore %60 %uint_1 Aligned 4 - %62 = OpLoad %uint %42 Aligned 4 - %65 = OpIEqual %bool %62 %uint_0 - OpBranchConditional %65 %18 %26 - %18 = OpLabel - %66 = OpLoad %uint %43 Aligned 4 - %67 = OpIAdd %uint %66 %uint_1 - %68 = OpLoad %uint %44 Aligned 4 - %69 = OpULessThan %bool %67 %68 - OpBranchConditional %69 %19 %23 - %19 = OpLabel - OpBranch %20 - %20 = OpLabel - %70 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %71 = OpLoad %uint %43 Aligned 4 - %72 = OpIAdd %uint %71 %uint_1 - %73 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %70 %72 - %75 = OpPtrCastToGeneric %_ptr_Generic_uint %73 - %77 = OpAtomicLoad %uint %75 %uint_1 %uint_2 - %78 = OpIEqual %bool %77 %uint_0 - OpBranchConditional %78 %21 %22 - %21 = OpLabel - OpBranch %20 - %22 = OpLabel - OpBranch %23 - %23 = OpLabel + %call4 = OpCompositeExtract %uint %56 0 + OpStore %global_size %call4 Aligned 4 + %58 = OpLoad %_ptr_CrossWorkgroup_uint %in_addr Aligned 4 + %59 = OpLoad %uint %global_id Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %58 %59 + OpStore %arrayidx %uint_1 Aligned 4 + %62 = OpLoad %uint %group_id Aligned 4 + %cmp = OpIEqual %bool %62 %uint_0 + OpBranchConditional %cmp %if_then %if_else + %if_then = OpLabel + %66 = OpLoad %uint %local_id Aligned 4 + %add = OpIAdd %uint %66 %uint_1 + %68 = OpLoad %uint %num_groups Aligned 4 + %cmp5 = OpULessThan %bool %add %68 + OpBranchConditional %cmp5 %if_then6 %if_end + %if_then6 = OpLabel + OpBranch %while_cond + %while_cond = OpLabel + %70 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %71 = OpLoad %uint %local_id Aligned 4 + %add7 = OpIAdd %uint %71 %uint_1 + %arrayidx8 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %70 %add7 +%arrayidx8_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %arrayidx8 + %call9 = OpAtomicLoad %uint %arrayidx8_ascast %uint_1 %uint_2 + %cmp10 = OpIEqual %bool %call9 %uint_0 + OpBranchConditional %cmp10 %while_body %while_end + %while_body = OpLabel + OpBranch %while_cond + %while_end = OpLabel + OpBranch %if_end + %if_end = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 - %80 = OpLoad %uint %43 Aligned 4 - %81 = OpIAdd %uint %80 %uint_1 - %82 = OpLoad %uint %44 Aligned 4 - %83 = OpULessThan %bool %81 %82 - OpBranchConditional %83 %24 %25 - %24 = OpLabel - %84 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %85 = OpLoad %uint %43 Aligned 4 - %86 = OpIAdd %uint %85 %uint_1 - %87 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %84 %86 - %88 = OpPtrCastToGeneric %_ptr_Generic_uint %87 - OpAtomicStore %88 %uint_1 %uint_4 %uint_0 - OpBranch %25 - %25 = OpLabel - OpBranch %32 - %26 = OpLabel + %80 = OpLoad %uint %local_id Aligned 4 + %add11 = OpIAdd %uint %80 %uint_1 + %82 = OpLoad %uint %num_groups Aligned 4 + %cmp12 = OpULessThan %bool %add11 %82 + OpBranchConditional %cmp12 %if_then13 %if_end16 + %if_then13 = OpLabel + %84 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %85 = OpLoad %uint %local_id Aligned 4 + %add14 = OpIAdd %uint %85 %uint_1 + %arrayidx15 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %84 %add14 +%arrayidx15_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %arrayidx15 + OpAtomicStore %arrayidx15_ascast %uint_1 %uint_4 %uint_0 + OpBranch %if_end16 + %if_end16 = OpLabel + OpBranch %if_end27 + %if_else = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 - %90 = OpLoad %uint %43 Aligned 4 - %91 = OpIEqual %bool %90 %uint_0 - OpBranchConditional %91 %27 %31 - %27 = OpLabel - %92 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %93 = OpLoad %uint %42 Aligned 4 - %94 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %92 %93 - %95 = OpPtrCastToGeneric %_ptr_Generic_uint %94 - OpAtomicStore %95 %uint_1 %uint_4 %uint_1 - OpBranch %28 - %28 = OpLabel - %96 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %97 = OpLoad %uint %42 Aligned 4 - %98 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %96 %97 - %99 = OpPtrCastToGeneric %_ptr_Generic_uint %98 - %100 = OpAtomicLoad %uint %99 %uint_1 %uint_2 - %101 = OpIEqual %bool %100 %uint_1 - OpBranchConditional %101 %29 %30 - %29 = OpLabel - OpBranch %28 - %30 = OpLabel - OpBranch %31 - %31 = OpLabel + %90 = OpLoad %uint %local_id Aligned 4 + %cmp17 = OpIEqual %bool %90 %uint_0 + OpBranchConditional %cmp17 %if_then18 %if_end26 + %if_then18 = OpLabel + %92 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %93 = OpLoad %uint %group_id Aligned 4 + %arrayidx19 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %92 %93 +%arrayidx19_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %arrayidx19 + OpAtomicStore %arrayidx19_ascast %uint_1 %uint_4 %uint_1 + OpBranch %while_cond20 +%while_cond20 = OpLabel + %96 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %97 = OpLoad %uint %group_id Aligned 4 + %arrayidx21 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %96 %97 +%arrayidx21_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %arrayidx21 + %call22 = OpAtomicLoad %uint %arrayidx21_ascast %uint_1 %uint_2 + %cmp23 = OpIEqual %bool %call22 %uint_1 + OpBranchConditional %cmp23 %while_body24 %while_end25 +%while_body24 = OpLabel + OpBranch %while_cond20 +%while_end25 = OpLabel + OpBranch %if_end26 + %if_end26 = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 - OpBranch %32 - %32 = OpLabel - OpStore %47 %uint_0 Aligned 4 - OpBranch %33 - %33 = OpLabel - %102 = OpLoad %uint %47 Aligned 4 - %103 = OpLoad %uint %46 Aligned 4 - %104 = OpULessThan %bool %102 %103 - OpBranchConditional %104 %34 %36 - %34 = OpLabel - %105 = OpLoad %_ptr_CrossWorkgroup_uint %39 Aligned 4 - %106 = OpLoad %uint %47 Aligned 4 - %107 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %105 %106 - %108 = OpLoad %uint %107 Aligned 4 - %109 = OpLoad %_ptr_CrossWorkgroup_uint %40 Aligned 4 - %110 = OpLoad %uint %45 Aligned 4 - %111 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %109 %110 - %112 = OpLoad %uint %111 Aligned 4 - %113 = OpIAdd %uint %112 %108 - OpStore %111 %113 Aligned 4 - OpBranch %35 - %35 = OpLabel - %114 = OpLoad %uint %47 Aligned 4 - %115 = OpIAdd %uint %114 %uint_1 - OpStore %47 %115 Aligned 4 - OpBranch %33 - %36 = OpLabel + OpBranch %if_end27 + %if_end27 = OpLabel + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %102 = OpLoad %uint %i Aligned 4 + %103 = OpLoad %uint %global_size Aligned 4 + %cmp28 = OpULessThan %bool %102 %103 + OpBranchConditional %cmp28 %for_body %for_end + %for_body = OpLabel + %105 = OpLoad %_ptr_CrossWorkgroup_uint %in_addr Aligned 4 + %106 = OpLoad %uint %i Aligned 4 + %arrayidx29 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %105 %106 + %108 = OpLoad %uint %arrayidx29 Aligned 4 + %109 = OpLoad %_ptr_CrossWorkgroup_uint %out_addr Aligned 4 + %110 = OpLoad %uint %global_id Aligned 4 + %arrayidx30 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %109 %110 + %112 = OpLoad %uint %arrayidx30 Aligned 4 + %add31 = OpIAdd %uint %112 %108 + OpStore %arrayidx30 %add31 Aligned 4 + OpBranch %for_inc + %for_inc = OpLabel + %114 = OpLoad %uint %i Aligned 4 + %inc = OpIAdd %uint %114 %uint_1 + OpStore %i %inc Aligned 4 + OpBranch %for_cond + %for_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/benchmarks/xf-barrier-fail1.spvasm b/dartagnan/src/test/resources/spirv/opencl/benchmarks/xf-barrier-fail1.spvasm index a8b2b9c3ef..3b0ed6a3c5 100644 --- a/dartagnan/src/test/resources/spirv/opencl/benchmarks/xf-barrier-fail1.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/benchmarks/xf-barrier-fail1.spvasm @@ -1,9 +1,9 @@ ; flag -; @Input: %14 = {0, 0, 0, 0, 0, 0, 0, 0} +; @Input: %flag = {0, 0, 0, 0, 0, 0, 0, 0} ; data -; @Input: %15 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} -; @Input: %16 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} -; @Output: forall (%16[0] == 4 and %16[1] == 4 and %16[2] == 4 and %16[3] == 4) +; @Input: %in = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +; @Input: %out = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +; @Output: forall (%out[0] == 4 and %out[1] == 4 and %out[2] == 4 and %out[3] == 4) ; @Config: 2, 1, 2 ; SPIR-V ; Version: 1.0 @@ -23,6 +23,69 @@ OpName %__spirv_BuiltInNumWorkgroups "__spirv_BuiltInNumWorkgroups" OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %__spirv_BuiltInGlobalSize "__spirv_BuiltInGlobalSize" + OpName %flag "flag" + OpName %in "in" + OpName %out "out" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_then6 "if.then6" + OpName %while_cond "while.cond" + OpName %while_body "while.body" + OpName %while_end "while.end" + OpName %if_end "if.end" + OpName %if_then13 "if.then13" + OpName %if_end16 "if.end16" + OpName %if_else "if.else" + OpName %if_then18 "if.then18" + OpName %while_cond20 "while.cond20" + OpName %while_body24 "while.body24" + OpName %while_end25 "while.end25" + OpName %if_end26 "if.end26" + OpName %if_end27 "if.end27" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %flag_addr "flag.addr" + OpName %in_addr "in.addr" + OpName %out_addr "out.addr" + OpName %group_id "group_id" + OpName %local_id "local_id" + OpName %num_groups "num_groups" + OpName %global_id "global_id" + OpName %global_size "global_size" + OpName %i "i" + OpName %call "call" + OpName %call1 "call1" + OpName %call2 "call2" + OpName %call3 "call3" + OpName %call4 "call4" + OpName %arrayidx "arrayidx" + OpName %cmp "cmp" + OpName %add "add" + OpName %cmp5 "cmp5" + OpName %add7 "add7" + OpName %arrayidx8 "arrayidx8" + OpName %arrayidx8_ascast "arrayidx8.ascast" + OpName %call9 "call9" + OpName %cmp10 "cmp10" + OpName %add11 "add11" + OpName %cmp12 "cmp12" + OpName %add14 "add14" + OpName %arrayidx15 "arrayidx15" + OpName %arrayidx15_ascast "arrayidx15.ascast" + OpName %cmp17 "cmp17" + OpName %arrayidx19 "arrayidx19" + OpName %arrayidx19_ascast "arrayidx19.ascast" + OpName %arrayidx21 "arrayidx21" + OpName %arrayidx21_ascast "arrayidx21.ascast" + OpName %call22 "call22" + OpName %cmp23 "cmp23" + OpName %cmp28 "cmp28" + OpName %arrayidx29 "arrayidx29" + OpName %arrayidx30 "arrayidx30" + OpName %add31 "add31" + OpName %inc "inc" OpDecorate %__spirv_BuiltInNumWorkgroups BuiltIn NumWorkgroups OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId @@ -38,15 +101,15 @@ OpDecorate %__spirv_BuiltInNumWorkgroups LinkageAttributes "__spirv_BuiltInNumWorkgroups" Import OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %38 Alignment 4 - OpDecorate %39 Alignment 4 - OpDecorate %40 Alignment 4 - OpDecorate %42 Alignment 4 - OpDecorate %43 Alignment 4 - OpDecorate %44 Alignment 4 - OpDecorate %45 Alignment 4 - OpDecorate %46 Alignment 4 - OpDecorate %47 Alignment 4 + OpDecorate %flag_addr Alignment 4 + OpDecorate %in_addr Alignment 4 + OpDecorate %out_addr Alignment 4 + OpDecorate %group_id Alignment 4 + OpDecorate %local_id Alignment 4 + OpDecorate %num_groups Alignment 4 + OpDecorate %global_id Alignment 4 + OpDecorate %global_size Alignment 4 + OpDecorate %i Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 @@ -68,134 +131,134 @@ %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInGlobalSize = OpVariable %_ptr_Input_v3uint Input %13 = OpFunction %void DontInline %12 - %14 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %15 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %16 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %17 = OpLabel - %38 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %39 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %40 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %42 = OpVariable %_ptr_Function_uint Function - %43 = OpVariable %_ptr_Function_uint Function - %44 = OpVariable %_ptr_Function_uint Function - %45 = OpVariable %_ptr_Function_uint Function - %46 = OpVariable %_ptr_Function_uint Function - %47 = OpVariable %_ptr_Function_uint Function - OpStore %38 %14 Aligned 4 - OpStore %39 %15 Aligned 4 - OpStore %40 %16 Aligned 4 + %flag = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %in = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %out = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %flag_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %in_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %out_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %group_id = OpVariable %_ptr_Function_uint Function + %local_id = OpVariable %_ptr_Function_uint Function + %num_groups = OpVariable %_ptr_Function_uint Function + %global_id = OpVariable %_ptr_Function_uint Function +%global_size = OpVariable %_ptr_Function_uint Function + %i = OpVariable %_ptr_Function_uint Function + OpStore %flag_addr %flag Aligned 4 + OpStore %in_addr %in Aligned 4 + OpStore %out_addr %out Aligned 4 %48 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %49 = OpCompositeExtract %uint %48 0 - OpStore %42 %49 Aligned 4 + %call = OpCompositeExtract %uint %48 0 + OpStore %group_id %call Aligned 4 %50 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %51 = OpCompositeExtract %uint %50 0 - OpStore %43 %51 Aligned 4 + %call1 = OpCompositeExtract %uint %50 0 + OpStore %local_id %call1 Aligned 4 %52 = OpLoad %v3uint %__spirv_BuiltInNumWorkgroups Aligned 16 - %53 = OpCompositeExtract %uint %52 0 - OpStore %44 %53 Aligned 4 + %call2 = OpCompositeExtract %uint %52 0 + OpStore %num_groups %call2 Aligned 4 %54 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %55 = OpCompositeExtract %uint %54 0 - OpStore %45 %55 Aligned 4 + %call3 = OpCompositeExtract %uint %54 0 + OpStore %global_id %call3 Aligned 4 %56 = OpLoad %v3uint %__spirv_BuiltInGlobalSize Aligned 16 - %57 = OpCompositeExtract %uint %56 0 - OpStore %46 %57 Aligned 4 - %58 = OpLoad %_ptr_CrossWorkgroup_uint %39 Aligned 4 - %59 = OpLoad %uint %45 Aligned 4 - %60 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %58 %59 - OpStore %60 %uint_1 Aligned 4 - %62 = OpLoad %uint %42 Aligned 4 - %65 = OpIEqual %bool %62 %uint_0 - OpBranchConditional %65 %18 %26 - %18 = OpLabel - %66 = OpLoad %uint %43 Aligned 4 - %67 = OpIAdd %uint %66 %uint_1 - %68 = OpLoad %uint %44 Aligned 4 - %69 = OpULessThan %bool %67 %68 - OpBranchConditional %69 %19 %23 - %19 = OpLabel - OpBranch %20 - %20 = OpLabel - %70 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %71 = OpLoad %uint %43 Aligned 4 - %72 = OpIAdd %uint %71 %uint_1 - %73 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %70 %72 - %75 = OpPtrCastToGeneric %_ptr_Generic_uint %73 - %76 = OpAtomicLoad %uint %75 %uint_1 %uint_0 - %77 = OpIEqual %bool %76 %uint_0 - OpBranchConditional %77 %21 %22 - %21 = OpLabel - OpBranch %20 - %22 = OpLabel - OpBranch %23 - %23 = OpLabel + %call4 = OpCompositeExtract %uint %56 0 + OpStore %global_size %call4 Aligned 4 + %58 = OpLoad %_ptr_CrossWorkgroup_uint %in_addr Aligned 4 + %59 = OpLoad %uint %global_id Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %58 %59 + OpStore %arrayidx %uint_1 Aligned 4 + %62 = OpLoad %uint %group_id Aligned 4 + %cmp = OpIEqual %bool %62 %uint_0 + OpBranchConditional %cmp %if_then %if_else + %if_then = OpLabel + %66 = OpLoad %uint %local_id Aligned 4 + %add = OpIAdd %uint %66 %uint_1 + %68 = OpLoad %uint %num_groups Aligned 4 + %cmp5 = OpULessThan %bool %add %68 + OpBranchConditional %cmp5 %if_then6 %if_end + %if_then6 = OpLabel + OpBranch %while_cond + %while_cond = OpLabel + %70 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %71 = OpLoad %uint %local_id Aligned 4 + %add7 = OpIAdd %uint %71 %uint_1 + %arrayidx8 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %70 %add7 +%arrayidx8_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %arrayidx8 + %call9 = OpAtomicLoad %uint %arrayidx8_ascast %uint_1 %uint_0 + %cmp10 = OpIEqual %bool %call9 %uint_0 + OpBranchConditional %cmp10 %while_body %while_end + %while_body = OpLabel + OpBranch %while_cond + %while_end = OpLabel + OpBranch %if_end + %if_end = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 - %80 = OpLoad %uint %43 Aligned 4 - %81 = OpIAdd %uint %80 %uint_1 - %82 = OpLoad %uint %44 Aligned 4 - %83 = OpULessThan %bool %81 %82 - OpBranchConditional %83 %24 %25 - %24 = OpLabel - %84 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %85 = OpLoad %uint %43 Aligned 4 - %86 = OpIAdd %uint %85 %uint_1 - %87 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %84 %86 - %88 = OpPtrCastToGeneric %_ptr_Generic_uint %87 - OpAtomicStore %88 %uint_1 %uint_4 %uint_0 - OpBranch %25 - %25 = OpLabel - OpBranch %32 - %26 = OpLabel + %80 = OpLoad %uint %local_id Aligned 4 + %add11 = OpIAdd %uint %80 %uint_1 + %82 = OpLoad %uint %num_groups Aligned 4 + %cmp12 = OpULessThan %bool %add11 %82 + OpBranchConditional %cmp12 %if_then13 %if_end16 + %if_then13 = OpLabel + %84 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %85 = OpLoad %uint %local_id Aligned 4 + %add14 = OpIAdd %uint %85 %uint_1 + %arrayidx15 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %84 %add14 +%arrayidx15_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %arrayidx15 + OpAtomicStore %arrayidx15_ascast %uint_1 %uint_4 %uint_0 + OpBranch %if_end16 + %if_end16 = OpLabel + OpBranch %if_end27 + %if_else = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 - %90 = OpLoad %uint %43 Aligned 4 - %91 = OpIEqual %bool %90 %uint_0 - OpBranchConditional %91 %27 %31 - %27 = OpLabel - %92 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %93 = OpLoad %uint %42 Aligned 4 - %94 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %92 %93 - %95 = OpPtrCastToGeneric %_ptr_Generic_uint %94 - OpAtomicStore %95 %uint_1 %uint_4 %uint_1 - OpBranch %28 - %28 = OpLabel - %96 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %97 = OpLoad %uint %42 Aligned 4 - %98 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %96 %97 - %99 = OpPtrCastToGeneric %_ptr_Generic_uint %98 - %100 = OpAtomicLoad %uint %99 %uint_1 %uint_2 - %101 = OpIEqual %bool %100 %uint_1 - OpBranchConditional %101 %29 %30 - %29 = OpLabel - OpBranch %28 - %30 = OpLabel - OpBranch %31 - %31 = OpLabel + %90 = OpLoad %uint %local_id Aligned 4 + %cmp17 = OpIEqual %bool %90 %uint_0 + OpBranchConditional %cmp17 %if_then18 %if_end26 + %if_then18 = OpLabel + %92 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %93 = OpLoad %uint %group_id Aligned 4 + %arrayidx19 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %92 %93 +%arrayidx19_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %arrayidx19 + OpAtomicStore %arrayidx19_ascast %uint_1 %uint_4 %uint_1 + OpBranch %while_cond20 +%while_cond20 = OpLabel + %96 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %97 = OpLoad %uint %group_id Aligned 4 + %arrayidx21 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %96 %97 +%arrayidx21_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %arrayidx21 + %call22 = OpAtomicLoad %uint %arrayidx21_ascast %uint_1 %uint_2 + %cmp23 = OpIEqual %bool %call22 %uint_1 + OpBranchConditional %cmp23 %while_body24 %while_end25 +%while_body24 = OpLabel + OpBranch %while_cond20 +%while_end25 = OpLabel + OpBranch %if_end26 + %if_end26 = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 - OpBranch %32 - %32 = OpLabel - OpStore %47 %uint_0 Aligned 4 - OpBranch %33 - %33 = OpLabel - %102 = OpLoad %uint %47 Aligned 4 - %103 = OpLoad %uint %46 Aligned 4 - %104 = OpULessThan %bool %102 %103 - OpBranchConditional %104 %34 %36 - %34 = OpLabel - %105 = OpLoad %_ptr_CrossWorkgroup_uint %39 Aligned 4 - %106 = OpLoad %uint %47 Aligned 4 - %107 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %105 %106 - %108 = OpLoad %uint %107 Aligned 4 - %109 = OpLoad %_ptr_CrossWorkgroup_uint %40 Aligned 4 - %110 = OpLoad %uint %45 Aligned 4 - %111 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %109 %110 - %112 = OpLoad %uint %111 Aligned 4 - %113 = OpIAdd %uint %112 %108 - OpStore %111 %113 Aligned 4 - OpBranch %35 - %35 = OpLabel - %114 = OpLoad %uint %47 Aligned 4 - %115 = OpIAdd %uint %114 %uint_1 - OpStore %47 %115 Aligned 4 - OpBranch %33 - %36 = OpLabel + OpBranch %if_end27 + %if_end27 = OpLabel + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %102 = OpLoad %uint %i Aligned 4 + %103 = OpLoad %uint %global_size Aligned 4 + %cmp28 = OpULessThan %bool %102 %103 + OpBranchConditional %cmp28 %for_body %for_end + %for_body = OpLabel + %105 = OpLoad %_ptr_CrossWorkgroup_uint %in_addr Aligned 4 + %106 = OpLoad %uint %i Aligned 4 + %arrayidx29 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %105 %106 + %108 = OpLoad %uint %arrayidx29 Aligned 4 + %109 = OpLoad %_ptr_CrossWorkgroup_uint %out_addr Aligned 4 + %110 = OpLoad %uint %global_id Aligned 4 + %arrayidx30 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %109 %110 + %112 = OpLoad %uint %arrayidx30 Aligned 4 + %add31 = OpIAdd %uint %112 %108 + OpStore %arrayidx30 %add31 Aligned 4 + OpBranch %for_inc + %for_inc = OpLabel + %114 = OpLoad %uint %i Aligned 4 + %inc = OpIAdd %uint %114 %uint_1 + OpStore %i %inc Aligned 4 + OpBranch %for_cond + %for_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/benchmarks/xf-barrier-fail2.spvasm b/dartagnan/src/test/resources/spirv/opencl/benchmarks/xf-barrier-fail2.spvasm index fe496daf98..90ad74265c 100644 --- a/dartagnan/src/test/resources/spirv/opencl/benchmarks/xf-barrier-fail2.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/benchmarks/xf-barrier-fail2.spvasm @@ -1,9 +1,9 @@ ; flag -; @Input: %14 = {0, 0, 0, 0, 0, 0, 0, 0} +; @Input: %flag = {0, 0, 0, 0, 0, 0, 0, 0} ; data -; @Input: %15 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} -; @Input: %16 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} -; @Output: forall (%16[0] == 4 and %16[1] == 4 and %16[2] == 4 and %16[3] == 4) +; @Input: %in = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +; @Input: %out = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +; @Output: forall (%out[0] == 4 and %out[1] == 4 and %out[2] == 4 and %out[3] == 4) ; @Config: 2, 1, 2 ; SPIR-V ; Version: 1.0 @@ -23,6 +23,69 @@ OpName %__spirv_BuiltInNumWorkgroups "__spirv_BuiltInNumWorkgroups" OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %__spirv_BuiltInGlobalSize "__spirv_BuiltInGlobalSize" + OpName %flag "flag" + OpName %in "in" + OpName %out "out" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_then6 "if.then6" + OpName %while_cond "while.cond" + OpName %while_body "while.body" + OpName %while_end "while.end" + OpName %if_end "if.end" + OpName %if_then13 "if.then13" + OpName %if_end16 "if.end16" + OpName %if_else "if.else" + OpName %if_then18 "if.then18" + OpName %while_cond20 "while.cond20" + OpName %while_body24 "while.body24" + OpName %while_end25 "while.end25" + OpName %if_end26 "if.end26" + OpName %if_end27 "if.end27" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %flag_addr "flag.addr" + OpName %in_addr "in.addr" + OpName %out_addr "out.addr" + OpName %group_id "group_id" + OpName %local_id "local_id" + OpName %num_groups "num_groups" + OpName %global_id "global_id" + OpName %global_size "global_size" + OpName %i "i" + OpName %call "call" + OpName %call1 "call1" + OpName %call2 "call2" + OpName %call3 "call3" + OpName %call4 "call4" + OpName %arrayidx "arrayidx" + OpName %cmp "cmp" + OpName %add "add" + OpName %cmp5 "cmp5" + OpName %add7 "add7" + OpName %arrayidx8 "arrayidx8" + OpName %arrayidx8_ascast "arrayidx8.ascast" + OpName %call9 "call9" + OpName %cmp10 "cmp10" + OpName %add11 "add11" + OpName %cmp12 "cmp12" + OpName %add14 "add14" + OpName %arrayidx15 "arrayidx15" + OpName %arrayidx15_ascast "arrayidx15.ascast" + OpName %cmp17 "cmp17" + OpName %arrayidx19 "arrayidx19" + OpName %arrayidx19_ascast "arrayidx19.ascast" + OpName %arrayidx21 "arrayidx21" + OpName %arrayidx21_ascast "arrayidx21.ascast" + OpName %call22 "call22" + OpName %cmp23 "cmp23" + OpName %cmp28 "cmp28" + OpName %arrayidx29 "arrayidx29" + OpName %arrayidx30 "arrayidx30" + OpName %add31 "add31" + OpName %inc "inc" OpDecorate %__spirv_BuiltInNumWorkgroups BuiltIn NumWorkgroups OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId @@ -38,15 +101,15 @@ OpDecorate %__spirv_BuiltInNumWorkgroups LinkageAttributes "__spirv_BuiltInNumWorkgroups" Import OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %38 Alignment 4 - OpDecorate %39 Alignment 4 - OpDecorate %40 Alignment 4 - OpDecorate %42 Alignment 4 - OpDecorate %43 Alignment 4 - OpDecorate %44 Alignment 4 - OpDecorate %45 Alignment 4 - OpDecorate %46 Alignment 4 - OpDecorate %47 Alignment 4 + OpDecorate %flag_addr Alignment 4 + OpDecorate %in_addr Alignment 4 + OpDecorate %out_addr Alignment 4 + OpDecorate %group_id Alignment 4 + OpDecorate %local_id Alignment 4 + OpDecorate %num_groups Alignment 4 + OpDecorate %global_id Alignment 4 + OpDecorate %global_size Alignment 4 + OpDecorate %i Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 @@ -68,134 +131,134 @@ %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInGlobalSize = OpVariable %_ptr_Input_v3uint Input %13 = OpFunction %void DontInline %12 - %14 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %15 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %16 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %17 = OpLabel - %38 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %39 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %40 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %42 = OpVariable %_ptr_Function_uint Function - %43 = OpVariable %_ptr_Function_uint Function - %44 = OpVariable %_ptr_Function_uint Function - %45 = OpVariable %_ptr_Function_uint Function - %46 = OpVariable %_ptr_Function_uint Function - %47 = OpVariable %_ptr_Function_uint Function - OpStore %38 %14 Aligned 4 - OpStore %39 %15 Aligned 4 - OpStore %40 %16 Aligned 4 + %flag = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %in = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %out = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %flag_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %in_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %out_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %group_id = OpVariable %_ptr_Function_uint Function + %local_id = OpVariable %_ptr_Function_uint Function + %num_groups = OpVariable %_ptr_Function_uint Function + %global_id = OpVariable %_ptr_Function_uint Function +%global_size = OpVariable %_ptr_Function_uint Function + %i = OpVariable %_ptr_Function_uint Function + OpStore %flag_addr %flag Aligned 4 + OpStore %in_addr %in Aligned 4 + OpStore %out_addr %out Aligned 4 %48 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %49 = OpCompositeExtract %uint %48 0 - OpStore %42 %49 Aligned 4 + %call = OpCompositeExtract %uint %48 0 + OpStore %group_id %call Aligned 4 %50 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %51 = OpCompositeExtract %uint %50 0 - OpStore %43 %51 Aligned 4 + %call1 = OpCompositeExtract %uint %50 0 + OpStore %local_id %call1 Aligned 4 %52 = OpLoad %v3uint %__spirv_BuiltInNumWorkgroups Aligned 16 - %53 = OpCompositeExtract %uint %52 0 - OpStore %44 %53 Aligned 4 + %call2 = OpCompositeExtract %uint %52 0 + OpStore %num_groups %call2 Aligned 4 %54 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %55 = OpCompositeExtract %uint %54 0 - OpStore %45 %55 Aligned 4 + %call3 = OpCompositeExtract %uint %54 0 + OpStore %global_id %call3 Aligned 4 %56 = OpLoad %v3uint %__spirv_BuiltInGlobalSize Aligned 16 - %57 = OpCompositeExtract %uint %56 0 - OpStore %46 %57 Aligned 4 - %58 = OpLoad %_ptr_CrossWorkgroup_uint %39 Aligned 4 - %59 = OpLoad %uint %45 Aligned 4 - %60 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %58 %59 - OpStore %60 %uint_1 Aligned 4 - %62 = OpLoad %uint %42 Aligned 4 - %65 = OpIEqual %bool %62 %uint_0 - OpBranchConditional %65 %18 %26 - %18 = OpLabel - %66 = OpLoad %uint %43 Aligned 4 - %67 = OpIAdd %uint %66 %uint_1 - %68 = OpLoad %uint %44 Aligned 4 - %69 = OpULessThan %bool %67 %68 - OpBranchConditional %69 %19 %23 - %19 = OpLabel - OpBranch %20 - %20 = OpLabel - %70 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %71 = OpLoad %uint %43 Aligned 4 - %72 = OpIAdd %uint %71 %uint_1 - %73 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %70 %72 - %75 = OpPtrCastToGeneric %_ptr_Generic_uint %73 - %77 = OpAtomicLoad %uint %75 %uint_1 %uint_2 - %78 = OpIEqual %bool %77 %uint_0 - OpBranchConditional %78 %21 %22 - %21 = OpLabel - OpBranch %20 - %22 = OpLabel - OpBranch %23 - %23 = OpLabel + %call4 = OpCompositeExtract %uint %56 0 + OpStore %global_size %call4 Aligned 4 + %58 = OpLoad %_ptr_CrossWorkgroup_uint %in_addr Aligned 4 + %59 = OpLoad %uint %global_id Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %58 %59 + OpStore %arrayidx %uint_1 Aligned 4 + %62 = OpLoad %uint %group_id Aligned 4 + %cmp = OpIEqual %bool %62 %uint_0 + OpBranchConditional %cmp %if_then %if_else + %if_then = OpLabel + %66 = OpLoad %uint %local_id Aligned 4 + %add = OpIAdd %uint %66 %uint_1 + %68 = OpLoad %uint %num_groups Aligned 4 + %cmp5 = OpULessThan %bool %add %68 + OpBranchConditional %cmp5 %if_then6 %if_end + %if_then6 = OpLabel + OpBranch %while_cond + %while_cond = OpLabel + %70 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %71 = OpLoad %uint %local_id Aligned 4 + %add7 = OpIAdd %uint %71 %uint_1 + %arrayidx8 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %70 %add7 +%arrayidx8_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %arrayidx8 + %call9 = OpAtomicLoad %uint %arrayidx8_ascast %uint_1 %uint_2 + %cmp10 = OpIEqual %bool %call9 %uint_0 + OpBranchConditional %cmp10 %while_body %while_end + %while_body = OpLabel + OpBranch %while_cond + %while_end = OpLabel + OpBranch %if_end + %if_end = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 - %80 = OpLoad %uint %43 Aligned 4 - %81 = OpIAdd %uint %80 %uint_1 - %82 = OpLoad %uint %44 Aligned 4 - %83 = OpULessThan %bool %81 %82 - OpBranchConditional %83 %24 %25 - %24 = OpLabel - %84 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %85 = OpLoad %uint %43 Aligned 4 - %86 = OpIAdd %uint %85 %uint_1 - %87 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %84 %86 - %88 = OpPtrCastToGeneric %_ptr_Generic_uint %87 - OpAtomicStore %88 %uint_1 %uint_0 %uint_0 - OpBranch %25 - %25 = OpLabel - OpBranch %32 - %26 = OpLabel + %80 = OpLoad %uint %local_id Aligned 4 + %add11 = OpIAdd %uint %80 %uint_1 + %82 = OpLoad %uint %num_groups Aligned 4 + %cmp12 = OpULessThan %bool %add11 %82 + OpBranchConditional %cmp12 %if_then13 %if_end16 + %if_then13 = OpLabel + %84 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %85 = OpLoad %uint %local_id Aligned 4 + %add14 = OpIAdd %uint %85 %uint_1 + %arrayidx15 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %84 %add14 +%arrayidx15_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %arrayidx15 + OpAtomicStore %arrayidx15_ascast %uint_1 %uint_0 %uint_0 + OpBranch %if_end16 + %if_end16 = OpLabel + OpBranch %if_end27 + %if_else = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 - %89 = OpLoad %uint %43 Aligned 4 - %90 = OpIEqual %bool %89 %uint_0 - OpBranchConditional %90 %27 %31 - %27 = OpLabel - %91 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %92 = OpLoad %uint %42 Aligned 4 - %93 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %91 %92 - %94 = OpPtrCastToGeneric %_ptr_Generic_uint %93 - OpAtomicStore %94 %uint_1 %uint_4 %uint_1 - OpBranch %28 - %28 = OpLabel - %96 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %97 = OpLoad %uint %42 Aligned 4 - %98 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %96 %97 - %99 = OpPtrCastToGeneric %_ptr_Generic_uint %98 - %100 = OpAtomicLoad %uint %99 %uint_1 %uint_2 - %101 = OpIEqual %bool %100 %uint_1 - OpBranchConditional %101 %29 %30 - %29 = OpLabel - OpBranch %28 - %30 = OpLabel - OpBranch %31 - %31 = OpLabel + %89 = OpLoad %uint %local_id Aligned 4 + %cmp17 = OpIEqual %bool %89 %uint_0 + OpBranchConditional %cmp17 %if_then18 %if_end26 + %if_then18 = OpLabel + %91 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %92 = OpLoad %uint %group_id Aligned 4 + %arrayidx19 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %91 %92 +%arrayidx19_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %arrayidx19 + OpAtomicStore %arrayidx19_ascast %uint_1 %uint_4 %uint_1 + OpBranch %while_cond20 +%while_cond20 = OpLabel + %96 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %97 = OpLoad %uint %group_id Aligned 4 + %arrayidx21 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %96 %97 +%arrayidx21_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %arrayidx21 + %call22 = OpAtomicLoad %uint %arrayidx21_ascast %uint_1 %uint_2 + %cmp23 = OpIEqual %bool %call22 %uint_1 + OpBranchConditional %cmp23 %while_body24 %while_end25 +%while_body24 = OpLabel + OpBranch %while_cond20 +%while_end25 = OpLabel + OpBranch %if_end26 + %if_end26 = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 - OpBranch %32 - %32 = OpLabel - OpStore %47 %uint_0 Aligned 4 - OpBranch %33 - %33 = OpLabel - %102 = OpLoad %uint %47 Aligned 4 - %103 = OpLoad %uint %46 Aligned 4 - %104 = OpULessThan %bool %102 %103 - OpBranchConditional %104 %34 %36 - %34 = OpLabel - %105 = OpLoad %_ptr_CrossWorkgroup_uint %39 Aligned 4 - %106 = OpLoad %uint %47 Aligned 4 - %107 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %105 %106 - %108 = OpLoad %uint %107 Aligned 4 - %109 = OpLoad %_ptr_CrossWorkgroup_uint %40 Aligned 4 - %110 = OpLoad %uint %45 Aligned 4 - %111 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %109 %110 - %112 = OpLoad %uint %111 Aligned 4 - %113 = OpIAdd %uint %112 %108 - OpStore %111 %113 Aligned 4 - OpBranch %35 - %35 = OpLabel - %114 = OpLoad %uint %47 Aligned 4 - %115 = OpIAdd %uint %114 %uint_1 - OpStore %47 %115 Aligned 4 - OpBranch %33 - %36 = OpLabel + OpBranch %if_end27 + %if_end27 = OpLabel + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %102 = OpLoad %uint %i Aligned 4 + %103 = OpLoad %uint %global_size Aligned 4 + %cmp28 = OpULessThan %bool %102 %103 + OpBranchConditional %cmp28 %for_body %for_end + %for_body = OpLabel + %105 = OpLoad %_ptr_CrossWorkgroup_uint %in_addr Aligned 4 + %106 = OpLoad %uint %i Aligned 4 + %arrayidx29 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %105 %106 + %108 = OpLoad %uint %arrayidx29 Aligned 4 + %109 = OpLoad %_ptr_CrossWorkgroup_uint %out_addr Aligned 4 + %110 = OpLoad %uint %global_id Aligned 4 + %arrayidx30 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %109 %110 + %112 = OpLoad %uint %arrayidx30 Aligned 4 + %add31 = OpIAdd %uint %112 %108 + OpStore %arrayidx30 %add31 Aligned 4 + OpBranch %for_inc + %for_inc = OpLabel + %114 = OpLoad %uint %i Aligned 4 + %inc = OpIAdd %uint %114 %uint_1 + OpStore %i %inc Aligned 4 + OpBranch %for_cond + %for_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/benchmarks/xf-barrier-fail3.spvasm b/dartagnan/src/test/resources/spirv/opencl/benchmarks/xf-barrier-fail3.spvasm index ec4cb85dc3..2fd66e8811 100644 --- a/dartagnan/src/test/resources/spirv/opencl/benchmarks/xf-barrier-fail3.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/benchmarks/xf-barrier-fail3.spvasm @@ -1,9 +1,9 @@ ; flag -; @Input: %14 = {0, 0, 0, 0, 0, 0, 0, 0} +; @Input: %flag = {0, 0, 0, 0, 0, 0, 0, 0} ; data -; @Input: %15 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} -; @Input: %16 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} -; @Output: forall (%16[0] == 4 and %16[1] == 4 and %16[2] == 4 and %16[3] == 4) +; @Input: %in = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +; @Input: %out = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +; @Output: forall (%out[0] == 4 and %out[1] == 4 and %out[2] == 4 and %out[3] == 4) ; @Config: 2, 1, 2 ; SPIR-V ; Version: 1.0 @@ -23,6 +23,69 @@ OpName %__spirv_BuiltInNumWorkgroups "__spirv_BuiltInNumWorkgroups" OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %__spirv_BuiltInGlobalSize "__spirv_BuiltInGlobalSize" + OpName %flag "flag" + OpName %in "in" + OpName %out "out" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_then6 "if.then6" + OpName %while_cond "while.cond" + OpName %while_body "while.body" + OpName %while_end "while.end" + OpName %if_end "if.end" + OpName %if_then13 "if.then13" + OpName %if_end16 "if.end16" + OpName %if_else "if.else" + OpName %if_then18 "if.then18" + OpName %while_cond20 "while.cond20" + OpName %while_body24 "while.body24" + OpName %while_end25 "while.end25" + OpName %if_end26 "if.end26" + OpName %if_end27 "if.end27" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %flag_addr "flag.addr" + OpName %in_addr "in.addr" + OpName %out_addr "out.addr" + OpName %group_id "group_id" + OpName %local_id "local_id" + OpName %num_groups "num_groups" + OpName %global_id "global_id" + OpName %global_size "global_size" + OpName %i "i" + OpName %call "call" + OpName %call1 "call1" + OpName %call2 "call2" + OpName %call3 "call3" + OpName %call4 "call4" + OpName %arrayidx "arrayidx" + OpName %cmp "cmp" + OpName %add "add" + OpName %cmp5 "cmp5" + OpName %add7 "add7" + OpName %arrayidx8 "arrayidx8" + OpName %arrayidx8_ascast "arrayidx8.ascast" + OpName %call9 "call9" + OpName %cmp10 "cmp10" + OpName %add11 "add11" + OpName %cmp12 "cmp12" + OpName %add14 "add14" + OpName %arrayidx15 "arrayidx15" + OpName %arrayidx15_ascast "arrayidx15.ascast" + OpName %cmp17 "cmp17" + OpName %arrayidx19 "arrayidx19" + OpName %arrayidx19_ascast "arrayidx19.ascast" + OpName %arrayidx21 "arrayidx21" + OpName %arrayidx21_ascast "arrayidx21.ascast" + OpName %call22 "call22" + OpName %cmp23 "cmp23" + OpName %cmp28 "cmp28" + OpName %arrayidx29 "arrayidx29" + OpName %arrayidx30 "arrayidx30" + OpName %add31 "add31" + OpName %inc "inc" OpDecorate %__spirv_BuiltInNumWorkgroups BuiltIn NumWorkgroups OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId @@ -38,15 +101,15 @@ OpDecorate %__spirv_BuiltInNumWorkgroups LinkageAttributes "__spirv_BuiltInNumWorkgroups" Import OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %38 Alignment 4 - OpDecorate %39 Alignment 4 - OpDecorate %40 Alignment 4 - OpDecorate %42 Alignment 4 - OpDecorate %43 Alignment 4 - OpDecorate %44 Alignment 4 - OpDecorate %45 Alignment 4 - OpDecorate %46 Alignment 4 - OpDecorate %47 Alignment 4 + OpDecorate %flag_addr Alignment 4 + OpDecorate %in_addr Alignment 4 + OpDecorate %out_addr Alignment 4 + OpDecorate %group_id Alignment 4 + OpDecorate %local_id Alignment 4 + OpDecorate %num_groups Alignment 4 + OpDecorate %global_id Alignment 4 + OpDecorate %global_size Alignment 4 + OpDecorate %i Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 @@ -68,134 +131,134 @@ %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInGlobalSize = OpVariable %_ptr_Input_v3uint Input %13 = OpFunction %void DontInline %12 - %14 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %15 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %16 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %17 = OpLabel - %38 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %39 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %40 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %42 = OpVariable %_ptr_Function_uint Function - %43 = OpVariable %_ptr_Function_uint Function - %44 = OpVariable %_ptr_Function_uint Function - %45 = OpVariable %_ptr_Function_uint Function - %46 = OpVariable %_ptr_Function_uint Function - %47 = OpVariable %_ptr_Function_uint Function - OpStore %38 %14 Aligned 4 - OpStore %39 %15 Aligned 4 - OpStore %40 %16 Aligned 4 + %flag = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %in = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %out = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %flag_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %in_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %out_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %group_id = OpVariable %_ptr_Function_uint Function + %local_id = OpVariable %_ptr_Function_uint Function + %num_groups = OpVariable %_ptr_Function_uint Function + %global_id = OpVariable %_ptr_Function_uint Function +%global_size = OpVariable %_ptr_Function_uint Function + %i = OpVariable %_ptr_Function_uint Function + OpStore %flag_addr %flag Aligned 4 + OpStore %in_addr %in Aligned 4 + OpStore %out_addr %out Aligned 4 %48 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %49 = OpCompositeExtract %uint %48 0 - OpStore %42 %49 Aligned 4 + %call = OpCompositeExtract %uint %48 0 + OpStore %group_id %call Aligned 4 %50 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %51 = OpCompositeExtract %uint %50 0 - OpStore %43 %51 Aligned 4 + %call1 = OpCompositeExtract %uint %50 0 + OpStore %local_id %call1 Aligned 4 %52 = OpLoad %v3uint %__spirv_BuiltInNumWorkgroups Aligned 16 - %53 = OpCompositeExtract %uint %52 0 - OpStore %44 %53 Aligned 4 + %call2 = OpCompositeExtract %uint %52 0 + OpStore %num_groups %call2 Aligned 4 %54 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %55 = OpCompositeExtract %uint %54 0 - OpStore %45 %55 Aligned 4 + %call3 = OpCompositeExtract %uint %54 0 + OpStore %global_id %call3 Aligned 4 %56 = OpLoad %v3uint %__spirv_BuiltInGlobalSize Aligned 16 - %57 = OpCompositeExtract %uint %56 0 - OpStore %46 %57 Aligned 4 - %58 = OpLoad %_ptr_CrossWorkgroup_uint %39 Aligned 4 - %59 = OpLoad %uint %45 Aligned 4 - %60 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %58 %59 - OpStore %60 %uint_1 Aligned 4 - %62 = OpLoad %uint %42 Aligned 4 - %65 = OpIEqual %bool %62 %uint_0 - OpBranchConditional %65 %18 %26 - %18 = OpLabel - %66 = OpLoad %uint %43 Aligned 4 - %67 = OpIAdd %uint %66 %uint_1 - %68 = OpLoad %uint %44 Aligned 4 - %69 = OpULessThan %bool %67 %68 - OpBranchConditional %69 %19 %23 - %19 = OpLabel - OpBranch %20 - %20 = OpLabel - %70 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %71 = OpLoad %uint %43 Aligned 4 - %72 = OpIAdd %uint %71 %uint_1 - %73 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %70 %72 - %75 = OpPtrCastToGeneric %_ptr_Generic_uint %73 - %77 = OpAtomicLoad %uint %75 %uint_1 %uint_2 - %78 = OpIEqual %bool %77 %uint_0 - OpBranchConditional %78 %21 %22 - %21 = OpLabel - OpBranch %20 - %22 = OpLabel - OpBranch %23 - %23 = OpLabel + %call4 = OpCompositeExtract %uint %56 0 + OpStore %global_size %call4 Aligned 4 + %58 = OpLoad %_ptr_CrossWorkgroup_uint %in_addr Aligned 4 + %59 = OpLoad %uint %global_id Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %58 %59 + OpStore %arrayidx %uint_1 Aligned 4 + %62 = OpLoad %uint %group_id Aligned 4 + %cmp = OpIEqual %bool %62 %uint_0 + OpBranchConditional %cmp %if_then %if_else + %if_then = OpLabel + %66 = OpLoad %uint %local_id Aligned 4 + %add = OpIAdd %uint %66 %uint_1 + %68 = OpLoad %uint %num_groups Aligned 4 + %cmp5 = OpULessThan %bool %add %68 + OpBranchConditional %cmp5 %if_then6 %if_end + %if_then6 = OpLabel + OpBranch %while_cond + %while_cond = OpLabel + %70 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %71 = OpLoad %uint %local_id Aligned 4 + %add7 = OpIAdd %uint %71 %uint_1 + %arrayidx8 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %70 %add7 +%arrayidx8_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %arrayidx8 + %call9 = OpAtomicLoad %uint %arrayidx8_ascast %uint_1 %uint_2 + %cmp10 = OpIEqual %bool %call9 %uint_0 + OpBranchConditional %cmp10 %while_body %while_end + %while_body = OpLabel + OpBranch %while_cond + %while_end = OpLabel + OpBranch %if_end + %if_end = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 - %80 = OpLoad %uint %43 Aligned 4 - %81 = OpIAdd %uint %80 %uint_1 - %82 = OpLoad %uint %44 Aligned 4 - %83 = OpULessThan %bool %81 %82 - OpBranchConditional %83 %24 %25 - %24 = OpLabel - %84 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %85 = OpLoad %uint %43 Aligned 4 - %86 = OpIAdd %uint %85 %uint_1 - %87 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %84 %86 - %88 = OpPtrCastToGeneric %_ptr_Generic_uint %87 - OpAtomicStore %88 %uint_1 %uint_4 %uint_0 - OpBranch %25 - %25 = OpLabel - OpBranch %32 - %26 = OpLabel + %80 = OpLoad %uint %local_id Aligned 4 + %add11 = OpIAdd %uint %80 %uint_1 + %82 = OpLoad %uint %num_groups Aligned 4 + %cmp12 = OpULessThan %bool %add11 %82 + OpBranchConditional %cmp12 %if_then13 %if_end16 + %if_then13 = OpLabel + %84 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %85 = OpLoad %uint %local_id Aligned 4 + %add14 = OpIAdd %uint %85 %uint_1 + %arrayidx15 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %84 %add14 +%arrayidx15_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %arrayidx15 + OpAtomicStore %arrayidx15_ascast %uint_1 %uint_4 %uint_0 + OpBranch %if_end16 + %if_end16 = OpLabel + OpBranch %if_end27 + %if_else = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 - %90 = OpLoad %uint %43 Aligned 4 - %91 = OpIEqual %bool %90 %uint_0 - OpBranchConditional %91 %27 %31 - %27 = OpLabel - %92 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %93 = OpLoad %uint %42 Aligned 4 - %94 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %92 %93 - %95 = OpPtrCastToGeneric %_ptr_Generic_uint %94 - OpAtomicStore %95 %uint_1 %uint_0 %uint_1 - OpBranch %28 - %28 = OpLabel - %96 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %97 = OpLoad %uint %42 Aligned 4 - %98 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %96 %97 - %99 = OpPtrCastToGeneric %_ptr_Generic_uint %98 - %100 = OpAtomicLoad %uint %99 %uint_1 %uint_2 - %101 = OpIEqual %bool %100 %uint_1 - OpBranchConditional %101 %29 %30 - %29 = OpLabel - OpBranch %28 - %30 = OpLabel - OpBranch %31 - %31 = OpLabel + %90 = OpLoad %uint %local_id Aligned 4 + %cmp17 = OpIEqual %bool %90 %uint_0 + OpBranchConditional %cmp17 %if_then18 %if_end26 + %if_then18 = OpLabel + %92 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %93 = OpLoad %uint %group_id Aligned 4 + %arrayidx19 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %92 %93 +%arrayidx19_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %arrayidx19 + OpAtomicStore %arrayidx19_ascast %uint_1 %uint_0 %uint_1 + OpBranch %while_cond20 +%while_cond20 = OpLabel + %96 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %97 = OpLoad %uint %group_id Aligned 4 + %arrayidx21 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %96 %97 +%arrayidx21_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %arrayidx21 + %call22 = OpAtomicLoad %uint %arrayidx21_ascast %uint_1 %uint_2 + %cmp23 = OpIEqual %bool %call22 %uint_1 + OpBranchConditional %cmp23 %while_body24 %while_end25 +%while_body24 = OpLabel + OpBranch %while_cond20 +%while_end25 = OpLabel + OpBranch %if_end26 + %if_end26 = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 - OpBranch %32 - %32 = OpLabel - OpStore %47 %uint_0 Aligned 4 - OpBranch %33 - %33 = OpLabel - %102 = OpLoad %uint %47 Aligned 4 - %103 = OpLoad %uint %46 Aligned 4 - %104 = OpULessThan %bool %102 %103 - OpBranchConditional %104 %34 %36 - %34 = OpLabel - %105 = OpLoad %_ptr_CrossWorkgroup_uint %39 Aligned 4 - %106 = OpLoad %uint %47 Aligned 4 - %107 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %105 %106 - %108 = OpLoad %uint %107 Aligned 4 - %109 = OpLoad %_ptr_CrossWorkgroup_uint %40 Aligned 4 - %110 = OpLoad %uint %45 Aligned 4 - %111 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %109 %110 - %112 = OpLoad %uint %111 Aligned 4 - %113 = OpIAdd %uint %112 %108 - OpStore %111 %113 Aligned 4 - OpBranch %35 - %35 = OpLabel - %114 = OpLoad %uint %47 Aligned 4 - %115 = OpIAdd %uint %114 %uint_1 - OpStore %47 %115 Aligned 4 - OpBranch %33 - %36 = OpLabel + OpBranch %if_end27 + %if_end27 = OpLabel + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %102 = OpLoad %uint %i Aligned 4 + %103 = OpLoad %uint %global_size Aligned 4 + %cmp28 = OpULessThan %bool %102 %103 + OpBranchConditional %cmp28 %for_body %for_end + %for_body = OpLabel + %105 = OpLoad %_ptr_CrossWorkgroup_uint %in_addr Aligned 4 + %106 = OpLoad %uint %i Aligned 4 + %arrayidx29 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %105 %106 + %108 = OpLoad %uint %arrayidx29 Aligned 4 + %109 = OpLoad %_ptr_CrossWorkgroup_uint %out_addr Aligned 4 + %110 = OpLoad %uint %global_id Aligned 4 + %arrayidx30 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %109 %110 + %112 = OpLoad %uint %arrayidx30 Aligned 4 + %add31 = OpIAdd %uint %112 %108 + OpStore %arrayidx30 %add31 Aligned 4 + OpBranch %for_inc + %for_inc = OpLabel + %114 = OpLoad %uint %i Aligned 4 + %inc = OpIAdd %uint %114 %uint_1 + OpStore %i %inc Aligned 4 + OpBranch %for_cond + %for_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/benchmarks/xf-barrier-fail4.spvasm b/dartagnan/src/test/resources/spirv/opencl/benchmarks/xf-barrier-fail4.spvasm index 7a6f388622..c1e09eb5a9 100644 --- a/dartagnan/src/test/resources/spirv/opencl/benchmarks/xf-barrier-fail4.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/benchmarks/xf-barrier-fail4.spvasm @@ -1,9 +1,9 @@ ; flag -; @Input: %14 = {0, 0, 0, 0, 0, 0, 0, 0} +; @Input: %flag = {0, 0, 0, 0, 0, 0, 0, 0} ; data -; @Input: %15 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} -; @Input: %16 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} -; @Output: forall (%16[0] == 4 and %16[1] == 4 and %16[2] == 4 and %16[3] == 4) +; @Input: %in = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +; @Input: %out = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +; @Output: forall (%out[0] == 4 and %out[1] == 4 and %out[2] == 4 and %out[3] == 4) ; @Config: 2, 1, 2 ; SPIR-V ; Version: 1.0 @@ -23,6 +23,69 @@ OpName %__spirv_BuiltInNumWorkgroups "__spirv_BuiltInNumWorkgroups" OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %__spirv_BuiltInGlobalSize "__spirv_BuiltInGlobalSize" + OpName %flag "flag" + OpName %in "in" + OpName %out "out" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_then6 "if.then6" + OpName %while_cond "while.cond" + OpName %while_body "while.body" + OpName %while_end "while.end" + OpName %if_end "if.end" + OpName %if_then13 "if.then13" + OpName %if_end16 "if.end16" + OpName %if_else "if.else" + OpName %if_then18 "if.then18" + OpName %while_cond20 "while.cond20" + OpName %while_body24 "while.body24" + OpName %while_end25 "while.end25" + OpName %if_end26 "if.end26" + OpName %if_end27 "if.end27" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %flag_addr "flag.addr" + OpName %in_addr "in.addr" + OpName %out_addr "out.addr" + OpName %group_id "group_id" + OpName %local_id "local_id" + OpName %num_groups "num_groups" + OpName %global_id "global_id" + OpName %global_size "global_size" + OpName %i "i" + OpName %call "call" + OpName %call1 "call1" + OpName %call2 "call2" + OpName %call3 "call3" + OpName %call4 "call4" + OpName %arrayidx "arrayidx" + OpName %cmp "cmp" + OpName %add "add" + OpName %cmp5 "cmp5" + OpName %add7 "add7" + OpName %arrayidx8 "arrayidx8" + OpName %arrayidx8_ascast "arrayidx8.ascast" + OpName %call9 "call9" + OpName %cmp10 "cmp10" + OpName %add11 "add11" + OpName %cmp12 "cmp12" + OpName %add14 "add14" + OpName %arrayidx15 "arrayidx15" + OpName %arrayidx15_ascast "arrayidx15.ascast" + OpName %cmp17 "cmp17" + OpName %arrayidx19 "arrayidx19" + OpName %arrayidx19_ascast "arrayidx19.ascast" + OpName %arrayidx21 "arrayidx21" + OpName %arrayidx21_ascast "arrayidx21.ascast" + OpName %call22 "call22" + OpName %cmp23 "cmp23" + OpName %cmp28 "cmp28" + OpName %arrayidx29 "arrayidx29" + OpName %arrayidx30 "arrayidx30" + OpName %add31 "add31" + OpName %inc "inc" OpDecorate %__spirv_BuiltInNumWorkgroups BuiltIn NumWorkgroups OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId @@ -38,15 +101,15 @@ OpDecorate %__spirv_BuiltInNumWorkgroups LinkageAttributes "__spirv_BuiltInNumWorkgroups" Import OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %38 Alignment 4 - OpDecorate %39 Alignment 4 - OpDecorate %40 Alignment 4 - OpDecorate %42 Alignment 4 - OpDecorate %43 Alignment 4 - OpDecorate %44 Alignment 4 - OpDecorate %45 Alignment 4 - OpDecorate %46 Alignment 4 - OpDecorate %47 Alignment 4 + OpDecorate %flag_addr Alignment 4 + OpDecorate %in_addr Alignment 4 + OpDecorate %out_addr Alignment 4 + OpDecorate %group_id Alignment 4 + OpDecorate %local_id Alignment 4 + OpDecorate %num_groups Alignment 4 + OpDecorate %global_id Alignment 4 + OpDecorate %global_size Alignment 4 + OpDecorate %i Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 @@ -68,134 +131,134 @@ %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInGlobalSize = OpVariable %_ptr_Input_v3uint Input %13 = OpFunction %void DontInline %12 - %14 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %15 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %16 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %17 = OpLabel - %38 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %39 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %40 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %42 = OpVariable %_ptr_Function_uint Function - %43 = OpVariable %_ptr_Function_uint Function - %44 = OpVariable %_ptr_Function_uint Function - %45 = OpVariable %_ptr_Function_uint Function - %46 = OpVariable %_ptr_Function_uint Function - %47 = OpVariable %_ptr_Function_uint Function - OpStore %38 %14 Aligned 4 - OpStore %39 %15 Aligned 4 - OpStore %40 %16 Aligned 4 + %flag = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %in = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %out = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %flag_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %in_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %out_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %group_id = OpVariable %_ptr_Function_uint Function + %local_id = OpVariable %_ptr_Function_uint Function + %num_groups = OpVariable %_ptr_Function_uint Function + %global_id = OpVariable %_ptr_Function_uint Function +%global_size = OpVariable %_ptr_Function_uint Function + %i = OpVariable %_ptr_Function_uint Function + OpStore %flag_addr %flag Aligned 4 + OpStore %in_addr %in Aligned 4 + OpStore %out_addr %out Aligned 4 %48 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %49 = OpCompositeExtract %uint %48 0 - OpStore %42 %49 Aligned 4 + %call = OpCompositeExtract %uint %48 0 + OpStore %group_id %call Aligned 4 %50 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %51 = OpCompositeExtract %uint %50 0 - OpStore %43 %51 Aligned 4 + %call1 = OpCompositeExtract %uint %50 0 + OpStore %local_id %call1 Aligned 4 %52 = OpLoad %v3uint %__spirv_BuiltInNumWorkgroups Aligned 16 - %53 = OpCompositeExtract %uint %52 0 - OpStore %44 %53 Aligned 4 + %call2 = OpCompositeExtract %uint %52 0 + OpStore %num_groups %call2 Aligned 4 %54 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %55 = OpCompositeExtract %uint %54 0 - OpStore %45 %55 Aligned 4 + %call3 = OpCompositeExtract %uint %54 0 + OpStore %global_id %call3 Aligned 4 %56 = OpLoad %v3uint %__spirv_BuiltInGlobalSize Aligned 16 - %57 = OpCompositeExtract %uint %56 0 - OpStore %46 %57 Aligned 4 - %58 = OpLoad %_ptr_CrossWorkgroup_uint %39 Aligned 4 - %59 = OpLoad %uint %45 Aligned 4 - %60 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %58 %59 - OpStore %60 %uint_1 Aligned 4 - %62 = OpLoad %uint %42 Aligned 4 - %65 = OpIEqual %bool %62 %uint_0 - OpBranchConditional %65 %18 %26 - %18 = OpLabel - %66 = OpLoad %uint %43 Aligned 4 - %67 = OpIAdd %uint %66 %uint_1 - %68 = OpLoad %uint %44 Aligned 4 - %69 = OpULessThan %bool %67 %68 - OpBranchConditional %69 %19 %23 - %19 = OpLabel - OpBranch %20 - %20 = OpLabel - %70 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %71 = OpLoad %uint %43 Aligned 4 - %72 = OpIAdd %uint %71 %uint_1 - %73 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %70 %72 - %75 = OpPtrCastToGeneric %_ptr_Generic_uint %73 - %77 = OpAtomicLoad %uint %75 %uint_1 %uint_2 - %78 = OpIEqual %bool %77 %uint_0 - OpBranchConditional %78 %21 %22 - %21 = OpLabel - OpBranch %20 - %22 = OpLabel - OpBranch %23 - %23 = OpLabel + %call4 = OpCompositeExtract %uint %56 0 + OpStore %global_size %call4 Aligned 4 + %58 = OpLoad %_ptr_CrossWorkgroup_uint %in_addr Aligned 4 + %59 = OpLoad %uint %global_id Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %58 %59 + OpStore %arrayidx %uint_1 Aligned 4 + %62 = OpLoad %uint %group_id Aligned 4 + %cmp = OpIEqual %bool %62 %uint_0 + OpBranchConditional %cmp %if_then %if_else + %if_then = OpLabel + %66 = OpLoad %uint %local_id Aligned 4 + %add = OpIAdd %uint %66 %uint_1 + %68 = OpLoad %uint %num_groups Aligned 4 + %cmp5 = OpULessThan %bool %add %68 + OpBranchConditional %cmp5 %if_then6 %if_end + %if_then6 = OpLabel + OpBranch %while_cond + %while_cond = OpLabel + %70 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %71 = OpLoad %uint %local_id Aligned 4 + %add7 = OpIAdd %uint %71 %uint_1 + %arrayidx8 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %70 %add7 +%arrayidx8_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %arrayidx8 + %call9 = OpAtomicLoad %uint %arrayidx8_ascast %uint_1 %uint_2 + %cmp10 = OpIEqual %bool %call9 %uint_0 + OpBranchConditional %cmp10 %while_body %while_end + %while_body = OpLabel + OpBranch %while_cond + %while_end = OpLabel + OpBranch %if_end + %if_end = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 - %80 = OpLoad %uint %43 Aligned 4 - %81 = OpIAdd %uint %80 %uint_1 - %82 = OpLoad %uint %44 Aligned 4 - %83 = OpULessThan %bool %81 %82 - OpBranchConditional %83 %24 %25 - %24 = OpLabel - %84 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %85 = OpLoad %uint %43 Aligned 4 - %86 = OpIAdd %uint %85 %uint_1 - %87 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %84 %86 - %88 = OpPtrCastToGeneric %_ptr_Generic_uint %87 - OpAtomicStore %88 %uint_1 %uint_4 %uint_0 - OpBranch %25 - %25 = OpLabel - OpBranch %32 - %26 = OpLabel + %80 = OpLoad %uint %local_id Aligned 4 + %add11 = OpIAdd %uint %80 %uint_1 + %82 = OpLoad %uint %num_groups Aligned 4 + %cmp12 = OpULessThan %bool %add11 %82 + OpBranchConditional %cmp12 %if_then13 %if_end16 + %if_then13 = OpLabel + %84 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %85 = OpLoad %uint %local_id Aligned 4 + %add14 = OpIAdd %uint %85 %uint_1 + %arrayidx15 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %84 %add14 +%arrayidx15_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %arrayidx15 + OpAtomicStore %arrayidx15_ascast %uint_1 %uint_4 %uint_0 + OpBranch %if_end16 + %if_end16 = OpLabel + OpBranch %if_end27 + %if_else = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 - %90 = OpLoad %uint %43 Aligned 4 - %91 = OpIEqual %bool %90 %uint_0 - OpBranchConditional %91 %27 %31 - %27 = OpLabel - %92 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %93 = OpLoad %uint %42 Aligned 4 - %94 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %92 %93 - %95 = OpPtrCastToGeneric %_ptr_Generic_uint %94 - OpAtomicStore %95 %uint_1 %uint_4 %uint_1 - OpBranch %28 - %28 = OpLabel - %96 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %97 = OpLoad %uint %42 Aligned 4 - %98 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %96 %97 - %99 = OpPtrCastToGeneric %_ptr_Generic_uint %98 - %100 = OpAtomicLoad %uint %99 %uint_1 %uint_0 - %101 = OpIEqual %bool %100 %uint_1 - OpBranchConditional %101 %29 %30 - %29 = OpLabel - OpBranch %28 - %30 = OpLabel - OpBranch %31 - %31 = OpLabel + %90 = OpLoad %uint %local_id Aligned 4 + %cmp17 = OpIEqual %bool %90 %uint_0 + OpBranchConditional %cmp17 %if_then18 %if_end26 + %if_then18 = OpLabel + %92 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %93 = OpLoad %uint %group_id Aligned 4 + %arrayidx19 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %92 %93 +%arrayidx19_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %arrayidx19 + OpAtomicStore %arrayidx19_ascast %uint_1 %uint_4 %uint_1 + OpBranch %while_cond20 +%while_cond20 = OpLabel + %96 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %97 = OpLoad %uint %group_id Aligned 4 + %arrayidx21 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %96 %97 +%arrayidx21_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %arrayidx21 + %call22 = OpAtomicLoad %uint %arrayidx21_ascast %uint_1 %uint_0 + %cmp23 = OpIEqual %bool %call22 %uint_1 + OpBranchConditional %cmp23 %while_body24 %while_end25 +%while_body24 = OpLabel + OpBranch %while_cond20 +%while_end25 = OpLabel + OpBranch %if_end26 + %if_end26 = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 - OpBranch %32 - %32 = OpLabel - OpStore %47 %uint_0 Aligned 4 - OpBranch %33 - %33 = OpLabel - %102 = OpLoad %uint %47 Aligned 4 - %103 = OpLoad %uint %46 Aligned 4 - %104 = OpULessThan %bool %102 %103 - OpBranchConditional %104 %34 %36 - %34 = OpLabel - %105 = OpLoad %_ptr_CrossWorkgroup_uint %39 Aligned 4 - %106 = OpLoad %uint %47 Aligned 4 - %107 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %105 %106 - %108 = OpLoad %uint %107 Aligned 4 - %109 = OpLoad %_ptr_CrossWorkgroup_uint %40 Aligned 4 - %110 = OpLoad %uint %45 Aligned 4 - %111 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %109 %110 - %112 = OpLoad %uint %111 Aligned 4 - %113 = OpIAdd %uint %112 %108 - OpStore %111 %113 Aligned 4 - OpBranch %35 - %35 = OpLabel - %114 = OpLoad %uint %47 Aligned 4 - %115 = OpIAdd %uint %114 %uint_1 - OpStore %47 %115 Aligned 4 - OpBranch %33 - %36 = OpLabel + OpBranch %if_end27 + %if_end27 = OpLabel + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %102 = OpLoad %uint %i Aligned 4 + %103 = OpLoad %uint %global_size Aligned 4 + %cmp28 = OpULessThan %bool %102 %103 + OpBranchConditional %cmp28 %for_body %for_end + %for_body = OpLabel + %105 = OpLoad %_ptr_CrossWorkgroup_uint %in_addr Aligned 4 + %106 = OpLoad %uint %i Aligned 4 + %arrayidx29 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %105 %106 + %108 = OpLoad %uint %arrayidx29 Aligned 4 + %109 = OpLoad %_ptr_CrossWorkgroup_uint %out_addr Aligned 4 + %110 = OpLoad %uint %global_id Aligned 4 + %arrayidx30 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %109 %110 + %112 = OpLoad %uint %arrayidx30 Aligned 4 + %add31 = OpIAdd %uint %112 %108 + OpStore %arrayidx30 %add31 Aligned 4 + OpBranch %for_inc + %for_inc = OpLabel + %114 = OpLoad %uint %i Aligned 4 + %inc = OpIAdd %uint %114 %uint_1 + OpStore %i %inc Aligned 4 + OpBranch %for_cond + %for_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/benchmarks/xf-barrier-weakest.spvasm b/dartagnan/src/test/resources/spirv/opencl/benchmarks/xf-barrier-weakest.spvasm index faccf27434..e9bd1e6e96 100644 --- a/dartagnan/src/test/resources/spirv/opencl/benchmarks/xf-barrier-weakest.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/benchmarks/xf-barrier-weakest.spvasm @@ -1,9 +1,9 @@ ; flag -; @Input: %14 = {0, 0, 0, 0, 0, 0, 0, 0} +; @Input: %flag = {0, 0, 0, 0, 0, 0, 0, 0} ; data -; @Input: %15 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} -; @Input: %16 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} -; @Output: forall (%16[0] == 4 and %16[1] == 4 and %16[2] == 4 and %16[3] == 4) +; @Input: %in = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +; @Input: %out = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +; @Output: forall (%out[0] == 4 and %out[1] == 4 and %out[2] == 4 and %out[3] == 4) ; @Config: 2, 1, 2 ; SPIR-V ; Version: 1.0 @@ -23,6 +23,69 @@ OpName %__spirv_BuiltInNumWorkgroups "__spirv_BuiltInNumWorkgroups" OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %__spirv_BuiltInGlobalSize "__spirv_BuiltInGlobalSize" + OpName %flag "flag" + OpName %in "in" + OpName %out "out" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_then6 "if.then6" + OpName %while_cond "while.cond" + OpName %while_body "while.body" + OpName %while_end "while.end" + OpName %if_end "if.end" + OpName %if_then13 "if.then13" + OpName %if_end16 "if.end16" + OpName %if_else "if.else" + OpName %if_then18 "if.then18" + OpName %while_cond20 "while.cond20" + OpName %while_body24 "while.body24" + OpName %while_end25 "while.end25" + OpName %if_end26 "if.end26" + OpName %if_end27 "if.end27" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %flag_addr "flag.addr" + OpName %in_addr "in.addr" + OpName %out_addr "out.addr" + OpName %group_id "group_id" + OpName %local_id "local_id" + OpName %num_groups "num_groups" + OpName %global_id "global_id" + OpName %global_size "global_size" + OpName %i "i" + OpName %call "call" + OpName %call1 "call1" + OpName %call2 "call2" + OpName %call3 "call3" + OpName %call4 "call4" + OpName %arrayidx "arrayidx" + OpName %cmp "cmp" + OpName %add "add" + OpName %cmp5 "cmp5" + OpName %add7 "add7" + OpName %arrayidx8 "arrayidx8" + OpName %arrayidx8_ascast "arrayidx8.ascast" + OpName %call9 "call9" + OpName %cmp10 "cmp10" + OpName %add11 "add11" + OpName %cmp12 "cmp12" + OpName %add14 "add14" + OpName %arrayidx15 "arrayidx15" + OpName %arrayidx15_ascast "arrayidx15.ascast" + OpName %cmp17 "cmp17" + OpName %arrayidx19 "arrayidx19" + OpName %arrayidx19_ascast "arrayidx19.ascast" + OpName %arrayidx21 "arrayidx21" + OpName %arrayidx21_ascast "arrayidx21.ascast" + OpName %call22 "call22" + OpName %cmp23 "cmp23" + OpName %cmp28 "cmp28" + OpName %arrayidx29 "arrayidx29" + OpName %arrayidx30 "arrayidx30" + OpName %add31 "add31" + OpName %inc "inc" OpDecorate %__spirv_BuiltInNumWorkgroups BuiltIn NumWorkgroups OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId @@ -38,15 +101,15 @@ OpDecorate %__spirv_BuiltInNumWorkgroups LinkageAttributes "__spirv_BuiltInNumWorkgroups" Import OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %38 Alignment 4 - OpDecorate %39 Alignment 4 - OpDecorate %40 Alignment 4 - OpDecorate %42 Alignment 4 - OpDecorate %43 Alignment 4 - OpDecorate %44 Alignment 4 - OpDecorate %45 Alignment 4 - OpDecorate %46 Alignment 4 - OpDecorate %47 Alignment 4 + OpDecorate %flag_addr Alignment 4 + OpDecorate %in_addr Alignment 4 + OpDecorate %out_addr Alignment 4 + OpDecorate %group_id Alignment 4 + OpDecorate %local_id Alignment 4 + OpDecorate %num_groups Alignment 4 + OpDecorate %global_id Alignment 4 + OpDecorate %global_size Alignment 4 + OpDecorate %i Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 @@ -67,134 +130,134 @@ %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInGlobalSize = OpVariable %_ptr_Input_v3uint Input %13 = OpFunction %void DontInline %12 - %14 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %15 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %16 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %17 = OpLabel - %38 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %39 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %40 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %42 = OpVariable %_ptr_Function_uint Function - %43 = OpVariable %_ptr_Function_uint Function - %44 = OpVariable %_ptr_Function_uint Function - %45 = OpVariable %_ptr_Function_uint Function - %46 = OpVariable %_ptr_Function_uint Function - %47 = OpVariable %_ptr_Function_uint Function - OpStore %38 %14 Aligned 4 - OpStore %39 %15 Aligned 4 - OpStore %40 %16 Aligned 4 + %flag = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %in = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %out = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %flag_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %in_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %out_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %group_id = OpVariable %_ptr_Function_uint Function + %local_id = OpVariable %_ptr_Function_uint Function + %num_groups = OpVariable %_ptr_Function_uint Function + %global_id = OpVariable %_ptr_Function_uint Function +%global_size = OpVariable %_ptr_Function_uint Function + %i = OpVariable %_ptr_Function_uint Function + OpStore %flag_addr %flag Aligned 4 + OpStore %in_addr %in Aligned 4 + OpStore %out_addr %out Aligned 4 %48 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %49 = OpCompositeExtract %uint %48 0 - OpStore %42 %49 Aligned 4 + %call = OpCompositeExtract %uint %48 0 + OpStore %group_id %call Aligned 4 %50 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %51 = OpCompositeExtract %uint %50 0 - OpStore %43 %51 Aligned 4 + %call1 = OpCompositeExtract %uint %50 0 + OpStore %local_id %call1 Aligned 4 %52 = OpLoad %v3uint %__spirv_BuiltInNumWorkgroups Aligned 16 - %53 = OpCompositeExtract %uint %52 0 - OpStore %44 %53 Aligned 4 + %call2 = OpCompositeExtract %uint %52 0 + OpStore %num_groups %call2 Aligned 4 %54 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %55 = OpCompositeExtract %uint %54 0 - OpStore %45 %55 Aligned 4 + %call3 = OpCompositeExtract %uint %54 0 + OpStore %global_id %call3 Aligned 4 %56 = OpLoad %v3uint %__spirv_BuiltInGlobalSize Aligned 16 - %57 = OpCompositeExtract %uint %56 0 - OpStore %46 %57 Aligned 4 - %58 = OpLoad %_ptr_CrossWorkgroup_uint %39 Aligned 4 - %59 = OpLoad %uint %45 Aligned 4 - %60 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %58 %59 - OpStore %60 %uint_1 Aligned 4 - %62 = OpLoad %uint %42 Aligned 4 - %65 = OpIEqual %bool %62 %uint_0 - OpBranchConditional %65 %18 %26 - %18 = OpLabel - %66 = OpLoad %uint %43 Aligned 4 - %67 = OpIAdd %uint %66 %uint_1 - %68 = OpLoad %uint %44 Aligned 4 - %69 = OpULessThan %bool %67 %68 - OpBranchConditional %69 %19 %23 - %19 = OpLabel - OpBranch %20 - %20 = OpLabel - %70 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %71 = OpLoad %uint %43 Aligned 4 - %72 = OpIAdd %uint %71 %uint_1 - %73 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %70 %72 - %75 = OpPtrCastToGeneric %_ptr_Generic_uint %73 - %76 = OpAtomicLoad %uint %75 %uint_1 %uint_0 - %77 = OpIEqual %bool %76 %uint_0 - OpBranchConditional %77 %21 %22 - %21 = OpLabel - OpBranch %20 - %22 = OpLabel - OpBranch %23 - %23 = OpLabel + %call4 = OpCompositeExtract %uint %56 0 + OpStore %global_size %call4 Aligned 4 + %58 = OpLoad %_ptr_CrossWorkgroup_uint %in_addr Aligned 4 + %59 = OpLoad %uint %global_id Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %58 %59 + OpStore %arrayidx %uint_1 Aligned 4 + %62 = OpLoad %uint %group_id Aligned 4 + %cmp = OpIEqual %bool %62 %uint_0 + OpBranchConditional %cmp %if_then %if_else + %if_then = OpLabel + %66 = OpLoad %uint %local_id Aligned 4 + %add = OpIAdd %uint %66 %uint_1 + %68 = OpLoad %uint %num_groups Aligned 4 + %cmp5 = OpULessThan %bool %add %68 + OpBranchConditional %cmp5 %if_then6 %if_end + %if_then6 = OpLabel + OpBranch %while_cond + %while_cond = OpLabel + %70 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %71 = OpLoad %uint %local_id Aligned 4 + %add7 = OpIAdd %uint %71 %uint_1 + %arrayidx8 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %70 %add7 +%arrayidx8_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %arrayidx8 + %call9 = OpAtomicLoad %uint %arrayidx8_ascast %uint_1 %uint_0 + %cmp10 = OpIEqual %bool %call9 %uint_0 + OpBranchConditional %cmp10 %while_body %while_end + %while_body = OpLabel + OpBranch %while_cond + %while_end = OpLabel + OpBranch %if_end + %if_end = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 - %80 = OpLoad %uint %43 Aligned 4 - %81 = OpIAdd %uint %80 %uint_1 - %82 = OpLoad %uint %44 Aligned 4 - %83 = OpULessThan %bool %81 %82 - OpBranchConditional %83 %24 %25 - %24 = OpLabel - %84 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %85 = OpLoad %uint %43 Aligned 4 - %86 = OpIAdd %uint %85 %uint_1 - %87 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %84 %86 - %88 = OpPtrCastToGeneric %_ptr_Generic_uint %87 - OpAtomicStore %88 %uint_1 %uint_0 %uint_0 - OpBranch %25 - %25 = OpLabel - OpBranch %32 - %26 = OpLabel + %80 = OpLoad %uint %local_id Aligned 4 + %add11 = OpIAdd %uint %80 %uint_1 + %82 = OpLoad %uint %num_groups Aligned 4 + %cmp12 = OpULessThan %bool %add11 %82 + OpBranchConditional %cmp12 %if_then13 %if_end16 + %if_then13 = OpLabel + %84 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %85 = OpLoad %uint %local_id Aligned 4 + %add14 = OpIAdd %uint %85 %uint_1 + %arrayidx15 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %84 %add14 +%arrayidx15_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %arrayidx15 + OpAtomicStore %arrayidx15_ascast %uint_1 %uint_0 %uint_0 + OpBranch %if_end16 + %if_end16 = OpLabel + OpBranch %if_end27 + %if_else = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 - %89 = OpLoad %uint %43 Aligned 4 - %90 = OpIEqual %bool %89 %uint_0 - OpBranchConditional %90 %27 %31 - %27 = OpLabel - %91 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %92 = OpLoad %uint %42 Aligned 4 - %93 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %91 %92 - %94 = OpPtrCastToGeneric %_ptr_Generic_uint %93 - OpAtomicStore %94 %uint_1 %uint_0 %uint_1 - OpBranch %28 - %28 = OpLabel - %95 = OpLoad %_ptr_CrossWorkgroup_uint %38 Aligned 4 - %96 = OpLoad %uint %42 Aligned 4 - %97 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %95 %96 - %98 = OpPtrCastToGeneric %_ptr_Generic_uint %97 - %99 = OpAtomicLoad %uint %98 %uint_1 %uint_0 - %100 = OpIEqual %bool %99 %uint_1 - OpBranchConditional %100 %29 %30 - %29 = OpLabel - OpBranch %28 - %30 = OpLabel - OpBranch %31 - %31 = OpLabel + %89 = OpLoad %uint %local_id Aligned 4 + %cmp17 = OpIEqual %bool %89 %uint_0 + OpBranchConditional %cmp17 %if_then18 %if_end26 + %if_then18 = OpLabel + %91 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %92 = OpLoad %uint %group_id Aligned 4 + %arrayidx19 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %91 %92 +%arrayidx19_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %arrayidx19 + OpAtomicStore %arrayidx19_ascast %uint_1 %uint_0 %uint_1 + OpBranch %while_cond20 +%while_cond20 = OpLabel + %95 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %96 = OpLoad %uint %group_id Aligned 4 + %arrayidx21 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %95 %96 +%arrayidx21_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %arrayidx21 + %call22 = OpAtomicLoad %uint %arrayidx21_ascast %uint_1 %uint_0 + %cmp23 = OpIEqual %bool %call22 %uint_1 + OpBranchConditional %cmp23 %while_body24 %while_end25 +%while_body24 = OpLabel + OpBranch %while_cond20 +%while_end25 = OpLabel + OpBranch %if_end26 + %if_end26 = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 - OpBranch %32 - %32 = OpLabel - OpStore %47 %uint_0 Aligned 4 - OpBranch %33 - %33 = OpLabel - %101 = OpLoad %uint %47 Aligned 4 - %102 = OpLoad %uint %46 Aligned 4 - %103 = OpULessThan %bool %101 %102 - OpBranchConditional %103 %34 %36 - %34 = OpLabel - %104 = OpLoad %_ptr_CrossWorkgroup_uint %39 Aligned 4 - %105 = OpLoad %uint %47 Aligned 4 - %106 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %104 %105 - %107 = OpLoad %uint %106 Aligned 4 - %108 = OpLoad %_ptr_CrossWorkgroup_uint %40 Aligned 4 - %109 = OpLoad %uint %45 Aligned 4 - %110 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %108 %109 - %111 = OpLoad %uint %110 Aligned 4 - %112 = OpIAdd %uint %111 %107 - OpStore %110 %112 Aligned 4 - OpBranch %35 - %35 = OpLabel - %113 = OpLoad %uint %47 Aligned 4 - %114 = OpIAdd %uint %113 %uint_1 - OpStore %47 %114 Aligned 4 - OpBranch %33 - %36 = OpLabel + OpBranch %if_end27 + %if_end27 = OpLabel + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %101 = OpLoad %uint %i Aligned 4 + %102 = OpLoad %uint %global_size Aligned 4 + %cmp28 = OpULessThan %bool %101 %102 + OpBranchConditional %cmp28 %for_body %for_end + %for_body = OpLabel + %104 = OpLoad %_ptr_CrossWorkgroup_uint %in_addr Aligned 4 + %105 = OpLoad %uint %i Aligned 4 + %arrayidx29 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %104 %105 + %107 = OpLoad %uint %arrayidx29 Aligned 4 + %108 = OpLoad %_ptr_CrossWorkgroup_uint %out_addr Aligned 4 + %109 = OpLoad %uint %global_id Aligned 4 + %arrayidx30 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %108 %109 + %111 = OpLoad %uint %arrayidx30 Aligned 4 + %add31 = OpIAdd %uint %111 %107 + OpStore %arrayidx30 %add31 Aligned 4 + OpBranch %for_inc + %for_inc = OpLabel + %113 = OpLoad %uint %i Aligned 4 + %inc = OpIAdd %uint %113 %uint_1 + OpStore %i %inc Aligned 4 + OpBranch %for_cond + %for_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/addressofinit.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/addressofinit.spvasm index 09f1a1328e..4748d876ab 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/addressofinit.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/addressofinit.spvasm @@ -13,9 +13,15 @@ OpEntryPoint Kernel %12 "foo" OpSource OpenCL_C 200000 OpName %bar "bar" + OpName %i "i" + OpName %entry "entry" + OpName %i_addr "i.addr" + OpName %entry_0 "entry" + OpName %i_0 "i" + OpName %i_ascast "i.ascast" OpDecorate %bar LinkageAttributes "bar" Export - OpDecorate %10 Alignment 4 - OpDecorate %15 Alignment 4 + OpDecorate %i_addr Alignment 4 + OpDecorate %i_0 Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %void = OpTypeVoid @@ -25,18 +31,18 @@ %11 = OpTypeFunction %void %_ptr_Function_uint = OpTypePointer Function %uint %bar = OpFunction %void DontInline %5 - %7 = OpFunctionParameter %_ptr_Generic_uint - %8 = OpLabel - %10 = OpVariable %_ptr_Function__ptr_Generic_uint Function - OpStore %10 %7 Aligned 4 + %i = OpFunctionParameter %_ptr_Generic_uint + %entry = OpLabel + %i_addr = OpVariable %_ptr_Function__ptr_Generic_uint Function + OpStore %i_addr %i Aligned 4 OpReturn OpFunctionEnd %12 = OpFunction %void DontInline %11 - %13 = OpLabel - %15 = OpVariable %_ptr_Function_uint Function - OpStore %15 %uint_0 Aligned 4 - OpStore %15 %uint_0 Aligned 4 - %17 = OpPtrCastToGeneric %_ptr_Generic_uint %15 - %18 = OpFunctionCall %void %bar %17 + %entry_0 = OpLabel + %i_0 = OpVariable %_ptr_Function_uint Function + OpStore %i_0 %uint_0 Aligned 4 + OpStore %i_0 %uint_0 Aligned 4 + %i_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %i_0 + %18 = OpFunctionCall %void %bar %i_ascast OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/addressofread.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/addressofread.spvasm index 8a8f32640c..6e2c120eab 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/addressofread.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/addressofread.spvasm @@ -15,11 +15,19 @@ OpSource OpenCL_C 200000 OpName %bar "bar" OpName %baz "baz" + OpName %i "i" + OpName %entry "entry" + OpName %i_addr "i.addr" + OpName %entry_0 "entry" + OpName %normal "normal" + OpName %i_0 "i" + OpName %call "call" + OpName %i_ascast "i.ascast" OpDecorate %bar LinkageAttributes "bar" Import OpDecorate %baz LinkageAttributes "baz" Export - OpDecorate %12 Alignment 4 - OpDecorate %17 Alignment 4 - OpDecorate %18 Alignment 4 + OpDecorate %i_addr Alignment 4 + OpDecorate %normal Alignment 4 + OpDecorate %i_0 Alignment 4 %uint = OpTypeInt 32 0 %3 = OpTypeFunction %uint %void = OpTypeVoid @@ -31,21 +39,21 @@ %bar = OpFunction %uint None %3 OpFunctionEnd %baz = OpFunction %void DontInline %7 - %9 = OpFunctionParameter %_ptr_Generic_uint - %10 = OpLabel - %12 = OpVariable %_ptr_Function__ptr_Generic_uint Function - OpStore %12 %9 Aligned 4 + %i = OpFunctionParameter %_ptr_Generic_uint + %entry = OpLabel + %i_addr = OpVariable %_ptr_Function__ptr_Generic_uint Function + OpStore %i_addr %i Aligned 4 OpReturn OpFunctionEnd %14 = OpFunction %void DontInline %13 - %15 = OpLabel - %17 = OpVariable %_ptr_Function_uint Function - %18 = OpVariable %_ptr_Function_uint Function - %19 = OpFunctionCall %uint %bar - OpStore %18 %19 Aligned 4 - %20 = OpLoad %uint %18 Aligned 4 - OpStore %17 %20 Aligned 4 - %21 = OpPtrCastToGeneric %_ptr_Generic_uint %18 - %22 = OpFunctionCall %void %baz %21 + %entry_0 = OpLabel + %normal = OpVariable %_ptr_Function_uint Function + %i_0 = OpVariable %_ptr_Function_uint Function + %call = OpFunctionCall %uint %bar + OpStore %i_0 %call Aligned 4 + %20 = OpLoad %uint %i_0 Aligned 4 + OpStore %normal %20 Aligned 4 + %i_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %i_0 + %22 = OpFunctionCall %void %baz %i_ascast OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/alignment/int3int4.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/alignment/int3int4.spvasm index 5a98e6e89e..c4dfa4114f 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/alignment/int3int4.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/alignment/int3int4.spvasm @@ -12,10 +12,20 @@ OpEntryPoint Kernel %9 "foo" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %n "n" + OpName %entry "entry" + OpName %n_addr "n.addr" + OpName %call "call" + OpName %splat_splatinsert "splat.splatinsert" + OpName %splat_splat "splat.splat" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" + OpName %extractVec "extractVec" + OpName %storetmp "storetmp" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %13 Alignment 4 + OpDecorate %n_addr Alignment 4 %uint = OpTypeInt 32 0 %v3uint = OpTypeVector %uint 3 %_ptr_Input_v3uint = OpTypePointer Input %v3uint @@ -28,20 +38,20 @@ %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %16 = OpUndef %v3uint %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_v3uint - %11 = OpLabel - %13 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_v3uint Function - OpStore %13 %10 Aligned 4 + %n = OpFunctionParameter %_ptr_CrossWorkgroup_v3uint + %entry = OpLabel + %n_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_v3uint Function + OpStore %n_addr %n Aligned 4 %14 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %15 = OpCompositeExtract %uint %14 0 - %17 = OpCompositeInsert %v3uint %15 %16 0 - %18 = OpVectorShuffle %v3uint %17 %16 0 0 0 - %19 = OpLoad %_ptr_CrossWorkgroup_v3uint %13 Aligned 4 + %call = OpCompositeExtract %uint %14 0 +%splat_splatinsert = OpCompositeInsert %v3uint %call %16 0 +%splat_splat = OpVectorShuffle %v3uint %splat_splatinsert %16 0 0 0 + %19 = OpLoad %_ptr_CrossWorkgroup_v3uint %n_addr Aligned 4 %20 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %21 = OpCompositeExtract %uint %20 0 - %22 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_v3uint %19 %21 - %24 = OpVectorShuffle %v4uint %18 %16 0 1 2 4294967295 - %26 = OpBitcast %_ptr_CrossWorkgroup_v4uint %22 - OpStore %26 %24 Aligned 16 + %call1 = OpCompositeExtract %uint %20 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_v3uint %19 %call1 + %extractVec = OpVectorShuffle %v4uint %splat_splat %16 0 1 2 4294967295 + %storetmp = OpBitcast %_ptr_CrossWorkgroup_v4uint %arrayidx + OpStore %storetmp %extractVec Aligned 16 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/alignment/race_location.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/alignment/race_location.spvasm index 7da0a4a26f..3e8755070e 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/alignment/race_location.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/alignment/race_location.spvasm @@ -12,10 +12,19 @@ OpEntryPoint Kernel %9 "foo" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %n "n" + OpName %entry "entry" + OpName %n_addr "n.addr" + OpName %call "call" + OpName %splat_splatinsert "splat.splatinsert" + OpName %splat_splat "splat.splat" + OpName %arrayidx "arrayidx" + OpName %extractVec "extractVec" + OpName %storetmp "storetmp" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %13 Alignment 4 + OpDecorate %n_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_200 = OpConstant %uint 200 %v3uint = OpTypeVector %uint 3 @@ -29,18 +38,18 @@ %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %16 = OpUndef %v3uint %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_v3uint - %11 = OpLabel - %13 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_v3uint Function - OpStore %13 %10 Aligned 4 + %n = OpFunctionParameter %_ptr_CrossWorkgroup_v3uint + %entry = OpLabel + %n_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_v3uint Function + OpStore %n_addr %n Aligned 4 %14 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %15 = OpCompositeExtract %uint %14 0 - %17 = OpCompositeInsert %v3uint %15 %16 0 - %18 = OpVectorShuffle %v3uint %17 %16 0 0 0 - %19 = OpLoad %_ptr_CrossWorkgroup_v3uint %13 Aligned 4 - %21 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_v3uint %19 %uint_200 - %23 = OpVectorShuffle %v4uint %18 %16 0 1 2 4294967295 - %25 = OpBitcast %_ptr_CrossWorkgroup_v4uint %21 - OpStore %25 %23 Aligned 16 + %call = OpCompositeExtract %uint %14 0 +%splat_splatinsert = OpCompositeInsert %v3uint %call %16 0 +%splat_splat = OpVectorShuffle %v3uint %splat_splatinsert %16 0 0 0 + %19 = OpLoad %_ptr_CrossWorkgroup_v3uint %n_addr Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_v3uint %19 %uint_200 + %extractVec = OpVectorShuffle %v4uint %splat_splat %16 0 1 2 4294967295 + %storetmp = OpBitcast %_ptr_CrossWorkgroup_v4uint %arrayidx + OpStore %storetmp %extractVec Aligned 16 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/annotation_tests/test_axiom.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/annotation_tests/test_axiom.spvasm index 80e320d858..38e3289fef 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/annotation_tests/test_axiom.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/annotation_tests/test_axiom.spvasm @@ -13,13 +13,25 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInWorkgroupSize "__spirv_BuiltInWorkgroupSize" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %A "A" + OpName %entry "entry" + OpName %lor_lhs_false "lor.lhs.false" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %A_addr "A.addr" + OpName %call "call" + OpName %cmp "cmp" + OpName %call1 "call1" + OpName %cmp2 "cmp2" + OpName %call3 "call3" + OpName %arrayidx "arrayidx" OpDecorate %__spirv_BuiltInWorkgroupSize BuiltIn WorkgroupSize OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInWorkgroupSize Constant OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInWorkgroupSize LinkageAttributes "__spirv_BuiltInWorkgroupSize" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %17 Alignment 4 + OpDecorate %A_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_16 = OpConstant %uint 16 %uint_0 = OpConstant %uint 0 @@ -33,26 +45,26 @@ %__spirv_BuiltInWorkgroupSize = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %10 = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpLabel - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %17 %11 Aligned 4 + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %A_addr %A Aligned 4 %18 = OpLoad %v3uint %__spirv_BuiltInWorkgroupSize Aligned 16 - %19 = OpCompositeExtract %uint %18 0 - %22 = OpINotEqual %bool %19 %uint_16 - OpBranchConditional %22 %14 %13 - %13 = OpLabel + %call = OpCompositeExtract %uint %18 0 + %cmp = OpINotEqual %bool %call %uint_16 + OpBranchConditional %cmp %if_then %lor_lhs_false +%lor_lhs_false = OpLabel %23 = OpLoad %v3uint %__spirv_BuiltInWorkgroupSize Aligned 16 - %24 = OpCompositeExtract %uint %23 1 - %25 = OpINotEqual %bool %24 %uint_16 - OpBranchConditional %25 %14 %15 - %14 = OpLabel + %call1 = OpCompositeExtract %uint %23 1 + %cmp2 = OpINotEqual %bool %call1 %uint_16 + OpBranchConditional %cmp2 %if_then %if_end + %if_then = OpLabel %26 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %27 = OpCompositeExtract %uint %26 0 - %28 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %30 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %28 %uint_0 - OpStore %30 %27 Aligned 4 - OpBranch %15 - %15 = OpLabel + %call3 = OpCompositeExtract %uint %26 0 + %28 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %28 %uint_0 + OpStore %arrayidx %call3 Aligned 4 + OpBranch %if_end + %if_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/array_in_array.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/array_in_array.spvasm index 1edbd6b30d..7819d03759 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/array_in_array.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/array_in_array.spvasm @@ -1,4 +1,4 @@ -; @Config: 8, 1, 8 +; @Config: 3, 1, 3 ; SPIR-V ; Version: 1.0 ; Generator: Khronos LLVM/SPIR-V Translator; 14 @@ -15,6 +15,11 @@ OpName %foo_G "foo.G" OpName %__spirv_BuiltInGlobalSize "__spirv_BuiltInGlobalSize" OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %entry "entry" + OpName %call "call" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" + OpName %arrayidx2 "arrayidx2" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalSize BuiltIn GlobalSize OpDecorate %__spirv_BuiltInGlobalSize Constant @@ -38,14 +43,14 @@ %__spirv_BuiltInGlobalSize = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %14 = OpFunction %void DontInline %13 - %15 = OpLabel + %entry = OpLabel %16 = OpLoad %v3uint %__spirv_BuiltInGlobalSize Aligned 16 - %17 = OpCompositeExtract %uint %16 0 + %call = OpCompositeExtract %uint %16 0 %18 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %19 = OpCompositeExtract %uint %18 0 - %22 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %foo_G %uint_0 %19 - %23 = OpLoad %uint %22 Aligned 4 - %24 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %foo_L %uint_0 %23 - OpStore %24 %17 Aligned 4 + %call1 = OpCompositeExtract %uint %18 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %foo_G %uint_0 %call1 + %23 = OpLoad %uint %arrayidx Aligned 4 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %foo_L %uint_0 %23 + OpStore %arrayidx2 %call Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/array_in_array_2.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/array_in_array_2.spvasm index 4cb35339d8..01cf55417d 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/array_in_array_2.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/array_in_array_2.spvasm @@ -14,13 +14,23 @@ OpSource OpenCL_C 200000 OpName %__const_foo_L "__const.foo.L" OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %entry "entry" + OpName %L "L" + OpName %K "K" + OpName %call "call" + OpName %rem "rem" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" + OpName %call2 "call2" + OpName %mul "mul" + OpName %arrayidx3 "arrayidx3" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__const_foo_L Constant OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import OpDecorate %__const_foo_L Alignment 4 - OpDecorate %21 Alignment 4 - OpDecorate %24 Alignment 4 + OpDecorate %L Alignment 4 + OpDecorate %K Alignment 4 %uint = OpTypeInt 32 0 %uchar = OpTypeInt 8 0 %uint_10 = OpConstant %uint 10 @@ -46,23 +56,23 @@ %__const_foo_L = OpVariable %_ptr_UniformConstant__arr_uint_uint_5 UniformConstant %10 %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %18 = OpFunction %void DontInline %17 - %19 = OpLabel - %21 = OpVariable %_ptr_Function__arr_uint_uint_5 Function - %24 = OpVariable %_ptr_Function__arr_uint_uint_40 Function - %27 = OpBitcast %_ptr_Function_uchar %21 + %entry = OpLabel + %L = OpVariable %_ptr_Function__arr_uint_uint_5 Function + %K = OpVariable %_ptr_Function__arr_uint_uint_40 Function + %27 = OpBitcast %_ptr_Function_uchar %L %29 = OpBitcast %_ptr_UniformConstant_uchar %__const_foo_L OpCopyMemorySized %27 %29 %uint_20 Aligned 4 %30 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %31 = OpCompositeExtract %uint %30 1 - %32 = OpUMod %uint %31 %uint_5 - %35 = OpInBoundsPtrAccessChain %_ptr_Function_uint %21 %uint_0 %32 - %36 = OpLoad %uint %35 Aligned 4 + %call = OpCompositeExtract %uint %30 1 + %rem = OpUMod %uint %call %uint_5 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Function_uint %L %uint_0 %rem + %36 = OpLoad %uint %arrayidx Aligned 4 %37 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %38 = OpCompositeExtract %uint %37 1 + %call1 = OpCompositeExtract %uint %37 1 %39 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %40 = OpCompositeExtract %uint %39 0 - %41 = OpIMul %uint %38 %40 - %42 = OpInBoundsPtrAccessChain %_ptr_Function_uint %24 %uint_0 %41 - OpStore %42 %36 Aligned 4 + %call2 = OpCompositeExtract %uint %39 0 + %mul = OpIMul %uint %call1 %call2 + %arrayidx3 = OpInBoundsPtrAccessChain %_ptr_Function_uint %K %uint_0 %mul + OpStore %arrayidx3 %36 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/array_in_array_param.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/array_in_array_param.spvasm index 37baeba8ad..44bcadce60 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/array_in_array_param.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/array_in_array_param.spvasm @@ -14,6 +14,13 @@ OpName %foo_L "foo.L" OpName %__spirv_BuiltInGlobalSize "__spirv_BuiltInGlobalSize" OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %G "G" + OpName %entry "entry" + OpName %G_addr "G.addr" + OpName %call "call" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" + OpName %arrayidx2 "arrayidx2" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalSize BuiltIn GlobalSize OpDecorate %__spirv_BuiltInGlobalSize Constant @@ -21,7 +28,7 @@ OpDecorate %__spirv_BuiltInGlobalSize LinkageAttributes "__spirv_BuiltInGlobalSize" Import OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import OpDecorate %foo_L Alignment 4 - OpDecorate %18 Alignment 4 + OpDecorate %G_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_64 = OpConstant %uint 64 %uint_0 = OpConstant %uint 0 @@ -38,18 +45,18 @@ %__spirv_BuiltInGlobalSize = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %14 = OpFunction %void DontInline %13 - %15 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %16 = OpLabel - %18 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %18 %15 Aligned 4 + %G = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %G_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %G_addr %G Aligned 4 %19 = OpLoad %v3uint %__spirv_BuiltInGlobalSize Aligned 16 - %20 = OpCompositeExtract %uint %19 0 - %21 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 + %call = OpCompositeExtract %uint %19 0 + %21 = OpLoad %_ptr_CrossWorkgroup_uint %G_addr Aligned 4 %22 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %23 = OpCompositeExtract %uint %22 0 - %24 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %21 %23 - %25 = OpLoad %uint %24 Aligned 4 - %28 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %foo_L %uint_0 %25 - OpStore %28 %20 Aligned 4 + %call1 = OpCompositeExtract %uint %22 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %21 %call1 + %25 = OpLoad %uint %arrayidx Aligned 4 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %foo_L %uint_0 %25 + OpStore %arrayidx2 %call Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/multi_dim_array.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/multi_dim_array.spvasm index 0e020fe57e..118dba5fd5 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/multi_dim_array.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/multi_dim_array.spvasm @@ -14,6 +14,12 @@ OpName %foo_L "foo.L" OpName %__spirv_BuiltInWorkgroupId "__spirv_BuiltInWorkgroupId" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %entry "entry" + OpName %call "call" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" + OpName %call2 "call2" + OpName %arrayidx3 "arrayidx3" OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInWorkgroupId Constant @@ -37,15 +43,15 @@ %__spirv_BuiltInWorkgroupId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %14 = OpFunction %void DontInline %13 - %15 = OpLabel + %entry = OpLabel %16 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %17 = OpCompositeExtract %uint %16 0 + %call = OpCompositeExtract %uint %16 0 %18 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %19 = OpCompositeExtract %uint %18 0 - %22 = OpInBoundsPtrAccessChain %_ptr_Workgroup__arr_uint_uint_8 %foo_L %uint_0 %19 + %call1 = OpCompositeExtract %uint %18 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup__arr_uint_uint_8 %foo_L %uint_0 %call1 %23 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %24 = OpCompositeExtract %uint %23 1 - %26 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %22 %uint_0 %24 - OpStore %26 %17 Aligned 4 + %call2 = OpCompositeExtract %uint %23 1 + %arrayidx3 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %arrayidx %uint_0 %call2 + OpStore %arrayidx3 %call Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/multi_dim_array_fail_upper.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/multi_dim_array_fail_upper.spvasm index 5ac90ea2cb..a94eadbca6 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/multi_dim_array_fail_upper.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/multi_dim_array_fail_upper.spvasm @@ -15,6 +15,14 @@ OpName %__spirv_BuiltInWorkgroupId "__spirv_BuiltInWorkgroupId" OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %entry "entry" + OpName %call "call" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" + OpName %call2 "call2" + OpName %arrayidx3 "arrayidx3" + OpName %call4 "call4" + OpName %arrayidx5 "arrayidx5" OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId @@ -44,18 +52,18 @@ %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %16 = OpFunction %void DontInline %15 - %17 = OpLabel + %entry = OpLabel %18 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %19 = OpCompositeExtract %uint %18 0 + %call = OpCompositeExtract %uint %18 0 %20 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %21 = OpCompositeExtract %uint %20 0 - %24 = OpInBoundsPtrAccessChain %_ptr_Workgroup__arr__arr_uint_uint_10_uint_10 %foo_L %uint_0 %21 + %call1 = OpCompositeExtract %uint %20 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup__arr__arr_uint_uint_10_uint_10 %foo_L %uint_0 %call1 %25 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %26 = OpCompositeExtract %uint %25 1 - %28 = OpInBoundsPtrAccessChain %_ptr_Workgroup__arr_uint_uint_10 %24 %uint_0 %26 + %call2 = OpCompositeExtract %uint %25 1 + %arrayidx3 = OpInBoundsPtrAccessChain %_ptr_Workgroup__arr_uint_uint_10 %arrayidx %uint_0 %call2 %29 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %30 = OpCompositeExtract %uint %29 2 - %32 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %28 %uint_0 %30 - OpStore %32 %19 Aligned 4 + %call4 = OpCompositeExtract %uint %29 2 + %arrayidx5 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %arrayidx3 %uint_0 %call4 + OpStore %arrayidx5 %call Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/negative_index_multi_dim.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/negative_index_multi_dim.spvasm index a3c3780bd1..326dcb19d1 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/negative_index_multi_dim.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/negative_index_multi_dim.spvasm @@ -15,6 +15,13 @@ OpName %__spirv_BuiltInGlobalSize "__spirv_BuiltInGlobalSize" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %entry "entry" + OpName %call "call" + OpName %call1 "call1" + OpName %mul "mul" + OpName %arrayidx "arrayidx" + OpName %call2 "call2" + OpName %arrayidx3 "arrayidx3" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalSize BuiltIn GlobalSize @@ -43,16 +50,16 @@ %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %15 = OpFunction %void DontInline %14 - %16 = OpLabel + %entry = OpLabel %17 = OpLoad %v3uint %__spirv_BuiltInGlobalSize Aligned 16 - %18 = OpCompositeExtract %uint %17 0 + %call = OpCompositeExtract %uint %17 0 %19 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %20 = OpCompositeExtract %uint %19 0 - %22 = OpIMul %uint %uint_4294967295 %20 - %25 = OpInBoundsPtrAccessChain %_ptr_Workgroup__arr_uint_uint_10 %foo_L %uint_0 %22 + %call1 = OpCompositeExtract %uint %19 0 + %mul = OpIMul %uint %uint_4294967295 %call1 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup__arr_uint_uint_10 %foo_L %uint_0 %mul %26 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %27 = OpCompositeExtract %uint %26 1 - %29 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %25 %uint_0 %27 - OpStore %29 %18 Aligned 4 + %call2 = OpCompositeExtract %uint %26 1 + %arrayidx3 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %arrayidx %uint_0 %call2 + OpStore %arrayidx3 %call Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/negative_index_multi_dim_fail.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/negative_index_multi_dim_fail.spvasm index 502131b427..45145eae94 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/negative_index_multi_dim_fail.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/negative_index_multi_dim_fail.spvasm @@ -14,6 +14,13 @@ OpName %foo_L "foo.L" OpName %__spirv_BuiltInGlobalSize "__spirv_BuiltInGlobalSize" OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %entry "entry" + OpName %call "call" + OpName %call1 "call1" + OpName %add "add" + OpName %arrayidx "arrayidx" + OpName %call2 "call2" + OpName %arrayidx3 "arrayidx3" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalSize BuiltIn GlobalSize OpDecorate %__spirv_BuiltInGlobalSize Constant @@ -38,16 +45,16 @@ %__spirv_BuiltInGlobalSize = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %14 = OpFunction %void DontInline %13 - %15 = OpLabel + %entry = OpLabel %16 = OpLoad %v3uint %__spirv_BuiltInGlobalSize Aligned 16 - %17 = OpCompositeExtract %uint %16 0 + %call = OpCompositeExtract %uint %16 0 %18 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %19 = OpCompositeExtract %uint %18 0 - %21 = OpIAdd %uint %uint_4294967295 %19 - %24 = OpInBoundsPtrAccessChain %_ptr_Workgroup__arr_uint_uint_10 %foo_L %uint_0 %21 + %call1 = OpCompositeExtract %uint %18 0 + %add = OpIAdd %uint %uint_4294967295 %call1 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup__arr_uint_uint_10 %foo_L %uint_0 %add %25 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %26 = OpCompositeExtract %uint %25 1 - %28 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %24 %uint_0 %26 - OpStore %28 %17 Aligned 4 + %call2 = OpCompositeExtract %uint %25 1 + %arrayidx3 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %arrayidx %uint_0 %call2 + OpStore %arrayidx3 %call Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/private_array.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/private_array.spvasm index 2810967714..ab395df1b7 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/private_array.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/private_array.spvasm @@ -12,11 +12,17 @@ OpEntryPoint Kernel %8 "foo" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %entry "entry" + OpName %L "L" + OpName %x "x" + OpName %call "call" + OpName %mul "mul" + OpName %arrayidx "arrayidx" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %13 Alignment 4 - OpDecorate %15 Alignment 4 + OpDecorate %L Alignment 4 + OpDecorate %x Alignment 4 %uint = OpTypeInt 32 0 %uint_16 = OpConstant %uint 16 %uint_0 = OpConstant %uint 0 @@ -29,17 +35,17 @@ %_ptr_Function_uint = OpTypePointer Function %uint %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %8 = OpFunction %void DontInline %7 - %9 = OpLabel - %13 = OpVariable %_ptr_Function__arr_uint_uint_16 Function - %15 = OpVariable %_ptr_Function_uint Function + %entry = OpLabel + %L = OpVariable %_ptr_Function__arr_uint_uint_16 Function + %x = OpVariable %_ptr_Function_uint Function %16 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %17 = OpCompositeExtract %uint %16 0 - OpStore %15 %17 Aligned 4 - %18 = OpLoad %uint %15 Aligned 4 - %19 = OpLoad %uint %15 Aligned 4 - %20 = OpIMul %uint %18 %19 - %21 = OpLoad %uint %15 Aligned 4 - %23 = OpInBoundsPtrAccessChain %_ptr_Function_uint %13 %uint_0 %21 - OpStore %23 %20 Aligned 4 + %call = OpCompositeExtract %uint %16 0 + OpStore %x %call Aligned 4 + %18 = OpLoad %uint %x Aligned 4 + %19 = OpLoad %uint %x Aligned 4 + %mul = OpIMul %uint %18 %19 + %21 = OpLoad %uint %x Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Function_uint %L %uint_0 %21 + OpStore %arrayidx %mul Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/realign_simple.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/realign_simple.spvasm index 34977aa79f..1a3a5cd754 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/realign_simple.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/realign_simple.spvasm @@ -15,6 +15,11 @@ OpName %foo_L "foo.L" OpName %__spirv_BuiltInGlobalSize "__spirv_BuiltInGlobalSize" OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %entry "entry" + OpName %call "call" + OpName %conv "conv" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalSize BuiltIn GlobalSize OpDecorate %__spirv_BuiltInGlobalSize Constant @@ -36,14 +41,14 @@ %__spirv_BuiltInGlobalSize = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %13 = OpFunction %void DontInline %12 - %14 = OpLabel + %entry = OpLabel %15 = OpLoad %v3uint %__spirv_BuiltInGlobalSize Aligned 16 - %16 = OpCompositeExtract %uint %15 0 - %18 = OpUConvert %uchar %16 + %call = OpCompositeExtract %uint %15 0 + %conv = OpUConvert %uchar %call %19 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %20 = OpCompositeExtract %uint %19 0 + %call1 = OpCompositeExtract %uint %19 0 %22 = OpBitcast %_ptr_Workgroup_uchar %foo_L - %23 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uchar %22 %20 - OpStore %23 %18 Aligned 1 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uchar %22 %call1 + OpStore %arrayidx %conv Aligned 1 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/realign_simple_fail.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/realign_simple_fail.spvasm index 34977aa79f..1a3a5cd754 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/realign_simple_fail.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/realign_simple_fail.spvasm @@ -15,6 +15,11 @@ OpName %foo_L "foo.L" OpName %__spirv_BuiltInGlobalSize "__spirv_BuiltInGlobalSize" OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %entry "entry" + OpName %call "call" + OpName %conv "conv" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalSize BuiltIn GlobalSize OpDecorate %__spirv_BuiltInGlobalSize Constant @@ -36,14 +41,14 @@ %__spirv_BuiltInGlobalSize = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %13 = OpFunction %void DontInline %12 - %14 = OpLabel + %entry = OpLabel %15 = OpLoad %v3uint %__spirv_BuiltInGlobalSize Aligned 16 - %16 = OpCompositeExtract %uint %15 0 - %18 = OpUConvert %uchar %16 + %call = OpCompositeExtract %uint %15 0 + %conv = OpUConvert %uchar %call %19 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %20 = OpCompositeExtract %uint %19 0 + %call1 = OpCompositeExtract %uint %19 0 %22 = OpBitcast %_ptr_Workgroup_uchar %foo_L - %23 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uchar %22 %20 - OpStore %23 %18 Aligned 1 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uchar %22 %call1 + OpStore %arrayidx %conv Aligned 1 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/simple_array.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/simple_array.spvasm index b2ea33048d..0bf2116294 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/simple_array.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/simple_array.spvasm @@ -14,6 +14,10 @@ OpName %foo_L "foo.L" OpName %__spirv_BuiltInGlobalSize "__spirv_BuiltInGlobalSize" OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %entry "entry" + OpName %call "call" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalSize BuiltIn GlobalSize OpDecorate %__spirv_BuiltInGlobalSize Constant @@ -35,12 +39,12 @@ %__spirv_BuiltInGlobalSize = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %13 = OpFunction %void DontInline %12 - %14 = OpLabel + %entry = OpLabel %15 = OpLoad %v3uint %__spirv_BuiltInGlobalSize Aligned 16 - %16 = OpCompositeExtract %uint %15 0 + %call = OpCompositeExtract %uint %15 0 %17 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %18 = OpCompositeExtract %uint %17 0 - %21 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %foo_L %uint_0 %18 - OpStore %21 %16 Aligned 4 + %call1 = OpCompositeExtract %uint %17 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %foo_L %uint_0 %call1 + OpStore %arrayidx %call Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/simple_array_fail_lower.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/simple_array_fail_lower.spvasm index 1b50d1e2eb..8631047653 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/simple_array_fail_lower.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/simple_array_fail_lower.spvasm @@ -14,6 +14,11 @@ OpName %foo_L "foo.L" OpName %__spirv_BuiltInGlobalSize "__spirv_BuiltInGlobalSize" OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %entry "entry" + OpName %call "call" + OpName %call1 "call1" + OpName %sub "sub" + OpName %arrayidx "arrayidx" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalSize BuiltIn GlobalSize OpDecorate %__spirv_BuiltInGlobalSize Constant @@ -35,13 +40,13 @@ %__spirv_BuiltInGlobalSize = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %13 = OpFunction %void DontInline %12 - %14 = OpLabel + %entry = OpLabel %15 = OpLoad %v3uint %__spirv_BuiltInGlobalSize Aligned 16 - %16 = OpCompositeExtract %uint %15 0 + %call = OpCompositeExtract %uint %15 0 %17 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %18 = OpCompositeExtract %uint %17 0 - %20 = OpISub %uint %uint_0 %18 - %22 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %foo_L %uint_0 %20 - OpStore %22 %16 Aligned 4 + %call1 = OpCompositeExtract %uint %17 0 + %sub = OpISub %uint %uint_0 %call1 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %foo_L %uint_0 %sub + OpStore %arrayidx %call Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/simple_array_fail_upper.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/simple_array_fail_upper.spvasm index ec8a513413..ebe2fadcee 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/simple_array_fail_upper.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/simple_array_fail_upper.spvasm @@ -14,6 +14,10 @@ OpName %foo_L "foo.L" OpName %__spirv_BuiltInGlobalSize "__spirv_BuiltInGlobalSize" OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %entry "entry" + OpName %call "call" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalSize BuiltIn GlobalSize OpDecorate %__spirv_BuiltInGlobalSize Constant @@ -35,12 +39,12 @@ %__spirv_BuiltInGlobalSize = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %13 = OpFunction %void DontInline %12 - %14 = OpLabel + %entry = OpLabel %15 = OpLoad %v3uint %__spirv_BuiltInGlobalSize Aligned 16 - %16 = OpCompositeExtract %uint %15 0 + %call = OpCompositeExtract %uint %15 0 %17 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %18 = OpCompositeExtract %uint %17 0 - %21 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %foo_L %uint_0 %18 - OpStore %21 %16 Aligned 4 + %call1 = OpCompositeExtract %uint %17 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %foo_L %uint_0 %call1 + OpStore %arrayidx %call Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/simple_array_fail_var.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/simple_array_fail_var.spvasm index bf517595d0..6d3701135b 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/simple_array_fail_var.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/array_bounds_tests/simple_array_fail_var.spvasm @@ -13,11 +13,16 @@ OpSource OpenCL_C 200000 OpName %foo_L "foo.L" OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %entry "entry" + OpName %x "x" + OpName %call "call" + OpName %mul "mul" + OpName %arrayidx "arrayidx" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import OpDecorate %foo_L Alignment 4 - OpDecorate %15 Alignment 4 + OpDecorate %x Alignment 4 %uint = OpTypeInt 32 0 %uint_20 = OpConstant %uint 20 %uint_0 = OpConstant %uint 0 @@ -32,16 +37,16 @@ %foo_L = OpVariable %_ptr_Workgroup__arr_uint_uint_20 Workgroup %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %12 = OpFunction %void DontInline %11 - %13 = OpLabel - %15 = OpVariable %_ptr_Function_uint Function + %entry = OpLabel + %x = OpVariable %_ptr_Function_uint Function %16 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %17 = OpCompositeExtract %uint %16 0 - OpStore %15 %17 Aligned 4 - %18 = OpLoad %uint %15 Aligned 4 - %19 = OpLoad %uint %15 Aligned 4 - %20 = OpIMul %uint %18 %19 - %21 = OpLoad %uint %15 Aligned 4 - %24 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %foo_L %uint_0 %21 - OpStore %24 %20 Aligned 4 + %call = OpCompositeExtract %uint %16 0 + OpStore %x %call Aligned 4 + %18 = OpLoad %uint %x Aligned 4 + %19 = OpLoad %uint %x Aligned 4 + %mul = OpIMul %uint %18 %19 + %21 = OpLoad %uint %x Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %foo_L %uint_0 %21 + OpStore %arrayidx %mul Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/async_work_group_copy/fail/test13.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/async_work_group_copy/fail/test13.spvasm index 98569be260..eb1e12ffcd 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/async_work_group_copy/fail/test13.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/async_work_group_copy/fail/test13.spvasm @@ -14,15 +14,27 @@ OpSource OpenCL_C 200000 OpName %foo_mydata "foo.mydata" OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %p "p" + OpName %q "q" + OpName %entry "entry" + OpName %p_addr "p.addr" + OpName %q_addr "q.addr" + OpName %handle "handle" + OpName %call "call" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" + OpName %call2 "call2" + OpName %arrayidx3 "arrayidx3" + OpName %handle_ascast "handle.ascast" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant - OpDecorate %14 FuncParamAttr NoAlias - OpDecorate %15 FuncParamAttr NoAlias + OpDecorate %p FuncParamAttr NoAlias + OpDecorate %q FuncParamAttr NoAlias OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import OpDecorate %foo_mydata Alignment 4 - OpDecorate %18 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %22 Alignment 4 + OpDecorate %p_addr Alignment 4 + OpDecorate %q_addr Alignment 4 + OpDecorate %handle Alignment 4 %uint = OpTypeInt 32 0 %uint_1024 = OpConstant %uint 1024 %uint_0 = OpConstant %uint 0 @@ -45,29 +57,29 @@ %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %29 = OpConstantNull %Event %13 = OpFunction %void DontInline %12 - %14 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %15 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %16 = OpLabel - %18 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %22 = OpVariable %_ptr_Function_Event Function - OpStore %18 %14 Aligned 4 - OpStore %19 %15 Aligned 4 - %23 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 + %p = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %q = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %q_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %handle = OpVariable %_ptr_Function_Event Function + OpStore %p_addr %p Aligned 4 + OpStore %q_addr %q Aligned 4 + %23 = OpLoad %_ptr_CrossWorkgroup_uint %p_addr Aligned 4 %26 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %foo_mydata %uint_0 %uint_0 - %30 = OpGroupAsyncCopy %Event %uint_2 %26 %23 %uint_1024 %uint_1 %29 - OpStore %22 %30 Aligned 4 + %call = OpGroupAsyncCopy %Event %uint_2 %26 %23 %uint_1024 %uint_1 %29 + OpStore %handle %call Aligned 4 OpControlBarrier %uint_2 %uint_2 %uint_784 %32 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %33 = OpCompositeExtract %uint %32 0 - %34 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %foo_mydata %uint_0 %33 - %35 = OpLoad %uint %34 Aligned 4 - %36 = OpLoad %_ptr_CrossWorkgroup_uint %19 Aligned 4 + %call1 = OpCompositeExtract %uint %32 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %foo_mydata %uint_0 %call1 + %35 = OpLoad %uint %arrayidx Aligned 4 + %36 = OpLoad %_ptr_CrossWorkgroup_uint %q_addr Aligned 4 %37 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %38 = OpCompositeExtract %uint %37 0 - %39 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %38 - OpStore %39 %35 Aligned 4 - %41 = OpPtrCastToGeneric %_ptr_Generic_Event %22 - OpGroupWaitEvents %uint_2 %uint_1 %41 + %call2 = OpCompositeExtract %uint %37 0 + %arrayidx3 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %call2 + OpStore %arrayidx3 %35 Aligned 4 +%handle_ascast = OpPtrCastToGeneric %_ptr_Generic_Event %handle + OpGroupWaitEvents %uint_2 %uint_1 %handle_ascast OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/atomic_read_race.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/atomic_read_race.spvasm index ff2d10b267..7171ae0658 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/atomic_read_race.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/atomic_read_race.spvasm @@ -12,11 +12,18 @@ OpEntryPoint Kernel %9 "atomic" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %A "A" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpName %x "x" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %13 Alignment 4 - OpDecorate %15 Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %x Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_0 = OpConstant %uint 0 @@ -29,18 +36,18 @@ %_ptr_Function_uint = OpTypePointer Function %uint %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_Workgroup_uint - %11 = OpLabel - %13 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %15 = OpVariable %_ptr_Function_uint Function - OpStore %13 %10 Aligned 4 - %16 = OpLoad %_ptr_Workgroup_uint %13 Aligned 4 + %A = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %x = OpVariable %_ptr_Function_uint Function + OpStore %A_addr %A Aligned 4 + %16 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 %17 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %18 = OpCompositeExtract %uint %17 0 - %19 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %16 %18 - %20 = OpLoad %uint %19 Aligned 4 - OpStore %15 %20 Volatile|Aligned 4 - %21 = OpLoad %_ptr_Workgroup_uint %13 Aligned 4 - %24 = OpAtomicIIncrement %uint %21 %uint_2 %uint_0 + %call = OpCompositeExtract %uint %17 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %16 %call + %20 = OpLoad %uint %arrayidx Aligned 4 + OpStore %x %20 Volatile|Aligned 4 + %21 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %call1 = OpAtomicIIncrement %uint %21 %uint_2 %uint_0 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/counter.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/counter.spvasm index cefba26d81..6dd0ed8d85 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/counter.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/counter.spvasm @@ -13,11 +13,21 @@ OpSource OpenCL_C 200000 OpName %counter_count "counter.count" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %A "A" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %A_addr "A.addr" + OpName %call "call" + OpName %cmp "cmp" + OpName %call1 "call1" + OpName %call2 "call2" + OpName %arrayidx "arrayidx" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import OpDecorate %counter_count Alignment 4 - OpDecorate %16 Alignment 4 + OpDecorate %A_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_2 = OpConstant %uint 2 @@ -32,24 +42,24 @@ %counter_count = OpVariable %_ptr_Workgroup_uint Workgroup %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %10 = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_Workgroup_uint - %12 = OpLabel - %16 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - OpStore %16 %11 Aligned 4 + %A = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + OpStore %A_addr %A Aligned 4 %17 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %18 = OpCompositeExtract %uint %17 0 - %21 = OpIEqual %bool %18 %uint_0 - OpBranchConditional %21 %13 %14 - %13 = OpLabel + %call = OpCompositeExtract %uint %17 0 + %cmp = OpIEqual %bool %call %uint_0 + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel OpStore %counter_count %uint_0 Aligned 4 - OpBranch %14 - %14 = OpLabel + OpBranch %if_end + %if_end = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_272 %24 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %25 = OpCompositeExtract %uint %24 0 - %26 = OpLoad %_ptr_Workgroup_uint %16 Aligned 4 - %27 = OpAtomicIIncrement %uint %counter_count %uint_2 %uint_0 - %28 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %26 %27 - OpStore %28 %25 Aligned 4 + %call1 = OpCompositeExtract %uint %24 0 + %26 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %call2 = OpAtomicIIncrement %uint %counter_count %uint_2 %uint_0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %26 %call2 + OpStore %arrayidx %call1 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/definitions_atom_int.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/definitions_atom_int.spvasm index 3e62d46d1d..fa4365d478 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/definitions_atom_int.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/definitions_atom_int.spvasm @@ -10,10 +10,63 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %7 "definitions" OpSource OpenCL_C 200000 - OpDecorate %14 Alignment 4 - OpDecorate %15 Alignment 4 - OpDecorate %17 Alignment 4 - OpDecorate %18 Alignment 4 + OpName %A "A" + OpName %B "B" + OpName %C "C" + OpName %D "D" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpName %B_addr "B.addr" + OpName %C_addr "C.addr" + OpName %D_addr "D.addr" + OpName %call "call" + OpName %call1 "call1" + OpName %call2 "call2" + OpName %call3 "call3" + OpName %call4 "call4" + OpName %call5 "call5" + OpName %call6 "call6" + OpName %call7 "call7" + OpName %call8 "call8" + OpName %call9 "call9" + OpName %call10 "call10" + OpName %call11 "call11" + OpName %call12 "call12" + OpName %call13 "call13" + OpName %call14 "call14" + OpName %call15 "call15" + OpName %call16 "call16" + OpName %call17 "call17" + OpName %call18 "call18" + OpName %call19 "call19" + OpName %call20 "call20" + OpName %call21 "call21" + OpName %call22 "call22" + OpName %call23 "call23" + OpName %call24 "call24" + OpName %call25 "call25" + OpName %call26 "call26" + OpName %call27 "call27" + OpName %call28 "call28" + OpName %call29 "call29" + OpName %call30 "call30" + OpName %call31 "call31" + OpName %call32 "call32" + OpName %call33 "call33" + OpName %call34 "call34" + OpName %call35 "call35" + OpName %call36 "call36" + OpName %call37 "call37" + OpName %call38 "call38" + OpName %call39 "call39" + OpName %call40 "call40" + OpName %call41 "call41" + OpName %call42 "call42" + OpName %call43 "call43" + OpDecorate %A_addr Alignment 4 + OpDecorate %B_addr Alignment 4 + OpDecorate %C_addr Alignment 4 + OpDecorate %D_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_0 = OpConstant %uint 0 @@ -25,106 +78,106 @@ %_ptr_Function__ptr_Workgroup_uint = OpTypePointer Function %_ptr_Workgroup_uint %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %7 = OpFunction %void DontInline %6 - %8 = OpFunctionParameter %_ptr_Workgroup_uint - %9 = OpFunctionParameter %_ptr_Workgroup_uint - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpLabel - %14 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %15 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %18 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %14 %8 Aligned 4 - OpStore %15 %9 Aligned 4 - OpStore %17 %10 Aligned 4 - OpStore %18 %11 Aligned 4 - %19 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 - %23 = OpAtomicIAdd %uint %19 %uint_2 %uint_0 %uint_10 - %24 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 - %25 = OpAtomicISub %uint %24 %uint_2 %uint_0 %uint_10 - %26 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 - %27 = OpAtomicExchange %uint %26 %uint_2 %uint_0 %uint_10 - %28 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 - %29 = OpAtomicSMin %uint %28 %uint_2 %uint_0 %uint_10 - %30 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 - %31 = OpAtomicSMax %uint %30 %uint_2 %uint_0 %uint_10 - %32 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 - %33 = OpAtomicAnd %uint %32 %uint_2 %uint_0 %uint_10 - %34 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 - %35 = OpAtomicOr %uint %34 %uint_2 %uint_0 %uint_10 - %36 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 - %37 = OpAtomicXor %uint %36 %uint_2 %uint_0 %uint_10 - %38 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 - %39 = OpAtomicIIncrement %uint %38 %uint_2 %uint_0 - %40 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 - %41 = OpAtomicIDecrement %uint %40 %uint_2 %uint_0 - %42 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 - %43 = OpAtomicCompareExchange %uint %42 %uint_2 %uint_0 %uint_0 %uint_10 %uint_10 - %44 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 - %45 = OpAtomicIAdd %uint %44 %uint_2 %uint_0 %uint_10 - %46 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 - %47 = OpAtomicISub %uint %46 %uint_2 %uint_0 %uint_10 - %48 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 - %49 = OpAtomicExchange %uint %48 %uint_2 %uint_0 %uint_10 - %50 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 - %51 = OpAtomicUMin %uint %50 %uint_2 %uint_0 %uint_10 - %52 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 - %53 = OpAtomicUMax %uint %52 %uint_2 %uint_0 %uint_10 - %54 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 - %55 = OpAtomicAnd %uint %54 %uint_2 %uint_0 %uint_10 - %56 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 - %57 = OpAtomicOr %uint %56 %uint_2 %uint_0 %uint_10 - %58 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 - %59 = OpAtomicXor %uint %58 %uint_2 %uint_0 %uint_10 - %60 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 - %61 = OpAtomicIIncrement %uint %60 %uint_2 %uint_0 - %62 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 - %63 = OpAtomicIDecrement %uint %62 %uint_2 %uint_0 - %64 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 - %65 = OpAtomicCompareExchange %uint %64 %uint_2 %uint_0 %uint_0 %uint_10 %uint_10 - %66 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %67 = OpAtomicIAdd %uint %66 %uint_2 %uint_0 %uint_10 - %68 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %69 = OpAtomicISub %uint %68 %uint_2 %uint_0 %uint_10 - %70 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %71 = OpAtomicExchange %uint %70 %uint_2 %uint_0 %uint_10 - %72 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %73 = OpAtomicSMin %uint %72 %uint_2 %uint_0 %uint_10 - %74 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %75 = OpAtomicSMax %uint %74 %uint_2 %uint_0 %uint_10 - %76 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %77 = OpAtomicAnd %uint %76 %uint_2 %uint_0 %uint_10 - %78 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %79 = OpAtomicOr %uint %78 %uint_2 %uint_0 %uint_10 - %80 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %81 = OpAtomicXor %uint %80 %uint_2 %uint_0 %uint_10 - %82 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %83 = OpAtomicIIncrement %uint %82 %uint_2 %uint_0 - %84 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %85 = OpAtomicIDecrement %uint %84 %uint_2 %uint_0 - %86 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %87 = OpAtomicCompareExchange %uint %86 %uint_2 %uint_0 %uint_0 %uint_10 %uint_10 - %88 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %89 = OpAtomicIAdd %uint %88 %uint_2 %uint_0 %uint_10 - %90 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %91 = OpAtomicISub %uint %90 %uint_2 %uint_0 %uint_10 - %92 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %93 = OpAtomicExchange %uint %92 %uint_2 %uint_0 %uint_10 - %94 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %95 = OpAtomicUMin %uint %94 %uint_2 %uint_0 %uint_10 - %96 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %97 = OpAtomicUMax %uint %96 %uint_2 %uint_0 %uint_10 - %98 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %99 = OpAtomicAnd %uint %98 %uint_2 %uint_0 %uint_10 - %100 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %101 = OpAtomicOr %uint %100 %uint_2 %uint_0 %uint_10 - %102 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %103 = OpAtomicXor %uint %102 %uint_2 %uint_0 %uint_10 - %104 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %105 = OpAtomicIIncrement %uint %104 %uint_2 %uint_0 - %106 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %107 = OpAtomicIDecrement %uint %106 %uint_2 %uint_0 - %108 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %109 = OpAtomicCompareExchange %uint %108 %uint_2 %uint_0 %uint_0 %uint_10 %uint_10 + %A = OpFunctionParameter %_ptr_Workgroup_uint + %B = OpFunctionParameter %_ptr_Workgroup_uint + %C = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %D = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %B_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %C_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %D_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %A_addr %A Aligned 4 + OpStore %B_addr %B Aligned 4 + OpStore %C_addr %C Aligned 4 + OpStore %D_addr %D Aligned 4 + %19 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %call = OpAtomicIAdd %uint %19 %uint_2 %uint_0 %uint_10 + %24 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %call1 = OpAtomicISub %uint %24 %uint_2 %uint_0 %uint_10 + %26 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %call2 = OpAtomicExchange %uint %26 %uint_2 %uint_0 %uint_10 + %28 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %call3 = OpAtomicSMin %uint %28 %uint_2 %uint_0 %uint_10 + %30 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %call4 = OpAtomicSMax %uint %30 %uint_2 %uint_0 %uint_10 + %32 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %call5 = OpAtomicAnd %uint %32 %uint_2 %uint_0 %uint_10 + %34 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %call6 = OpAtomicOr %uint %34 %uint_2 %uint_0 %uint_10 + %36 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %call7 = OpAtomicXor %uint %36 %uint_2 %uint_0 %uint_10 + %38 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %call8 = OpAtomicIIncrement %uint %38 %uint_2 %uint_0 + %40 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %call9 = OpAtomicIDecrement %uint %40 %uint_2 %uint_0 + %42 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %call10 = OpAtomicCompareExchange %uint %42 %uint_2 %uint_0 %uint_0 %uint_10 %uint_10 + %44 = OpLoad %_ptr_Workgroup_uint %B_addr Aligned 4 + %call11 = OpAtomicIAdd %uint %44 %uint_2 %uint_0 %uint_10 + %46 = OpLoad %_ptr_Workgroup_uint %B_addr Aligned 4 + %call12 = OpAtomicISub %uint %46 %uint_2 %uint_0 %uint_10 + %48 = OpLoad %_ptr_Workgroup_uint %B_addr Aligned 4 + %call13 = OpAtomicExchange %uint %48 %uint_2 %uint_0 %uint_10 + %50 = OpLoad %_ptr_Workgroup_uint %B_addr Aligned 4 + %call14 = OpAtomicUMin %uint %50 %uint_2 %uint_0 %uint_10 + %52 = OpLoad %_ptr_Workgroup_uint %B_addr Aligned 4 + %call15 = OpAtomicUMax %uint %52 %uint_2 %uint_0 %uint_10 + %54 = OpLoad %_ptr_Workgroup_uint %B_addr Aligned 4 + %call16 = OpAtomicAnd %uint %54 %uint_2 %uint_0 %uint_10 + %56 = OpLoad %_ptr_Workgroup_uint %B_addr Aligned 4 + %call17 = OpAtomicOr %uint %56 %uint_2 %uint_0 %uint_10 + %58 = OpLoad %_ptr_Workgroup_uint %B_addr Aligned 4 + %call18 = OpAtomicXor %uint %58 %uint_2 %uint_0 %uint_10 + %60 = OpLoad %_ptr_Workgroup_uint %B_addr Aligned 4 + %call19 = OpAtomicIIncrement %uint %60 %uint_2 %uint_0 + %62 = OpLoad %_ptr_Workgroup_uint %B_addr Aligned 4 + %call20 = OpAtomicIDecrement %uint %62 %uint_2 %uint_0 + %64 = OpLoad %_ptr_Workgroup_uint %B_addr Aligned 4 + %call21 = OpAtomicCompareExchange %uint %64 %uint_2 %uint_0 %uint_0 %uint_10 %uint_10 + %66 = OpLoad %_ptr_CrossWorkgroup_uint %C_addr Aligned 4 + %call22 = OpAtomicIAdd %uint %66 %uint_2 %uint_0 %uint_10 + %68 = OpLoad %_ptr_CrossWorkgroup_uint %C_addr Aligned 4 + %call23 = OpAtomicISub %uint %68 %uint_2 %uint_0 %uint_10 + %70 = OpLoad %_ptr_CrossWorkgroup_uint %C_addr Aligned 4 + %call24 = OpAtomicExchange %uint %70 %uint_2 %uint_0 %uint_10 + %72 = OpLoad %_ptr_CrossWorkgroup_uint %C_addr Aligned 4 + %call25 = OpAtomicSMin %uint %72 %uint_2 %uint_0 %uint_10 + %74 = OpLoad %_ptr_CrossWorkgroup_uint %C_addr Aligned 4 + %call26 = OpAtomicSMax %uint %74 %uint_2 %uint_0 %uint_10 + %76 = OpLoad %_ptr_CrossWorkgroup_uint %C_addr Aligned 4 + %call27 = OpAtomicAnd %uint %76 %uint_2 %uint_0 %uint_10 + %78 = OpLoad %_ptr_CrossWorkgroup_uint %C_addr Aligned 4 + %call28 = OpAtomicOr %uint %78 %uint_2 %uint_0 %uint_10 + %80 = OpLoad %_ptr_CrossWorkgroup_uint %C_addr Aligned 4 + %call29 = OpAtomicXor %uint %80 %uint_2 %uint_0 %uint_10 + %82 = OpLoad %_ptr_CrossWorkgroup_uint %C_addr Aligned 4 + %call30 = OpAtomicIIncrement %uint %82 %uint_2 %uint_0 + %84 = OpLoad %_ptr_CrossWorkgroup_uint %C_addr Aligned 4 + %call31 = OpAtomicIDecrement %uint %84 %uint_2 %uint_0 + %86 = OpLoad %_ptr_CrossWorkgroup_uint %C_addr Aligned 4 + %call32 = OpAtomicCompareExchange %uint %86 %uint_2 %uint_0 %uint_0 %uint_10 %uint_10 + %88 = OpLoad %_ptr_CrossWorkgroup_uint %D_addr Aligned 4 + %call33 = OpAtomicIAdd %uint %88 %uint_2 %uint_0 %uint_10 + %90 = OpLoad %_ptr_CrossWorkgroup_uint %D_addr Aligned 4 + %call34 = OpAtomicISub %uint %90 %uint_2 %uint_0 %uint_10 + %92 = OpLoad %_ptr_CrossWorkgroup_uint %D_addr Aligned 4 + %call35 = OpAtomicExchange %uint %92 %uint_2 %uint_0 %uint_10 + %94 = OpLoad %_ptr_CrossWorkgroup_uint %D_addr Aligned 4 + %call36 = OpAtomicUMin %uint %94 %uint_2 %uint_0 %uint_10 + %96 = OpLoad %_ptr_CrossWorkgroup_uint %D_addr Aligned 4 + %call37 = OpAtomicUMax %uint %96 %uint_2 %uint_0 %uint_10 + %98 = OpLoad %_ptr_CrossWorkgroup_uint %D_addr Aligned 4 + %call38 = OpAtomicAnd %uint %98 %uint_2 %uint_0 %uint_10 + %100 = OpLoad %_ptr_CrossWorkgroup_uint %D_addr Aligned 4 + %call39 = OpAtomicOr %uint %100 %uint_2 %uint_0 %uint_10 + %102 = OpLoad %_ptr_CrossWorkgroup_uint %D_addr Aligned 4 + %call40 = OpAtomicXor %uint %102 %uint_2 %uint_0 %uint_10 + %104 = OpLoad %_ptr_CrossWorkgroup_uint %D_addr Aligned 4 + %call41 = OpAtomicIIncrement %uint %104 %uint_2 %uint_0 + %106 = OpLoad %_ptr_CrossWorkgroup_uint %D_addr Aligned 4 + %call42 = OpAtomicIDecrement %uint %106 %uint_2 %uint_0 + %108 = OpLoad %_ptr_CrossWorkgroup_uint %D_addr Aligned 4 + %call43 = OpAtomicCompareExchange %uint %108 %uint_2 %uint_0 %uint_0 %uint_10 %uint_10 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/definitions_int.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/definitions_int.spvasm index 3e62d46d1d..fa4365d478 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/definitions_int.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/definitions_int.spvasm @@ -10,10 +10,63 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %7 "definitions" OpSource OpenCL_C 200000 - OpDecorate %14 Alignment 4 - OpDecorate %15 Alignment 4 - OpDecorate %17 Alignment 4 - OpDecorate %18 Alignment 4 + OpName %A "A" + OpName %B "B" + OpName %C "C" + OpName %D "D" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpName %B_addr "B.addr" + OpName %C_addr "C.addr" + OpName %D_addr "D.addr" + OpName %call "call" + OpName %call1 "call1" + OpName %call2 "call2" + OpName %call3 "call3" + OpName %call4 "call4" + OpName %call5 "call5" + OpName %call6 "call6" + OpName %call7 "call7" + OpName %call8 "call8" + OpName %call9 "call9" + OpName %call10 "call10" + OpName %call11 "call11" + OpName %call12 "call12" + OpName %call13 "call13" + OpName %call14 "call14" + OpName %call15 "call15" + OpName %call16 "call16" + OpName %call17 "call17" + OpName %call18 "call18" + OpName %call19 "call19" + OpName %call20 "call20" + OpName %call21 "call21" + OpName %call22 "call22" + OpName %call23 "call23" + OpName %call24 "call24" + OpName %call25 "call25" + OpName %call26 "call26" + OpName %call27 "call27" + OpName %call28 "call28" + OpName %call29 "call29" + OpName %call30 "call30" + OpName %call31 "call31" + OpName %call32 "call32" + OpName %call33 "call33" + OpName %call34 "call34" + OpName %call35 "call35" + OpName %call36 "call36" + OpName %call37 "call37" + OpName %call38 "call38" + OpName %call39 "call39" + OpName %call40 "call40" + OpName %call41 "call41" + OpName %call42 "call42" + OpName %call43 "call43" + OpDecorate %A_addr Alignment 4 + OpDecorate %B_addr Alignment 4 + OpDecorate %C_addr Alignment 4 + OpDecorate %D_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_0 = OpConstant %uint 0 @@ -25,106 +78,106 @@ %_ptr_Function__ptr_Workgroup_uint = OpTypePointer Function %_ptr_Workgroup_uint %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %7 = OpFunction %void DontInline %6 - %8 = OpFunctionParameter %_ptr_Workgroup_uint - %9 = OpFunctionParameter %_ptr_Workgroup_uint - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpLabel - %14 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %15 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %18 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %14 %8 Aligned 4 - OpStore %15 %9 Aligned 4 - OpStore %17 %10 Aligned 4 - OpStore %18 %11 Aligned 4 - %19 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 - %23 = OpAtomicIAdd %uint %19 %uint_2 %uint_0 %uint_10 - %24 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 - %25 = OpAtomicISub %uint %24 %uint_2 %uint_0 %uint_10 - %26 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 - %27 = OpAtomicExchange %uint %26 %uint_2 %uint_0 %uint_10 - %28 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 - %29 = OpAtomicSMin %uint %28 %uint_2 %uint_0 %uint_10 - %30 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 - %31 = OpAtomicSMax %uint %30 %uint_2 %uint_0 %uint_10 - %32 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 - %33 = OpAtomicAnd %uint %32 %uint_2 %uint_0 %uint_10 - %34 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 - %35 = OpAtomicOr %uint %34 %uint_2 %uint_0 %uint_10 - %36 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 - %37 = OpAtomicXor %uint %36 %uint_2 %uint_0 %uint_10 - %38 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 - %39 = OpAtomicIIncrement %uint %38 %uint_2 %uint_0 - %40 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 - %41 = OpAtomicIDecrement %uint %40 %uint_2 %uint_0 - %42 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 - %43 = OpAtomicCompareExchange %uint %42 %uint_2 %uint_0 %uint_0 %uint_10 %uint_10 - %44 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 - %45 = OpAtomicIAdd %uint %44 %uint_2 %uint_0 %uint_10 - %46 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 - %47 = OpAtomicISub %uint %46 %uint_2 %uint_0 %uint_10 - %48 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 - %49 = OpAtomicExchange %uint %48 %uint_2 %uint_0 %uint_10 - %50 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 - %51 = OpAtomicUMin %uint %50 %uint_2 %uint_0 %uint_10 - %52 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 - %53 = OpAtomicUMax %uint %52 %uint_2 %uint_0 %uint_10 - %54 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 - %55 = OpAtomicAnd %uint %54 %uint_2 %uint_0 %uint_10 - %56 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 - %57 = OpAtomicOr %uint %56 %uint_2 %uint_0 %uint_10 - %58 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 - %59 = OpAtomicXor %uint %58 %uint_2 %uint_0 %uint_10 - %60 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 - %61 = OpAtomicIIncrement %uint %60 %uint_2 %uint_0 - %62 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 - %63 = OpAtomicIDecrement %uint %62 %uint_2 %uint_0 - %64 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 - %65 = OpAtomicCompareExchange %uint %64 %uint_2 %uint_0 %uint_0 %uint_10 %uint_10 - %66 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %67 = OpAtomicIAdd %uint %66 %uint_2 %uint_0 %uint_10 - %68 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %69 = OpAtomicISub %uint %68 %uint_2 %uint_0 %uint_10 - %70 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %71 = OpAtomicExchange %uint %70 %uint_2 %uint_0 %uint_10 - %72 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %73 = OpAtomicSMin %uint %72 %uint_2 %uint_0 %uint_10 - %74 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %75 = OpAtomicSMax %uint %74 %uint_2 %uint_0 %uint_10 - %76 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %77 = OpAtomicAnd %uint %76 %uint_2 %uint_0 %uint_10 - %78 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %79 = OpAtomicOr %uint %78 %uint_2 %uint_0 %uint_10 - %80 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %81 = OpAtomicXor %uint %80 %uint_2 %uint_0 %uint_10 - %82 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %83 = OpAtomicIIncrement %uint %82 %uint_2 %uint_0 - %84 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %85 = OpAtomicIDecrement %uint %84 %uint_2 %uint_0 - %86 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %87 = OpAtomicCompareExchange %uint %86 %uint_2 %uint_0 %uint_0 %uint_10 %uint_10 - %88 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %89 = OpAtomicIAdd %uint %88 %uint_2 %uint_0 %uint_10 - %90 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %91 = OpAtomicISub %uint %90 %uint_2 %uint_0 %uint_10 - %92 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %93 = OpAtomicExchange %uint %92 %uint_2 %uint_0 %uint_10 - %94 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %95 = OpAtomicUMin %uint %94 %uint_2 %uint_0 %uint_10 - %96 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %97 = OpAtomicUMax %uint %96 %uint_2 %uint_0 %uint_10 - %98 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %99 = OpAtomicAnd %uint %98 %uint_2 %uint_0 %uint_10 - %100 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %101 = OpAtomicOr %uint %100 %uint_2 %uint_0 %uint_10 - %102 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %103 = OpAtomicXor %uint %102 %uint_2 %uint_0 %uint_10 - %104 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %105 = OpAtomicIIncrement %uint %104 %uint_2 %uint_0 - %106 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %107 = OpAtomicIDecrement %uint %106 %uint_2 %uint_0 - %108 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %109 = OpAtomicCompareExchange %uint %108 %uint_2 %uint_0 %uint_0 %uint_10 %uint_10 + %A = OpFunctionParameter %_ptr_Workgroup_uint + %B = OpFunctionParameter %_ptr_Workgroup_uint + %C = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %D = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %B_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %C_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %D_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %A_addr %A Aligned 4 + OpStore %B_addr %B Aligned 4 + OpStore %C_addr %C Aligned 4 + OpStore %D_addr %D Aligned 4 + %19 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %call = OpAtomicIAdd %uint %19 %uint_2 %uint_0 %uint_10 + %24 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %call1 = OpAtomicISub %uint %24 %uint_2 %uint_0 %uint_10 + %26 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %call2 = OpAtomicExchange %uint %26 %uint_2 %uint_0 %uint_10 + %28 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %call3 = OpAtomicSMin %uint %28 %uint_2 %uint_0 %uint_10 + %30 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %call4 = OpAtomicSMax %uint %30 %uint_2 %uint_0 %uint_10 + %32 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %call5 = OpAtomicAnd %uint %32 %uint_2 %uint_0 %uint_10 + %34 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %call6 = OpAtomicOr %uint %34 %uint_2 %uint_0 %uint_10 + %36 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %call7 = OpAtomicXor %uint %36 %uint_2 %uint_0 %uint_10 + %38 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %call8 = OpAtomicIIncrement %uint %38 %uint_2 %uint_0 + %40 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %call9 = OpAtomicIDecrement %uint %40 %uint_2 %uint_0 + %42 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %call10 = OpAtomicCompareExchange %uint %42 %uint_2 %uint_0 %uint_0 %uint_10 %uint_10 + %44 = OpLoad %_ptr_Workgroup_uint %B_addr Aligned 4 + %call11 = OpAtomicIAdd %uint %44 %uint_2 %uint_0 %uint_10 + %46 = OpLoad %_ptr_Workgroup_uint %B_addr Aligned 4 + %call12 = OpAtomicISub %uint %46 %uint_2 %uint_0 %uint_10 + %48 = OpLoad %_ptr_Workgroup_uint %B_addr Aligned 4 + %call13 = OpAtomicExchange %uint %48 %uint_2 %uint_0 %uint_10 + %50 = OpLoad %_ptr_Workgroup_uint %B_addr Aligned 4 + %call14 = OpAtomicUMin %uint %50 %uint_2 %uint_0 %uint_10 + %52 = OpLoad %_ptr_Workgroup_uint %B_addr Aligned 4 + %call15 = OpAtomicUMax %uint %52 %uint_2 %uint_0 %uint_10 + %54 = OpLoad %_ptr_Workgroup_uint %B_addr Aligned 4 + %call16 = OpAtomicAnd %uint %54 %uint_2 %uint_0 %uint_10 + %56 = OpLoad %_ptr_Workgroup_uint %B_addr Aligned 4 + %call17 = OpAtomicOr %uint %56 %uint_2 %uint_0 %uint_10 + %58 = OpLoad %_ptr_Workgroup_uint %B_addr Aligned 4 + %call18 = OpAtomicXor %uint %58 %uint_2 %uint_0 %uint_10 + %60 = OpLoad %_ptr_Workgroup_uint %B_addr Aligned 4 + %call19 = OpAtomicIIncrement %uint %60 %uint_2 %uint_0 + %62 = OpLoad %_ptr_Workgroup_uint %B_addr Aligned 4 + %call20 = OpAtomicIDecrement %uint %62 %uint_2 %uint_0 + %64 = OpLoad %_ptr_Workgroup_uint %B_addr Aligned 4 + %call21 = OpAtomicCompareExchange %uint %64 %uint_2 %uint_0 %uint_0 %uint_10 %uint_10 + %66 = OpLoad %_ptr_CrossWorkgroup_uint %C_addr Aligned 4 + %call22 = OpAtomicIAdd %uint %66 %uint_2 %uint_0 %uint_10 + %68 = OpLoad %_ptr_CrossWorkgroup_uint %C_addr Aligned 4 + %call23 = OpAtomicISub %uint %68 %uint_2 %uint_0 %uint_10 + %70 = OpLoad %_ptr_CrossWorkgroup_uint %C_addr Aligned 4 + %call24 = OpAtomicExchange %uint %70 %uint_2 %uint_0 %uint_10 + %72 = OpLoad %_ptr_CrossWorkgroup_uint %C_addr Aligned 4 + %call25 = OpAtomicSMin %uint %72 %uint_2 %uint_0 %uint_10 + %74 = OpLoad %_ptr_CrossWorkgroup_uint %C_addr Aligned 4 + %call26 = OpAtomicSMax %uint %74 %uint_2 %uint_0 %uint_10 + %76 = OpLoad %_ptr_CrossWorkgroup_uint %C_addr Aligned 4 + %call27 = OpAtomicAnd %uint %76 %uint_2 %uint_0 %uint_10 + %78 = OpLoad %_ptr_CrossWorkgroup_uint %C_addr Aligned 4 + %call28 = OpAtomicOr %uint %78 %uint_2 %uint_0 %uint_10 + %80 = OpLoad %_ptr_CrossWorkgroup_uint %C_addr Aligned 4 + %call29 = OpAtomicXor %uint %80 %uint_2 %uint_0 %uint_10 + %82 = OpLoad %_ptr_CrossWorkgroup_uint %C_addr Aligned 4 + %call30 = OpAtomicIIncrement %uint %82 %uint_2 %uint_0 + %84 = OpLoad %_ptr_CrossWorkgroup_uint %C_addr Aligned 4 + %call31 = OpAtomicIDecrement %uint %84 %uint_2 %uint_0 + %86 = OpLoad %_ptr_CrossWorkgroup_uint %C_addr Aligned 4 + %call32 = OpAtomicCompareExchange %uint %86 %uint_2 %uint_0 %uint_0 %uint_10 %uint_10 + %88 = OpLoad %_ptr_CrossWorkgroup_uint %D_addr Aligned 4 + %call33 = OpAtomicIAdd %uint %88 %uint_2 %uint_0 %uint_10 + %90 = OpLoad %_ptr_CrossWorkgroup_uint %D_addr Aligned 4 + %call34 = OpAtomicISub %uint %90 %uint_2 %uint_0 %uint_10 + %92 = OpLoad %_ptr_CrossWorkgroup_uint %D_addr Aligned 4 + %call35 = OpAtomicExchange %uint %92 %uint_2 %uint_0 %uint_10 + %94 = OpLoad %_ptr_CrossWorkgroup_uint %D_addr Aligned 4 + %call36 = OpAtomicUMin %uint %94 %uint_2 %uint_0 %uint_10 + %96 = OpLoad %_ptr_CrossWorkgroup_uint %D_addr Aligned 4 + %call37 = OpAtomicUMax %uint %96 %uint_2 %uint_0 %uint_10 + %98 = OpLoad %_ptr_CrossWorkgroup_uint %D_addr Aligned 4 + %call38 = OpAtomicAnd %uint %98 %uint_2 %uint_0 %uint_10 + %100 = OpLoad %_ptr_CrossWorkgroup_uint %D_addr Aligned 4 + %call39 = OpAtomicOr %uint %100 %uint_2 %uint_0 %uint_10 + %102 = OpLoad %_ptr_CrossWorkgroup_uint %D_addr Aligned 4 + %call40 = OpAtomicXor %uint %102 %uint_2 %uint_0 %uint_10 + %104 = OpLoad %_ptr_CrossWorkgroup_uint %D_addr Aligned 4 + %call41 = OpAtomicIIncrement %uint %104 %uint_2 %uint_0 + %106 = OpLoad %_ptr_CrossWorkgroup_uint %D_addr Aligned 4 + %call42 = OpAtomicIDecrement %uint %106 %uint_2 %uint_0 + %108 = OpLoad %_ptr_CrossWorkgroup_uint %D_addr Aligned 4 + %call43 = OpAtomicCompareExchange %uint %108 %uint_2 %uint_0 %uint_0 %uint_10 %uint_10 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/definitions_long.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/definitions_long.spvasm index 7c2a4dea34..4b3d3fa160 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/definitions_long.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/definitions_long.spvasm @@ -12,10 +12,63 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %7 "definitions" OpSource OpenCL_C 200000 - OpDecorate %14 Alignment 4 - OpDecorate %15 Alignment 4 - OpDecorate %17 Alignment 4 - OpDecorate %18 Alignment 4 + OpName %G "G" + OpName %H "H" + OpName %I "I" + OpName %J "J" + OpName %entry "entry" + OpName %G_addr "G.addr" + OpName %H_addr "H.addr" + OpName %I_addr "I.addr" + OpName %J_addr "J.addr" + OpName %call "call" + OpName %call1 "call1" + OpName %call2 "call2" + OpName %call3 "call3" + OpName %call4 "call4" + OpName %call5 "call5" + OpName %call6 "call6" + OpName %call7 "call7" + OpName %call8 "call8" + OpName %call9 "call9" + OpName %call10 "call10" + OpName %call11 "call11" + OpName %call12 "call12" + OpName %call13 "call13" + OpName %call14 "call14" + OpName %call15 "call15" + OpName %call16 "call16" + OpName %call17 "call17" + OpName %call18 "call18" + OpName %call19 "call19" + OpName %call20 "call20" + OpName %call21 "call21" + OpName %call22 "call22" + OpName %call23 "call23" + OpName %call24 "call24" + OpName %call25 "call25" + OpName %call26 "call26" + OpName %call27 "call27" + OpName %call28 "call28" + OpName %call29 "call29" + OpName %call30 "call30" + OpName %call31 "call31" + OpName %call32 "call32" + OpName %call33 "call33" + OpName %call34 "call34" + OpName %call35 "call35" + OpName %call36 "call36" + OpName %call37 "call37" + OpName %call38 "call38" + OpName %call39 "call39" + OpName %call40 "call40" + OpName %call41 "call41" + OpName %call42 "call42" + OpName %call43 "call43" + OpDecorate %G_addr Alignment 4 + OpDecorate %H_addr Alignment 4 + OpDecorate %I_addr Alignment 4 + OpDecorate %J_addr Alignment 4 %ulong = OpTypeInt 64 0 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 @@ -28,106 +81,106 @@ %_ptr_Function__ptr_Workgroup_ulong = OpTypePointer Function %_ptr_Workgroup_ulong %_ptr_Function__ptr_CrossWorkgroup_ulong = OpTypePointer Function %_ptr_CrossWorkgroup_ulong %7 = OpFunction %void DontInline %6 - %8 = OpFunctionParameter %_ptr_Workgroup_ulong - %9 = OpFunctionParameter %_ptr_Workgroup_ulong - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_ulong - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_ulong - %12 = OpLabel - %14 = OpVariable %_ptr_Function__ptr_Workgroup_ulong Function - %15 = OpVariable %_ptr_Function__ptr_Workgroup_ulong Function - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_ulong Function - %18 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_ulong Function - OpStore %14 %8 Aligned 4 - OpStore %15 %9 Aligned 4 - OpStore %17 %10 Aligned 4 - OpStore %18 %11 Aligned 4 - %19 = OpLoad %_ptr_Workgroup_ulong %14 Aligned 4 - %24 = OpAtomicIAdd %ulong %19 %uint_2 %uint_0 %ulong_10 - %25 = OpLoad %_ptr_Workgroup_ulong %14 Aligned 4 - %26 = OpAtomicISub %ulong %25 %uint_2 %uint_0 %ulong_10 - %27 = OpLoad %_ptr_Workgroup_ulong %14 Aligned 4 - %28 = OpAtomicExchange %ulong %27 %uint_2 %uint_0 %ulong_10 - %29 = OpLoad %_ptr_Workgroup_ulong %14 Aligned 4 - %30 = OpAtomicSMin %ulong %29 %uint_2 %uint_0 %ulong_10 - %31 = OpLoad %_ptr_Workgroup_ulong %14 Aligned 4 - %32 = OpAtomicSMax %ulong %31 %uint_2 %uint_0 %ulong_10 - %33 = OpLoad %_ptr_Workgroup_ulong %14 Aligned 4 - %34 = OpAtomicAnd %ulong %33 %uint_2 %uint_0 %ulong_10 - %35 = OpLoad %_ptr_Workgroup_ulong %14 Aligned 4 - %36 = OpAtomicOr %ulong %35 %uint_2 %uint_0 %ulong_10 - %37 = OpLoad %_ptr_Workgroup_ulong %14 Aligned 4 - %38 = OpAtomicXor %ulong %37 %uint_2 %uint_0 %ulong_10 - %39 = OpLoad %_ptr_Workgroup_ulong %14 Aligned 4 - %40 = OpAtomicIIncrement %ulong %39 %uint_2 %uint_0 - %41 = OpLoad %_ptr_Workgroup_ulong %14 Aligned 4 - %42 = OpAtomicIDecrement %ulong %41 %uint_2 %uint_0 - %43 = OpLoad %_ptr_Workgroup_ulong %14 Aligned 4 - %44 = OpAtomicCompareExchange %ulong %43 %uint_2 %uint_0 %uint_0 %ulong_10 %ulong_10 - %45 = OpLoad %_ptr_Workgroup_ulong %15 Aligned 4 - %46 = OpAtomicIAdd %ulong %45 %uint_2 %uint_0 %ulong_10 - %47 = OpLoad %_ptr_Workgroup_ulong %15 Aligned 4 - %48 = OpAtomicISub %ulong %47 %uint_2 %uint_0 %ulong_10 - %49 = OpLoad %_ptr_Workgroup_ulong %15 Aligned 4 - %50 = OpAtomicExchange %ulong %49 %uint_2 %uint_0 %ulong_10 - %51 = OpLoad %_ptr_Workgroup_ulong %15 Aligned 4 - %52 = OpAtomicUMin %ulong %51 %uint_2 %uint_0 %ulong_10 - %53 = OpLoad %_ptr_Workgroup_ulong %15 Aligned 4 - %54 = OpAtomicUMax %ulong %53 %uint_2 %uint_0 %ulong_10 - %55 = OpLoad %_ptr_Workgroup_ulong %15 Aligned 4 - %56 = OpAtomicAnd %ulong %55 %uint_2 %uint_0 %ulong_10 - %57 = OpLoad %_ptr_Workgroup_ulong %15 Aligned 4 - %58 = OpAtomicOr %ulong %57 %uint_2 %uint_0 %ulong_10 - %59 = OpLoad %_ptr_Workgroup_ulong %15 Aligned 4 - %60 = OpAtomicXor %ulong %59 %uint_2 %uint_0 %ulong_10 - %61 = OpLoad %_ptr_Workgroup_ulong %15 Aligned 4 - %62 = OpAtomicIIncrement %ulong %61 %uint_2 %uint_0 - %63 = OpLoad %_ptr_Workgroup_ulong %15 Aligned 4 - %64 = OpAtomicIDecrement %ulong %63 %uint_2 %uint_0 - %65 = OpLoad %_ptr_Workgroup_ulong %15 Aligned 4 - %66 = OpAtomicCompareExchange %ulong %65 %uint_2 %uint_0 %uint_0 %ulong_10 %ulong_10 - %67 = OpLoad %_ptr_CrossWorkgroup_ulong %17 Aligned 4 - %68 = OpAtomicIAdd %ulong %67 %uint_2 %uint_0 %ulong_10 - %69 = OpLoad %_ptr_CrossWorkgroup_ulong %17 Aligned 4 - %70 = OpAtomicISub %ulong %69 %uint_2 %uint_0 %ulong_10 - %71 = OpLoad %_ptr_CrossWorkgroup_ulong %17 Aligned 4 - %72 = OpAtomicExchange %ulong %71 %uint_2 %uint_0 %ulong_10 - %73 = OpLoad %_ptr_CrossWorkgroup_ulong %17 Aligned 4 - %74 = OpAtomicSMin %ulong %73 %uint_2 %uint_0 %ulong_10 - %75 = OpLoad %_ptr_CrossWorkgroup_ulong %17 Aligned 4 - %76 = OpAtomicSMax %ulong %75 %uint_2 %uint_0 %ulong_10 - %77 = OpLoad %_ptr_CrossWorkgroup_ulong %17 Aligned 4 - %78 = OpAtomicAnd %ulong %77 %uint_2 %uint_0 %ulong_10 - %79 = OpLoad %_ptr_CrossWorkgroup_ulong %17 Aligned 4 - %80 = OpAtomicOr %ulong %79 %uint_2 %uint_0 %ulong_10 - %81 = OpLoad %_ptr_CrossWorkgroup_ulong %17 Aligned 4 - %82 = OpAtomicXor %ulong %81 %uint_2 %uint_0 %ulong_10 - %83 = OpLoad %_ptr_CrossWorkgroup_ulong %17 Aligned 4 - %84 = OpAtomicIIncrement %ulong %83 %uint_2 %uint_0 - %85 = OpLoad %_ptr_CrossWorkgroup_ulong %17 Aligned 4 - %86 = OpAtomicIDecrement %ulong %85 %uint_2 %uint_0 - %87 = OpLoad %_ptr_CrossWorkgroup_ulong %17 Aligned 4 - %88 = OpAtomicCompareExchange %ulong %87 %uint_2 %uint_0 %uint_0 %ulong_10 %ulong_10 - %89 = OpLoad %_ptr_CrossWorkgroup_ulong %18 Aligned 4 - %90 = OpAtomicIAdd %ulong %89 %uint_2 %uint_0 %ulong_10 - %91 = OpLoad %_ptr_CrossWorkgroup_ulong %18 Aligned 4 - %92 = OpAtomicISub %ulong %91 %uint_2 %uint_0 %ulong_10 - %93 = OpLoad %_ptr_CrossWorkgroup_ulong %18 Aligned 4 - %94 = OpAtomicExchange %ulong %93 %uint_2 %uint_0 %ulong_10 - %95 = OpLoad %_ptr_CrossWorkgroup_ulong %18 Aligned 4 - %96 = OpAtomicUMin %ulong %95 %uint_2 %uint_0 %ulong_10 - %97 = OpLoad %_ptr_CrossWorkgroup_ulong %18 Aligned 4 - %98 = OpAtomicUMax %ulong %97 %uint_2 %uint_0 %ulong_10 - %99 = OpLoad %_ptr_CrossWorkgroup_ulong %18 Aligned 4 - %100 = OpAtomicAnd %ulong %99 %uint_2 %uint_0 %ulong_10 - %101 = OpLoad %_ptr_CrossWorkgroup_ulong %18 Aligned 4 - %102 = OpAtomicOr %ulong %101 %uint_2 %uint_0 %ulong_10 - %103 = OpLoad %_ptr_CrossWorkgroup_ulong %18 Aligned 4 - %104 = OpAtomicXor %ulong %103 %uint_2 %uint_0 %ulong_10 - %105 = OpLoad %_ptr_CrossWorkgroup_ulong %18 Aligned 4 - %106 = OpAtomicIIncrement %ulong %105 %uint_2 %uint_0 - %107 = OpLoad %_ptr_CrossWorkgroup_ulong %18 Aligned 4 - %108 = OpAtomicIDecrement %ulong %107 %uint_2 %uint_0 - %109 = OpLoad %_ptr_CrossWorkgroup_ulong %18 Aligned 4 - %110 = OpAtomicCompareExchange %ulong %109 %uint_2 %uint_0 %uint_0 %ulong_10 %ulong_10 + %G = OpFunctionParameter %_ptr_Workgroup_ulong + %H = OpFunctionParameter %_ptr_Workgroup_ulong + %I = OpFunctionParameter %_ptr_CrossWorkgroup_ulong + %J = OpFunctionParameter %_ptr_CrossWorkgroup_ulong + %entry = OpLabel + %G_addr = OpVariable %_ptr_Function__ptr_Workgroup_ulong Function + %H_addr = OpVariable %_ptr_Function__ptr_Workgroup_ulong Function + %I_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_ulong Function + %J_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_ulong Function + OpStore %G_addr %G Aligned 4 + OpStore %H_addr %H Aligned 4 + OpStore %I_addr %I Aligned 4 + OpStore %J_addr %J Aligned 4 + %19 = OpLoad %_ptr_Workgroup_ulong %G_addr Aligned 4 + %call = OpAtomicIAdd %ulong %19 %uint_2 %uint_0 %ulong_10 + %25 = OpLoad %_ptr_Workgroup_ulong %G_addr Aligned 4 + %call1 = OpAtomicISub %ulong %25 %uint_2 %uint_0 %ulong_10 + %27 = OpLoad %_ptr_Workgroup_ulong %G_addr Aligned 4 + %call2 = OpAtomicExchange %ulong %27 %uint_2 %uint_0 %ulong_10 + %29 = OpLoad %_ptr_Workgroup_ulong %G_addr Aligned 4 + %call3 = OpAtomicSMin %ulong %29 %uint_2 %uint_0 %ulong_10 + %31 = OpLoad %_ptr_Workgroup_ulong %G_addr Aligned 4 + %call4 = OpAtomicSMax %ulong %31 %uint_2 %uint_0 %ulong_10 + %33 = OpLoad %_ptr_Workgroup_ulong %G_addr Aligned 4 + %call5 = OpAtomicAnd %ulong %33 %uint_2 %uint_0 %ulong_10 + %35 = OpLoad %_ptr_Workgroup_ulong %G_addr Aligned 4 + %call6 = OpAtomicOr %ulong %35 %uint_2 %uint_0 %ulong_10 + %37 = OpLoad %_ptr_Workgroup_ulong %G_addr Aligned 4 + %call7 = OpAtomicXor %ulong %37 %uint_2 %uint_0 %ulong_10 + %39 = OpLoad %_ptr_Workgroup_ulong %G_addr Aligned 4 + %call8 = OpAtomicIIncrement %ulong %39 %uint_2 %uint_0 + %41 = OpLoad %_ptr_Workgroup_ulong %G_addr Aligned 4 + %call9 = OpAtomicIDecrement %ulong %41 %uint_2 %uint_0 + %43 = OpLoad %_ptr_Workgroup_ulong %G_addr Aligned 4 + %call10 = OpAtomicCompareExchange %ulong %43 %uint_2 %uint_0 %uint_0 %ulong_10 %ulong_10 + %45 = OpLoad %_ptr_Workgroup_ulong %H_addr Aligned 4 + %call11 = OpAtomicIAdd %ulong %45 %uint_2 %uint_0 %ulong_10 + %47 = OpLoad %_ptr_Workgroup_ulong %H_addr Aligned 4 + %call12 = OpAtomicISub %ulong %47 %uint_2 %uint_0 %ulong_10 + %49 = OpLoad %_ptr_Workgroup_ulong %H_addr Aligned 4 + %call13 = OpAtomicExchange %ulong %49 %uint_2 %uint_0 %ulong_10 + %51 = OpLoad %_ptr_Workgroup_ulong %H_addr Aligned 4 + %call14 = OpAtomicUMin %ulong %51 %uint_2 %uint_0 %ulong_10 + %53 = OpLoad %_ptr_Workgroup_ulong %H_addr Aligned 4 + %call15 = OpAtomicUMax %ulong %53 %uint_2 %uint_0 %ulong_10 + %55 = OpLoad %_ptr_Workgroup_ulong %H_addr Aligned 4 + %call16 = OpAtomicAnd %ulong %55 %uint_2 %uint_0 %ulong_10 + %57 = OpLoad %_ptr_Workgroup_ulong %H_addr Aligned 4 + %call17 = OpAtomicOr %ulong %57 %uint_2 %uint_0 %ulong_10 + %59 = OpLoad %_ptr_Workgroup_ulong %H_addr Aligned 4 + %call18 = OpAtomicXor %ulong %59 %uint_2 %uint_0 %ulong_10 + %61 = OpLoad %_ptr_Workgroup_ulong %H_addr Aligned 4 + %call19 = OpAtomicIIncrement %ulong %61 %uint_2 %uint_0 + %63 = OpLoad %_ptr_Workgroup_ulong %H_addr Aligned 4 + %call20 = OpAtomicIDecrement %ulong %63 %uint_2 %uint_0 + %65 = OpLoad %_ptr_Workgroup_ulong %H_addr Aligned 4 + %call21 = OpAtomicCompareExchange %ulong %65 %uint_2 %uint_0 %uint_0 %ulong_10 %ulong_10 + %67 = OpLoad %_ptr_CrossWorkgroup_ulong %I_addr Aligned 4 + %call22 = OpAtomicIAdd %ulong %67 %uint_2 %uint_0 %ulong_10 + %69 = OpLoad %_ptr_CrossWorkgroup_ulong %I_addr Aligned 4 + %call23 = OpAtomicISub %ulong %69 %uint_2 %uint_0 %ulong_10 + %71 = OpLoad %_ptr_CrossWorkgroup_ulong %I_addr Aligned 4 + %call24 = OpAtomicExchange %ulong %71 %uint_2 %uint_0 %ulong_10 + %73 = OpLoad %_ptr_CrossWorkgroup_ulong %I_addr Aligned 4 + %call25 = OpAtomicSMin %ulong %73 %uint_2 %uint_0 %ulong_10 + %75 = OpLoad %_ptr_CrossWorkgroup_ulong %I_addr Aligned 4 + %call26 = OpAtomicSMax %ulong %75 %uint_2 %uint_0 %ulong_10 + %77 = OpLoad %_ptr_CrossWorkgroup_ulong %I_addr Aligned 4 + %call27 = OpAtomicAnd %ulong %77 %uint_2 %uint_0 %ulong_10 + %79 = OpLoad %_ptr_CrossWorkgroup_ulong %I_addr Aligned 4 + %call28 = OpAtomicOr %ulong %79 %uint_2 %uint_0 %ulong_10 + %81 = OpLoad %_ptr_CrossWorkgroup_ulong %I_addr Aligned 4 + %call29 = OpAtomicXor %ulong %81 %uint_2 %uint_0 %ulong_10 + %83 = OpLoad %_ptr_CrossWorkgroup_ulong %I_addr Aligned 4 + %call30 = OpAtomicIIncrement %ulong %83 %uint_2 %uint_0 + %85 = OpLoad %_ptr_CrossWorkgroup_ulong %I_addr Aligned 4 + %call31 = OpAtomicIDecrement %ulong %85 %uint_2 %uint_0 + %87 = OpLoad %_ptr_CrossWorkgroup_ulong %I_addr Aligned 4 + %call32 = OpAtomicCompareExchange %ulong %87 %uint_2 %uint_0 %uint_0 %ulong_10 %ulong_10 + %89 = OpLoad %_ptr_CrossWorkgroup_ulong %J_addr Aligned 4 + %call33 = OpAtomicIAdd %ulong %89 %uint_2 %uint_0 %ulong_10 + %91 = OpLoad %_ptr_CrossWorkgroup_ulong %J_addr Aligned 4 + %call34 = OpAtomicISub %ulong %91 %uint_2 %uint_0 %ulong_10 + %93 = OpLoad %_ptr_CrossWorkgroup_ulong %J_addr Aligned 4 + %call35 = OpAtomicExchange %ulong %93 %uint_2 %uint_0 %ulong_10 + %95 = OpLoad %_ptr_CrossWorkgroup_ulong %J_addr Aligned 4 + %call36 = OpAtomicUMin %ulong %95 %uint_2 %uint_0 %ulong_10 + %97 = OpLoad %_ptr_CrossWorkgroup_ulong %J_addr Aligned 4 + %call37 = OpAtomicUMax %ulong %97 %uint_2 %uint_0 %ulong_10 + %99 = OpLoad %_ptr_CrossWorkgroup_ulong %J_addr Aligned 4 + %call38 = OpAtomicAnd %ulong %99 %uint_2 %uint_0 %ulong_10 + %101 = OpLoad %_ptr_CrossWorkgroup_ulong %J_addr Aligned 4 + %call39 = OpAtomicOr %ulong %101 %uint_2 %uint_0 %ulong_10 + %103 = OpLoad %_ptr_CrossWorkgroup_ulong %J_addr Aligned 4 + %call40 = OpAtomicXor %ulong %103 %uint_2 %uint_0 %ulong_10 + %105 = OpLoad %_ptr_CrossWorkgroup_ulong %J_addr Aligned 4 + %call41 = OpAtomicIIncrement %ulong %105 %uint_2 %uint_0 + %107 = OpLoad %_ptr_CrossWorkgroup_ulong %J_addr Aligned 4 + %call42 = OpAtomicIDecrement %ulong %107 %uint_2 %uint_0 + %109 = OpLoad %_ptr_CrossWorkgroup_ulong %J_addr Aligned 4 + %call43 = OpAtomicCompareExchange %ulong %109 %uint_2 %uint_0 %uint_0 %ulong_10 %ulong_10 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/displaced.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/displaced.spvasm index 6b8e05cc26..4df3ec5bdc 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/displaced.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/displaced.spvasm @@ -13,12 +13,23 @@ OpEntryPoint Kernel %9 "atomicTest" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %A "A" + OpName %B "B" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpName %B_addr "B.addr" + OpName %C "C" + OpName %call "call" + OpName %add "add" + OpName %arrayidx "arrayidx" + OpName %add_ptr "add.ptr" + OpName %call1 "call1" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %14 Alignment 4 - OpDecorate %16 Alignment 4 - OpDecorate %20 Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %B_addr Alignment 4 + OpDecorate %C Alignment 4 %uint = OpTypeInt 32 0 %uchar = OpTypeInt 8 0 %uint_1 = OpConstant %uint 1 @@ -36,27 +47,27 @@ %_ptr_Function__ptr_Workgroup_uchar = OpTypePointer Function %_ptr_Workgroup_uchar %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_Workgroup_uint - %11 = OpFunctionParameter %uint - %12 = OpLabel - %14 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %16 = OpVariable %_ptr_Function_uint Function - %20 = OpVariable %_ptr_Function__ptr_Workgroup_uchar Function - OpStore %14 %10 Aligned 4 - OpStore %16 %11 Aligned 4 - %21 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 + %A = OpFunctionParameter %_ptr_Workgroup_uint + %B = OpFunctionParameter %uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %B_addr = OpVariable %_ptr_Function_uint Function + %C = OpVariable %_ptr_Function__ptr_Workgroup_uchar Function + OpStore %A_addr %A Aligned 4 + OpStore %B_addr %B Aligned 4 + %21 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 %22 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %23 = OpCompositeExtract %uint %22 0 - %25 = OpIAdd %uint %23 %uint_1 - %26 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %21 %25 - OpStore %26 %uint_42 Aligned 4 - %28 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 + %call = OpCompositeExtract %uint %22 0 + %add = OpIAdd %uint %call %uint_1 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %21 %add + OpStore %arrayidx %uint_42 Aligned 4 + %28 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 %29 = OpBitcast %_ptr_Workgroup_uchar %28 - OpStore %20 %29 Aligned 4 - %30 = OpLoad %_ptr_Workgroup_uchar %20 Aligned 4 - %31 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uchar %30 %uint_1 - %32 = OpBitcast %_ptr_Workgroup_uint %31 - %33 = OpLoad %uint %16 Aligned 4 - %36 = OpAtomicIAdd %uint %32 %uint_2 %uint_0 %33 + OpStore %C %29 Aligned 4 + %30 = OpLoad %_ptr_Workgroup_uchar %C Aligned 4 + %add_ptr = OpInBoundsPtrAccessChain %_ptr_Workgroup_uchar %30 %uint_1 + %32 = OpBitcast %_ptr_Workgroup_uint %add_ptr + %33 = OpLoad %uint %B_addr Aligned 4 + %call1 = OpAtomicIAdd %uint %32 %uint_2 %uint_0 %33 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/equality_fail.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/equality_fail.spvasm index d0636ecbb6..ebf84e0445 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/equality_fail.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/equality_fail.spvasm @@ -10,7 +10,11 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %6 "simple" OpSource OpenCL_C 200000 - OpDecorate %10 Alignment 4 + OpName %A "A" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpName %call "call" + OpDecorate %A_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_0 = OpConstant %uint 0 @@ -19,11 +23,11 @@ %5 = OpTypeFunction %void %_ptr_Workgroup_uint %_ptr_Function__ptr_Workgroup_uint = OpTypePointer Function %_ptr_Workgroup_uint %6 = OpFunction %void DontInline %5 - %7 = OpFunctionParameter %_ptr_Workgroup_uint - %8 = OpLabel - %10 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - OpStore %10 %7 Aligned 4 - %11 = OpLoad %_ptr_Workgroup_uint %10 Aligned 4 - %14 = OpAtomicIIncrement %uint %11 %uint_2 %uint_0 + %A = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + OpStore %A_addr %A Aligned 4 + %11 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %call = OpAtomicIIncrement %uint %11 %uint_2 %uint_0 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/forloop.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/forloop.spvasm index 9368dca217..06852ebb2f 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/forloop.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/forloop.spvasm @@ -12,16 +12,38 @@ OpEntryPoint Kernel %9 "blarp" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %A "A" + OpName %B "B" + OpName %C "C" + OpName %x "x" + OpName %entry "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %A_addr "A.addr" + OpName %B_addr "B.addr" + OpName %C_addr "C.addr" + OpName %x_addr "x.addr" + OpName %v "v" + OpName %i "i" + OpName %tid "tid" + OpName %call "call" + OpName %cmp "cmp" + OpName %add_ptr "add.ptr" + OpName %call1 "call1" + OpName %inc "inc" + OpName %arrayidx "arrayidx" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %20 Alignment 4 - OpDecorate %21 Alignment 4 - OpDecorate %22 Alignment 4 - OpDecorate %24 Alignment 4 - OpDecorate %25 Alignment 4 - OpDecorate %26 Alignment 4 - OpDecorate %27 Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %B_addr Alignment 4 + OpDecorate %C_addr Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %v Alignment 4 + OpDecorate %i Alignment 4 + OpDecorate %tid Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_2 = OpConstant %uint 2 @@ -36,50 +58,50 @@ %bool = OpTypeBool %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpFunctionParameter %uint - %14 = OpLabel - %20 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %21 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %22 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %24 = OpVariable %_ptr_Function_uint Function - %25 = OpVariable %_ptr_Function_uint Function - %26 = OpVariable %_ptr_Function_uint Function - %27 = OpVariable %_ptr_Function_uint Function - OpStore %20 %10 Aligned 4 - OpStore %21 %11 Aligned 4 - OpStore %22 %12 Aligned 4 - OpStore %24 %13 Aligned 4 + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %B = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %C = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %x = OpFunctionParameter %uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %B_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %C_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %x_addr = OpVariable %_ptr_Function_uint Function + %v = OpVariable %_ptr_Function_uint Function + %i = OpVariable %_ptr_Function_uint Function + %tid = OpVariable %_ptr_Function_uint Function + OpStore %A_addr %A Aligned 4 + OpStore %B_addr %B Aligned 4 + OpStore %C_addr %C Aligned 4 + OpStore %x_addr %x Aligned 4 %28 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %29 = OpCompositeExtract %uint %28 0 - OpStore %27 %29 Aligned 4 - OpStore %26 %uint_0 Aligned 4 - OpBranch %15 - %15 = OpLabel - %31 = OpLoad %uint %26 Aligned 4 - %32 = OpLoad %uint %24 Aligned 4 - %34 = OpSLessThan %bool %31 %32 - OpBranchConditional %34 %16 %18 - %16 = OpLabel - %35 = OpLoad %_ptr_CrossWorkgroup_uint %21 Aligned 4 - %36 = OpLoad %uint %26 Aligned 4 - %37 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %35 %36 - %38 = OpLoad %uint %25 Aligned 4 - %40 = OpAtomicIAdd %uint %37 %uint_2 %uint_0 %38 - OpStore %25 %40 Aligned 4 - OpBranch %17 - %17 = OpLabel - %41 = OpLoad %uint %26 Aligned 4 - %43 = OpIAdd %uint %41 %uint_1 - OpStore %26 %43 Aligned 4 - OpBranch %15 - %18 = OpLabel - %44 = OpLoad %uint %25 Aligned 4 - %45 = OpLoad %_ptr_CrossWorkgroup_uint %21 Aligned 4 - %46 = OpLoad %uint %27 Aligned 4 - %47 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %45 %46 - OpStore %47 %44 Aligned 4 + %call = OpCompositeExtract %uint %28 0 + OpStore %tid %call Aligned 4 + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %31 = OpLoad %uint %i Aligned 4 + %32 = OpLoad %uint %x_addr Aligned 4 + %cmp = OpSLessThan %bool %31 %32 + OpBranchConditional %cmp %for_body %for_end + %for_body = OpLabel + %35 = OpLoad %_ptr_CrossWorkgroup_uint %B_addr Aligned 4 + %36 = OpLoad %uint %i Aligned 4 + %add_ptr = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %35 %36 + %38 = OpLoad %uint %v Aligned 4 + %call1 = OpAtomicIAdd %uint %add_ptr %uint_2 %uint_0 %38 + OpStore %v %call1 Aligned 4 + OpBranch %for_inc + %for_inc = OpLabel + %41 = OpLoad %uint %i Aligned 4 + %inc = OpIAdd %uint %41 %uint_1 + OpStore %i %inc Aligned 4 + OpBranch %for_cond + %for_end = OpLabel + %44 = OpLoad %uint %v Aligned 4 + %45 = OpLoad %_ptr_CrossWorkgroup_uint %B_addr Aligned 4 + %46 = OpLoad %uint %tid Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %45 %46 + OpStore %arrayidx %44 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/histo.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/histo.spvasm index 9346ef6c8a..ada4460ef6 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/histo.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/histo.spvasm @@ -12,13 +12,24 @@ OpEntryPoint Kernel %9 "atomic" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %A "A" + OpName %B "B" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpName %B_addr "B.addr" + OpName %tid "tid" + OpName %t "t" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %add_ptr "add.ptr" + OpName %call1 "call1" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %14 Alignment 4 - OpDecorate %15 Alignment 4 - OpDecorate %17 Alignment 4 - OpDecorate %18 Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %B_addr Alignment 4 + OpDecorate %tid Alignment 4 + OpDecorate %t Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_0 = OpConstant %uint 0 @@ -31,26 +42,26 @@ %_ptr_Function_uint = OpTypePointer Function %uint %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_Workgroup_uint - %11 = OpFunctionParameter %_ptr_Workgroup_uint - %12 = OpLabel - %14 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %15 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %17 = OpVariable %_ptr_Function_uint Function - %18 = OpVariable %_ptr_Function_uint Function - OpStore %14 %10 Aligned 4 - OpStore %15 %11 Aligned 4 + %A = OpFunctionParameter %_ptr_Workgroup_uint + %B = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %B_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %tid = OpVariable %_ptr_Function_uint Function + %t = OpVariable %_ptr_Function_uint Function + OpStore %A_addr %A Aligned 4 + OpStore %B_addr %B Aligned 4 %19 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %20 = OpCompositeExtract %uint %19 0 - OpStore %17 %20 Aligned 4 - %21 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 - %22 = OpLoad %uint %17 Aligned 4 - %23 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %21 %22 - %24 = OpLoad %uint %23 Aligned 4 - OpStore %18 %24 Aligned 4 - %25 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 - %26 = OpLoad %uint %18 Aligned 4 - %27 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %25 %26 - %30 = OpAtomicIIncrement %uint %27 %uint_2 %uint_0 + %call = OpCompositeExtract %uint %19 0 + OpStore %tid %call Aligned 4 + %21 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %22 = OpLoad %uint %tid Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %21 %22 + %24 = OpLoad %uint %arrayidx Aligned 4 + OpStore %t %24 Aligned 4 + %25 = OpLoad %_ptr_Workgroup_uint %B_addr Aligned 4 + %26 = OpLoad %uint %t Aligned 4 + %add_ptr = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %25 %26 + %call1 = OpAtomicIIncrement %uint %add_ptr %uint_2 %uint_0 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/mismatched_types/int_add_with_long.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/mismatched_types/int_add_with_long.spvasm index 878258918b..b2d7cd7e80 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/mismatched_types/int_add_with_long.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/mismatched_types/int_add_with_long.spvasm @@ -13,11 +13,20 @@ OpEntryPoint Kernel %10 "atomicTest" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %A "A" + OpName %B "B" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpName %B_addr "B.addr" + OpName %call "call" + OpName %add "add" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %15 Alignment 4 - OpDecorate %17 Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %B_addr Alignment 4 %uint = OpTypeInt 32 0 %ulong = OpTypeInt 64 0 %uint_1 = OpConstant %uint 1 @@ -34,22 +43,22 @@ %_ptr_Workgroup_uint = OpTypePointer Workgroup %uint %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %10 = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_Workgroup_ulong - %12 = OpFunctionParameter %uint - %13 = OpLabel - %15 = OpVariable %_ptr_Function__ptr_Workgroup_ulong Function - %17 = OpVariable %_ptr_Function_uint Function - OpStore %15 %11 Aligned 4 - OpStore %17 %12 Aligned 4 - %18 = OpLoad %_ptr_Workgroup_ulong %15 Aligned 4 + %A = OpFunctionParameter %_ptr_Workgroup_ulong + %B = OpFunctionParameter %uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_Workgroup_ulong Function + %B_addr = OpVariable %_ptr_Function_uint Function + OpStore %A_addr %A Aligned 4 + OpStore %B_addr %B Aligned 4 + %18 = OpLoad %_ptr_Workgroup_ulong %A_addr Aligned 4 %19 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %20 = OpCompositeExtract %uint %19 0 - %22 = OpIAdd %uint %20 %uint_1 - %23 = OpInBoundsPtrAccessChain %_ptr_Workgroup_ulong %18 %22 - OpStore %23 %ulong_42 Aligned 8 - %25 = OpLoad %_ptr_Workgroup_ulong %15 Aligned 4 + %call = OpCompositeExtract %uint %19 0 + %add = OpIAdd %uint %call %uint_1 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_ulong %18 %add + OpStore %arrayidx %ulong_42 Aligned 8 + %25 = OpLoad %_ptr_Workgroup_ulong %A_addr Aligned 4 %27 = OpBitcast %_ptr_Workgroup_uint %25 - %28 = OpLoad %uint %17 Aligned 4 - %31 = OpAtomicIAdd %uint %27 %uint_2 %uint_0 %28 + %28 = OpLoad %uint %B_addr Aligned 4 + %call1 = OpAtomicIAdd %uint %27 %uint_2 %uint_0 %28 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/mismatched_types/int_add_with_short.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/mismatched_types/int_add_with_short.spvasm index aecb8d98d4..3e53f1b24f 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/mismatched_types/int_add_with_short.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/mismatched_types/int_add_with_short.spvasm @@ -1,4 +1,4 @@ -; @Config: 3, 1, 2 +; @Config: 3, 1, 3 ; SPIR-V ; Version: 1.0 ; Generator: Khronos LLVM/SPIR-V Translator; 14 @@ -13,11 +13,20 @@ OpEntryPoint Kernel %10 "atomicTest" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %A "A" + OpName %B "B" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpName %B_addr "B.addr" + OpName %call "call" + OpName %add "add" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %15 Alignment 4 - OpDecorate %17 Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %B_addr Alignment 4 %uint = OpTypeInt 32 0 %ushort = OpTypeInt 16 0 %uint_2 = OpConstant %uint 2 @@ -33,22 +42,22 @@ %_ptr_Workgroup_uint = OpTypePointer Workgroup %uint %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %10 = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_Workgroup_ushort - %12 = OpFunctionParameter %uint - %13 = OpLabel - %15 = OpVariable %_ptr_Function__ptr_Workgroup_ushort Function - %17 = OpVariable %_ptr_Function_uint Function - OpStore %15 %11 Aligned 4 - OpStore %17 %12 Aligned 4 - %18 = OpLoad %_ptr_Workgroup_ushort %15 Aligned 4 + %A = OpFunctionParameter %_ptr_Workgroup_ushort + %B = OpFunctionParameter %uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_Workgroup_ushort Function + %B_addr = OpVariable %_ptr_Function_uint Function + OpStore %A_addr %A Aligned 4 + OpStore %B_addr %B Aligned 4 + %18 = OpLoad %_ptr_Workgroup_ushort %A_addr Aligned 4 %19 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %20 = OpCompositeExtract %uint %19 0 - %22 = OpIAdd %uint %20 %uint_2 - %23 = OpInBoundsPtrAccessChain %_ptr_Workgroup_ushort %18 %22 - OpStore %23 %ushort_42 Aligned 2 - %25 = OpLoad %_ptr_Workgroup_ushort %15 Aligned 4 + %call = OpCompositeExtract %uint %19 0 + %add = OpIAdd %uint %call %uint_2 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_ushort %18 %add + OpStore %arrayidx %ushort_42 Aligned 2 + %25 = OpLoad %_ptr_Workgroup_ushort %A_addr Aligned 4 %27 = OpBitcast %_ptr_Workgroup_uint %25 - %28 = OpLoad %uint %17 Aligned 4 - %30 = OpAtomicIAdd %uint %27 %uint_2 %uint_0 %28 + %28 = OpLoad %uint %B_addr Aligned 4 + %call1 = OpAtomicIAdd %uint %27 %uint_2 %uint_0 %28 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/pointers.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/pointers.spvasm index 9cd2031e99..cc1765ffae 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/pointers.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/pointers.spvasm @@ -12,14 +12,32 @@ OpEntryPoint Kernel %9 "pointers" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %A "A" + OpName %B "B" + OpName %c "c" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_else "if.else" + OpName %if_end "if.end" + OpName %A_addr "A.addr" + OpName %B_addr "B.addr" + OpName %c_addr "c.addr" + OpName %p "p" + OpName %tid "tid" + OpName %call "call" + OpName %tobool "tobool" + OpName %add_ptr "add.ptr" + OpName %add_ptr1 "add.ptr1" + OpName %call2 "call2" + OpName %arrayidx "arrayidx" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %18 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %21 Alignment 4 - OpDecorate %22 Alignment 4 - OpDecorate %23 Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %B_addr Alignment 4 + OpDecorate %c_addr Alignment 4 + OpDecorate %p Alignment 4 + OpDecorate %tid Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_3 = OpConstant %uint 3 @@ -35,40 +53,40 @@ %bool = OpTypeBool %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_Workgroup_uint - %11 = OpFunctionParameter %_ptr_Workgroup_uint - %12 = OpFunctionParameter %uint - %13 = OpLabel - %18 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %19 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %21 = OpVariable %_ptr_Function_uint Function - %22 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %23 = OpVariable %_ptr_Function_uint Function - OpStore %18 %10 Aligned 4 - OpStore %19 %11 Aligned 4 - OpStore %21 %12 Aligned 4 + %A = OpFunctionParameter %_ptr_Workgroup_uint + %B = OpFunctionParameter %_ptr_Workgroup_uint + %c = OpFunctionParameter %uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %B_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %c_addr = OpVariable %_ptr_Function_uint Function + %p = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %tid = OpVariable %_ptr_Function_uint Function + OpStore %A_addr %A Aligned 4 + OpStore %B_addr %B Aligned 4 + OpStore %c_addr %c Aligned 4 %24 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %25 = OpCompositeExtract %uint %24 0 - OpStore %23 %25 Aligned 4 - %26 = OpLoad %uint %21 Aligned 4 - %29 = OpINotEqual %bool %26 %uint_0 - OpBranchConditional %29 %14 %15 - %14 = OpLabel - %30 = OpLoad %_ptr_Workgroup_uint %19 Aligned 4 - %32 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %30 %uint_3 - OpStore %22 %32 Aligned 4 - OpBranch %16 - %15 = OpLabel - %33 = OpLoad %_ptr_Workgroup_uint %18 Aligned 4 - %35 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %33 %uint_12 - OpStore %22 %35 Aligned 4 - OpBranch %16 - %16 = OpLabel - %36 = OpLoad %_ptr_Workgroup_uint %22 Aligned 4 - %38 = OpAtomicIIncrement %uint %36 %uint_2 %uint_0 - %39 = OpLoad %_ptr_Workgroup_uint %18 Aligned 4 - %40 = OpLoad %uint %23 Aligned 4 - %41 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %39 %40 - OpStore %41 %38 Aligned 4 + %call = OpCompositeExtract %uint %24 0 + OpStore %tid %call Aligned 4 + %26 = OpLoad %uint %c_addr Aligned 4 + %tobool = OpINotEqual %bool %26 %uint_0 + OpBranchConditional %tobool %if_then %if_else + %if_then = OpLabel + %30 = OpLoad %_ptr_Workgroup_uint %B_addr Aligned 4 + %add_ptr = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %30 %uint_3 + OpStore %p %add_ptr Aligned 4 + OpBranch %if_end + %if_else = OpLabel + %33 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %add_ptr1 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %33 %uint_12 + OpStore %p %add_ptr1 Aligned 4 + OpBranch %if_end + %if_end = OpLabel + %36 = OpLoad %_ptr_Workgroup_uint %p Aligned 4 + %call2 = OpAtomicIIncrement %uint %36 %uint_2 %uint_0 + %39 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %40 = OpLoad %uint %tid Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %39 %40 + OpStore %arrayidx %call2 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/refined_atomic_abstraction/bad_local_counters.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/refined_atomic_abstraction/bad_local_counters.spvasm index 5b39b9fcf3..35176a0f21 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/refined_atomic_abstraction/bad_local_counters.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/refined_atomic_abstraction/bad_local_counters.spvasm @@ -12,12 +12,21 @@ OpEntryPoint Kernel %10 "foo" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %localCounter "localCounter" + OpName %globalArray "globalArray" + OpName %entry "entry" + OpName %localCounter_addr "localCounter.addr" + OpName %globalArray_addr "globalArray.addr" + OpName %localIndex "localIndex" + OpName %call "call" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %15 Alignment 4 - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 + OpDecorate %localCounter_addr Alignment 4 + OpDecorate %globalArray_addr Alignment 4 + OpDecorate %localIndex Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_0 = OpConstant %uint 0 @@ -32,22 +41,22 @@ %_ptr_Function_uint = OpTypePointer Function %uint %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %10 = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_Workgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpLabel - %15 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - OpStore %15 %11 Aligned 4 - OpStore %17 %12 Aligned 4 - %20 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 - %23 = OpAtomicIIncrement %uint %20 %uint_2 %uint_0 - OpStore %19 %23 Aligned 4 +%localCounter = OpFunctionParameter %_ptr_Workgroup_uint +%globalArray = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel +%localCounter_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function +%globalArray_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %localIndex = OpVariable %_ptr_Function_uint Function + OpStore %localCounter_addr %localCounter Aligned 4 + OpStore %globalArray_addr %globalArray Aligned 4 + %20 = OpLoad %_ptr_Workgroup_uint %localCounter_addr Aligned 4 + %call = OpAtomicIIncrement %uint %20 %uint_2 %uint_0 + OpStore %localIndex %call Aligned 4 %24 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %25 = OpCompositeExtract %uint %24 0 - %26 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %27 = OpLoad %uint %19 Aligned 4 - %28 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %26 %27 - OpStore %28 %25 Aligned 4 + %call1 = OpCompositeExtract %uint %24 0 + %26 = OpLoad %_ptr_CrossWorkgroup_uint %globalArray_addr Aligned 4 + %27 = OpLoad %uint %localIndex Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %26 %27 + OpStore %arrayidx %call1 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/refined_atomic_abstraction/intra_local_counters.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/refined_atomic_abstraction/intra_local_counters.spvasm index d96393b037..a91d6b69da 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/refined_atomic_abstraction/intra_local_counters.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/atomics/refined_atomic_abstraction/intra_local_counters.spvasm @@ -12,12 +12,21 @@ OpEntryPoint Kernel %10 "foo" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %localCounter "localCounter" + OpName %globalArray "globalArray" + OpName %entry "entry" + OpName %localCounter_addr "localCounter.addr" + OpName %globalArray_addr "globalArray.addr" + OpName %localIndex "localIndex" + OpName %call "call" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %15 Alignment 4 - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 + OpDecorate %localCounter_addr Alignment 4 + OpDecorate %globalArray_addr Alignment 4 + OpDecorate %localIndex Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_0 = OpConstant %uint 0 @@ -32,22 +41,22 @@ %_ptr_Function_uint = OpTypePointer Function %uint %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %10 = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_Workgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpLabel - %15 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - OpStore %15 %11 Aligned 4 - OpStore %17 %12 Aligned 4 - %20 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 - %23 = OpAtomicIIncrement %uint %20 %uint_2 %uint_0 - OpStore %19 %23 Aligned 4 +%localCounter = OpFunctionParameter %_ptr_Workgroup_uint +%globalArray = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel +%localCounter_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function +%globalArray_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %localIndex = OpVariable %_ptr_Function_uint Function + OpStore %localCounter_addr %localCounter Aligned 4 + OpStore %globalArray_addr %globalArray Aligned 4 + %20 = OpLoad %_ptr_Workgroup_uint %localCounter_addr Aligned 4 + %call = OpAtomicIIncrement %uint %20 %uint_2 %uint_0 + OpStore %localIndex %call Aligned 4 %24 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %25 = OpCompositeExtract %uint %24 0 - %26 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %27 = OpLoad %uint %19 Aligned 4 - %28 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %26 %27 - OpStore %28 %25 Aligned 4 + %call1 = OpCompositeExtract %uint %24 0 + %26 = OpLoad %_ptr_CrossWorkgroup_uint %globalArray_addr Aligned 4 + %27 = OpLoad %uint %localIndex Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %26 %27 + OpStore %arrayidx %call1 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/barrier_intervals/test1.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/barrier_intervals/test1.spvasm index 49643f8f0b..93bdfb1189 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/barrier_intervals/test1.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/barrier_intervals/test1.spvasm @@ -12,10 +12,22 @@ OpEntryPoint Kernel %9 "simple_kernel" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %p "p" + OpName %entry "entry" + OpName %p_addr "p.addr" + OpName %call "call" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" + OpName %call2 "call2" + OpName %call3 "call3" + OpName %arrayidx4 "arrayidx4" + OpName %call5 "call5" + OpName %call6 "call6" + OpName %arrayidx7 "arrayidx7" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %13 Alignment 4 + OpDecorate %p_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_272 = OpConstant %uint 272 @@ -27,32 +39,32 @@ %_ptr_Function__ptr_Workgroup_uint = OpTypePointer Function %_ptr_Workgroup_uint %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_Workgroup_uint - %11 = OpLabel - %13 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - OpStore %13 %10 Aligned 4 + %p = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + OpStore %p_addr %p Aligned 4 %14 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %15 = OpCompositeExtract %uint %14 0 - %16 = OpLoad %_ptr_Workgroup_uint %13 Aligned 4 + %call = OpCompositeExtract %uint %14 0 + %16 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 %17 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %18 = OpCompositeExtract %uint %17 0 - %19 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %16 %18 - OpStore %19 %15 Aligned 4 + %call1 = OpCompositeExtract %uint %17 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %16 %call1 + OpStore %arrayidx %call Aligned 4 OpControlBarrier %uint_2 %uint_2 %uint_272 %22 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %23 = OpCompositeExtract %uint %22 0 - %24 = OpLoad %_ptr_Workgroup_uint %13 Aligned 4 + %call2 = OpCompositeExtract %uint %22 0 + %24 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 %25 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %26 = OpCompositeExtract %uint %25 0 - %27 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %24 %26 - OpStore %27 %23 Aligned 4 + %call3 = OpCompositeExtract %uint %25 0 + %arrayidx4 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %24 %call3 + OpStore %arrayidx4 %call2 Aligned 4 OpControlBarrier %uint_2 %uint_2 %uint_272 %28 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %29 = OpCompositeExtract %uint %28 0 - %30 = OpLoad %_ptr_Workgroup_uint %13 Aligned 4 + %call5 = OpCompositeExtract %uint %28 0 + %30 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 %31 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %32 = OpCompositeExtract %uint %31 0 - %33 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %30 %32 - OpStore %33 %29 Aligned 4 + %call6 = OpCompositeExtract %uint %31 0 + %arrayidx7 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %30 %call6 + OpStore %arrayidx7 %call5 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/barrier_intervals/test2.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/barrier_intervals/test2.spvasm index 7b12e3f627..b7a5fad748 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/barrier_intervals/test2.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/barrier_intervals/test2.spvasm @@ -12,10 +12,26 @@ OpEntryPoint Kernel %9 "simple_kernel" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %p "p" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %p_addr "p.addr" + OpName %call "call" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" + OpName %call2 "call2" + OpName %cmp "cmp" + OpName %call3 "call3" + OpName %call4 "call4" + OpName %arrayidx5 "arrayidx5" + OpName %call6 "call6" + OpName %call7 "call7" + OpName %arrayidx8 "arrayidx8" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %15 Alignment 4 + OpDecorate %p_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_2 = OpConstant %uint 2 @@ -29,39 +45,39 @@ %bool = OpTypeBool %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_Workgroup_uint - %11 = OpLabel - %15 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - OpStore %15 %10 Aligned 4 + %p = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + OpStore %p_addr %p Aligned 4 %16 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %17 = OpCompositeExtract %uint %16 0 - %18 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 + %call = OpCompositeExtract %uint %16 0 + %18 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 %19 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %20 = OpCompositeExtract %uint %19 0 - %21 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %18 %20 - OpStore %21 %17 Aligned 4 + %call1 = OpCompositeExtract %uint %19 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %18 %call1 + OpStore %arrayidx %call Aligned 4 %22 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %23 = OpCompositeExtract %uint %22 0 - %26 = OpIEqual %bool %23 %uint_0 - OpBranchConditional %26 %12 %13 - %12 = OpLabel + %call2 = OpCompositeExtract %uint %22 0 + %cmp = OpIEqual %bool %call2 %uint_0 + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_272 - OpBranch %13 - %13 = OpLabel + OpBranch %if_end + %if_end = OpLabel %29 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %30 = OpCompositeExtract %uint %29 0 - %31 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 + %call3 = OpCompositeExtract %uint %29 0 + %31 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 %32 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %33 = OpCompositeExtract %uint %32 0 - %34 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %31 %33 - OpStore %34 %30 Aligned 4 + %call4 = OpCompositeExtract %uint %32 0 + %arrayidx5 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %31 %call4 + OpStore %arrayidx5 %call3 Aligned 4 OpControlBarrier %uint_2 %uint_2 %uint_272 %35 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %36 = OpCompositeExtract %uint %35 0 - %37 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 + %call6 = OpCompositeExtract %uint %35 0 + %37 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 %38 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %39 = OpCompositeExtract %uint %38 0 - %40 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %37 %39 - OpStore %40 %36 Aligned 4 + %call7 = OpCompositeExtract %uint %38 0 + %arrayidx8 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %37 %call7 + OpStore %arrayidx8 %call6 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/barrier_intervals/test3.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/barrier_intervals/test3.spvasm index 917d040f14..b776fdc14d 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/barrier_intervals/test3.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/barrier_intervals/test3.spvasm @@ -13,13 +13,41 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" OpName %barrier_wrapper "barrier_wrapper" + OpName %entry "entry" + OpName %p "p" + OpName %entry_0 "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %if_then "if.then" + OpName %for_cond5 "for.cond5" + OpName %for_body7 "for.body7" + OpName %for_inc11 "for.inc11" + OpName %for_end13 "for.end13" + OpName %if_end "if.end" + OpName %p_addr "p.addr" + OpName %i "i" + OpName %i4 "i4" + OpName %cmp "cmp" + OpName %call "call" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" + OpName %inc "inc" + OpName %arrayidx2 "arrayidx2" + OpName %cmp3 "cmp3" + OpName %cmp6 "cmp6" + OpName %call8 "call8" + OpName %call9 "call9" + OpName %arrayidx10 "arrayidx10" + OpName %inc12 "inc12" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %barrier_wrapper LinkageAttributes "barrier_wrapper" Export OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %28 Alignment 4 - OpDecorate %30 Alignment 4 - OpDecorate %31 Alignment 4 + OpDecorate %p_addr Alignment 4 + OpDecorate %i Alignment 4 + OpDecorate %i4 Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_784 = OpConstant %uint 784 @@ -38,70 +66,70 @@ %bool = OpTypeBool %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %barrier_wrapper = OpFunction %void DontInline %7 - %9 = OpLabel + %entry = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_784 OpReturn OpFunctionEnd %14 = OpFunction %void DontInline %13 - %15 = OpFunctionParameter %_ptr_Workgroup_uint - %16 = OpLabel - %28 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %30 = OpVariable %_ptr_Function_uint Function - %31 = OpVariable %_ptr_Function_uint Function - OpStore %28 %15 Aligned 4 - OpStore %30 %uint_0 Aligned 4 - OpBranch %17 - %17 = OpLabel - %33 = OpLoad %uint %30 Aligned 4 - %36 = OpSLessThan %bool %33 %uint_100 - OpBranchConditional %36 %18 %20 - %18 = OpLabel + %p = OpFunctionParameter %_ptr_Workgroup_uint + %entry_0 = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %i = OpVariable %_ptr_Function_uint Function + %i4 = OpVariable %_ptr_Function_uint Function + OpStore %p_addr %p Aligned 4 + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %33 = OpLoad %uint %i Aligned 4 + %cmp = OpSLessThan %bool %33 %uint_100 + OpBranchConditional %cmp %for_body %for_end + %for_body = OpLabel %37 = OpFunctionCall %void %barrier_wrapper %38 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %39 = OpCompositeExtract %uint %38 0 - %40 = OpLoad %_ptr_Workgroup_uint %28 Aligned 4 + %call = OpCompositeExtract %uint %38 0 + %40 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 %41 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %42 = OpCompositeExtract %uint %41 0 - %43 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %40 %42 - OpStore %43 %39 Aligned 4 + %call1 = OpCompositeExtract %uint %41 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %40 %call1 + OpStore %arrayidx %call Aligned 4 %44 = OpFunctionCall %void %barrier_wrapper - OpBranch %19 - %19 = OpLabel - %45 = OpLoad %uint %30 Aligned 4 - %47 = OpIAdd %uint %45 %uint_1 - OpStore %30 %47 Aligned 4 - OpBranch %17 - %20 = OpLabel - %48 = OpLoad %_ptr_Workgroup_uint %28 Aligned 4 - %49 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %48 %uint_0 - %50 = OpLoad %uint %49 Aligned 4 - %52 = OpIEqual %bool %50 %uint_22 - OpBranchConditional %52 %21 %26 - %21 = OpLabel - OpStore %31 %uint_0 Aligned 4 - OpBranch %22 - %22 = OpLabel - %53 = OpLoad %uint %31 Aligned 4 - %54 = OpSLessThan %bool %53 %uint_100 - OpBranchConditional %54 %23 %25 - %23 = OpLabel + OpBranch %for_inc + %for_inc = OpLabel + %45 = OpLoad %uint %i Aligned 4 + %inc = OpIAdd %uint %45 %uint_1 + OpStore %i %inc Aligned 4 + OpBranch %for_cond + %for_end = OpLabel + %48 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %48 %uint_0 + %50 = OpLoad %uint %arrayidx2 Aligned 4 + %cmp3 = OpIEqual %bool %50 %uint_22 + OpBranchConditional %cmp3 %if_then %if_end + %if_then = OpLabel + OpStore %i4 %uint_0 Aligned 4 + OpBranch %for_cond5 + %for_cond5 = OpLabel + %53 = OpLoad %uint %i4 Aligned 4 + %cmp6 = OpSLessThan %bool %53 %uint_100 + OpBranchConditional %cmp6 %for_body7 %for_end13 + %for_body7 = OpLabel %55 = OpFunctionCall %void %barrier_wrapper %56 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %57 = OpCompositeExtract %uint %56 0 - %58 = OpLoad %_ptr_Workgroup_uint %28 Aligned 4 + %call8 = OpCompositeExtract %uint %56 0 + %58 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 %59 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %60 = OpCompositeExtract %uint %59 0 - %61 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %58 %60 - OpStore %61 %57 Aligned 4 + %call9 = OpCompositeExtract %uint %59 0 + %arrayidx10 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %58 %call9 + OpStore %arrayidx10 %call8 Aligned 4 %62 = OpFunctionCall %void %barrier_wrapper - OpBranch %24 - %24 = OpLabel - %63 = OpLoad %uint %31 Aligned 4 - %64 = OpIAdd %uint %63 %uint_1 - OpStore %31 %64 Aligned 4 - OpBranch %22 - %25 = OpLabel - OpBranch %26 - %26 = OpLabel + OpBranch %for_inc11 + %for_inc11 = OpLabel + %63 = OpLoad %uint %i4 Aligned 4 + %inc12 = OpIAdd %uint %63 %uint_1 + OpStore %i4 %inc12 Aligned 4 + OpBranch %for_cond5 + %for_end13 = OpLabel + OpBranch %if_end + %if_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/barrier_intervals/test4.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/barrier_intervals/test4.spvasm index acf3670f82..519fcade0b 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/barrier_intervals/test4.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/barrier_intervals/test4.spvasm @@ -13,15 +13,63 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" OpName %barrier_wrapper "barrier_wrapper" + OpName %entry "entry" + OpName %p "p" + OpName %entry_0 "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %if_then "if.then" + OpName %for_cond5 "for.cond5" + OpName %for_body7 "for.body7" + OpName %for_inc11 "for.inc11" + OpName %for_end13 "for.end13" + OpName %for_cond15 "for.cond15" + OpName %for_body17 "for.body17" + OpName %for_inc21 "for.inc21" + OpName %for_end23 "for.end23" + OpName %for_cond25 "for.cond25" + OpName %for_body27 "for.body27" + OpName %for_inc31 "for.inc31" + OpName %for_end33 "for.end33" + OpName %if_end "if.end" + OpName %p_addr "p.addr" + OpName %i "i" + OpName %i4 "i4" + OpName %i14 "i14" + OpName %i24 "i24" + OpName %cmp "cmp" + OpName %call "call" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" + OpName %inc "inc" + OpName %arrayidx2 "arrayidx2" + OpName %cmp3 "cmp3" + OpName %cmp6 "cmp6" + OpName %call8 "call8" + OpName %call9 "call9" + OpName %arrayidx10 "arrayidx10" + OpName %inc12 "inc12" + OpName %cmp16 "cmp16" + OpName %call18 "call18" + OpName %call19 "call19" + OpName %arrayidx20 "arrayidx20" + OpName %inc22 "inc22" + OpName %cmp26 "cmp26" + OpName %call28 "call28" + OpName %call29 "call29" + OpName %arrayidx30 "arrayidx30" + OpName %inc32 "inc32" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %barrier_wrapper LinkageAttributes "barrier_wrapper" Export OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %36 Alignment 4 - OpDecorate %38 Alignment 4 - OpDecorate %39 Alignment 4 - OpDecorate %40 Alignment 4 - OpDecorate %41 Alignment 4 + OpDecorate %p_addr Alignment 4 + OpDecorate %i Alignment 4 + OpDecorate %i4 Alignment 4 + OpDecorate %i14 Alignment 4 + OpDecorate %i24 Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_784 = OpConstant %uint 784 @@ -40,115 +88,115 @@ %bool = OpTypeBool %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %barrier_wrapper = OpFunction %void DontInline %7 - %9 = OpLabel + %entry = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_784 OpReturn OpFunctionEnd %14 = OpFunction %void DontInline %13 - %15 = OpFunctionParameter %_ptr_Workgroup_uint - %16 = OpLabel - %36 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %38 = OpVariable %_ptr_Function_uint Function - %39 = OpVariable %_ptr_Function_uint Function - %40 = OpVariable %_ptr_Function_uint Function - %41 = OpVariable %_ptr_Function_uint Function - OpStore %36 %15 Aligned 4 - OpStore %38 %uint_0 Aligned 4 - OpBranch %17 - %17 = OpLabel - %43 = OpLoad %uint %38 Aligned 4 - %46 = OpSLessThan %bool %43 %uint_100 - OpBranchConditional %46 %18 %20 - %18 = OpLabel + %p = OpFunctionParameter %_ptr_Workgroup_uint + %entry_0 = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %i = OpVariable %_ptr_Function_uint Function + %i4 = OpVariable %_ptr_Function_uint Function + %i14 = OpVariable %_ptr_Function_uint Function + %i24 = OpVariable %_ptr_Function_uint Function + OpStore %p_addr %p Aligned 4 + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %43 = OpLoad %uint %i Aligned 4 + %cmp = OpSLessThan %bool %43 %uint_100 + OpBranchConditional %cmp %for_body %for_end + %for_body = OpLabel %47 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %48 = OpCompositeExtract %uint %47 0 - %49 = OpLoad %_ptr_Workgroup_uint %36 Aligned 4 + %call = OpCompositeExtract %uint %47 0 + %49 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 %50 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %51 = OpCompositeExtract %uint %50 0 - %52 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %49 %51 - OpStore %52 %48 Aligned 4 + %call1 = OpCompositeExtract %uint %50 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %49 %call1 + OpStore %arrayidx %call Aligned 4 %53 = OpFunctionCall %void %barrier_wrapper - OpBranch %19 - %19 = OpLabel - %54 = OpLoad %uint %38 Aligned 4 - %56 = OpIAdd %uint %54 %uint_1 - OpStore %38 %56 Aligned 4 - OpBranch %17 - %20 = OpLabel - %57 = OpLoad %_ptr_Workgroup_uint %36 Aligned 4 - %58 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %57 %uint_0 - %59 = OpLoad %uint %58 Aligned 4 - %61 = OpIEqual %bool %59 %uint_22 - OpBranchConditional %61 %21 %34 - %21 = OpLabel + OpBranch %for_inc + %for_inc = OpLabel + %54 = OpLoad %uint %i Aligned 4 + %inc = OpIAdd %uint %54 %uint_1 + OpStore %i %inc Aligned 4 + OpBranch %for_cond + %for_end = OpLabel + %57 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %57 %uint_0 + %59 = OpLoad %uint %arrayidx2 Aligned 4 + %cmp3 = OpIEqual %bool %59 %uint_22 + OpBranchConditional %cmp3 %if_then %if_end + %if_then = OpLabel %62 = OpFunctionCall %void %barrier_wrapper - OpStore %39 %uint_0 Aligned 4 - OpBranch %22 - %22 = OpLabel - %63 = OpLoad %uint %39 Aligned 4 - %64 = OpSLessThan %bool %63 %uint_100 - OpBranchConditional %64 %23 %25 - %23 = OpLabel + OpStore %i4 %uint_0 Aligned 4 + OpBranch %for_cond5 + %for_cond5 = OpLabel + %63 = OpLoad %uint %i4 Aligned 4 + %cmp6 = OpSLessThan %bool %63 %uint_100 + OpBranchConditional %cmp6 %for_body7 %for_end13 + %for_body7 = OpLabel %65 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %66 = OpCompositeExtract %uint %65 0 - %67 = OpLoad %_ptr_Workgroup_uint %36 Aligned 4 + %call8 = OpCompositeExtract %uint %65 0 + %67 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 %68 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %69 = OpCompositeExtract %uint %68 0 - %70 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %67 %69 - OpStore %70 %66 Aligned 4 + %call9 = OpCompositeExtract %uint %68 0 + %arrayidx10 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %67 %call9 + OpStore %arrayidx10 %call8 Aligned 4 %71 = OpFunctionCall %void %barrier_wrapper - OpBranch %24 - %24 = OpLabel - %72 = OpLoad %uint %39 Aligned 4 - %73 = OpIAdd %uint %72 %uint_1 - OpStore %39 %73 Aligned 4 - OpBranch %22 - %25 = OpLabel - OpStore %40 %uint_0 Aligned 4 - OpBranch %26 - %26 = OpLabel - %74 = OpLoad %uint %40 Aligned 4 - %75 = OpSLessThan %bool %74 %uint_100 - OpBranchConditional %75 %27 %29 - %27 = OpLabel + OpBranch %for_inc11 + %for_inc11 = OpLabel + %72 = OpLoad %uint %i4 Aligned 4 + %inc12 = OpIAdd %uint %72 %uint_1 + OpStore %i4 %inc12 Aligned 4 + OpBranch %for_cond5 + %for_end13 = OpLabel + OpStore %i14 %uint_0 Aligned 4 + OpBranch %for_cond15 + %for_cond15 = OpLabel + %74 = OpLoad %uint %i14 Aligned 4 + %cmp16 = OpSLessThan %bool %74 %uint_100 + OpBranchConditional %cmp16 %for_body17 %for_end23 + %for_body17 = OpLabel %76 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %77 = OpCompositeExtract %uint %76 0 - %78 = OpLoad %_ptr_Workgroup_uint %36 Aligned 4 + %call18 = OpCompositeExtract %uint %76 0 + %78 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 %79 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %80 = OpCompositeExtract %uint %79 0 - %81 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %78 %80 - OpStore %81 %77 Aligned 4 + %call19 = OpCompositeExtract %uint %79 0 + %arrayidx20 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %78 %call19 + OpStore %arrayidx20 %call18 Aligned 4 %82 = OpFunctionCall %void %barrier_wrapper - OpBranch %28 - %28 = OpLabel - %83 = OpLoad %uint %40 Aligned 4 - %84 = OpIAdd %uint %83 %uint_1 - OpStore %40 %84 Aligned 4 - OpBranch %26 - %29 = OpLabel - OpStore %41 %uint_0 Aligned 4 - OpBranch %30 - %30 = OpLabel - %85 = OpLoad %uint %41 Aligned 4 - %86 = OpSLessThan %bool %85 %uint_100 - OpBranchConditional %86 %31 %33 - %31 = OpLabel + OpBranch %for_inc21 + %for_inc21 = OpLabel + %83 = OpLoad %uint %i14 Aligned 4 + %inc22 = OpIAdd %uint %83 %uint_1 + OpStore %i14 %inc22 Aligned 4 + OpBranch %for_cond15 + %for_end23 = OpLabel + OpStore %i24 %uint_0 Aligned 4 + OpBranch %for_cond25 + %for_cond25 = OpLabel + %85 = OpLoad %uint %i24 Aligned 4 + %cmp26 = OpSLessThan %bool %85 %uint_100 + OpBranchConditional %cmp26 %for_body27 %for_end33 + %for_body27 = OpLabel %87 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %88 = OpCompositeExtract %uint %87 0 - %89 = OpLoad %_ptr_Workgroup_uint %36 Aligned 4 + %call28 = OpCompositeExtract %uint %87 0 + %89 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 %90 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %91 = OpCompositeExtract %uint %90 0 - %92 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %89 %91 - OpStore %92 %88 Aligned 4 + %call29 = OpCompositeExtract %uint %90 0 + %arrayidx30 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %89 %call29 + OpStore %arrayidx30 %call28 Aligned 4 %93 = OpFunctionCall %void %barrier_wrapper - OpBranch %32 - %32 = OpLabel - %94 = OpLoad %uint %41 Aligned 4 - %95 = OpIAdd %uint %94 %uint_1 - OpStore %41 %95 Aligned 4 - OpBranch %30 - %33 = OpLabel - OpBranch %34 - %34 = OpLabel + OpBranch %for_inc31 + %for_inc31 = OpLabel + %94 = OpLoad %uint %i24 Aligned 4 + %inc32 = OpIAdd %uint %94 %uint_1 + OpStore %i24 %inc32 Aligned 4 + OpBranch %for_cond25 + %for_end33 = OpLabel + OpBranch %if_end + %if_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/barrierconditionalkernelparam.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/barrierconditionalkernelparam.spvasm index fa0a89d0a8..3c0e6fc9f3 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/barrierconditionalkernelparam.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/barrierconditionalkernelparam.spvasm @@ -10,7 +10,13 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %5 "foo" OpSource OpenCL_C 200000 - OpDecorate %11 Alignment 4 + OpName %x "x" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %x_addr "x.addr" + OpName %cmp "cmp" + OpDecorate %x_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_10 = OpConstant %uint 10 %uint_2 = OpConstant %uint 2 @@ -20,16 +26,16 @@ %_ptr_Function_uint = OpTypePointer Function %uint %bool = OpTypeBool %5 = OpFunction %void DontInline %4 - %6 = OpFunctionParameter %uint - %7 = OpLabel - %11 = OpVariable %_ptr_Function_uint Function - OpStore %11 %6 Aligned 4 - %12 = OpLoad %uint %11 Aligned 4 - %15 = OpIEqual %bool %12 %uint_10 - OpBranchConditional %15 %8 %9 - %8 = OpLabel + %x = OpFunctionParameter %uint + %entry = OpLabel + %x_addr = OpVariable %_ptr_Function_uint Function + OpStore %x_addr %x Aligned 4 + %12 = OpLoad %uint %x_addr Aligned 4 + %cmp = OpIEqual %bool %12 %uint_10 + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_272 - OpBranch %9 - %9 = OpLabel + OpBranch %if_end + %if_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/basic1.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/basic1.spvasm index 90dca4e45e..e5412e2b40 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/basic1.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/basic1.spvasm @@ -10,9 +10,14 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %4 "foo" OpSource OpenCL_C 200000 - OpDecorate %8 Alignment 4 - OpDecorate %9 Alignment 4 - OpDecorate %10 Alignment 4 + OpName %entry "entry" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %add "add" + OpDecorate %a Alignment 4 + OpDecorate %b Alignment 4 + OpDecorate %c Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_3 = OpConstant %uint 3 @@ -20,15 +25,15 @@ %3 = OpTypeFunction %void %_ptr_Function_uint = OpTypePointer Function %uint %4 = OpFunction %void DontInline %3 - %5 = OpLabel - %8 = OpVariable %_ptr_Function_uint Function - %9 = OpVariable %_ptr_Function_uint Function - %10 = OpVariable %_ptr_Function_uint Function - OpStore %8 %uint_2 Aligned 4 - OpStore %9 %uint_3 Aligned 4 - %13 = OpLoad %uint %8 Aligned 4 - %14 = OpLoad %uint %9 Aligned 4 - %15 = OpIAdd %uint %13 %14 - OpStore %10 %15 Aligned 4 + %entry = OpLabel + %a = OpVariable %_ptr_Function_uint Function + %b = OpVariable %_ptr_Function_uint Function + %c = OpVariable %_ptr_Function_uint Function + OpStore %a %uint_2 Aligned 4 + OpStore %b %uint_3 Aligned 4 + %13 = OpLoad %uint %a Aligned 4 + %14 = OpLoad %uint %b Aligned 4 + %add = OpIAdd %uint %13 %14 + OpStore %c %add Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/basicbarrier.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/basicbarrier.spvasm index a616c6f509..d1fc61f190 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/basicbarrier.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/basicbarrier.spvasm @@ -10,9 +10,14 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %4 "foo" OpSource OpenCL_C 200000 - OpDecorate %8 Alignment 4 - OpDecorate %9 Alignment 4 - OpDecorate %10 Alignment 4 + OpName %entry "entry" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %add "add" + OpDecorate %a Alignment 4 + OpDecorate %b Alignment 4 + OpDecorate %c Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_3 = OpConstant %uint 3 @@ -21,16 +26,16 @@ %3 = OpTypeFunction %void %_ptr_Function_uint = OpTypePointer Function %uint %4 = OpFunction %void DontInline %3 - %5 = OpLabel - %8 = OpVariable %_ptr_Function_uint Function - %9 = OpVariable %_ptr_Function_uint Function - %10 = OpVariable %_ptr_Function_uint Function - OpStore %8 %uint_2 Aligned 4 - OpStore %9 %uint_3 Aligned 4 - %13 = OpLoad %uint %8 Aligned 4 - %14 = OpLoad %uint %9 Aligned 4 - %15 = OpIAdd %uint %13 %14 - OpStore %10 %15 Aligned 4 + %entry = OpLabel + %a = OpVariable %_ptr_Function_uint Function + %b = OpVariable %_ptr_Function_uint Function + %c = OpVariable %_ptr_Function_uint Function + OpStore %a %uint_2 Aligned 4 + OpStore %b %uint_3 Aligned 4 + %13 = OpLoad %uint %a Aligned 4 + %14 = OpLoad %uint %b Aligned 4 + %add = OpIAdd %uint %13 %14 + OpStore %c %add Aligned 4 OpControlBarrier %uint_2 %uint_2 %uint_272 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/basicglobalarray.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/basicglobalarray.spvasm index 5087b9a1f2..67e67412c0 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/basicglobalarray.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/basicglobalarray.spvasm @@ -13,13 +13,19 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %p "p" + OpName %entry "entry" + OpName %p_addr "p.addr" + OpName %call "call" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %14 Alignment 4 + OpDecorate %p_addr Alignment 4 %uint = OpTypeInt 32 0 %v3uint = OpTypeVector %uint 3 %_ptr_Input_v3uint = OpTypePointer Input %v3uint @@ -30,16 +36,16 @@ %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %10 = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpLabel - %14 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %14 %11 Aligned 4 + %p = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %p_addr %p Aligned 4 %15 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %16 = OpCompositeExtract %uint %15 0 - %17 = OpLoad %_ptr_CrossWorkgroup_uint %14 Aligned 4 + %call = OpCompositeExtract %uint %15 0 + %17 = OpLoad %_ptr_CrossWorkgroup_uint %p_addr Aligned 4 %18 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %19 = OpCompositeExtract %uint %18 0 - %20 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %17 %19 - OpStore %20 %16 Aligned 4 + %call1 = OpCompositeExtract %uint %18 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %17 %call1 + OpStore %arrayidx %call Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/benign_race_tests/fail/writeafterread_addition.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/benign_race_tests/fail/writeafterread_addition.spvasm index 97869e92e4..b99a9fc5a5 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/benign_race_tests/fail/writeafterread_addition.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/benign_race_tests/fail/writeafterread_addition.spvasm @@ -10,8 +10,15 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %6 "foo" OpSource OpenCL_C 200000 - OpDecorate %10 Alignment 4 - OpDecorate %12 Alignment 4 + OpName %A "A" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpName %v "v" + OpName %arrayidx "arrayidx" + OpName %add "add" + OpName %arrayidx1 "arrayidx1" + OpDecorate %A_addr Alignment 4 + OpDecorate %v Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_1 = OpConstant %uint 1 @@ -21,19 +28,19 @@ %_ptr_Function__ptr_Workgroup_uint = OpTypePointer Function %_ptr_Workgroup_uint %_ptr_Function_uint = OpTypePointer Function %uint %6 = OpFunction %void DontInline %5 - %7 = OpFunctionParameter %_ptr_Workgroup_uint - %8 = OpLabel - %10 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %12 = OpVariable %_ptr_Function_uint Function - OpStore %10 %7 Aligned 4 - %13 = OpLoad %_ptr_Workgroup_uint %10 Aligned 4 - %15 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %13 %uint_0 - %16 = OpLoad %uint %15 Aligned 4 - OpStore %12 %16 Aligned 4 - %17 = OpLoad %uint %12 Aligned 4 - %19 = OpIAdd %uint %17 %uint_1 - %20 = OpLoad %_ptr_Workgroup_uint %10 Aligned 4 - %21 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %20 %uint_0 - OpStore %21 %19 Aligned 4 + %A = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %v = OpVariable %_ptr_Function_uint Function + OpStore %A_addr %A Aligned 4 + %13 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %13 %uint_0 + %16 = OpLoad %uint %arrayidx Aligned 4 + OpStore %v %16 Aligned 4 + %17 = OpLoad %uint %v Aligned 4 + %add = OpIAdd %uint %17 %uint_1 + %20 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %arrayidx1 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %20 %uint_0 + OpStore %arrayidx1 %add Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/benign_race_tests/fail/writeafterread_otherval.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/benign_race_tests/fail/writeafterread_otherval.spvasm index 1af09103d4..a7a6ca50a2 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/benign_race_tests/fail/writeafterread_otherval.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/benign_race_tests/fail/writeafterread_otherval.spvasm @@ -12,12 +12,22 @@ OpEntryPoint Kernel %9 "foo" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %A "A" + OpName %B "B" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpName %B_addr "B.addr" + OpName %v "v" + OpName %arrayidx "arrayidx" + OpName %call "call" + OpName %arrayidx1 "arrayidx1" + OpName %arrayidx2 "arrayidx2" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %14 Alignment 4 - OpDecorate %15 Alignment 4 - OpDecorate %17 Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %B_addr Alignment 4 + OpDecorate %v Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_5 = OpConstant %uint 5 @@ -30,24 +40,24 @@ %_ptr_Function_uint = OpTypePointer Function %uint %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_Workgroup_uint - %11 = OpFunctionParameter %_ptr_Workgroup_uint - %12 = OpLabel - %14 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %15 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %17 = OpVariable %_ptr_Function_uint Function - OpStore %14 %10 Aligned 4 - OpStore %15 %11 Aligned 4 - %18 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 - %20 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %18 %uint_0 - %21 = OpLoad %uint %20 Aligned 4 - %22 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 + %A = OpFunctionParameter %_ptr_Workgroup_uint + %B = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %B_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %v = OpVariable %_ptr_Function_uint Function + OpStore %A_addr %A Aligned 4 + OpStore %B_addr %B Aligned 4 + %18 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %18 %uint_0 + %21 = OpLoad %uint %arrayidx Aligned 4 + %22 = OpLoad %_ptr_Workgroup_uint %B_addr Aligned 4 %23 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %24 = OpCompositeExtract %uint %23 0 - %25 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %22 %24 - OpStore %25 %21 Aligned 4 - %26 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 - %27 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %26 %uint_0 - OpStore %27 %uint_5 Aligned 4 + %call = OpCompositeExtract %uint %23 0 + %arrayidx1 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %22 %call + OpStore %arrayidx1 %21 Aligned 4 + %26 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %26 %uint_0 + OpStore %arrayidx2 %uint_5 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/benign_race_tests/fail/writereadarray_equality.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/benign_race_tests/fail/writereadarray_equality.spvasm index 6f7b68c4f5..207363111e 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/benign_race_tests/fail/writereadarray_equality.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/benign_race_tests/fail/writereadarray_equality.spvasm @@ -14,11 +14,19 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" OpName %foo "foo" + OpName %A "A" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" + OpName %add "add" + OpName %arrayidx2 "arrayidx2" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %foo LinkageAttributes "foo" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %16 Alignment 4 + OpDecorate %A_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_1 = OpConstant %uint 1 @@ -34,21 +42,21 @@ %9 = OpFunctionParameter %uint OpFunctionEnd %12 = OpFunction %void DontInline %11 - %13 = OpFunctionParameter %_ptr_Workgroup_uint - %14 = OpLabel - %16 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - OpStore %16 %13 Aligned 4 - %17 = OpLoad %_ptr_Workgroup_uint %16 Aligned 4 + %A = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + OpStore %A_addr %A Aligned 4 + %17 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 %18 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %19 = OpCompositeExtract %uint %18 0 - %20 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %17 %19 - OpStore %20 %uint_0 Aligned 4 - %22 = OpLoad %_ptr_Workgroup_uint %16 Aligned 4 + %call = OpCompositeExtract %uint %18 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %17 %call + OpStore %arrayidx %uint_0 Aligned 4 + %22 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 %23 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %24 = OpCompositeExtract %uint %23 0 - %26 = OpIAdd %uint %24 %uint_1 - %27 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %22 %26 - %28 = OpLoad %uint %27 Aligned 4 + %call1 = OpCompositeExtract %uint %23 0 + %add = OpIAdd %uint %call1 %uint_1 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %22 %add + %28 = OpLoad %uint %arrayidx2 Aligned 4 %29 = OpFunctionCall %void %foo %28 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/benign_race_tests/fail/writetiddiv64_offbyone.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/benign_race_tests/fail/writetiddiv64_offbyone.spvasm index d572e5d0bd..aef51085e0 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/benign_race_tests/fail/writetiddiv64_offbyone.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/benign_race_tests/fail/writetiddiv64_offbyone.spvasm @@ -12,11 +12,19 @@ OpEntryPoint Kernel %9 "foo" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %A "A" + OpName %i "i" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpName %i_addr "i.addr" + OpName %call "call" + OpName %div "div" + OpName %arrayidx "arrayidx" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %14 Alignment 4 - OpDecorate %16 Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %i_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_64 = OpConstant %uint 64 %v3uint = OpTypeVector %uint 3 @@ -28,19 +36,19 @@ %_ptr_Function_uint = OpTypePointer Function %uint %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_Workgroup_uint - %11 = OpFunctionParameter %uint - %12 = OpLabel - %14 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %16 = OpVariable %_ptr_Function_uint Function - OpStore %14 %10 Aligned 4 - OpStore %16 %11 Aligned 4 + %A = OpFunctionParameter %_ptr_Workgroup_uint + %i = OpFunctionParameter %uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %i_addr = OpVariable %_ptr_Function_uint Function + OpStore %A_addr %A Aligned 4 + OpStore %i_addr %i Aligned 4 %17 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %18 = OpCompositeExtract %uint %17 0 - %20 = OpUDiv %uint %18 %uint_64 - %21 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 - %22 = OpLoad %uint %16 Aligned 4 - %23 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %21 %22 - OpStore %23 %20 Aligned 4 + %call = OpCompositeExtract %uint %17 0 + %div = OpUDiv %uint %call %uint_64 + %21 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %22 = OpLoad %uint %i_addr Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %21 %22 + OpStore %arrayidx %div Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/benign_race_tests/fail/writewritearray_adversarial.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/benign_race_tests/fail/writewritearray_adversarial.spvasm index 291402dd21..bb9b7d30e9 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/benign_race_tests/fail/writewritearray_adversarial.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/benign_race_tests/fail/writewritearray_adversarial.spvasm @@ -10,10 +10,21 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %6 "foo" OpSource OpenCL_C 200000 - OpDecorate %13 Alignment 4 - OpDecorate %14 Alignment 4 - OpDecorate %16 Alignment 4 - OpDecorate %17 Alignment 4 + OpName %A "A" + OpName %B "B" + OpName %i "i" + OpName %j "j" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpName %B_addr "B.addr" + OpName %i_addr "i.addr" + OpName %j_addr "j.addr" + OpName %arrayidx "arrayidx" + OpName %arrayidx1 "arrayidx1" + OpDecorate %A_addr Alignment 4 + OpDecorate %B_addr Alignment 4 + OpDecorate %i_addr Alignment 4 + OpDecorate %j_addr Alignment 4 %uint = OpTypeInt 32 0 %void = OpTypeVoid %_ptr_Workgroup_uint = OpTypePointer Workgroup %uint @@ -21,26 +32,26 @@ %_ptr_Function__ptr_Workgroup_uint = OpTypePointer Function %_ptr_Workgroup_uint %_ptr_Function_uint = OpTypePointer Function %uint %6 = OpFunction %void DontInline %5 - %7 = OpFunctionParameter %_ptr_Workgroup_uint - %8 = OpFunctionParameter %_ptr_Workgroup_uint - %9 = OpFunctionParameter %uint - %10 = OpFunctionParameter %uint - %11 = OpLabel - %13 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %14 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %16 = OpVariable %_ptr_Function_uint Function - %17 = OpVariable %_ptr_Function_uint Function - OpStore %13 %7 Aligned 4 - OpStore %14 %8 Aligned 4 - OpStore %16 %9 Aligned 4 - OpStore %17 %10 Aligned 4 - %18 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 - %19 = OpLoad %uint %17 Aligned 4 - %20 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %18 %19 - %21 = OpLoad %uint %20 Aligned 4 - %22 = OpLoad %_ptr_Workgroup_uint %13 Aligned 4 - %23 = OpLoad %uint %16 Aligned 4 - %24 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %22 %23 - OpStore %24 %21 Aligned 4 + %A = OpFunctionParameter %_ptr_Workgroup_uint + %B = OpFunctionParameter %_ptr_Workgroup_uint + %i = OpFunctionParameter %uint + %j = OpFunctionParameter %uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %B_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %i_addr = OpVariable %_ptr_Function_uint Function + %j_addr = OpVariable %_ptr_Function_uint Function + OpStore %A_addr %A Aligned 4 + OpStore %B_addr %B Aligned 4 + OpStore %i_addr %i Aligned 4 + OpStore %j_addr %j Aligned 4 + %18 = OpLoad %_ptr_Workgroup_uint %B_addr Aligned 4 + %19 = OpLoad %uint %j_addr Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %18 %19 + %21 = OpLoad %uint %arrayidx Aligned 4 + %22 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %23 = OpLoad %uint %i_addr Aligned 4 + %arrayidx1 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %22 %23 + OpStore %arrayidx1 %21 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/benign_race_tests/fail/writezero_nobenign.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/benign_race_tests/fail/writezero_nobenign.spvasm index dc2867823a..01b329ff10 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/benign_race_tests/fail/writezero_nobenign.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/benign_race_tests/fail/writezero_nobenign.spvasm @@ -10,10 +10,20 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %6 "foo" OpSource OpenCL_C 200000 - OpDecorate %13 Alignment 4 - OpDecorate %14 Alignment 4 - OpDecorate %16 Alignment 4 - OpDecorate %17 Alignment 4 + OpName %A "A" + OpName %B "B" + OpName %i "i" + OpName %j "j" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpName %B_addr "B.addr" + OpName %i_addr "i.addr" + OpName %j_addr "j.addr" + OpName %arrayidx "arrayidx" + OpDecorate %A_addr Alignment 4 + OpDecorate %B_addr Alignment 4 + OpDecorate %i_addr Alignment 4 + OpDecorate %j_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %void = OpTypeVoid @@ -22,21 +32,21 @@ %_ptr_Function__ptr_Workgroup_uint = OpTypePointer Function %_ptr_Workgroup_uint %_ptr_Function_uint = OpTypePointer Function %uint %6 = OpFunction %void DontInline %5 - %7 = OpFunctionParameter %_ptr_Workgroup_uint - %8 = OpFunctionParameter %_ptr_Workgroup_uint - %9 = OpFunctionParameter %uint - %10 = OpFunctionParameter %uint - %11 = OpLabel - %13 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %14 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %16 = OpVariable %_ptr_Function_uint Function - %17 = OpVariable %_ptr_Function_uint Function - OpStore %13 %7 Aligned 4 - OpStore %14 %8 Aligned 4 - OpStore %16 %9 Aligned 4 - OpStore %17 %10 Aligned 4 - %18 = OpLoad %_ptr_Workgroup_uint %13 Aligned 4 - %20 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %18 %uint_0 - OpStore %20 %uint_0 Aligned 4 + %A = OpFunctionParameter %_ptr_Workgroup_uint + %B = OpFunctionParameter %_ptr_Workgroup_uint + %i = OpFunctionParameter %uint + %j = OpFunctionParameter %uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %B_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %i_addr = OpVariable %_ptr_Function_uint Function + %j_addr = OpVariable %_ptr_Function_uint Function + OpStore %A_addr %A Aligned 4 + OpStore %B_addr %B Aligned 4 + OpStore %i_addr %i Aligned 4 + OpStore %j_addr %j Aligned 4 + %18 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %18 %uint_0 + OpStore %arrayidx %uint_0 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/benign_race_tests/pass/writeafterread.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/benign_race_tests/pass/writeafterread.spvasm index 66f54d0720..a294857c76 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/benign_race_tests/pass/writeafterread.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/benign_race_tests/pass/writeafterread.spvasm @@ -10,8 +10,14 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %6 "foo" OpSource OpenCL_C 200000 - OpDecorate %10 Alignment 4 - OpDecorate %12 Alignment 4 + OpName %A "A" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpName %v "v" + OpName %arrayidx "arrayidx" + OpName %arrayidx1 "arrayidx1" + OpDecorate %A_addr Alignment 4 + OpDecorate %v Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %void = OpTypeVoid @@ -20,18 +26,18 @@ %_ptr_Function__ptr_Workgroup_uint = OpTypePointer Function %_ptr_Workgroup_uint %_ptr_Function_uint = OpTypePointer Function %uint %6 = OpFunction %void DontInline %5 - %7 = OpFunctionParameter %_ptr_Workgroup_uint - %8 = OpLabel - %10 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %12 = OpVariable %_ptr_Function_uint Function - OpStore %10 %7 Aligned 4 - %13 = OpLoad %_ptr_Workgroup_uint %10 Aligned 4 - %15 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %13 %uint_0 - %16 = OpLoad %uint %15 Aligned 4 - OpStore %12 %16 Aligned 4 - %17 = OpLoad %uint %12 Aligned 4 - %18 = OpLoad %_ptr_Workgroup_uint %10 Aligned 4 - %19 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %18 %uint_0 - OpStore %19 %17 Aligned 4 + %A = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %v = OpVariable %_ptr_Function_uint Function + OpStore %A_addr %A Aligned 4 + %13 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %13 %uint_0 + %16 = OpLoad %uint %arrayidx Aligned 4 + OpStore %v %16 Aligned 4 + %17 = OpLoad %uint %v Aligned 4 + %18 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %arrayidx1 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %18 %uint_0 + OpStore %arrayidx1 %17 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/benign_race_tests/pass/writeinloop.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/benign_race_tests/pass/writeinloop.spvasm index 5988ee60c7..b1a1cbfe99 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/benign_race_tests/pass/writeinloop.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/benign_race_tests/pass/writeinloop.spvasm @@ -10,10 +10,25 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %6 "foo" OpSource OpenCL_C 200000 - OpDecorate %16 Alignment 4 - OpDecorate %18 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %20 Alignment 4 + OpName %A "A" + OpName %start "start" + OpName %end "end" + OpName %entry "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %A_addr "A.addr" + OpName %start_addr "start.addr" + OpName %end_addr "end.addr" + OpName %i "i" + OpName %cmp "cmp" + OpName %arrayidx "arrayidx" + OpName %inc "inc" + OpDecorate %A_addr Alignment 4 + OpDecorate %start_addr Alignment 4 + OpDecorate %end_addr Alignment 4 + OpDecorate %i Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_42 = OpConstant %uint 42 @@ -25,35 +40,35 @@ %_ptr_Function_uint = OpTypePointer Function %uint %bool = OpTypeBool %6 = OpFunction %void DontInline %5 - %7 = OpFunctionParameter %_ptr_Workgroup_uint - %8 = OpFunctionParameter %uint - %9 = OpFunctionParameter %uint - %10 = OpLabel - %16 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %18 = OpVariable %_ptr_Function_uint Function - %19 = OpVariable %_ptr_Function_uint Function - %20 = OpVariable %_ptr_Function_uint Function - OpStore %16 %7 Aligned 4 - OpStore %18 %8 Aligned 4 - OpStore %19 %9 Aligned 4 - %21 = OpLoad %uint %18 Aligned 4 - OpStore %20 %21 Aligned 4 - OpBranch %11 - %11 = OpLabel - %22 = OpLoad %uint %20 Aligned 4 - %23 = OpLoad %uint %19 Aligned 4 - %25 = OpULessThan %bool %22 %23 - OpBranchConditional %25 %12 %14 - %12 = OpLabel - %26 = OpLoad %_ptr_Workgroup_uint %16 Aligned 4 - %28 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %26 %uint_0 - OpStore %28 %uint_42 Aligned 4 - OpBranch %13 - %13 = OpLabel - %30 = OpLoad %uint %20 Aligned 4 - %32 = OpIAdd %uint %30 %uint_1 - OpStore %20 %32 Aligned 4 - OpBranch %11 - %14 = OpLabel + %A = OpFunctionParameter %_ptr_Workgroup_uint + %start = OpFunctionParameter %uint + %end = OpFunctionParameter %uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %start_addr = OpVariable %_ptr_Function_uint Function + %end_addr = OpVariable %_ptr_Function_uint Function + %i = OpVariable %_ptr_Function_uint Function + OpStore %A_addr %A Aligned 4 + OpStore %start_addr %start Aligned 4 + OpStore %end_addr %end Aligned 4 + %21 = OpLoad %uint %start_addr Aligned 4 + OpStore %i %21 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %22 = OpLoad %uint %i Aligned 4 + %23 = OpLoad %uint %end_addr Aligned 4 + %cmp = OpULessThan %bool %22 %23 + OpBranchConditional %cmp %for_body %for_end + %for_body = OpLabel + %26 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %26 %uint_0 + OpStore %arrayidx %uint_42 Aligned 4 + OpBranch %for_inc + %for_inc = OpLabel + %30 = OpLoad %uint %i Aligned 4 + %inc = OpIAdd %uint %30 %uint_1 + OpStore %i %inc Aligned 4 + OpBranch %for_cond + %for_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/benign_race_tests/pass/writezero.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/benign_race_tests/pass/writezero.spvasm index c256988c62..69287bf1a3 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/benign_race_tests/pass/writezero.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/benign_race_tests/pass/writezero.spvasm @@ -10,10 +10,20 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %6 "foo" OpSource OpenCL_C 200000 - OpDecorate %13 Alignment 4 - OpDecorate %14 Alignment 4 - OpDecorate %16 Alignment 4 - OpDecorate %17 Alignment 4 + OpName %A "A" + OpName %B "B" + OpName %i "i" + OpName %j "j" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpName %B_addr "B.addr" + OpName %i_addr "i.addr" + OpName %j_addr "j.addr" + OpName %arrayidx "arrayidx" + OpDecorate %A_addr Alignment 4 + OpDecorate %B_addr Alignment 4 + OpDecorate %i_addr Alignment 4 + OpDecorate %j_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %void = OpTypeVoid @@ -22,21 +32,21 @@ %_ptr_Function__ptr_Workgroup_uint = OpTypePointer Function %_ptr_Workgroup_uint %_ptr_Function_uint = OpTypePointer Function %uint %6 = OpFunction %void DontInline %5 - %7 = OpFunctionParameter %_ptr_Workgroup_uint - %8 = OpFunctionParameter %_ptr_Workgroup_uint - %9 = OpFunctionParameter %uint - %10 = OpFunctionParameter %uint - %11 = OpLabel - %13 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %14 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %16 = OpVariable %_ptr_Function_uint Function - %17 = OpVariable %_ptr_Function_uint Function - OpStore %13 %7 Aligned 4 - OpStore %14 %8 Aligned 4 - OpStore %16 %9 Aligned 4 - OpStore %17 %10 Aligned 4 - %18 = OpLoad %_ptr_Workgroup_uint %13 Aligned 4 - %20 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %18 %uint_0 - OpStore %20 %uint_0 Aligned 4 + %A = OpFunctionParameter %_ptr_Workgroup_uint + %B = OpFunctionParameter %_ptr_Workgroup_uint + %i = OpFunctionParameter %uint + %j = OpFunctionParameter %uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %B_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %i_addr = OpVariable %_ptr_Function_uint Function + %j_addr = OpVariable %_ptr_Function_uint Function + OpStore %A_addr %A Aligned 4 + OpStore %B_addr %B Aligned 4 + OpStore %i_addr %i Aligned 4 + OpStore %j_addr %j Aligned 4 + %18 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %18 %uint_0 + OpStore %arrayidx %uint_0 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/bitand.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/bitand.spvasm index 1953602218..4c3cb767fd 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/bitand.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/bitand.spvasm @@ -10,9 +10,14 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %4 "foo" OpSource OpenCL_C 200000 - OpDecorate %8 Alignment 4 - OpDecorate %9 Alignment 4 - OpDecorate %10 Alignment 4 + OpName %entry "entry" + OpName %x "x" + OpName %y "y" + OpName %z "z" + OpName %and "and" + OpDecorate %x Alignment 4 + OpDecorate %y Alignment 4 + OpDecorate %z Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_1 = OpConstant %uint 1 @@ -20,15 +25,15 @@ %3 = OpTypeFunction %void %_ptr_Function_uint = OpTypePointer Function %uint %4 = OpFunction %void DontInline %3 - %5 = OpLabel - %8 = OpVariable %_ptr_Function_uint Function - %9 = OpVariable %_ptr_Function_uint Function - %10 = OpVariable %_ptr_Function_uint Function - OpStore %8 %uint_0 Aligned 4 - OpStore %9 %uint_1 Aligned 4 - %13 = OpLoad %uint %8 Aligned 4 - %14 = OpLoad %uint %9 Aligned 4 - %15 = OpBitwiseAnd %uint %13 %14 - OpStore %10 %15 Aligned 4 + %entry = OpLabel + %x = OpVariable %_ptr_Function_uint Function + %y = OpVariable %_ptr_Function_uint Function + %z = OpVariable %_ptr_Function_uint Function + OpStore %x %uint_0 Aligned 4 + OpStore %y %uint_1 Aligned 4 + %13 = OpLoad %uint %x Aligned 4 + %14 = OpLoad %uint %y Aligned 4 + %and = OpBitwiseAnd %uint %13 %14 + OpStore %z %and Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/bitnot.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/bitnot.spvasm index 9367b605ae..c5142c2aea 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/bitnot.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/bitnot.spvasm @@ -10,8 +10,12 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %4 "foo" OpSource OpenCL_C 200000 - OpDecorate %8 Alignment 4 - OpDecorate %9 Alignment 4 + OpName %entry "entry" + OpName %x "x" + OpName %y "y" + OpName %neg "neg" + OpDecorate %x Alignment 4 + OpDecorate %y Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_4294967295 = OpConstant %uint 4294967295 @@ -19,12 +23,12 @@ %3 = OpTypeFunction %void %_ptr_Function_uint = OpTypePointer Function %uint %4 = OpFunction %void DontInline %3 - %5 = OpLabel - %8 = OpVariable %_ptr_Function_uint Function - %9 = OpVariable %_ptr_Function_uint Function - OpStore %8 %uint_2 Aligned 4 - %11 = OpLoad %uint %8 Aligned 4 - %13 = OpBitwiseXor %uint %11 %uint_4294967295 - OpStore %9 %13 Aligned 4 + %entry = OpLabel + %x = OpVariable %_ptr_Function_uint Function + %y = OpVariable %_ptr_Function_uint Function + OpStore %x %uint_2 Aligned 4 + %11 = OpLoad %uint %x Aligned 4 + %neg = OpBitwiseXor %uint %11 %uint_4294967295 + OpStore %y %neg Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/bitor.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/bitor.spvasm index 0f7b45359a..1f881a6018 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/bitor.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/bitor.spvasm @@ -10,9 +10,14 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %4 "foo" OpSource OpenCL_C 200000 - OpDecorate %8 Alignment 4 - OpDecorate %9 Alignment 4 - OpDecorate %10 Alignment 4 + OpName %entry "entry" + OpName %x "x" + OpName %y "y" + OpName %z "z" + OpName %or "or" + OpDecorate %x Alignment 4 + OpDecorate %y Alignment 4 + OpDecorate %z Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_1 = OpConstant %uint 1 @@ -20,15 +25,15 @@ %3 = OpTypeFunction %void %_ptr_Function_uint = OpTypePointer Function %uint %4 = OpFunction %void DontInline %3 - %5 = OpLabel - %8 = OpVariable %_ptr_Function_uint Function - %9 = OpVariable %_ptr_Function_uint Function - %10 = OpVariable %_ptr_Function_uint Function - OpStore %8 %uint_0 Aligned 4 - OpStore %9 %uint_1 Aligned 4 - %13 = OpLoad %uint %8 Aligned 4 - %14 = OpLoad %uint %9 Aligned 4 - %15 = OpBitwiseOr %uint %13 %14 - OpStore %10 %15 Aligned 4 + %entry = OpLabel + %x = OpVariable %_ptr_Function_uint Function + %y = OpVariable %_ptr_Function_uint Function + %z = OpVariable %_ptr_Function_uint Function + OpStore %x %uint_0 Aligned 4 + OpStore %y %uint_1 Aligned 4 + %13 = OpLoad %uint %x Aligned 4 + %14 = OpLoad %uint %y Aligned 4 + %or = OpBitwiseOr %uint %13 %14 + OpStore %z %or Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/bitxor.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/bitxor.spvasm index 75af5c5751..645d51bbe9 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/bitxor.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/bitxor.spvasm @@ -10,9 +10,14 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %4 "foo" OpSource OpenCL_C 200000 - OpDecorate %8 Alignment 4 - OpDecorate %9 Alignment 4 - OpDecorate %10 Alignment 4 + OpName %entry "entry" + OpName %x "x" + OpName %y "y" + OpName %z "z" + OpName %xor "xor" + OpDecorate %x Alignment 4 + OpDecorate %y Alignment 4 + OpDecorate %z Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_1 = OpConstant %uint 1 @@ -20,15 +25,15 @@ %3 = OpTypeFunction %void %_ptr_Function_uint = OpTypePointer Function %uint %4 = OpFunction %void DontInline %3 - %5 = OpLabel - %8 = OpVariable %_ptr_Function_uint Function - %9 = OpVariable %_ptr_Function_uint Function - %10 = OpVariable %_ptr_Function_uint Function - OpStore %8 %uint_0 Aligned 4 - OpStore %9 %uint_1 Aligned 4 - %13 = OpLoad %uint %8 Aligned 4 - %14 = OpLoad %uint %9 Aligned 4 - %15 = OpBitwiseXor %uint %13 %14 - OpStore %10 %15 Aligned 4 + %entry = OpLabel + %x = OpVariable %_ptr_Function_uint Function + %y = OpVariable %_ptr_Function_uint Function + %z = OpVariable %_ptr_Function_uint Function + OpStore %x %uint_0 Aligned 4 + OpStore %y %uint_1 Aligned 4 + %13 = OpLoad %uint %x Aligned 4 + %14 = OpLoad %uint %y Aligned 4 + %xor = OpBitwiseXor %uint %13 %14 + OpStore %z %xor Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/bool_bv_test.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/bool_bv_test.spvasm index eef224b0ae..ecd5f1e217 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/bool_bv_test.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/bool_bv_test.spvasm @@ -11,8 +11,14 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %5 "foo" OpSource OpenCL_C 200000 - OpDecorate %9 Alignment 4 - OpDecorate %10 Alignment 4 + OpName %j "j" + OpName %entry "entry" + OpName %j_addr "j.addr" + OpName %x "x" + OpName %tobool "tobool" + OpName %cond "cond" + OpDecorate %j_addr Alignment 4 + OpDecorate %x Alignment 4 %uint = OpTypeInt 32 0 %ulong = OpTypeInt 64 0 %uint_0 = OpConstant %uint 0 @@ -24,15 +30,15 @@ %_ptr_Function_uint = OpTypePointer Function %uint %bool = OpTypeBool %5 = OpFunction %void DontInline %4 - %6 = OpFunctionParameter %uint - %7 = OpLabel - %9 = OpVariable %_ptr_Function_uint Function - %10 = OpVariable %_ptr_Function_uint Function - OpStore %9 %6 Aligned 4 - %11 = OpLoad %uint %9 Aligned 4 - %14 = OpINotEqual %bool %11 %uint_0 - %18 = OpSelect %ulong %14 %ulong_1 %ulong_0 - %20 = OpSelect %uint %14 %uint_1 %uint_0 - OpStore %10 %20 Aligned 4 + %j = OpFunctionParameter %uint + %entry = OpLabel + %j_addr = OpVariable %_ptr_Function_uint Function + %x = OpVariable %_ptr_Function_uint Function + OpStore %j_addr %j Aligned 4 + %11 = OpLoad %uint %j_addr Aligned 4 + %tobool = OpINotEqual %bool %11 %uint_0 + %18 = OpSelect %ulong %tobool %ulong_1 %ulong_0 + %cond = OpSelect %uint %tobool %uint_1 %uint_0 + OpStore %x %cond Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/booleanTests.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/booleanTests.spvasm index df3f5af374..cb32bd8ba2 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/booleanTests.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/booleanTests.spvasm @@ -15,11 +15,41 @@ OpSource OpenCL_C 200000 OpName %bar "bar" OpName %baz "baz" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %if_then8 "if.then8" + OpName %if_end9 "if.end9" + OpName %if_then11 "if.then11" + OpName %if_end12 "if.end12" + OpName %if_then14 "if.then14" + OpName %if_end15 "if.end15" + OpName %if_then16 "if.then16" + OpName %if_end17 "if.end17" + OpName %if_then19 "if.then19" + OpName %if_end20 "if.end20" + OpName %y "y" + OpName %x "x" + OpName %call "call" + OpName %frombool "frombool" + OpName %call1 "call1" + OpName %tobool "tobool" + OpName %lnot "lnot" + OpName %lnot_ext "lnot.ext" + OpName %tobool2 "tobool2" + OpName %lnot3 "lnot3" + OpName %frombool5 "frombool5" + OpName %tobool6 "tobool6" + OpName %tobool7 "tobool7" + OpName %tobool10 "tobool10" + OpName %tobool13 "tobool13" + OpName %cmp "cmp" + OpName %cmp18 "cmp18" OpDecorate %bar FuncParamAttr Zext OpDecorate %bar LinkageAttributes "bar" Import OpDecorate %baz LinkageAttributes "baz" Import - OpDecorate %26 Alignment 1 - OpDecorate %28 Alignment 4 + OpDecorate %y Alignment 1 + OpDecorate %x Alignment 4 %uint = OpTypeInt 32 0 %uchar = OpTypeInt 8 0 %uchar_0 = OpConstant %uchar 0 @@ -39,64 +69,64 @@ %baz = OpFunction %uint None %6 OpFunctionEnd %10 = OpFunction %void DontInline %9 - %11 = OpLabel - %26 = OpVariable %_ptr_Function_uchar Function - %28 = OpVariable %_ptr_Function_uint Function - %29 = OpFunctionCall %bool %bar - %32 = OpSelect %uchar %29 %uchar_1 %uchar_0 - OpStore %26 %32 Aligned 1 - %33 = OpFunctionCall %uint %baz - OpStore %28 %33 Aligned 4 - %34 = OpLoad %uint %28 Aligned 4 - %36 = OpINotEqual %bool %34 %uint_0 - %38 = OpLogicalNotEqual %bool %36 %true - %40 = OpSelect %uint %38 %uint_1 %uint_0 - OpStore %28 %40 Aligned 4 - %41 = OpLoad %uchar %26 Aligned 1 + %entry = OpLabel + %y = OpVariable %_ptr_Function_uchar Function + %x = OpVariable %_ptr_Function_uint Function + %call = OpFunctionCall %bool %bar + %frombool = OpSelect %uchar %call %uchar_1 %uchar_0 + OpStore %y %frombool Aligned 1 + %call1 = OpFunctionCall %uint %baz + OpStore %x %call1 Aligned 4 + %34 = OpLoad %uint %x Aligned 4 + %tobool = OpINotEqual %bool %34 %uint_0 + %lnot = OpLogicalNotEqual %bool %tobool %true + %lnot_ext = OpSelect %uint %lnot %uint_1 %uint_0 + OpStore %x %lnot_ext Aligned 4 + %41 = OpLoad %uchar %y Aligned 1 %42 = OpBitwiseAnd %uchar %41 %uchar_1 - %43 = OpINotEqual %bool %42 %uchar_0 - %44 = OpLogicalNotEqual %bool %43 %true - %45 = OpSelect %uchar %44 %uchar_1 %uchar_0 - OpStore %26 %45 Aligned 1 - %46 = OpLoad %uint %28 Aligned 4 - %47 = OpINotEqual %bool %46 %uint_0 - OpBranchConditional %47 %12 %13 - %12 = OpLabel - OpBranch %13 - %13 = OpLabel - %48 = OpLoad %uint %28 Aligned 4 - %49 = OpINotEqual %bool %48 %uint_0 - OpBranchConditional %49 %15 %14 - %14 = OpLabel - OpBranch %15 - %15 = OpLabel - %50 = OpLoad %uchar %26 Aligned 1 + %tobool2 = OpINotEqual %bool %42 %uchar_0 + %lnot3 = OpLogicalNotEqual %bool %tobool2 %true + %frombool5 = OpSelect %uchar %lnot3 %uchar_1 %uchar_0 + OpStore %y %frombool5 Aligned 1 + %46 = OpLoad %uint %x Aligned 4 + %tobool6 = OpINotEqual %bool %46 %uint_0 + OpBranchConditional %tobool6 %if_then %if_end + %if_then = OpLabel + OpBranch %if_end + %if_end = OpLabel + %48 = OpLoad %uint %x Aligned 4 + %tobool7 = OpINotEqual %bool %48 %uint_0 + OpBranchConditional %tobool7 %if_end9 %if_then8 + %if_then8 = OpLabel + OpBranch %if_end9 + %if_end9 = OpLabel + %50 = OpLoad %uchar %y Aligned 1 %51 = OpBitwiseAnd %uchar %50 %uchar_1 - %52 = OpINotEqual %bool %51 %uchar_0 - OpBranchConditional %52 %16 %17 - %16 = OpLabel - OpBranch %17 - %17 = OpLabel - %53 = OpLoad %uchar %26 Aligned 1 + %tobool10 = OpINotEqual %bool %51 %uchar_0 + OpBranchConditional %tobool10 %if_then11 %if_end12 + %if_then11 = OpLabel + OpBranch %if_end12 + %if_end12 = OpLabel + %53 = OpLoad %uchar %y Aligned 1 %54 = OpBitwiseAnd %uchar %53 %uchar_1 - %55 = OpINotEqual %bool %54 %uchar_0 - OpBranchConditional %55 %19 %18 - %18 = OpLabel - OpBranch %19 - %19 = OpLabel - %56 = OpLoad %uint %28 Aligned 4 - %57 = OpLoad %uint %28 Aligned 4 - %58 = OpSLessThan %bool %56 %57 - OpBranchConditional %58 %20 %21 - %20 = OpLabel - OpBranch %21 - %21 = OpLabel - %59 = OpLoad %uint %28 Aligned 4 - %60 = OpLoad %uint %28 Aligned 4 - %61 = OpSLessThan %bool %59 %60 - OpBranchConditional %61 %23 %22 - %22 = OpLabel - OpBranch %23 - %23 = OpLabel + %tobool13 = OpINotEqual %bool %54 %uchar_0 + OpBranchConditional %tobool13 %if_end15 %if_then14 + %if_then14 = OpLabel + OpBranch %if_end15 + %if_end15 = OpLabel + %56 = OpLoad %uint %x Aligned 4 + %57 = OpLoad %uint %x Aligned 4 + %cmp = OpSLessThan %bool %56 %57 + OpBranchConditional %cmp %if_then16 %if_end17 + %if_then16 = OpLabel + OpBranch %if_end17 + %if_end17 = OpLabel + %59 = OpLoad %uint %x Aligned 4 + %60 = OpLoad %uint %x Aligned 4 + %cmp18 = OpSLessThan %bool %59 %60 + OpBranchConditional %cmp18 %if_end20 %if_then19 + %if_then19 = OpLabel + OpBranch %if_end20 + %if_end20 = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/break_test.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/break_test.spvasm index fef895e8dd..579d6bb7b8 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/break_test.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/break_test.spvasm @@ -12,10 +12,22 @@ OpEntryPoint Kernel %8 "foo" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %x "x" + OpName %entry "entry" + OpName %while_cond "while.cond" + OpName %while_body "while.body" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %while_end "while.end" + OpName %x_addr "x.addr" + OpName %add "add" + OpName %cmp "cmp" + OpName %call "call" + OpName %cmp1 "cmp1" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %17 Alignment 4 + OpDecorate %x_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_100 = OpConstant %uint 100 %uint_102 = OpConstant %uint 102 @@ -29,26 +41,26 @@ %bool = OpTypeBool %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %8 = OpFunction %void DontInline %7 - %9 = OpFunctionParameter %uint - %10 = OpLabel - %17 = OpVariable %_ptr_Function_uint Function - OpStore %17 %9 Aligned 4 - OpBranch %11 - %11 = OpLabel - %18 = OpLoad %uint %17 Aligned 4 - %20 = OpIAdd %uint %18 %uint_100 - %23 = OpSLessThan %bool %20 %uint_102 - OpBranchConditional %23 %12 %15 - %12 = OpLabel + %x = OpFunctionParameter %uint + %entry = OpLabel + %x_addr = OpVariable %_ptr_Function_uint Function + OpStore %x_addr %x Aligned 4 + OpBranch %while_cond + %while_cond = OpLabel + %18 = OpLoad %uint %x_addr Aligned 4 + %add = OpIAdd %uint %18 %uint_100 + %cmp = OpSLessThan %bool %add %uint_102 + OpBranchConditional %cmp %while_body %while_end + %while_body = OpLabel %24 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %25 = OpCompositeExtract %uint %24 0 - %27 = OpULessThan %bool %25 %uint_5 - OpBranchConditional %27 %13 %14 - %13 = OpLabel - OpStore %17 %uint_2 Aligned 4 - OpBranch %15 - %14 = OpLabel - OpBranch %11 - %15 = OpLabel + %call = OpCompositeExtract %uint %24 0 + %cmp1 = OpULessThan %bool %call %uint_5 + OpBranchConditional %cmp1 %if_then %if_end + %if_then = OpLabel + OpStore %x_addr %uint_2 Aligned 4 + OpBranch %while_end + %if_end = OpLabel + OpBranch %while_cond + %while_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/checkarrays/fail/arraydoesnotexist1.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/checkarrays/fail/arraydoesnotexist1.spvasm index 8bc56c8e20..1a65d02113 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/checkarrays/fail/arraydoesnotexist1.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/checkarrays/fail/arraydoesnotexist1.spvasm @@ -10,16 +10,19 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %6 "foo" OpSource OpenCL_C 200000 - OpDecorate %10 Alignment 4 + OpName %A "A" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpDecorate %A_addr Alignment 4 %uint = OpTypeInt 32 0 %void = OpTypeVoid %_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint %5 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %6 = OpFunction %void DontInline %5 - %7 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %8 = OpLabel - %10 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %10 %7 Aligned 4 + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %A_addr %A Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/checkarrays/fail/arraydoesnotexist2.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/checkarrays/fail/arraydoesnotexist2.spvasm index 78fd9f4bf5..d7581a0535 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/checkarrays/fail/arraydoesnotexist2.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/checkarrays/fail/arraydoesnotexist2.spvasm @@ -10,20 +10,25 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %6 "foo" OpSource OpenCL_C 200000 - OpDecorate %11 Alignment 4 - OpDecorate %12 Alignment 4 + OpName %A "A" + OpName %B "B" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpName %B_addr "B.addr" + OpDecorate %A_addr Alignment 4 + OpDecorate %B_addr Alignment 4 %uint = OpTypeInt 32 0 %void = OpTypeVoid %_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint %5 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %6 = OpFunction %void DontInline %5 - %7 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %8 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %9 = OpLabel - %11 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %12 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %11 %7 Aligned 4 - OpStore %12 %8 Aligned 4 + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %B = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %B_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %A_addr %A Aligned 4 + OpStore %B_addr %B Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/checkarrays/pass/specifyall.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/checkarrays/pass/specifyall.spvasm index f8d65b7509..5aa59e33c8 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/checkarrays/pass/specifyall.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/checkarrays/pass/specifyall.spvasm @@ -14,6 +14,24 @@ OpName %foo_C "foo.C" OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %A "A" + OpName %B "B" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpName %B_addr "B.addr" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" + OpName %arrayidx2 "arrayidx2" + OpName %call3 "call3" + OpName %arrayidx4 "arrayidx4" + OpName %call5 "call5" + OpName %arrayidx6 "arrayidx6" + OpName %call7 "call7" + OpName %arrayidx8 "arrayidx8" + OpName %call9 "call9" + OpName %arrayidx10 "arrayidx10" + OpName %add "add" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant @@ -21,8 +39,8 @@ OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import OpDecorate %foo_C Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %20 Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %B_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_256 = OpConstant %uint 256 %uint_0 = OpConstant %uint 0 @@ -39,42 +57,42 @@ %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %14 = OpFunction %void DontInline %13 - %15 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %16 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %17 = OpLabel - %19 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %20 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %19 %15 Aligned 4 - OpStore %20 %16 Aligned 4 - %21 = OpLoad %_ptr_CrossWorkgroup_uint %20 Aligned 4 + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %B = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %B_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %A_addr %A Aligned 4 + OpStore %B_addr %B Aligned 4 + %21 = OpLoad %_ptr_CrossWorkgroup_uint %B_addr Aligned 4 %22 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %23 = OpCompositeExtract %uint %22 0 - %24 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %21 %23 - %25 = OpLoad %uint %24 Aligned 4 - %26 = OpLoad %_ptr_CrossWorkgroup_uint %19 Aligned 4 + %call = OpCompositeExtract %uint %22 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %21 %call + %25 = OpLoad %uint %arrayidx Aligned 4 + %26 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %27 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %28 = OpCompositeExtract %uint %27 0 - %29 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %26 %28 - OpStore %29 %25 Aligned 4 - %30 = OpLoad %_ptr_CrossWorkgroup_uint %19 Aligned 4 + %call1 = OpCompositeExtract %uint %27 0 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %26 %call1 + OpStore %arrayidx2 %25 Aligned 4 + %30 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %31 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %32 = OpCompositeExtract %uint %31 0 - %33 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %30 %32 - %34 = OpLoad %uint %33 Aligned 4 + %call3 = OpCompositeExtract %uint %31 0 + %arrayidx4 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %30 %call3 + %34 = OpLoad %uint %arrayidx4 Aligned 4 %35 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %36 = OpCompositeExtract %uint %35 0 - %39 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %foo_C %uint_0 %36 - OpStore %39 %34 Aligned 4 + %call5 = OpCompositeExtract %uint %35 0 + %arrayidx6 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %foo_C %uint_0 %call5 + OpStore %arrayidx6 %34 Aligned 4 %40 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %41 = OpCompositeExtract %uint %40 0 - %42 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %foo_C %uint_0 %41 - %43 = OpLoad %uint %42 Aligned 4 - %44 = OpLoad %_ptr_CrossWorkgroup_uint %20 Aligned 4 + %call7 = OpCompositeExtract %uint %40 0 + %arrayidx8 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %foo_C %uint_0 %call7 + %43 = OpLoad %uint %arrayidx8 Aligned 4 + %44 = OpLoad %_ptr_CrossWorkgroup_uint %B_addr Aligned 4 %45 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %46 = OpCompositeExtract %uint %45 0 - %47 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %44 %46 - %48 = OpLoad %uint %47 Aligned 4 - %49 = OpIAdd %uint %48 %43 - OpStore %47 %49 Aligned 4 + %call9 = OpCompositeExtract %uint %45 0 + %arrayidx10 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %44 %call9 + %48 = OpLoad %uint %arrayidx10 Aligned 4 + %add = OpIAdd %uint %48 %43 + OpStore %arrayidx10 %add Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/conditional_int_test.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/conditional_int_test.spvasm index 7408d31c9e..4bd3102021 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/conditional_int_test.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/conditional_int_test.spvasm @@ -10,8 +10,20 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %5 "foo" OpSource OpenCL_C 200000 - OpDecorate %15 Alignment 4 - OpDecorate %16 Alignment 4 + OpName %x "x" + OpName %y "y" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_else "if.else" + OpName %if_then1 "if.then1" + OpName %if_end "if.end" + OpName %if_end2 "if.end2" + OpName %x_addr "x.addr" + OpName %y_addr "y.addr" + OpName %tobool "tobool" + OpName %cmp "cmp" + OpDecorate %x_addr Alignment 4 + OpDecorate %y_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %void = OpTypeVoid @@ -19,27 +31,27 @@ %_ptr_Function_uint = OpTypePointer Function %uint %bool = OpTypeBool %5 = OpFunction %void DontInline %4 - %6 = OpFunctionParameter %uint - %7 = OpFunctionParameter %uint - %8 = OpLabel - %15 = OpVariable %_ptr_Function_uint Function - %16 = OpVariable %_ptr_Function_uint Function - OpStore %15 %6 Aligned 4 - OpStore %16 %7 Aligned 4 - %17 = OpLoad %uint %15 Aligned 4 - %20 = OpINotEqual %bool %17 %uint_0 - OpBranchConditional %20 %9 %10 - %9 = OpLabel - OpBranch %13 - %10 = OpLabel - %21 = OpLoad %uint %15 Aligned 4 - %22 = OpLoad %uint %16 Aligned 4 - %23 = OpIEqual %bool %21 %22 - OpBranchConditional %23 %11 %12 - %11 = OpLabel - OpBranch %12 - %12 = OpLabel - OpBranch %13 - %13 = OpLabel + %x = OpFunctionParameter %uint + %y = OpFunctionParameter %uint + %entry = OpLabel + %x_addr = OpVariable %_ptr_Function_uint Function + %y_addr = OpVariable %_ptr_Function_uint Function + OpStore %x_addr %x Aligned 4 + OpStore %y_addr %y Aligned 4 + %17 = OpLoad %uint %x_addr Aligned 4 + %tobool = OpINotEqual %bool %17 %uint_0 + OpBranchConditional %tobool %if_then %if_else + %if_then = OpLabel + OpBranch %if_end2 + %if_else = OpLabel + %21 = OpLoad %uint %x_addr Aligned 4 + %22 = OpLoad %uint %y_addr Aligned 4 + %cmp = OpIEqual %bool %21 %22 + OpBranchConditional %cmp %if_then1 %if_end + %if_then1 = OpLabel + OpBranch %if_end + %if_end = OpLabel + OpBranch %if_end2 + %if_end2 = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/derived_from_uniformity_analysis_bug.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/derived_from_uniformity_analysis_bug.spvasm index 3794472f8a..f6b17a959d 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/derived_from_uniformity_analysis_bug.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/derived_from_uniformity_analysis_bug.spvasm @@ -12,12 +12,30 @@ OpEntryPoint Kernel %9 "foo" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %A "A" + OpName %entry "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %for_cond1 "for.cond1" + OpName %for_body3 "for.body3" + OpName %for_inc4 "for.inc4" + OpName %for_end5 "for.end5" + OpName %A_addr "A.addr" + OpName %i "i" + OpName %j "j" + OpName %call "call" + OpName %cmp "cmp" + OpName %inc "inc" + OpName %cmp2 "cmp2" + OpName %dec "dec" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %21 Alignment 4 - OpDecorate %23 Alignment 4 - OpDecorate %24 Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %i Alignment 4 + OpDecorate %j Alignment 4 %uint = OpTypeInt 32 0 %uint_100 = OpConstant %uint 100 %uint_1 = OpConstant %uint 1 @@ -33,41 +51,41 @@ %bool = OpTypeBool %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpLabel - %21 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %23 = OpVariable %_ptr_Function_uint Function - %24 = OpVariable %_ptr_Function_uint Function - OpStore %21 %10 Aligned 4 + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %i = OpVariable %_ptr_Function_uint Function + %j = OpVariable %_ptr_Function_uint Function + OpStore %A_addr %A Aligned 4 %25 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %26 = OpCompositeExtract %uint %25 0 - OpStore %23 %26 Aligned 4 - OpBranch %12 - %12 = OpLabel - %27 = OpLoad %uint %23 Aligned 4 - %30 = OpSLessThan %bool %27 %uint_100 - OpBranchConditional %30 %13 %15 - %13 = OpLabel - OpBranch %14 - %14 = OpLabel - %31 = OpLoad %uint %23 Aligned 4 - %33 = OpIAdd %uint %31 %uint_1 - OpStore %23 %33 Aligned 4 - OpBranch %12 - %15 = OpLabel - OpStore %24 %uint_100 Aligned 4 - OpBranch %16 - %16 = OpLabel - %34 = OpLoad %uint %24 Aligned 4 - %36 = OpSGreaterThan %bool %34 %uint_0 - OpBranchConditional %36 %17 %19 - %17 = OpLabel - OpBranch %18 - %18 = OpLabel - %37 = OpLoad %uint %24 Aligned 4 - %39 = OpIAdd %uint %37 %uint_4294967295 - OpStore %24 %39 Aligned 4 - OpBranch %16 - %19 = OpLabel + %call = OpCompositeExtract %uint %25 0 + OpStore %i %call Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %27 = OpLoad %uint %i Aligned 4 + %cmp = OpSLessThan %bool %27 %uint_100 + OpBranchConditional %cmp %for_body %for_end + %for_body = OpLabel + OpBranch %for_inc + %for_inc = OpLabel + %31 = OpLoad %uint %i Aligned 4 + %inc = OpIAdd %uint %31 %uint_1 + OpStore %i %inc Aligned 4 + OpBranch %for_cond + %for_end = OpLabel + OpStore %j %uint_100 Aligned 4 + OpBranch %for_cond1 + %for_cond1 = OpLabel + %34 = OpLoad %uint %j Aligned 4 + %cmp2 = OpSGreaterThan %bool %34 %uint_0 + OpBranchConditional %cmp2 %for_body3 %for_end5 + %for_body3 = OpLabel + OpBranch %for_inc4 + %for_inc4 = OpLabel + %37 = OpLoad %uint %j Aligned 4 + %dec = OpIAdd %uint %37 %uint_4294967295 + OpStore %j %dec Aligned 4 + OpBranch %for_cond1 + %for_end5 = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/divergence/race_and_divergence.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/divergence/race_and_divergence.spvasm index 5380af7681..cd589e86ca 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/divergence/race_and_divergence.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/divergence/race_and_divergence.spvasm @@ -12,14 +12,26 @@ OpEntryPoint Kernel %9 "foo" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %A "A" + OpName %B "B" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %A_addr "A.addr" + OpName %B_addr "B.addr" + OpName %tmp "tmp" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %cmp "cmp" + OpName %arrayidx1 "arrayidx1" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant - OpDecorate %10 FuncParamAttr NoAlias - OpDecorate %11 FuncParamAttr NoAlias + OpDecorate %A FuncParamAttr NoAlias + OpDecorate %B FuncParamAttr NoAlias OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %16 Alignment 4 - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %B_addr Alignment 4 + OpDecorate %tmp Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_2 = OpConstant %uint 2 @@ -34,30 +46,30 @@ %bool = OpTypeBool %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpLabel - %16 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - OpStore %16 %10 Aligned 4 - OpStore %17 %11 Aligned 4 - %20 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %B = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %B_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %tmp = OpVariable %_ptr_Function_uint Function + OpStore %A_addr %A Aligned 4 + OpStore %B_addr %B Aligned 4 + %20 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %21 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %22 = OpCompositeExtract %uint %21 0 - %23 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %20 %22 - %24 = OpLoad %uint %23 Aligned 4 - OpStore %19 %24 Aligned 4 - %25 = OpLoad %uint %19 Aligned 4 - %28 = OpIEqual %bool %25 %uint_0 - OpBranchConditional %28 %13 %14 - %13 = OpLabel + %call = OpCompositeExtract %uint %21 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %20 %call + %24 = OpLoad %uint %arrayidx Aligned 4 + OpStore %tmp %24 Aligned 4 + %25 = OpLoad %uint %tmp Aligned 4 + %cmp = OpIEqual %bool %25 %uint_0 + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 - OpBranch %14 - %14 = OpLabel - %31 = OpLoad %uint %19 Aligned 4 - %32 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %33 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %32 %uint_0 - OpStore %33 %31 Aligned 4 + OpBranch %if_end + %if_end = OpLabel + %31 = OpLoad %uint %tmp Aligned 4 + %32 = OpLoad %_ptr_CrossWorkgroup_uint %B_addr Aligned 4 + %arrayidx1 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %32 %uint_0 + OpStore %arrayidx1 %31 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/divergence/race_no_divergence.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/divergence/race_no_divergence.spvasm index 91119d9f61..88e1d2e731 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/divergence/race_no_divergence.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/divergence/race_no_divergence.spvasm @@ -12,14 +12,23 @@ OpEntryPoint Kernel %9 "foo" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %A "A" + OpName %B "B" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpName %B_addr "B.addr" + OpName %tmp "tmp" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %arrayidx1 "arrayidx1" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant - OpDecorate %10 FuncParamAttr NoAlias - OpDecorate %11 FuncParamAttr NoAlias + OpDecorate %A FuncParamAttr NoAlias + OpDecorate %B FuncParamAttr NoAlias OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %14 Alignment 4 - OpDecorate %15 Alignment 4 - OpDecorate %17 Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %B_addr Alignment 4 + OpDecorate %tmp Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_528 = OpConstant %uint 528 @@ -33,24 +42,24 @@ %_ptr_Function_uint = OpTypePointer Function %uint %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpLabel - %14 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %15 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %17 = OpVariable %_ptr_Function_uint Function - OpStore %14 %10 Aligned 4 - OpStore %15 %11 Aligned 4 - %18 = OpLoad %_ptr_CrossWorkgroup_uint %14 Aligned 4 + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %B = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %B_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %tmp = OpVariable %_ptr_Function_uint Function + OpStore %A_addr %A Aligned 4 + OpStore %B_addr %B Aligned 4 + %18 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %19 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %20 = OpCompositeExtract %uint %19 0 - %21 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %18 %20 - %22 = OpLoad %uint %21 Aligned 4 - OpStore %17 %22 Aligned 4 + %call = OpCompositeExtract %uint %19 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %18 %call + %22 = OpLoad %uint %arrayidx Aligned 4 + OpStore %tmp %22 Aligned 4 OpControlBarrier %uint_2 %uint_2 %uint_528 - %25 = OpLoad %uint %17 Aligned 4 - %26 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 - %28 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %26 %uint_0 - OpStore %28 %25 Aligned 4 + %25 = OpLoad %uint %tmp Aligned 4 + %26 = OpLoad %_ptr_CrossWorkgroup_uint %B_addr Aligned 4 + %arrayidx1 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %26 %uint_0 + OpStore %arrayidx1 %25 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/fail_equality_and_adversarial.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/fail_equality_and_adversarial.spvasm index 5f404c789b..c2a0725247 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/fail_equality_and_adversarial.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/fail_equality_and_adversarial.spvasm @@ -10,9 +10,10 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %4 "foo" OpSource OpenCL_C 200000 + OpName %entry "entry" %void = OpTypeVoid %3 = OpTypeFunction %void %4 = OpFunction %void DontInline %3 - %5 = OpLabel + %entry = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/global_size/local_size_fail_divide_global_size.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/global_size/local_size_fail_divide_global_size.spvasm index d85912257e..aa942dc664 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/global_size/local_size_fail_divide_global_size.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/global_size/local_size_fail_divide_global_size.spvasm @@ -12,10 +12,16 @@ OpEntryPoint Kernel %9 "a" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %A "A" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %add "add" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %13 Alignment 4 + OpDecorate %A_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_5 = OpConstant %uint 5 %v3uint = OpTypeVector %uint 3 @@ -26,16 +32,16 @@ %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpLabel - %13 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %13 %10 Aligned 4 - %14 = OpLoad %_ptr_CrossWorkgroup_uint %13 Aligned 4 + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %A_addr %A Aligned 4 + %14 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %15 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %16 = OpCompositeExtract %uint %15 0 - %17 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %14 %16 - %18 = OpLoad %uint %17 Aligned 4 - %20 = OpIAdd %uint %18 %uint_5 - OpStore %17 %20 Aligned 4 + %call = OpCompositeExtract %uint %15 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %14 %call + %18 = OpLoad %uint %arrayidx Aligned 4 + %add = OpIAdd %uint %18 %uint_5 + OpStore %arrayidx %add Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/global_size/mismatch_dims.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/global_size/mismatch_dims.spvasm index d85912257e..aa942dc664 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/global_size/mismatch_dims.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/global_size/mismatch_dims.spvasm @@ -12,10 +12,16 @@ OpEntryPoint Kernel %9 "a" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %A "A" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %add "add" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %13 Alignment 4 + OpDecorate %A_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_5 = OpConstant %uint 5 %v3uint = OpTypeVector %uint 3 @@ -26,16 +32,16 @@ %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpLabel - %13 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %13 %10 Aligned 4 - %14 = OpLoad %_ptr_CrossWorkgroup_uint %13 Aligned 4 + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %A_addr %A Aligned 4 + %14 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %15 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %16 = OpCompositeExtract %uint %15 0 - %17 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %14 %16 - %18 = OpLoad %uint %17 Aligned 4 - %20 = OpIAdd %uint %18 %uint_5 - OpStore %17 %20 Aligned 4 + %call = OpCompositeExtract %uint %15 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %14 %call + %18 = OpLoad %uint %arrayidx Aligned 4 + %add = OpIAdd %uint %18 %uint_5 + OpStore %arrayidx %add Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/global_size/num_groups_and_global_size.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/global_size/num_groups_and_global_size.spvasm index d85912257e..aa942dc664 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/global_size/num_groups_and_global_size.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/global_size/num_groups_and_global_size.spvasm @@ -12,10 +12,16 @@ OpEntryPoint Kernel %9 "a" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %A "A" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %add "add" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %13 Alignment 4 + OpDecorate %A_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_5 = OpConstant %uint 5 %v3uint = OpTypeVector %uint 3 @@ -26,16 +32,16 @@ %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpLabel - %13 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %13 %10 Aligned 4 - %14 = OpLoad %_ptr_CrossWorkgroup_uint %13 Aligned 4 + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %A_addr %A Aligned 4 + %14 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %15 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %16 = OpCompositeExtract %uint %15 0 - %17 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %14 %16 - %18 = OpLoad %uint %17 Aligned 4 - %20 = OpIAdd %uint %18 %uint_5 - OpStore %17 %20 Aligned 4 + %call = OpCompositeExtract %uint %15 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %14 %call + %18 = OpLoad %uint %arrayidx Aligned 4 + %add = OpIAdd %uint %18 %uint_5 + OpStore %arrayidx %add Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/imagetests/fail2dimagecopy.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/imagetests/fail2dimagecopy.spvasm index 1334d4eb91..4bd067e833 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/imagetests/fail2dimagecopy.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/imagetests/fail2dimagecopy.spvasm @@ -14,15 +14,30 @@ OpEntryPoint Kernel %10 "k" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %dest "dest" + OpName %src "src" + OpName %entry "entry" + OpName %dest_addr "dest.addr" + OpName %src_addr "src.addr" + OpName %sampler "sampler" + OpName %_compoundliteral ".compoundliteral" + OpName %_compoundliteral1 ".compoundliteral1" + OpName %call "call" + OpName %vecinit "vecinit" + OpName %call2 "call2" + OpName %vecinit3 "vecinit3" + OpName %call4 "call4" + OpName %vecinit5 "vecinit5" OpName %TempSampledImage "TempSampledImage" + OpName %call6 "call6" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %15 Alignment 4 - OpDecorate %17 Alignment 4 - OpDecorate %20 Alignment 4 - OpDecorate %23 Alignment 8 - OpDecorate %24 Alignment 8 + OpDecorate %dest_addr Alignment 4 + OpDecorate %src_addr Alignment 4 + OpDecorate %sampler Alignment 4 + OpDecorate %_compoundliteral Alignment 8 + OpDecorate %_compoundliteral1 Alignment 8 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %30 = OpUndef %uint @@ -47,35 +62,35 @@ %38 = OpUndef %v2uint %float_0 = OpConstant %float 0 %10 = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %7 - %12 = OpFunctionParameter %8 - %13 = OpLabel - %15 = OpVariable %_ptr_Function_7 Function - %17 = OpVariable %_ptr_Function_8 Function - %20 = OpVariable %_ptr_Function_18 Function - %23 = OpVariable %_ptr_Function_v2uint Function - %24 = OpVariable %_ptr_Function_v2uint Function - OpStore %15 %11 Aligned 4 - OpStore %17 %12 Aligned 4 - OpStore %20 %25 Aligned 4 - %26 = OpLoad %7 %15 Aligned 4 + %dest = OpFunctionParameter %7 + %src = OpFunctionParameter %8 + %entry = OpLabel + %dest_addr = OpVariable %_ptr_Function_7 Function + %src_addr = OpVariable %_ptr_Function_8 Function + %sampler = OpVariable %_ptr_Function_18 Function +%_compoundliteral = OpVariable %_ptr_Function_v2uint Function +%_compoundliteral1 = OpVariable %_ptr_Function_v2uint Function + OpStore %dest_addr %dest Aligned 4 + OpStore %src_addr %src Aligned 4 + OpStore %sampler %25 Aligned 4 + %26 = OpLoad %7 %dest_addr Aligned 4 %27 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %28 = OpCompositeExtract %uint %27 1 - %32 = OpCompositeInsert %v2uint %28 %31 1 - OpStore %23 %32 Aligned 8 - %33 = OpLoad %v2uint %23 Aligned 8 - %34 = OpLoad %8 %17 Aligned 4 - %35 = OpLoad %18 %20 Aligned 4 + %call = OpCompositeExtract %uint %27 1 + %vecinit = OpCompositeInsert %v2uint %call %31 1 + OpStore %_compoundliteral %vecinit Aligned 8 + %33 = OpLoad %v2uint %_compoundliteral Aligned 8 + %34 = OpLoad %8 %src_addr Aligned 4 + %35 = OpLoad %18 %sampler Aligned 4 %36 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %37 = OpCompositeExtract %uint %36 0 - %39 = OpCompositeInsert %v2uint %37 %38 0 + %call2 = OpCompositeExtract %uint %36 0 + %vecinit3 = OpCompositeInsert %v2uint %call2 %38 0 %40 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %41 = OpCompositeExtract %uint %40 1 - %42 = OpCompositeInsert %v2uint %41 %39 1 - OpStore %24 %42 Aligned 8 - %43 = OpLoad %v2uint %24 Aligned 8 + %call4 = OpCompositeExtract %uint %40 1 + %vecinit5 = OpCompositeInsert %v2uint %call4 %vecinit3 1 + OpStore %_compoundliteral1 %vecinit5 Aligned 8 + %43 = OpLoad %v2uint %_compoundliteral1 Aligned 8 %TempSampledImage = OpSampledImage %44 %34 %35 - %49 = OpImageSampleExplicitLod %v4float %TempSampledImage %43 Lod %float_0 - OpImageWrite %26 %33 %49 + %call6 = OpImageSampleExplicitLod %v4float %TempSampledImage %43 Lod %float_0 + OpImageWrite %26 %33 %call6 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/imagetests/test2dimagecopy.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/imagetests/test2dimagecopy.spvasm index 3a4af86f06..731f2863ea 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/imagetests/test2dimagecopy.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/imagetests/test2dimagecopy.spvasm @@ -14,15 +14,32 @@ OpEntryPoint Kernel %10 "k" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %dest "dest" + OpName %src "src" + OpName %entry "entry" + OpName %dest_addr "dest.addr" + OpName %src_addr "src.addr" + OpName %sampler "sampler" + OpName %_compoundliteral ".compoundliteral" + OpName %_compoundliteral3 ".compoundliteral3" + OpName %call "call" + OpName %vecinit "vecinit" + OpName %call1 "call1" + OpName %vecinit2 "vecinit2" + OpName %call4 "call4" + OpName %vecinit5 "vecinit5" + OpName %call6 "call6" + OpName %vecinit7 "vecinit7" OpName %TempSampledImage "TempSampledImage" + OpName %call8 "call8" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %15 Alignment 4 - OpDecorate %17 Alignment 4 - OpDecorate %20 Alignment 4 - OpDecorate %23 Alignment 8 - OpDecorate %24 Alignment 8 + OpDecorate %dest_addr Alignment 4 + OpDecorate %src_addr Alignment 4 + OpDecorate %sampler Alignment 4 + OpDecorate %_compoundliteral Alignment 8 + OpDecorate %_compoundliteral3 Alignment 8 %uint = OpTypeInt 32 0 %v3uint = OpTypeVector %uint 3 %_ptr_Input_v3uint = OpTypePointer Input %v3uint @@ -44,38 +61,38 @@ %29 = OpUndef %v2uint %float_0 = OpConstant %float 0 %10 = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %7 - %12 = OpFunctionParameter %8 - %13 = OpLabel - %15 = OpVariable %_ptr_Function_7 Function - %17 = OpVariable %_ptr_Function_8 Function - %20 = OpVariable %_ptr_Function_18 Function - %23 = OpVariable %_ptr_Function_v2uint Function - %24 = OpVariable %_ptr_Function_v2uint Function - OpStore %15 %11 Aligned 4 - OpStore %17 %12 Aligned 4 - OpStore %20 %25 Aligned 4 - %26 = OpLoad %7 %15 Aligned 4 + %dest = OpFunctionParameter %7 + %src = OpFunctionParameter %8 + %entry = OpLabel + %dest_addr = OpVariable %_ptr_Function_7 Function + %src_addr = OpVariable %_ptr_Function_8 Function + %sampler = OpVariable %_ptr_Function_18 Function +%_compoundliteral = OpVariable %_ptr_Function_v2uint Function +%_compoundliteral3 = OpVariable %_ptr_Function_v2uint Function + OpStore %dest_addr %dest Aligned 4 + OpStore %src_addr %src Aligned 4 + OpStore %sampler %25 Aligned 4 + %26 = OpLoad %7 %dest_addr Aligned 4 %27 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %28 = OpCompositeExtract %uint %27 0 - %30 = OpCompositeInsert %v2uint %28 %29 0 + %call = OpCompositeExtract %uint %27 0 + %vecinit = OpCompositeInsert %v2uint %call %29 0 %31 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %32 = OpCompositeExtract %uint %31 1 - %33 = OpCompositeInsert %v2uint %32 %30 1 - OpStore %23 %33 Aligned 8 - %34 = OpLoad %v2uint %23 Aligned 8 - %35 = OpLoad %8 %17 Aligned 4 - %36 = OpLoad %18 %20 Aligned 4 + %call1 = OpCompositeExtract %uint %31 1 + %vecinit2 = OpCompositeInsert %v2uint %call1 %vecinit 1 + OpStore %_compoundliteral %vecinit2 Aligned 8 + %34 = OpLoad %v2uint %_compoundliteral Aligned 8 + %35 = OpLoad %8 %src_addr Aligned 4 + %36 = OpLoad %18 %sampler Aligned 4 %37 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %38 = OpCompositeExtract %uint %37 0 - %39 = OpCompositeInsert %v2uint %38 %29 0 + %call4 = OpCompositeExtract %uint %37 0 + %vecinit5 = OpCompositeInsert %v2uint %call4 %29 0 %40 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %41 = OpCompositeExtract %uint %40 1 - %42 = OpCompositeInsert %v2uint %41 %39 1 - OpStore %24 %42 Aligned 8 - %43 = OpLoad %v2uint %24 Aligned 8 + %call6 = OpCompositeExtract %uint %40 1 + %vecinit7 = OpCompositeInsert %v2uint %call6 %vecinit5 1 + OpStore %_compoundliteral3 %vecinit7 Aligned 8 + %43 = OpLoad %v2uint %_compoundliteral3 Aligned 8 %TempSampledImage = OpSampledImage %44 %35 %36 - %49 = OpImageSampleExplicitLod %v4float %TempSampledImage %43 Lod %float_0 - OpImageWrite %26 %34 %49 + %call8 = OpImageSampleExplicitLod %v4float %TempSampledImage %43 Lod %float_0 + OpImageWrite %26 %34 %call8 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/induction_variable.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/induction_variable.spvasm index 3c9d0ebd0d..07d10cc533 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/induction_variable.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/induction_variable.spvasm @@ -13,15 +13,32 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" OpName %__spirv_BuiltInWorkgroupSize "__spirv_BuiltInWorkgroupSize" + OpName %data "data" + OpName %entry "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %data_addr "data.addr" + OpName %j "j" + OpName %i "i" + OpName %cmp "cmp" + OpName %call "call" + OpName %call1 "call1" + OpName %add "add" + OpName %arrayidx "arrayidx" + OpName %inc "inc" + OpName %call2 "call2" + OpName %add3 "add3" OpDecorate %__spirv_BuiltInWorkgroupSize BuiltIn WorkgroupSize OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInWorkgroupSize Constant OpDecorate %__spirv_BuiltInWorkgroupSize LinkageAttributes "__spirv_BuiltInWorkgroupSize" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %18 Alignment 4 - OpDecorate %20 Alignment 4 - OpDecorate %21 Alignment 4 + OpDecorate %data_addr Alignment 4 + OpDecorate %j Alignment 4 + OpDecorate %i Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_10 = OpConstant %uint 10 @@ -37,40 +54,40 @@ %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInWorkgroupSize = OpVariable %_ptr_Input_v3uint Input %10 = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_Workgroup_uint - %12 = OpLabel - %18 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %20 = OpVariable %_ptr_Function_uint Function - %21 = OpVariable %_ptr_Function_uint Function - OpStore %18 %11 Aligned 4 - OpStore %20 %uint_0 Aligned 4 - OpStore %21 %uint_0 Aligned 4 - OpBranch %13 - %13 = OpLabel - %23 = OpLoad %uint %21 Aligned 4 - %26 = OpSLessThan %bool %23 %uint_10 - OpBranchConditional %26 %14 %16 - %14 = OpLabel + %data = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %data_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %j = OpVariable %_ptr_Function_uint Function + %i = OpVariable %_ptr_Function_uint Function + OpStore %data_addr %data Aligned 4 + OpStore %j %uint_0 Aligned 4 + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %23 = OpLoad %uint %i Aligned 4 + %cmp = OpSLessThan %bool %23 %uint_10 + OpBranchConditional %cmp %for_body %for_end + %for_body = OpLabel %27 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %28 = OpCompositeExtract %uint %27 0 - %29 = OpLoad %_ptr_Workgroup_uint %18 Aligned 4 - %30 = OpLoad %uint %20 Aligned 4 + %call = OpCompositeExtract %uint %27 0 + %29 = OpLoad %_ptr_Workgroup_uint %data_addr Aligned 4 + %30 = OpLoad %uint %j Aligned 4 %31 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %32 = OpCompositeExtract %uint %31 0 - %33 = OpIAdd %uint %30 %32 - %34 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %29 %33 - OpStore %34 %28 Aligned 4 - OpBranch %15 - %15 = OpLabel - %35 = OpLoad %uint %21 Aligned 4 - %37 = OpIAdd %uint %35 %uint_1 - OpStore %21 %37 Aligned 4 + %call1 = OpCompositeExtract %uint %31 0 + %add = OpIAdd %uint %30 %call1 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %29 %add + OpStore %arrayidx %call Aligned 4 + OpBranch %for_inc + %for_inc = OpLabel + %35 = OpLoad %uint %i Aligned 4 + %inc = OpIAdd %uint %35 %uint_1 + OpStore %i %inc Aligned 4 %38 = OpLoad %v3uint %__spirv_BuiltInWorkgroupSize Aligned 16 - %39 = OpCompositeExtract %uint %38 0 - %40 = OpLoad %uint %20 Aligned 4 - %41 = OpIAdd %uint %40 %39 - OpStore %20 %41 Aligned 4 - OpBranch %13 - %16 = OpLabel + %call2 = OpCompositeExtract %uint %38 0 + %40 = OpLoad %uint %j Aligned 4 + %add3 = OpIAdd %uint %40 %call2 + OpStore %j %add3 Aligned 4 + OpBranch %for_cond + %for_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/fail/local_id.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/fail/local_id.spvasm index 61952ff148..207a00f97e 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/fail/local_id.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/fail/local_id.spvasm @@ -13,13 +13,19 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInWorkgroupId "__spirv_BuiltInWorkgroupId" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %p "p" + OpName %entry "entry" + OpName %p_addr "p.addr" + OpName %call "call" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInWorkgroupId Constant OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInWorkgroupId LinkageAttributes "__spirv_BuiltInWorkgroupId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %14 Alignment 4 + OpDecorate %p_addr Alignment 4 %uint = OpTypeInt 32 0 %v3uint = OpTypeVector %uint 3 %_ptr_Input_v3uint = OpTypePointer Input %v3uint @@ -30,16 +36,16 @@ %__spirv_BuiltInWorkgroupId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %10 = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpLabel - %14 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %14 %11 Aligned 4 + %p = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %p_addr %p Aligned 4 %15 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %16 = OpCompositeExtract %uint %15 0 - %17 = OpLoad %_ptr_CrossWorkgroup_uint %14 Aligned 4 + %call = OpCompositeExtract %uint %15 0 + %17 = OpLoad %_ptr_CrossWorkgroup_uint %p_addr Aligned 4 %18 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %19 = OpCompositeExtract %uint %18 0 - %20 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %17 %19 - OpStore %20 %16 Aligned 4 + %call1 = OpCompositeExtract %uint %18 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %17 %call1 + OpStore %arrayidx %call Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/fail/missing_global_barrier_flag.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/fail/missing_global_barrier_flag.spvasm index a3d219690b..062d3a940f 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/fail/missing_global_barrier_flag.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/fail/missing_global_barrier_flag.spvasm @@ -14,6 +14,22 @@ OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" OpName %__spirv_BuiltInWorkgroupSize "__spirv_BuiltInWorkgroupSize" + OpName %p "p" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %p_addr "p.addr" + OpName %call "call" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" + OpName %call2 "call2" + OpName %call3 "call3" + OpName %sub "sub" + OpName %cmp "cmp" + OpName %call4 "call4" + OpName %call5 "call5" + OpName %add "add" + OpName %arrayidx6 "arrayidx6" OpDecorate %__spirv_BuiltInWorkgroupSize BuiltIn WorkgroupSize OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId @@ -23,7 +39,7 @@ OpDecorate %__spirv_BuiltInWorkgroupSize LinkageAttributes "__spirv_BuiltInWorkgroupSize" Import OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %17 Alignment 4 + OpDecorate %p_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_272 = OpConstant %uint 272 @@ -39,35 +55,35 @@ %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInWorkgroupSize = OpVariable %_ptr_Input_v3uint Input %11 = OpFunction %void DontInline %10 - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpLabel - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %17 %12 Aligned 4 + %p = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %p_addr %p Aligned 4 %18 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %19 = OpCompositeExtract %uint %18 0 - %20 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 + %call = OpCompositeExtract %uint %18 0 + %20 = OpLoad %_ptr_CrossWorkgroup_uint %p_addr Aligned 4 %21 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %22 = OpCompositeExtract %uint %21 0 - %23 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %20 %22 - OpStore %23 %19 Aligned 4 + %call1 = OpCompositeExtract %uint %21 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %20 %call1 + OpStore %arrayidx %call Aligned 4 OpControlBarrier %uint_2 %uint_2 %uint_272 %26 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %27 = OpCompositeExtract %uint %26 0 + %call2 = OpCompositeExtract %uint %26 0 %28 = OpLoad %v3uint %__spirv_BuiltInWorkgroupSize Aligned 16 - %29 = OpCompositeExtract %uint %28 0 - %31 = OpISub %uint %29 %uint_1 - %33 = OpULessThan %bool %27 %31 - OpBranchConditional %33 %14 %15 - %14 = OpLabel + %call3 = OpCompositeExtract %uint %28 0 + %sub = OpISub %uint %call3 %uint_1 + %cmp = OpULessThan %bool %call2 %sub + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel %34 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %35 = OpCompositeExtract %uint %34 0 - %36 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 + %call4 = OpCompositeExtract %uint %34 0 + %36 = OpLoad %_ptr_CrossWorkgroup_uint %p_addr Aligned 4 %37 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %38 = OpCompositeExtract %uint %37 0 - %39 = OpIAdd %uint %38 %uint_1 - %40 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %39 - OpStore %40 %35 Aligned 4 - OpBranch %15 - %15 = OpLabel + %call5 = OpCompositeExtract %uint %37 0 + %add = OpIAdd %uint %call5 %uint_1 + %arrayidx6 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %add + OpStore %arrayidx6 %call4 Aligned 4 + OpBranch %if_end + %if_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/fail/missing_local_barrier_flag.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/fail/missing_local_barrier_flag.spvasm index 795cf1cf52..c4cf9b835d 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/fail/missing_local_barrier_flag.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/fail/missing_local_barrier_flag.spvasm @@ -13,13 +13,23 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %p "p" + OpName %entry "entry" + OpName %p_addr "p.addr" + OpName %call "call" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" + OpName %call2 "call2" + OpName %call3 "call3" + OpName %add "add" + OpName %arrayidx4 "arrayidx4" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %14 Alignment 4 + OpDecorate %p_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_528 = OpConstant %uint 528 @@ -33,25 +43,25 @@ %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %10 = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_Workgroup_uint - %12 = OpLabel - %14 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - OpStore %14 %11 Aligned 4 + %p = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + OpStore %p_addr %p Aligned 4 %15 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %16 = OpCompositeExtract %uint %15 0 - %17 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 + %call = OpCompositeExtract %uint %15 0 + %17 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 %18 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %19 = OpCompositeExtract %uint %18 0 - %20 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %17 %19 - OpStore %20 %16 Aligned 4 + %call1 = OpCompositeExtract %uint %18 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %17 %call1 + OpStore %arrayidx %call Aligned 4 OpControlBarrier %uint_2 %uint_2 %uint_528 %23 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %24 = OpCompositeExtract %uint %23 0 - %25 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 + %call2 = OpCompositeExtract %uint %23 0 + %25 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 %26 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %27 = OpCompositeExtract %uint %26 0 - %29 = OpIAdd %uint %27 %uint_1 - %30 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %25 %29 - OpStore %30 %24 Aligned 4 + %call3 = OpCompositeExtract %uint %26 0 + %add = OpIAdd %uint %call3 %uint_1 + %arrayidx4 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %25 %add + OpStore %arrayidx4 %call2 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/fail/no_barrier_flags.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/fail/no_barrier_flags.spvasm index 61a8584ac9..6094e770c4 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/fail/no_barrier_flags.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/fail/no_barrier_flags.spvasm @@ -13,13 +13,23 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %p "p" + OpName %entry "entry" + OpName %p_addr "p.addr" + OpName %call "call" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" + OpName %call2 "call2" + OpName %call3 "call3" + OpName %add "add" + OpName %arrayidx4 "arrayidx4" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %14 Alignment 4 + OpDecorate %p_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_0 = OpConstant %uint 0 @@ -33,25 +43,25 @@ %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %10 = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_Workgroup_uint - %12 = OpLabel - %14 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - OpStore %14 %11 Aligned 4 + %p = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + OpStore %p_addr %p Aligned 4 %15 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %16 = OpCompositeExtract %uint %15 0 - %17 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 + %call = OpCompositeExtract %uint %15 0 + %17 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 %18 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %19 = OpCompositeExtract %uint %18 0 - %20 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %17 %19 - OpStore %20 %16 Aligned 4 + %call1 = OpCompositeExtract %uint %18 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %17 %call1 + OpStore %arrayidx %call Aligned 4 OpControlBarrier %uint_2 %uint_2 %uint_0 %23 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %24 = OpCompositeExtract %uint %23 0 - %25 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 + %call2 = OpCompositeExtract %uint %23 0 + %25 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 %26 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %27 = OpCompositeExtract %uint %26 0 - %29 = OpIAdd %uint %27 %uint_1 - %30 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %25 %29 - OpStore %30 %24 Aligned 4 + %call3 = OpCompositeExtract %uint %26 0 + %add = OpIAdd %uint %call3 %uint_1 + %arrayidx4 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %25 %add + OpStore %arrayidx4 %call2 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/fail/sync.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/fail/sync.spvasm index 1cd311f29e..182dc83c40 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/fail/sync.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/fail/sync.spvasm @@ -12,10 +12,20 @@ OpEntryPoint Kernel %9 "foo" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %p "p" + OpName %entry "entry" + OpName %p_addr "p.addr" + OpName %call "call" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" + OpName %call2 "call2" + OpName %call3 "call3" + OpName %add "add" + OpName %arrayidx4 "arrayidx4" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %13 Alignment 4 + OpDecorate %p_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_528 = OpConstant %uint 528 @@ -28,25 +38,25 @@ %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpLabel - %13 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %13 %10 Aligned 4 + %p = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %p_addr %p Aligned 4 %14 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %15 = OpCompositeExtract %uint %14 0 - %16 = OpLoad %_ptr_CrossWorkgroup_uint %13 Aligned 4 + %call = OpCompositeExtract %uint %14 0 + %16 = OpLoad %_ptr_CrossWorkgroup_uint %p_addr Aligned 4 %17 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %18 = OpCompositeExtract %uint %17 0 - %19 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %16 %18 - OpStore %19 %15 Aligned 4 + %call1 = OpCompositeExtract %uint %17 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %16 %call1 + OpStore %arrayidx %call Aligned 4 OpControlBarrier %uint_2 %uint_2 %uint_528 %22 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %23 = OpCompositeExtract %uint %22 0 - %24 = OpLoad %_ptr_CrossWorkgroup_uint %13 Aligned 4 + %call2 = OpCompositeExtract %uint %22 0 + %24 = OpLoad %_ptr_CrossWorkgroup_uint %p_addr Aligned 4 %25 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %26 = OpCompositeExtract %uint %25 0 - %28 = OpIAdd %uint %26 %uint_1 - %29 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %24 %28 - OpStore %29 %23 Aligned 4 + %call3 = OpCompositeExtract %uint %25 0 + %add = OpIAdd %uint %call3 %uint_1 + %arrayidx4 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %24 %add + OpStore %arrayidx4 %call2 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/fail/sync_within_group_wrong_flag.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/fail/sync_within_group_wrong_flag.spvasm index a3d219690b..062d3a940f 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/fail/sync_within_group_wrong_flag.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/fail/sync_within_group_wrong_flag.spvasm @@ -14,6 +14,22 @@ OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" OpName %__spirv_BuiltInWorkgroupSize "__spirv_BuiltInWorkgroupSize" + OpName %p "p" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %p_addr "p.addr" + OpName %call "call" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" + OpName %call2 "call2" + OpName %call3 "call3" + OpName %sub "sub" + OpName %cmp "cmp" + OpName %call4 "call4" + OpName %call5 "call5" + OpName %add "add" + OpName %arrayidx6 "arrayidx6" OpDecorate %__spirv_BuiltInWorkgroupSize BuiltIn WorkgroupSize OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId @@ -23,7 +39,7 @@ OpDecorate %__spirv_BuiltInWorkgroupSize LinkageAttributes "__spirv_BuiltInWorkgroupSize" Import OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %17 Alignment 4 + OpDecorate %p_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_272 = OpConstant %uint 272 @@ -39,35 +55,35 @@ %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInWorkgroupSize = OpVariable %_ptr_Input_v3uint Input %11 = OpFunction %void DontInline %10 - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpLabel - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %17 %12 Aligned 4 + %p = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %p_addr %p Aligned 4 %18 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %19 = OpCompositeExtract %uint %18 0 - %20 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 + %call = OpCompositeExtract %uint %18 0 + %20 = OpLoad %_ptr_CrossWorkgroup_uint %p_addr Aligned 4 %21 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %22 = OpCompositeExtract %uint %21 0 - %23 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %20 %22 - OpStore %23 %19 Aligned 4 + %call1 = OpCompositeExtract %uint %21 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %20 %call1 + OpStore %arrayidx %call Aligned 4 OpControlBarrier %uint_2 %uint_2 %uint_272 %26 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %27 = OpCompositeExtract %uint %26 0 + %call2 = OpCompositeExtract %uint %26 0 %28 = OpLoad %v3uint %__spirv_BuiltInWorkgroupSize Aligned 16 - %29 = OpCompositeExtract %uint %28 0 - %31 = OpISub %uint %29 %uint_1 - %33 = OpULessThan %bool %27 %31 - OpBranchConditional %33 %14 %15 - %14 = OpLabel + %call3 = OpCompositeExtract %uint %28 0 + %sub = OpISub %uint %call3 %uint_1 + %cmp = OpULessThan %bool %call2 %sub + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel %34 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %35 = OpCompositeExtract %uint %34 0 - %36 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 + %call4 = OpCompositeExtract %uint %34 0 + %36 = OpLoad %_ptr_CrossWorkgroup_uint %p_addr Aligned 4 %37 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %38 = OpCompositeExtract %uint %37 0 - %39 = OpIAdd %uint %38 %uint_1 - %40 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %39 - OpStore %40 %35 Aligned 4 - OpBranch %15 - %15 = OpLabel + %call5 = OpCompositeExtract %uint %37 0 + %add = OpIAdd %uint %call5 %uint_1 + %arrayidx6 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %add + OpStore %arrayidx6 %call4 Aligned 4 + OpBranch %if_end + %if_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/pass/global_barrier.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/pass/global_barrier.spvasm index 3a4e0d2166..75cc407e8f 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/pass/global_barrier.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/pass/global_barrier.spvasm @@ -14,6 +14,22 @@ OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" OpName %__spirv_BuiltInWorkgroupSize "__spirv_BuiltInWorkgroupSize" + OpName %p "p" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %p_addr "p.addr" + OpName %call "call" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" + OpName %call2 "call2" + OpName %call3 "call3" + OpName %sub "sub" + OpName %cmp "cmp" + OpName %call4 "call4" + OpName %call5 "call5" + OpName %add "add" + OpName %arrayidx6 "arrayidx6" OpDecorate %__spirv_BuiltInWorkgroupSize BuiltIn WorkgroupSize OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId @@ -23,7 +39,7 @@ OpDecorate %__spirv_BuiltInWorkgroupSize LinkageAttributes "__spirv_BuiltInWorkgroupSize" Import OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %17 Alignment 4 + OpDecorate %p_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_528 = OpConstant %uint 528 @@ -39,35 +55,35 @@ %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInWorkgroupSize = OpVariable %_ptr_Input_v3uint Input %11 = OpFunction %void DontInline %10 - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpLabel - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %17 %12 Aligned 4 + %p = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %p_addr %p Aligned 4 %18 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %19 = OpCompositeExtract %uint %18 0 - %20 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 + %call = OpCompositeExtract %uint %18 0 + %20 = OpLoad %_ptr_CrossWorkgroup_uint %p_addr Aligned 4 %21 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %22 = OpCompositeExtract %uint %21 0 - %23 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %20 %22 - OpStore %23 %19 Aligned 4 + %call1 = OpCompositeExtract %uint %21 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %20 %call1 + OpStore %arrayidx %call Aligned 4 OpControlBarrier %uint_2 %uint_2 %uint_528 %26 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %27 = OpCompositeExtract %uint %26 0 + %call2 = OpCompositeExtract %uint %26 0 %28 = OpLoad %v3uint %__spirv_BuiltInWorkgroupSize Aligned 16 - %29 = OpCompositeExtract %uint %28 0 - %31 = OpISub %uint %29 %uint_1 - %33 = OpULessThan %bool %27 %31 - OpBranchConditional %33 %14 %15 - %14 = OpLabel + %call3 = OpCompositeExtract %uint %28 0 + %sub = OpISub %uint %call3 %uint_1 + %cmp = OpULessThan %bool %call2 %sub + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel %34 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %35 = OpCompositeExtract %uint %34 0 - %36 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 + %call4 = OpCompositeExtract %uint %34 0 + %36 = OpLoad %_ptr_CrossWorkgroup_uint %p_addr Aligned 4 %37 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %38 = OpCompositeExtract %uint %37 0 - %39 = OpIAdd %uint %38 %uint_1 - %40 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %39 - OpStore %40 %35 Aligned 4 - OpBranch %15 - %15 = OpLabel + %call5 = OpCompositeExtract %uint %37 0 + %add = OpIAdd %uint %call5 %uint_1 + %arrayidx6 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %add + OpStore %arrayidx6 %call4 Aligned 4 + OpBranch %if_end + %if_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/pass/local_barrier_flag.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/pass/local_barrier_flag.spvasm index f791f0c094..efd431d9cb 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/pass/local_barrier_flag.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/pass/local_barrier_flag.spvasm @@ -13,13 +13,23 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %p "p" + OpName %entry "entry" + OpName %p_addr "p.addr" + OpName %call "call" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" + OpName %call2 "call2" + OpName %call3 "call3" + OpName %add "add" + OpName %arrayidx4 "arrayidx4" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %14 Alignment 4 + OpDecorate %p_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_272 = OpConstant %uint 272 @@ -33,25 +43,25 @@ %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %10 = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_Workgroup_uint - %12 = OpLabel - %14 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - OpStore %14 %11 Aligned 4 + %p = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + OpStore %p_addr %p Aligned 4 %15 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %16 = OpCompositeExtract %uint %15 0 - %17 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 + %call = OpCompositeExtract %uint %15 0 + %17 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 %18 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %19 = OpCompositeExtract %uint %18 0 - %20 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %17 %19 - OpStore %20 %16 Aligned 4 + %call1 = OpCompositeExtract %uint %18 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %17 %call1 + OpStore %arrayidx %call Aligned 4 OpControlBarrier %uint_2 %uint_2 %uint_272 %23 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %24 = OpCompositeExtract %uint %23 0 - %25 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 + %call2 = OpCompositeExtract %uint %23 0 + %25 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 %26 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %27 = OpCompositeExtract %uint %26 0 - %29 = OpIAdd %uint %27 %uint_1 - %30 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %25 %29 - OpStore %30 %24 Aligned 4 + %call3 = OpCompositeExtract %uint %26 0 + %add = OpIAdd %uint %call3 %uint_1 + %arrayidx4 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %25 %add + OpStore %arrayidx4 %call2 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/pass/local_id_benign_write_write.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/pass/local_id_benign_write_write.spvasm index bbbc98fb67..27bfcf328a 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/pass/local_id_benign_write_write.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/pass/local_id_benign_write_write.spvasm @@ -12,10 +12,16 @@ OpEntryPoint Kernel %9 "foo" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %p "p" + OpName %entry "entry" + OpName %p_addr "p.addr" + OpName %call "call" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %13 Alignment 4 + OpDecorate %p_addr Alignment 4 %uint = OpTypeInt 32 0 %v3uint = OpTypeVector %uint 3 %_ptr_Input_v3uint = OpTypePointer Input %v3uint @@ -25,16 +31,16 @@ %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpLabel - %13 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %13 %10 Aligned 4 + %p = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %p_addr %p Aligned 4 %14 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %15 = OpCompositeExtract %uint %14 0 - %16 = OpLoad %_ptr_CrossWorkgroup_uint %13 Aligned 4 + %call = OpCompositeExtract %uint %14 0 + %16 = OpLoad %_ptr_CrossWorkgroup_uint %p_addr Aligned 4 %17 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %18 = OpCompositeExtract %uint %17 0 - %19 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %16 %18 - OpStore %19 %15 Aligned 4 + %call1 = OpCompositeExtract %uint %17 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %16 %call1 + OpStore %arrayidx %call Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/pass/pass_due_to_intra_group_flag.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/pass/pass_due_to_intra_group_flag.spvasm index e5cf1b7ee6..49c1d2d986 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/pass/pass_due_to_intra_group_flag.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/pass/pass_due_to_intra_group_flag.spvasm @@ -13,13 +13,19 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %p "p" + OpName %entry "entry" + OpName %p_addr "p.addr" + OpName %call "call" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %14 Alignment 4 + OpDecorate %p_addr Alignment 4 %uint = OpTypeInt 32 0 %v3uint = OpTypeVector %uint 3 %_ptr_Input_v3uint = OpTypePointer Input %v3uint @@ -30,16 +36,16 @@ %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %10 = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpLabel - %14 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %14 %11 Aligned 4 + %p = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %p_addr %p Aligned 4 %15 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %16 = OpCompositeExtract %uint %15 0 - %17 = OpLoad %_ptr_CrossWorkgroup_uint %14 Aligned 4 + %call = OpCompositeExtract %uint %15 0 + %17 = OpLoad %_ptr_CrossWorkgroup_uint %p_addr Aligned 4 %18 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %19 = OpCompositeExtract %uint %18 0 - %20 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %17 %19 - OpStore %20 %16 Aligned 4 + %call1 = OpCompositeExtract %uint %18 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %17 %call1 + OpStore %arrayidx %call Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/pass/sync_within_group.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/pass/sync_within_group.spvasm index 3a4e0d2166..75cc407e8f 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/pass/sync_within_group.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/inter_group_and_barrier_flag_tests/pass/sync_within_group.spvasm @@ -14,6 +14,22 @@ OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" OpName %__spirv_BuiltInWorkgroupSize "__spirv_BuiltInWorkgroupSize" + OpName %p "p" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %p_addr "p.addr" + OpName %call "call" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" + OpName %call2 "call2" + OpName %call3 "call3" + OpName %sub "sub" + OpName %cmp "cmp" + OpName %call4 "call4" + OpName %call5 "call5" + OpName %add "add" + OpName %arrayidx6 "arrayidx6" OpDecorate %__spirv_BuiltInWorkgroupSize BuiltIn WorkgroupSize OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId @@ -23,7 +39,7 @@ OpDecorate %__spirv_BuiltInWorkgroupSize LinkageAttributes "__spirv_BuiltInWorkgroupSize" Import OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %17 Alignment 4 + OpDecorate %p_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_528 = OpConstant %uint 528 @@ -39,35 +55,35 @@ %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInWorkgroupSize = OpVariable %_ptr_Input_v3uint Input %11 = OpFunction %void DontInline %10 - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpLabel - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %17 %12 Aligned 4 + %p = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %p_addr %p Aligned 4 %18 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %19 = OpCompositeExtract %uint %18 0 - %20 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 + %call = OpCompositeExtract %uint %18 0 + %20 = OpLoad %_ptr_CrossWorkgroup_uint %p_addr Aligned 4 %21 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %22 = OpCompositeExtract %uint %21 0 - %23 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %20 %22 - OpStore %23 %19 Aligned 4 + %call1 = OpCompositeExtract %uint %21 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %20 %call1 + OpStore %arrayidx %call Aligned 4 OpControlBarrier %uint_2 %uint_2 %uint_528 %26 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %27 = OpCompositeExtract %uint %26 0 + %call2 = OpCompositeExtract %uint %26 0 %28 = OpLoad %v3uint %__spirv_BuiltInWorkgroupSize Aligned 16 - %29 = OpCompositeExtract %uint %28 0 - %31 = OpISub %uint %29 %uint_1 - %33 = OpULessThan %bool %27 %31 - OpBranchConditional %33 %14 %15 - %14 = OpLabel + %call3 = OpCompositeExtract %uint %28 0 + %sub = OpISub %uint %call3 %uint_1 + %cmp = OpULessThan %bool %call2 %sub + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel %34 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %35 = OpCompositeExtract %uint %34 0 - %36 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 + %call4 = OpCompositeExtract %uint %34 0 + %36 = OpLoad %_ptr_CrossWorkgroup_uint %p_addr Aligned 4 %37 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %38 = OpCompositeExtract %uint %37 0 - %39 = OpIAdd %uint %38 %uint_1 - %40 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %39 - OpStore %40 %35 Aligned 4 - OpBranch %15 - %15 = OpLabel + %call5 = OpCompositeExtract %uint %37 0 + %add = OpIAdd %uint %call5 %uint_1 + %arrayidx6 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %add + OpStore %arrayidx6 %call4 Aligned 4 + OpBranch %if_end + %if_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/k-induction/amazingreduction.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/k-induction/amazingreduction.spvasm index 34bdf66fda..ee81075b0f 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/k-induction/amazingreduction.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/k-induction/amazingreduction.spvasm @@ -13,14 +13,42 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInWorkgroupSize "__spirv_BuiltInWorkgroupSize" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %p "p" + OpName %entry "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %if_then9 "if.then9" + OpName %if_end12 "if.end12" + OpName %p_addr "p.addr" + OpName %d "d" + OpName %call "call" + OpName %div "div" + OpName %cmp "cmp" + OpName %call1 "call1" + OpName %cmp2 "cmp2" + OpName %call3 "call3" + OpName %add "add" + OpName %arrayidx "arrayidx" + OpName %call4 "call4" + OpName %arrayidx5 "arrayidx5" + OpName %add6 "add6" + OpName %shr "shr" + OpName %call7 "call7" + OpName %cmp8 "cmp8" + OpName %call10 "call10" + OpName %arrayidx11 "arrayidx11" OpDecorate %__spirv_BuiltInWorkgroupSize BuiltIn WorkgroupSize OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInWorkgroupSize Constant OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInWorkgroupSize LinkageAttributes "__spirv_BuiltInWorkgroupSize" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %22 Alignment 4 - OpDecorate %24 Alignment 4 + OpDecorate %p_addr Alignment 4 + OpDecorate %d Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_0 = OpConstant %uint 0 @@ -37,62 +65,62 @@ %__spirv_BuiltInWorkgroupSize = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %10 = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_Workgroup_uint - %12 = OpLabel - %22 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %24 = OpVariable %_ptr_Function_uint Function - OpStore %22 %11 Aligned 4 + %p = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %d = OpVariable %_ptr_Function_uint Function + OpStore %p_addr %p Aligned 4 %25 = OpLoad %v3uint %__spirv_BuiltInWorkgroupSize Aligned 16 - %26 = OpCompositeExtract %uint %25 0 - %28 = OpUDiv %uint %26 %uint_2 - OpStore %24 %28 Aligned 4 - OpBranch %13 - %13 = OpLabel - %29 = OpLoad %uint %24 Aligned 4 - %32 = OpSGreaterThan %bool %29 %uint_0 - OpBranchConditional %32 %14 %18 - %14 = OpLabel + %call = OpCompositeExtract %uint %25 0 + %div = OpUDiv %uint %call %uint_2 + OpStore %d %div Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %29 = OpLoad %uint %d Aligned 4 + %cmp = OpSGreaterThan %bool %29 %uint_0 + OpBranchConditional %cmp %for_body %for_end + %for_body = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_272 %34 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %35 = OpCompositeExtract %uint %34 0 - %36 = OpLoad %uint %24 Aligned 4 - %37 = OpULessThan %bool %35 %36 - OpBranchConditional %37 %15 %16 - %15 = OpLabel - %38 = OpLoad %_ptr_Workgroup_uint %22 Aligned 4 + %call1 = OpCompositeExtract %uint %34 0 + %36 = OpLoad %uint %d Aligned 4 + %cmp2 = OpULessThan %bool %call1 %36 + OpBranchConditional %cmp2 %if_then %if_end + %if_then = OpLabel + %38 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 %39 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %40 = OpCompositeExtract %uint %39 0 - %41 = OpLoad %uint %24 Aligned 4 - %42 = OpIAdd %uint %40 %41 - %43 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %38 %42 - %44 = OpLoad %uint %43 Aligned 4 - %45 = OpLoad %_ptr_Workgroup_uint %22 Aligned 4 + %call3 = OpCompositeExtract %uint %39 0 + %41 = OpLoad %uint %d Aligned 4 + %add = OpIAdd %uint %call3 %41 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %38 %add + %44 = OpLoad %uint %arrayidx Aligned 4 + %45 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 %46 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %47 = OpCompositeExtract %uint %46 0 - %48 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %45 %47 - %49 = OpLoad %uint %48 Aligned 4 - %50 = OpIAdd %uint %49 %44 - OpStore %48 %50 Aligned 4 - OpBranch %16 - %16 = OpLabel - OpBranch %17 - %17 = OpLabel - %51 = OpLoad %uint %24 Aligned 4 - %53 = OpShiftRightArithmetic %uint %51 %uint_1 - OpStore %24 %53 Aligned 4 - OpBranch %13 - %18 = OpLabel + %call4 = OpCompositeExtract %uint %46 0 + %arrayidx5 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %45 %call4 + %49 = OpLoad %uint %arrayidx5 Aligned 4 + %add6 = OpIAdd %uint %49 %44 + OpStore %arrayidx5 %add6 Aligned 4 + OpBranch %if_end + %if_end = OpLabel + OpBranch %for_inc + %for_inc = OpLabel + %51 = OpLoad %uint %d Aligned 4 + %shr = OpShiftRightArithmetic %uint %51 %uint_1 + OpStore %d %shr Aligned 4 + OpBranch %for_cond + %for_end = OpLabel %54 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %55 = OpCompositeExtract %uint %54 0 - %56 = OpIEqual %bool %55 %uint_0 - OpBranchConditional %56 %19 %20 - %19 = OpLabel + %call7 = OpCompositeExtract %uint %54 0 + %cmp8 = OpIEqual %bool %call7 %uint_0 + OpBranchConditional %cmp8 %if_then9 %if_end12 + %if_then9 = OpLabel %57 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %58 = OpCompositeExtract %uint %57 0 - %59 = OpLoad %_ptr_Workgroup_uint %22 Aligned 4 - %60 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %59 %uint_0 - OpStore %60 %58 Aligned 4 - OpBranch %20 - %20 = OpLabel + %call10 = OpCompositeExtract %uint %57 0 + %59 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 + %arrayidx11 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %59 %uint_0 + OpStore %arrayidx11 %call10 Aligned 4 + OpBranch %if_end12 + %if_end12 = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/leftshiftequals.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/leftshiftequals.spvasm index 8d83cfa11d..bb0d2d36d8 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/leftshiftequals.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/leftshiftequals.spvasm @@ -10,8 +10,15 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %4 "foo" OpSource OpenCL_C 200000 - OpDecorate %8 Alignment 4 - OpDecorate %9 Alignment 4 + OpName %entry "entry" + OpName %x "x" + OpName %y "y" + OpName %shl_mask "shl.mask" + OpName %shl "shl" + OpName %shl_mask1 "shl.mask1" + OpName %shl2 "shl2" + OpDecorate %x Alignment 4 + OpDecorate %y Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_2 = OpConstant %uint 2 @@ -20,20 +27,20 @@ %3 = OpTypeFunction %void %_ptr_Function_uint = OpTypePointer Function %uint %4 = OpFunction %void DontInline %3 - %5 = OpLabel - %8 = OpVariable %_ptr_Function_uint Function - %9 = OpVariable %_ptr_Function_uint Function - OpStore %8 %uint_1 Aligned 4 - OpStore %9 %uint_2 Aligned 4 - %12 = OpLoad %uint %8 Aligned 4 - %13 = OpLoad %uint %8 Aligned 4 - %15 = OpBitwiseAnd %uint %12 %uint_31 - %16 = OpShiftLeftLogical %uint %13 %15 - OpStore %8 %16 Aligned 4 - %17 = OpLoad %uint %8 Aligned 4 - %18 = OpLoad %uint %9 Aligned 4 - %19 = OpBitwiseAnd %uint %17 %uint_31 - %20 = OpShiftLeftLogical %uint %18 %19 - OpStore %9 %20 Aligned 4 + %entry = OpLabel + %x = OpVariable %_ptr_Function_uint Function + %y = OpVariable %_ptr_Function_uint Function + OpStore %x %uint_1 Aligned 4 + OpStore %y %uint_2 Aligned 4 + %12 = OpLoad %uint %x Aligned 4 + %13 = OpLoad %uint %x Aligned 4 + %shl_mask = OpBitwiseAnd %uint %12 %uint_31 + %shl = OpShiftLeftLogical %uint %13 %shl_mask + OpStore %x %shl Aligned 4 + %17 = OpLoad %uint %x Aligned 4 + %18 = OpLoad %uint %y Aligned 4 + %shl_mask1 = OpBitwiseAnd %uint %17 %uint_31 + %shl2 = OpShiftLeftLogical %uint %18 %shl_mask1 + OpStore %y %shl2 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/localarrayaccess.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/localarrayaccess.spvasm index 92dd34feaf..067f8088ad 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/localarrayaccess.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/localarrayaccess.spvasm @@ -13,11 +13,18 @@ OpSource OpenCL_C 200000 OpName %foo_A "foo.A" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %entry "entry" + OpName %x "x" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" + OpName %add "add" + OpName %arrayidx2 "arrayidx2" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import OpDecorate %foo_A Alignment 4 - OpDecorate %15 Alignment 4 + OpDecorate %x Alignment 4 %uint = OpTypeInt 32 0 %uint_65 = OpConstant %uint 65 %uint_0 = OpConstant %uint 0 @@ -35,18 +42,18 @@ %foo_A = OpVariable %_ptr_Workgroup__arr_uint_uint_65 Workgroup %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %12 = OpFunction %void DontInline %11 - %13 = OpLabel - %15 = OpVariable %_ptr_Function_uint Function + %entry = OpLabel + %x = OpVariable %_ptr_Function_uint Function %16 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %17 = OpCompositeExtract %uint %16 0 - %20 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %foo_A %uint_0 %17 - OpStore %20 %uint_2 Aligned 4 + %call = OpCompositeExtract %uint %16 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %foo_A %uint_0 %call + OpStore %arrayidx %uint_2 Aligned 4 OpControlBarrier %uint_2 %uint_2 %uint_272 %23 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %24 = OpCompositeExtract %uint %23 0 - %26 = OpIAdd %uint %24 %uint_1 - %27 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %foo_A %uint_0 %26 - %28 = OpLoad %uint %27 Aligned 4 - OpStore %15 %28 Aligned 4 + %call1 = OpCompositeExtract %uint %23 0 + %add = OpIAdd %uint %call1 %uint_1 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %foo_A %uint_0 %add + %28 = OpLoad %uint %arrayidx2 Aligned 4 + OpStore %x %28 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/mem_fence.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/mem_fence.spvasm index 7913055778..f2cfa20870 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/mem_fence.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/mem_fence.spvasm @@ -10,6 +10,7 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %4 "foo" OpSource OpenCL_C 200000 + OpName %entry "entry" %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_8 = OpConstant %uint 8 @@ -17,7 +18,7 @@ %void = OpTypeVoid %3 = OpTypeFunction %void %4 = OpFunction %void DontInline %3 - %5 = OpLabel + %entry = OpLabel OpMemoryBarrier %uint_2 %uint_8 OpMemoryBarrier %uint_2 %uint_2 OpMemoryBarrier %uint_2 %uint_4 diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/fail/2d_array_race.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/fail/2d_array_race.spvasm index b23ca854da..cb5566f460 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/fail/2d_array_race.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/fail/2d_array_race.spvasm @@ -15,6 +15,35 @@ OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %__spirv_BuiltInGlobalSize "__spirv_BuiltInGlobalSize" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %G "G" + OpName %entry "entry" + OpName %G_addr "G.addr" + OpName %call "call" + OpName %call1 "call1" + OpName %mul "mul" + OpName %call2 "call2" + OpName %add "add" + OpName %arrayidx "arrayidx" + OpName %call3 "call3" + OpName %arrayidx4 "arrayidx4" + OpName %call5 "call5" + OpName %arrayidx6 "arrayidx6" + OpName %call7 "call7" + OpName %add8 "add8" + OpName %arrayidx9 "arrayidx9" + OpName %call10 "call10" + OpName %arrayidx11 "arrayidx11" + OpName %inc "inc" + OpName %call12 "call12" + OpName %arrayidx13 "arrayidx13" + OpName %call14 "call14" + OpName %arrayidx15 "arrayidx15" + OpName %call16 "call16" + OpName %call17 "call17" + OpName %mul18 "mul18" + OpName %call19 "call19" + OpName %add20 "add20" + OpName %arrayidx21 "arrayidx21" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalSize BuiltIn GlobalSize @@ -25,7 +54,7 @@ OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import OpDecorate %example_L Alignment 4 - OpDecorate %20 Alignment 4 + OpDecorate %G_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_64 = OpConstant %uint 64 %uint_0 = OpConstant %uint 0 @@ -46,55 +75,55 @@ %__spirv_BuiltInGlobalSize = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %16 = OpFunction %void DontInline %15 - %17 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %18 = OpLabel - %20 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %20 %17 Aligned 4 - %21 = OpLoad %_ptr_CrossWorkgroup_uint %20 Aligned 4 + %G = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %G_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %G_addr %G Aligned 4 + %21 = OpLoad %_ptr_CrossWorkgroup_uint %G_addr Aligned 4 %22 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %23 = OpCompositeExtract %uint %22 1 + %call = OpCompositeExtract %uint %22 1 %24 = OpLoad %v3uint %__spirv_BuiltInGlobalSize Aligned 16 - %25 = OpCompositeExtract %uint %24 1 - %26 = OpIMul %uint %23 %25 + %call1 = OpCompositeExtract %uint %24 1 + %mul = OpIMul %uint %call %call1 %27 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %28 = OpCompositeExtract %uint %27 0 - %29 = OpIAdd %uint %26 %28 - %30 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %21 %29 - %31 = OpLoad %uint %30 Aligned 4 + %call2 = OpCompositeExtract %uint %27 0 + %add = OpIAdd %uint %mul %call2 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %21 %add + %31 = OpLoad %uint %arrayidx Aligned 4 %32 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %33 = OpCompositeExtract %uint %32 1 - %36 = OpInBoundsPtrAccessChain %_ptr_Workgroup__arr_uint_uint_64 %example_L %uint_0 %33 + %call3 = OpCompositeExtract %uint %32 1 + %arrayidx4 = OpInBoundsPtrAccessChain %_ptr_Workgroup__arr_uint_uint_64 %example_L %uint_0 %call3 %37 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %38 = OpCompositeExtract %uint %37 0 - %40 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %36 %uint_0 %38 - OpStore %40 %31 Aligned 4 + %call5 = OpCompositeExtract %uint %37 0 + %arrayidx6 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %arrayidx4 %uint_0 %call5 + OpStore %arrayidx6 %31 Aligned 4 %41 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %42 = OpCompositeExtract %uint %41 1 - %44 = OpIAdd %uint %42 %uint_1 - %45 = OpInBoundsPtrAccessChain %_ptr_Workgroup__arr_uint_uint_64 %example_L %uint_0 %44 + %call7 = OpCompositeExtract %uint %41 1 + %add8 = OpIAdd %uint %call7 %uint_1 + %arrayidx9 = OpInBoundsPtrAccessChain %_ptr_Workgroup__arr_uint_uint_64 %example_L %uint_0 %add8 %46 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %47 = OpCompositeExtract %uint %46 0 - %48 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %45 %uint_0 %47 - %49 = OpLoad %uint %48 Aligned 4 - %50 = OpIAdd %uint %49 %uint_1 - OpStore %48 %50 Aligned 4 + %call10 = OpCompositeExtract %uint %46 0 + %arrayidx11 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %arrayidx9 %uint_0 %call10 + %49 = OpLoad %uint %arrayidx11 Aligned 4 + %inc = OpIAdd %uint %49 %uint_1 + OpStore %arrayidx11 %inc Aligned 4 %51 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %52 = OpCompositeExtract %uint %51 1 - %53 = OpInBoundsPtrAccessChain %_ptr_Workgroup__arr_uint_uint_64 %example_L %uint_0 %52 + %call12 = OpCompositeExtract %uint %51 1 + %arrayidx13 = OpInBoundsPtrAccessChain %_ptr_Workgroup__arr_uint_uint_64 %example_L %uint_0 %call12 %54 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %55 = OpCompositeExtract %uint %54 0 - %56 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %53 %uint_0 %55 - %57 = OpLoad %uint %56 Aligned 4 - %58 = OpLoad %_ptr_CrossWorkgroup_uint %20 Aligned 4 + %call14 = OpCompositeExtract %uint %54 0 + %arrayidx15 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %arrayidx13 %uint_0 %call14 + %57 = OpLoad %uint %arrayidx15 Aligned 4 + %58 = OpLoad %_ptr_CrossWorkgroup_uint %G_addr Aligned 4 %59 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %60 = OpCompositeExtract %uint %59 1 + %call16 = OpCompositeExtract %uint %59 1 %61 = OpLoad %v3uint %__spirv_BuiltInGlobalSize Aligned 16 - %62 = OpCompositeExtract %uint %61 1 - %63 = OpIMul %uint %60 %62 + %call17 = OpCompositeExtract %uint %61 1 + %mul18 = OpIMul %uint %call16 %call17 %64 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %65 = OpCompositeExtract %uint %64 0 - %66 = OpIAdd %uint %63 %65 - %67 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %58 %66 - OpStore %67 %57 Aligned 4 + %call19 = OpCompositeExtract %uint %64 0 + %add20 = OpIAdd %uint %mul18 %call19 + %arrayidx21 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %58 %add20 + OpStore %arrayidx21 %57 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/fail/4d_array_race.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/fail/4d_array_race.spvasm index 9b1c0988cc..29bacce4bb 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/fail/4d_array_race.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/fail/4d_array_race.spvasm @@ -13,11 +13,16 @@ OpSource OpenCL_C 200000 OpName %example_L "example.L" OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %G "G" + OpName %entry "entry" + OpName %G_addr "G.addr" + OpName %call "call" + OpName %arrayidx "arrayidx" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import OpDecorate %example_L Alignment 4 - OpDecorate %23 Alignment 4 + OpDecorate %G_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_3 = OpConstant %uint 3 @@ -40,15 +45,15 @@ %example_L = OpVariable %_ptr_Workgroup__arr__arr__arr__arr_uint_uint_5_uint_4_uint_3_uint_2 Workgroup %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %19 = OpFunction %void DontInline %18 - %20 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %21 = OpLabel - %23 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %23 %20 Aligned 4 - %24 = OpLoad %_ptr_CrossWorkgroup_uint %23 Aligned 4 + %G = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %G_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %G_addr %G Aligned 4 + %24 = OpLoad %_ptr_CrossWorkgroup_uint %G_addr Aligned 4 %25 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %26 = OpCompositeExtract %uint %25 0 - %27 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %24 %26 - %28 = OpLoad %uint %27 Aligned 4 + %call = OpCompositeExtract %uint %25 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %24 %call + %28 = OpLoad %uint %arrayidx Aligned 4 %32 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %example_L %uint_0 %uint_1 %uint_2 %uint_3 %uint_3 OpStore %32 %28 Aligned 4 OpReturn diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/fail/4d_array_with_casting.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/fail/4d_array_with_casting.spvasm index 836697818f..465026954f 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/fail/4d_array_with_casting.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/fail/4d_array_with_casting.spvasm @@ -14,12 +14,27 @@ OpSource OpenCL_C 200000 OpName %example_L "example.L" OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %G "G" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %if_then4 "if.then4" + OpName %if_end6 "if.end6" + OpName %G_addr "G.addr" + OpName %p "p" + OpName %call "call" + OpName %cmp "cmp" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" + OpName %call2 "call2" + OpName %cmp3 "cmp3" + OpName %arrayidx5 "arrayidx5" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import OpDecorate %example_L Alignment 4 - OpDecorate %27 Alignment 4 - OpDecorate %31 Alignment 4 + OpDecorate %G_addr Alignment 4 + OpDecorate %p Alignment 4 %uint = OpTypeInt 32 0 %uchar = OpTypeInt 8 0 %uint_2 = OpConstant %uint 2 @@ -48,36 +63,36 @@ %example_L = OpVariable %_ptr_Workgroup__arr__arr__arr__arr_uint_uint_5_uint_4_uint_3_uint_2 Workgroup %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %19 = OpFunction %void DontInline %18 - %20 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %21 = OpLabel - %27 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %31 = OpVariable %_ptr_Function__ptr_Workgroup_uchar Function - OpStore %27 %20 Aligned 4 + %G = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %G_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %p = OpVariable %_ptr_Function__ptr_Workgroup_uchar Function + OpStore %G_addr %G Aligned 4 %32 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %33 = OpCompositeExtract %uint %32 0 - %36 = OpIEqual %bool %33 %uint_0 + %call = OpCompositeExtract %uint %32 0 + %cmp = OpIEqual %bool %call %uint_0 %39 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %example_L %uint_0 %uint_1 %uint_2 %uint_3 %uint_3 %40 = OpBitcast %_ptr_Workgroup_uchar %example_L - OpBranchConditional %36 %22 %23 - %22 = OpLabel - %41 = OpLoad %_ptr_CrossWorkgroup_uint %27 Aligned 4 + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel + %41 = OpLoad %_ptr_CrossWorkgroup_uint %G_addr Aligned 4 %42 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %43 = OpCompositeExtract %uint %42 0 - %44 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %41 %43 - %45 = OpLoad %uint %44 Aligned 4 + %call1 = OpCompositeExtract %uint %42 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %41 %call1 + %45 = OpLoad %uint %arrayidx Aligned 4 OpStore %39 %45 Aligned 4 - OpBranch %23 - %23 = OpLabel - OpStore %31 %40 Aligned 4 + OpBranch %if_end + %if_end = OpLabel + OpStore %p %40 Aligned 4 %46 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %47 = OpCompositeExtract %uint %46 0 - %48 = OpIEqual %bool %47 %uint_1 - OpBranchConditional %48 %24 %25 - %24 = OpLabel - %49 = OpLoad %_ptr_Workgroup_uchar %31 Aligned 4 - %51 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uchar %49 %uint_474 - OpStore %51 %uchar_42 Aligned 1 - OpBranch %25 - %25 = OpLabel + %call2 = OpCompositeExtract %uint %46 0 + %cmp3 = OpIEqual %bool %call2 %uint_1 + OpBranchConditional %cmp3 %if_then4 %if_end6 + %if_then4 = OpLabel + %49 = OpLoad %_ptr_Workgroup_uchar %p Aligned 4 + %arrayidx5 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uchar %49 %uint_474 + OpStore %arrayidx5 %uchar_42 Aligned 1 + OpBranch %if_end6 + %if_end6 = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/fail/miscfail1.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/fail/miscfail1.spvasm index 9248566b0b..27d6be57eb 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/fail/miscfail1.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/fail/miscfail1.spvasm @@ -12,12 +12,30 @@ OpEntryPoint Kernel %9 "foo" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %A "A" + OpName %B "B" + OpName %C "C" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpName %B_addr "B.addr" + OpName %C_addr "C.addr" + OpName %call "call" + OpName %add "add" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" + OpName %arrayidx2 "arrayidx2" + OpName %call3 "call3" + OpName %add4 "add4" + OpName %arrayidx5 "arrayidx5" + OpName %arrayidx6 "arrayidx6" + OpName %call7 "call7" + OpName %arrayidx8 "arrayidx8" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %15 Alignment 4 - OpDecorate %16 Alignment 4 - OpDecorate %17 Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %B_addr Alignment 4 + OpDecorate %C_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_2 = OpConstant %uint 2 @@ -29,40 +47,40 @@ %_ptr_Function__ptr_Workgroup_uint = OpTypePointer Function %_ptr_Workgroup_uint %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_Workgroup_uint - %11 = OpFunctionParameter %_ptr_Workgroup_uint - %12 = OpFunctionParameter %_ptr_Workgroup_uint - %13 = OpLabel - %15 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %16 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %17 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - OpStore %15 %10 Aligned 4 - OpStore %16 %11 Aligned 4 - OpStore %17 %12 Aligned 4 - %18 = OpLoad %_ptr_Workgroup_uint %17 Aligned 4 + %A = OpFunctionParameter %_ptr_Workgroup_uint + %B = OpFunctionParameter %_ptr_Workgroup_uint + %C = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %B_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %C_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + OpStore %A_addr %A Aligned 4 + OpStore %B_addr %B Aligned 4 + OpStore %C_addr %C Aligned 4 + %18 = OpLoad %_ptr_Workgroup_uint %C_addr Aligned 4 %19 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %20 = OpCompositeExtract %uint %19 0 - %22 = OpIAdd %uint %20 %uint_1 - %23 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %18 %22 - %24 = OpLoad %uint %23 Aligned 4 - %25 = OpLoad %_ptr_Workgroup_uint %17 Aligned 4 + %call = OpCompositeExtract %uint %19 0 + %add = OpIAdd %uint %call %uint_1 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %18 %add + %24 = OpLoad %uint %arrayidx Aligned 4 + %25 = OpLoad %_ptr_Workgroup_uint %C_addr Aligned 4 %26 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %27 = OpCompositeExtract %uint %26 0 - %28 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %25 %27 - OpStore %28 %24 Aligned 4 - %29 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 - %30 = OpLoad %_ptr_Workgroup_uint %17 Aligned 4 + %call1 = OpCompositeExtract %uint %26 0 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %25 %call1 + OpStore %arrayidx2 %24 Aligned 4 + %29 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %30 = OpLoad %_ptr_Workgroup_uint %C_addr Aligned 4 %31 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %32 = OpCompositeExtract %uint %31 0 - %34 = OpIAdd %uint %32 %uint_2 - %35 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %30 %34 - %36 = OpLoad %uint %35 Aligned 4 - %37 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %29 %36 - %38 = OpLoad %uint %37 Aligned 4 - %39 = OpLoad %_ptr_Workgroup_uint %16 Aligned 4 + %call3 = OpCompositeExtract %uint %31 0 + %add4 = OpIAdd %uint %call3 %uint_2 + %arrayidx5 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %30 %add4 + %36 = OpLoad %uint %arrayidx5 Aligned 4 + %arrayidx6 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %29 %36 + %38 = OpLoad %uint %arrayidx6 Aligned 4 + %39 = OpLoad %_ptr_Workgroup_uint %B_addr Aligned 4 %40 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %41 = OpCompositeExtract %uint %40 0 - %42 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %39 %41 - OpStore %42 %38 Aligned 4 + %call7 = OpCompositeExtract %uint %40 0 + %arrayidx8 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %39 %call7 + OpStore %arrayidx8 %38 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/fail/miscfail10.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/fail/miscfail10.spvasm index edca0fac23..7ef7d6201f 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/fail/miscfail10.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/fail/miscfail10.spvasm @@ -11,12 +11,35 @@ OpEntryPoint Kernel %10 "foo" OpSource OpenCL_C 200000 OpName %foo_l "foo.l" + OpName %h1 "h1" + OpName %h2 "h2" + OpName %i "i" + OpName %entry "entry" + OpName %cond_true "cond.true" + OpName %cond_false "cond.false" + OpName %cond_end "cond.end" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %h1_addr "h1.addr" + OpName %h2_addr "h2.addr" + OpName %i_addr "i.addr" + OpName %h "h" + OpName %i1 "i1" + OpName %cmp "cmp" + OpName %cond "cond" + OpName %cmp2 "cmp2" + OpName %arrayidx "arrayidx" + OpName %arrayidx3 "arrayidx3" + OpName %add "add" + OpName %add4 "add4" OpDecorate %foo_l Alignment 4 - OpDecorate %23 Alignment 4 - OpDecorate %24 Alignment 4 - OpDecorate %26 Alignment 4 - OpDecorate %27 Alignment 4 - OpDecorate %28 Alignment 4 + OpDecorate %h1_addr Alignment 4 + OpDecorate %h2_addr Alignment 4 + OpDecorate %i_addr Alignment 4 + OpDecorate %h Alignment 4 + OpDecorate %i1 Alignment 4 %uint = OpTypeInt 32 0 %uint_256 = OpConstant %uint 256 %uint_0 = OpConstant %uint 0 @@ -32,52 +55,52 @@ %_ptr_Workgroup_uint = OpTypePointer Workgroup %uint %foo_l = OpVariable %_ptr_Workgroup__arr_uint_uint_256 Workgroup %10 = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpFunctionParameter %uint - %14 = OpLabel - %23 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %24 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %26 = OpVariable %_ptr_Function_uint Function - %27 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %28 = OpVariable %_ptr_Function_uint Function - OpStore %23 %11 Aligned 4 - OpStore %24 %12 Aligned 4 - OpStore %26 %13 Aligned 4 - %29 = OpLoad %uint %26 Aligned 4 - %32 = OpSGreaterThan %bool %29 %uint_0 - OpBranchConditional %32 %15 %16 - %15 = OpLabel - %33 = OpLoad %_ptr_CrossWorkgroup_uint %23 Aligned 4 - OpBranch %17 - %16 = OpLabel - %34 = OpLoad %_ptr_CrossWorkgroup_uint %24 Aligned 4 - OpBranch %17 - %17 = OpLabel - %35 = OpPhi %_ptr_CrossWorkgroup_uint %33 %15 %34 %16 - OpStore %27 %35 Aligned 4 - OpStore %28 %uint_0 Aligned 4 - OpBranch %18 - %18 = OpLabel - %36 = OpLoad %uint %28 Aligned 4 - %37 = OpULessThan %bool %36 %uint_256 - OpBranchConditional %37 %19 %21 - %19 = OpLabel - %38 = OpLoad %uint %28 Aligned 4 - %40 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %foo_l %uint_0 %38 - %41 = OpLoad %uint %40 Aligned 4 - %42 = OpLoad %_ptr_CrossWorkgroup_uint %27 Aligned 4 - %43 = OpLoad %uint %28 Aligned 4 - %44 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %42 %43 - %45 = OpLoad %uint %44 Aligned 4 - %46 = OpIAdd %uint %45 %41 - OpStore %44 %46 Aligned 4 - OpBranch %20 - %20 = OpLabel - %47 = OpLoad %uint %28 Aligned 4 - %49 = OpIAdd %uint %47 %uint_1 - OpStore %28 %49 Aligned 4 - OpBranch %18 - %21 = OpLabel + %h1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %h2 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %i = OpFunctionParameter %uint + %entry = OpLabel + %h1_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %h2_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %i_addr = OpVariable %_ptr_Function_uint Function + %h = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %i1 = OpVariable %_ptr_Function_uint Function + OpStore %h1_addr %h1 Aligned 4 + OpStore %h2_addr %h2 Aligned 4 + OpStore %i_addr %i Aligned 4 + %29 = OpLoad %uint %i_addr Aligned 4 + %cmp = OpSGreaterThan %bool %29 %uint_0 + OpBranchConditional %cmp %cond_true %cond_false + %cond_true = OpLabel + %33 = OpLoad %_ptr_CrossWorkgroup_uint %h1_addr Aligned 4 + OpBranch %cond_end + %cond_false = OpLabel + %34 = OpLoad %_ptr_CrossWorkgroup_uint %h2_addr Aligned 4 + OpBranch %cond_end + %cond_end = OpLabel + %cond = OpPhi %_ptr_CrossWorkgroup_uint %33 %cond_true %34 %cond_false + OpStore %h %cond Aligned 4 + OpStore %i1 %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %36 = OpLoad %uint %i1 Aligned 4 + %cmp2 = OpULessThan %bool %36 %uint_256 + OpBranchConditional %cmp2 %for_body %for_end + %for_body = OpLabel + %38 = OpLoad %uint %i1 Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %foo_l %uint_0 %38 + %41 = OpLoad %uint %arrayidx Aligned 4 + %42 = OpLoad %_ptr_CrossWorkgroup_uint %h Aligned 4 + %43 = OpLoad %uint %i1 Aligned 4 + %arrayidx3 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %42 %43 + %45 = OpLoad %uint %arrayidx3 Aligned 4 + %add = OpIAdd %uint %45 %41 + OpStore %arrayidx3 %add Aligned 4 + OpBranch %for_inc + %for_inc = OpLabel + %47 = OpLoad %uint %i1 Aligned 4 + %add4 = OpIAdd %uint %47 %uint_1 + OpStore %i1 %add4 Aligned 4 + OpBranch %for_cond + %for_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/fail/miscfail3.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/fail/miscfail3.spvasm index d5710f640c..e1d88953d2 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/fail/miscfail3.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/fail/miscfail3.spvasm @@ -12,11 +12,33 @@ OpEntryPoint Kernel %9 "foo" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %A "A" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %if_then5 "if.then5" + OpName %if_end8 "if.end8" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %A_addr "A.addr" + OpName %i "i" + OpName %call "call" + OpName %cmp "cmp" + OpName %call1 "call1" + OpName %call2 "call2" + OpName %arrayidx "arrayidx" + OpName %cmp3 "cmp3" + OpName %cmp4 "cmp4" + OpName %call6 "call6" + OpName %arrayidx7 "arrayidx7" + OpName %inc "inc" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %21 Alignment 4 - OpDecorate %23 Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %i Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_100 = OpConstant %uint 100 @@ -31,49 +53,49 @@ %bool = OpTypeBool %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_Workgroup_uint - %11 = OpLabel - %21 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %23 = OpVariable %_ptr_Function_uint Function - OpStore %21 %10 Aligned 4 + %A = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %i = OpVariable %_ptr_Function_uint Function + OpStore %A_addr %A Aligned 4 %24 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %25 = OpCompositeExtract %uint %24 0 - %28 = OpINotEqual %bool %25 %uint_0 - OpBranchConditional %28 %12 %13 - %12 = OpLabel + %call = OpCompositeExtract %uint %24 0 + %cmp = OpINotEqual %bool %call %uint_0 + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel %29 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %30 = OpCompositeExtract %uint %29 0 - %31 = OpLoad %_ptr_Workgroup_uint %21 Aligned 4 + %call1 = OpCompositeExtract %uint %29 0 + %31 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 %32 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %33 = OpCompositeExtract %uint %32 0 - %34 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %31 %33 - OpStore %34 %30 Aligned 4 - OpBranch %13 - %13 = OpLabel - OpStore %23 %uint_0 Aligned 4 - OpBranch %14 - %14 = OpLabel - %35 = OpLoad %uint %23 Aligned 4 - %37 = OpSLessThan %bool %35 %uint_100 - OpBranchConditional %37 %15 %19 - %15 = OpLabel - %38 = OpLoad %uint %23 Aligned 4 - %40 = OpIEqual %bool %38 %uint_1 - OpBranchConditional %40 %16 %17 - %16 = OpLabel + %call2 = OpCompositeExtract %uint %32 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %31 %call2 + OpStore %arrayidx %call1 Aligned 4 + OpBranch %if_end + %if_end = OpLabel + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %35 = OpLoad %uint %i Aligned 4 + %cmp3 = OpSLessThan %bool %35 %uint_100 + OpBranchConditional %cmp3 %for_body %for_end + %for_body = OpLabel + %38 = OpLoad %uint %i Aligned 4 + %cmp4 = OpIEqual %bool %38 %uint_1 + OpBranchConditional %cmp4 %if_then5 %if_end8 + %if_then5 = OpLabel %41 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %42 = OpCompositeExtract %uint %41 0 - %43 = OpLoad %_ptr_Workgroup_uint %21 Aligned 4 - %44 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %43 %uint_0 - OpStore %44 %42 Aligned 4 - OpBranch %17 - %17 = OpLabel - OpBranch %18 - %18 = OpLabel - %45 = OpLoad %uint %23 Aligned 4 - %46 = OpIAdd %uint %45 %uint_1 - OpStore %23 %46 Aligned 4 - OpBranch %14 - %19 = OpLabel + %call6 = OpCompositeExtract %uint %41 0 + %43 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %arrayidx7 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %43 %uint_0 + OpStore %arrayidx7 %call6 Aligned 4 + OpBranch %if_end8 + %if_end8 = OpLabel + OpBranch %for_inc + %for_inc = OpLabel + %45 = OpLoad %uint %i Aligned 4 + %inc = OpIAdd %uint %45 %uint_1 + OpStore %i %inc Aligned 4 + OpBranch %for_cond + %for_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/fail/miscfail8.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/fail/miscfail8.spvasm index 45658f6efc..c19bb16663 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/fail/miscfail8.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/fail/miscfail8.spvasm @@ -12,11 +12,21 @@ OpEntryPoint Kernel %9 "baz" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %p "p" + OpName %entry "entry" + OpName %p_addr_i "p.addr.i" + OpName %p_addr "p.addr" + OpName %call_i "call.i" + OpName %arrayidx_i "arrayidx.i" + OpName %call1 "call1" + OpName %call2 "call2" + OpName %add "add" + OpName %arrayidx "arrayidx" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %13 Alignment 4 - OpDecorate %14 Alignment 4 + OpDecorate %p_addr_i Alignment 4 + OpDecorate %p_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %v3uint = OpTypeVector %uint 3 @@ -27,25 +37,25 @@ %_ptr_Function__ptr_Workgroup_uint = OpTypePointer Function %_ptr_Workgroup_uint %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_Workgroup_uint - %11 = OpLabel - %13 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %14 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - OpStore %14 %10 Aligned 4 - %15 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 - OpStore %13 %15 Aligned 4 - %16 = OpLoad %_ptr_Workgroup_uint %13 Aligned 4 + %p = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %p_addr_i = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %p_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + OpStore %p_addr %p Aligned 4 + %15 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 + OpStore %p_addr_i %15 Aligned 4 + %16 = OpLoad %_ptr_Workgroup_uint %p_addr_i Aligned 4 %17 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %18 = OpCompositeExtract %uint %17 0 - %19 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %16 %18 - %20 = OpLoad %uint %19 Aligned 4 + %call_i = OpCompositeExtract %uint %17 0 + %arrayidx_i = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %16 %call_i + %20 = OpLoad %uint %arrayidx_i Aligned 4 %21 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %22 = OpCompositeExtract %uint %21 0 - %23 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 + %call1 = OpCompositeExtract %uint %21 0 + %23 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 %24 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %25 = OpCompositeExtract %uint %24 0 - %27 = OpIAdd %uint %25 %uint_1 - %28 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %23 %27 - OpStore %28 %22 Aligned 4 + %call2 = OpCompositeExtract %uint %24 0 + %add = OpIAdd %uint %call2 %uint_1 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %23 %add + OpStore %arrayidx %call1 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/fail/struct_member_race.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/fail/struct_member_race.spvasm index 09fd7b1fd7..c7da4ba145 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/fail/struct_member_race.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/fail/struct_member_race.spvasm @@ -13,10 +13,16 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %struct_S "struct.S" + OpName %G "G" + OpName %entry "entry" + OpName %G_addr "G.addr" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %y "y" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %14 Alignment 4 + OpDecorate %G_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_3 = OpConstant %uint 3 %uint_0 = OpConstant %uint 0 @@ -31,15 +37,15 @@ %_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %10 = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_struct_S - %12 = OpLabel - %14 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_struct_S Function - OpStore %14 %11 Aligned 4 + %G = OpFunctionParameter %_ptr_CrossWorkgroup_struct_S + %entry = OpLabel + %G_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_struct_S Function + OpStore %G_addr %G Aligned 4 %15 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %16 = OpCompositeExtract %uint %15 0 - %17 = OpLoad %_ptr_CrossWorkgroup_struct_S %14 Aligned 4 - %19 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_S %17 %uint_3 - %23 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %19 %uint_0 %uint_1 - OpStore %23 %16 Aligned 4 + %call = OpCompositeExtract %uint %15 0 + %17 = OpLoad %_ptr_CrossWorkgroup_struct_S %G_addr Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_S %17 %uint_3 + %y = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %arrayidx %uint_0 %uint_1 + OpStore %y %call Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/pass/misc12.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/pass/misc12.spvasm index 32890ad31c..d9c3cef1d1 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/pass/misc12.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/pass/misc12.spvasm @@ -12,10 +12,19 @@ OpEntryPoint Kernel %8 "foo" %__spirv_BuiltInWorkgroupId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInWorkgroupId "__spirv_BuiltInWorkgroupId" + OpName %entry "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %i "i" + OpName %call "call" + OpName %cmp "cmp" + OpName %inc "inc" OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId OpDecorate %__spirv_BuiltInWorkgroupId Constant OpDecorate %__spirv_BuiltInWorkgroupId LinkageAttributes "__spirv_BuiltInWorkgroupId" Import - OpDecorate %15 Alignment 4 + OpDecorate %i Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_2 = OpConstant %uint 2 @@ -29,24 +38,24 @@ %bool = OpTypeBool %__spirv_BuiltInWorkgroupId = OpVariable %_ptr_Input_v3uint Input %8 = OpFunction %void DontInline %7 - %9 = OpLabel - %15 = OpVariable %_ptr_Function_uint Function - OpStore %15 %uint_0 Aligned 4 - OpBranch %10 - %10 = OpLabel - %17 = OpLoad %uint %15 Aligned 4 + %entry = OpLabel + %i = OpVariable %_ptr_Function_uint Function + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %17 = OpLoad %uint %i Aligned 4 %18 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %19 = OpCompositeExtract %uint %18 0 - %21 = OpULessThan %bool %17 %19 - OpBranchConditional %21 %11 %13 - %11 = OpLabel + %call = OpCompositeExtract %uint %18 0 + %cmp = OpULessThan %bool %17 %call + OpBranchConditional %cmp %for_body %for_end + %for_body = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_272 - OpBranch %12 - %12 = OpLabel - %24 = OpLoad %uint %15 Aligned 4 - %26 = OpIAdd %uint %24 %uint_1 - OpStore %15 %26 Aligned 4 - OpBranch %10 - %13 = OpLabel + OpBranch %for_inc + %for_inc = OpLabel + %24 = OpLoad %uint %i Aligned 4 + %inc = OpIAdd %uint %24 %uint_1 + OpStore %i %inc Aligned 4 + OpBranch %for_cond + %for_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/pass/misc13.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/pass/misc13.spvasm index ca4892ff69..8d3419d992 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/pass/misc13.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/pass/misc13.spvasm @@ -14,13 +14,20 @@ OpSource OpenCL_C 200000 OpName %__const_foo_A "__const.foo.A" OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %B "B" + OpName %entry "entry" + OpName %B_addr "B.addr" + OpName %A "A" + OpName %arrayidx "arrayidx" + OpName %call "call" + OpName %arrayidx1 "arrayidx1" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__const_foo_A Constant OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import OpDecorate %__const_foo_A Alignment 4 - OpDecorate %18 Alignment 4 - OpDecorate %20 Alignment 4 + OpDecorate %B_addr Alignment 4 + OpDecorate %A Alignment 4 %uint = OpTypeInt 32 0 %uchar = OpTypeInt 8 0 %uint_1 = OpConstant %uint 1 @@ -42,20 +49,20 @@ %__const_foo_A = OpVariable %_ptr_UniformConstant__arr_uint_uint_1 UniformConstant %5 %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %14 = OpFunction %void DontInline %13 - %15 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %16 = OpLabel - %18 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %20 = OpVariable %_ptr_Function__arr_uint_uint_1 Function - OpStore %18 %15 Aligned 4 - %23 = OpBitcast %_ptr_Function_uchar %20 + %B = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %B_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %A = OpVariable %_ptr_Function__arr_uint_uint_1 Function + OpStore %B_addr %B Aligned 4 + %23 = OpBitcast %_ptr_Function_uchar %A %25 = OpBitcast %_ptr_UniformConstant_uchar %__const_foo_A OpCopyMemorySized %23 %25 %uint_4 Aligned 4 - %29 = OpInBoundsPtrAccessChain %_ptr_Function_uint %20 %uint_0 %uint_0 - %30 = OpLoad %uint %29 Aligned 4 - %31 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Function_uint %A %uint_0 %uint_0 + %30 = OpLoad %uint %arrayidx Aligned 4 + %31 = OpLoad %_ptr_CrossWorkgroup_uint %B_addr Aligned 4 %32 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %33 = OpCompositeExtract %uint %32 0 - %34 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %31 %33 - OpStore %34 %30 Aligned 4 + %call = OpCompositeExtract %uint %32 0 + %arrayidx1 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %31 %call + OpStore %arrayidx1 %30 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/pass/misc15.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/pass/misc15.spvasm index c5e51f6e9b..2749db3755 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/pass/misc15.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/pass/misc15.spvasm @@ -12,11 +12,24 @@ OpEntryPoint Kernel %9 "foo" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %A "A" + OpName %x "x" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_else "if.else" + OpName %if_end "if.end" + OpName %A_addr "A.addr" + OpName %x_addr "x.addr" + OpName %cmp "cmp" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" + OpName %arrayidx2 "arrayidx2" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %x_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_3 = OpConstant %uint 3 %uint_0 = OpConstant %uint 0 @@ -30,30 +43,30 @@ %bool = OpTypeBool %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_Workgroup_uint - %11 = OpFunctionParameter %uint - %12 = OpLabel - %17 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - OpStore %17 %10 Aligned 4 - OpStore %19 %11 Aligned 4 - %20 = OpLoad %uint %19 Aligned 4 - %23 = OpIEqual %bool %20 %uint_3 - OpBranchConditional %23 %13 %14 - %13 = OpLabel - %24 = OpLoad %_ptr_Workgroup_uint %17 Aligned 4 + %A = OpFunctionParameter %_ptr_Workgroup_uint + %x = OpFunctionParameter %uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %x_addr = OpVariable %_ptr_Function_uint Function + OpStore %A_addr %A Aligned 4 + OpStore %x_addr %x Aligned 4 + %20 = OpLoad %uint %x_addr Aligned 4 + %cmp = OpIEqual %bool %20 %uint_3 + OpBranchConditional %cmp %if_then %if_else + %if_then = OpLabel + %24 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 %25 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %26 = OpCompositeExtract %uint %25 0 - %27 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %24 %26 - OpStore %27 %uint_3 Aligned 4 - OpBranch %15 - %14 = OpLabel + %call = OpCompositeExtract %uint %25 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %24 %call + OpStore %arrayidx %uint_3 Aligned 4 + OpBranch %if_end + %if_else = OpLabel %28 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %29 = OpCompositeExtract %uint %28 0 - %30 = OpLoad %_ptr_Workgroup_uint %17 Aligned 4 - %32 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %30 %uint_0 - OpStore %32 %29 Aligned 4 - OpBranch %15 - %15 = OpLabel + %call1 = OpCompositeExtract %uint %28 0 + %30 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %30 %uint_0 + OpStore %arrayidx2 %call1 Aligned 4 + OpBranch %if_end + %if_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/pass/misc2.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/pass/misc2.spvasm index 7d836432a2..8a4428666e 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/pass/misc2.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/pass/misc2.spvasm @@ -12,12 +12,37 @@ OpEntryPoint Kernel %9 "foo" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %shared "shared" + OpName %entry "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %if_then "if.then" + OpName %if_then5 "if.then5" + OpName %if_end "if.end" + OpName %if_end8 "if.end8" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %shared_addr "shared.addr" + OpName %j "j" + OpName %ixj "ixj" + OpName %cmp "cmp" + OpName %call "call" + OpName %xor "xor" + OpName %call1 "call1" + OpName %cmp2 "cmp2" + OpName %call3 "call3" + OpName %and "and" + OpName %cmp4 "cmp4" + OpName %call6 "call6" + OpName %arrayidx "arrayidx" + OpName %arrayidx7 "arrayidx7" + OpName %div "div" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %21 Alignment 4 - OpDecorate %23 Alignment 4 - OpDecorate %24 Alignment 4 + OpDecorate %shared_addr Alignment 4 + OpDecorate %j Alignment 4 + OpDecorate %ixj Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 @@ -33,56 +58,56 @@ %bool = OpTypeBool %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_Workgroup_uint - %11 = OpLabel - %21 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %23 = OpVariable %_ptr_Function_uint Function - %24 = OpVariable %_ptr_Function_uint Function - OpStore %21 %10 Aligned 4 - OpStore %23 %uint_1 Aligned 4 - OpBranch %12 - %12 = OpLabel - %26 = OpLoad %uint %23 Aligned 4 - %29 = OpUGreaterThan %bool %26 %uint_0 - OpBranchConditional %29 %13 %19 - %13 = OpLabel + %shared = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel +%shared_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %j = OpVariable %_ptr_Function_uint Function + %ixj = OpVariable %_ptr_Function_uint Function + OpStore %shared_addr %shared Aligned 4 + OpStore %j %uint_1 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %26 = OpLoad %uint %j Aligned 4 + %cmp = OpUGreaterThan %bool %26 %uint_0 + OpBranchConditional %cmp %for_body %for_end + %for_body = OpLabel %30 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %31 = OpCompositeExtract %uint %30 0 - %32 = OpLoad %uint %23 Aligned 4 - %33 = OpBitwiseXor %uint %31 %32 - OpStore %24 %33 Aligned 4 - %34 = OpLoad %uint %24 Aligned 4 + %call = OpCompositeExtract %uint %30 0 + %32 = OpLoad %uint %j Aligned 4 + %xor = OpBitwiseXor %uint %call %32 + OpStore %ixj %xor Aligned 4 + %34 = OpLoad %uint %ixj Aligned 4 %35 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %36 = OpCompositeExtract %uint %35 0 - %37 = OpUGreaterThan %bool %34 %36 - OpBranchConditional %37 %14 %17 - %14 = OpLabel + %call1 = OpCompositeExtract %uint %35 0 + %cmp2 = OpUGreaterThan %bool %34 %call1 + OpBranchConditional %cmp2 %if_then %if_end8 + %if_then = OpLabel %38 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %39 = OpCompositeExtract %uint %38 0 - %41 = OpBitwiseAnd %uint %39 %uint_2 - %42 = OpIEqual %bool %41 %uint_0 - OpBranchConditional %42 %15 %16 - %15 = OpLabel - %43 = OpLoad %_ptr_Workgroup_uint %21 Aligned 4 + %call3 = OpCompositeExtract %uint %38 0 + %and = OpBitwiseAnd %uint %call3 %uint_2 + %cmp4 = OpIEqual %bool %and %uint_0 + OpBranchConditional %cmp4 %if_then5 %if_end + %if_then5 = OpLabel + %43 = OpLoad %_ptr_Workgroup_uint %shared_addr Aligned 4 %44 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %45 = OpCompositeExtract %uint %44 0 - %46 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %43 %45 - %47 = OpLoad %uint %46 Aligned 4 - %48 = OpLoad %_ptr_Workgroup_uint %21 Aligned 4 - %49 = OpLoad %uint %24 Aligned 4 - %50 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %48 %49 - OpStore %50 %47 Aligned 4 - OpBranch %16 - %16 = OpLabel - OpBranch %17 - %17 = OpLabel + %call6 = OpCompositeExtract %uint %44 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %43 %call6 + %47 = OpLoad %uint %arrayidx Aligned 4 + %48 = OpLoad %_ptr_Workgroup_uint %shared_addr Aligned 4 + %49 = OpLoad %uint %ixj Aligned 4 + %arrayidx7 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %48 %49 + OpStore %arrayidx7 %47 Aligned 4 + OpBranch %if_end + %if_end = OpLabel + OpBranch %if_end8 + %if_end8 = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_272 - OpBranch %18 - %18 = OpLabel - %52 = OpLoad %uint %23 Aligned 4 - %53 = OpUDiv %uint %52 %uint_2 - OpStore %23 %53 Aligned 4 - OpBranch %12 - %19 = OpLabel + OpBranch %for_inc + %for_inc = OpLabel + %52 = OpLoad %uint %j Aligned 4 + %div = OpUDiv %uint %52 %uint_2 + OpStore %j %div Aligned 4 + OpBranch %for_cond + %for_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/pass/misc3.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/pass/misc3.spvasm index 231f38e8e9..4d5cdd09ab 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/pass/misc3.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/misc/pass/misc3.spvasm @@ -13,15 +13,28 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" OpName %f2 "f2" + OpName %a "a" + OpName %entry "entry" + OpName %a_addr "a.addr" OpName %f1 "f1" + OpName %a_0 "a" + OpName %entry_0 "entry" + OpName %a_addr_0 "a.addr" + OpName %a_1 "a" + OpName %entry_1 "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %a_addr_1 "a.addr" + OpName %call "call" + OpName %tobool "tobool" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %f1 LinkageAttributes "f1" Export OpDecorate %f2 LinkageAttributes "f2" Export OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %13 Alignment 4 - OpDecorate %17 Alignment 4 - OpDecorate %25 Alignment 4 + OpDecorate %a_addr Alignment 4 + OpDecorate %a_addr_0 Alignment 4 + OpDecorate %a_addr_1 Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %v3uint = OpTypeVector %uint 3 @@ -33,34 +46,34 @@ %bool = OpTypeBool %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %f2 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpLabel - %13 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %13 %10 Aligned 4 + %a = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %a_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %a_addr %a Aligned 4 OpReturn OpFunctionEnd %f1 = OpFunction %void DontInline %8 - %15 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %16 = OpLabel - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %17 %15 Aligned 4 - %18 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 + %a_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_0 = OpLabel + %a_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %a_addr_0 %a_0 Aligned 4 + %18 = OpLoad %_ptr_CrossWorkgroup_uint %a_addr_0 Aligned 4 %19 = OpFunctionCall %void %f2 %18 OpReturn OpFunctionEnd %20 = OpFunction %void DontInline %8 - %21 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %22 = OpLabel - %25 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %25 %21 Aligned 4 + %a_1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_1 = OpLabel + %a_addr_1 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %a_addr_1 %a_1 Aligned 4 %26 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %27 = OpCompositeExtract %uint %26 0 - %30 = OpINotEqual %bool %27 %uint_0 - OpBranchConditional %30 %23 %24 - %23 = OpLabel - %31 = OpLoad %_ptr_CrossWorkgroup_uint %25 Aligned 4 + %call = OpCompositeExtract %uint %26 0 + %tobool = OpINotEqual %bool %call %uint_0 + OpBranchConditional %tobool %if_then %if_end + %if_then = OpLabel + %31 = OpLoad %_ptr_CrossWorkgroup_uint %a_addr_1 Aligned 4 %32 = OpFunctionCall %void %f1 %31 - OpBranch %24 - %24 = OpLabel + OpBranch %if_end + %if_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/modifyparam.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/modifyparam.spvasm index 1fc746c82c..9f72511f6f 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/modifyparam.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/modifyparam.spvasm @@ -10,17 +10,20 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %5 "foo" OpSource OpenCL_C 200000 - OpDecorate %9 Alignment 4 + OpName %a "a" + OpName %entry "entry" + OpName %a_addr "a.addr" + OpDecorate %a_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_5 = OpConstant %uint 5 %void = OpTypeVoid %4 = OpTypeFunction %void %uint %_ptr_Function_uint = OpTypePointer Function %uint %5 = OpFunction %void DontInline %4 - %6 = OpFunctionParameter %uint - %7 = OpLabel - %9 = OpVariable %_ptr_Function_uint Function - OpStore %9 %6 Aligned 4 - OpStore %9 %uint_5 Aligned 4 + %a = OpFunctionParameter %uint + %entry = OpLabel + %a_addr = OpVariable %_ptr_Function_uint Function + OpStore %a_addr %a Aligned 4 + OpStore %a_addr %uint_5 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/multidimarrays/test1.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/multidimarrays/test1.spvasm index 88b829d046..4397ba0b23 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/multidimarrays/test1.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/multidimarrays/test1.spvasm @@ -11,8 +11,10 @@ OpEntryPoint Kernel %11 "foo" OpSource OpenCL_C 200000 OpName %foo_A "foo.A" + OpName %entry "entry" + OpName %x "x" OpDecorate %foo_A Alignment 4 - OpDecorate %14 Alignment 4 + OpDecorate %x Alignment 4 %uint = OpTypeInt 32 0 %uint_10 = OpConstant %uint 10 %uint_5 = OpConstant %uint 5 @@ -28,10 +30,10 @@ %_ptr_Workgroup_uint = OpTypePointer Workgroup %uint %foo_A = OpVariable %_ptr_Workgroup__arr__arr_uint_uint_5_uint_10 Workgroup %11 = OpFunction %void DontInline %10 - %12 = OpLabel - %14 = OpVariable %_ptr_Function_uint Function + %entry = OpLabel + %x = OpVariable %_ptr_Function_uint Function %19 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %foo_A %uint_0 %uint_3 %uint_4 %20 = OpLoad %uint %19 Aligned 4 - OpStore %14 %20 Aligned 4 + OpStore %x %20 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/multidimarrays/test2.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/multidimarrays/test2.spvasm index f9af9a7923..4c604e6453 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/multidimarrays/test2.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/multidimarrays/test2.spvasm @@ -13,6 +13,11 @@ OpSource OpenCL_C 200000 OpName %foo_A "foo.A" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %entry "entry" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" + OpName %arrayidx2 "arrayidx2" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import @@ -33,13 +38,13 @@ %foo_A = OpVariable %_ptr_Workgroup__arr__arr_uint_uint_32_uint_32 Workgroup %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %13 = OpFunction %void DontInline %12 - %14 = OpLabel + %entry = OpLabel %15 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %16 = OpCompositeExtract %uint %15 1 - %19 = OpInBoundsPtrAccessChain %_ptr_Workgroup__arr_uint_uint_32 %foo_A %uint_0 %16 + %call = OpCompositeExtract %uint %15 1 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup__arr_uint_uint_32 %foo_A %uint_0 %call %20 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %21 = OpCompositeExtract %uint %20 0 - %23 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %19 %uint_0 %21 - OpStore %23 %uint_2 Aligned 4 + %call1 = OpCompositeExtract %uint %20 0 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %arrayidx %uint_0 %call1 + OpStore %arrayidx2 %uint_2 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/multidimarrays/test3.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/multidimarrays/test3.spvasm index 8fdfee19b2..a6726611eb 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/multidimarrays/test3.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/multidimarrays/test3.spvasm @@ -11,8 +11,10 @@ OpEntryPoint Kernel %13 "foo" OpSource OpenCL_C 200000 OpName %foo_A "foo.A" + OpName %entry "entry" + OpName %x "x" OpDecorate %foo_A Alignment 4 - OpDecorate %16 Alignment 4 + OpDecorate %x Alignment 4 %uint = OpTypeInt 32 0 %uint_100 = OpConstant %uint 100 %uint_99 = OpConstant %uint 99 @@ -31,10 +33,10 @@ %_ptr_Workgroup_uint = OpTypePointer Workgroup %uint %foo_A = OpVariable %_ptr_Workgroup__arr__arr__arr_uint_uint_98_uint_99_uint_100 Workgroup %13 = OpFunction %void DontInline %12 - %14 = OpLabel - %16 = OpVariable %_ptr_Function_uint Function + %entry = OpLabel + %x = OpVariable %_ptr_Function_uint Function %22 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %foo_A %uint_0 %uint_5 %uint_4 %uint_3 %23 = OpLoad %uint %22 Aligned 4 - OpStore %16 %23 Aligned 4 + OpStore %x %23 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/multidimarrays/test5.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/multidimarrays/test5.spvasm index 80720a3f2b..76d53731d3 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/multidimarrays/test5.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/multidimarrays/test5.spvasm @@ -10,8 +10,14 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %6 "foo" OpSource OpenCL_C 200000 - OpDecorate %10 Alignment 4 - OpDecorate %12 Alignment 4 + OpName %A "A" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpName %x "x" + OpName %arrayidx "arrayidx" + OpName %arrayidx1 "arrayidx1" + OpDecorate %A_addr Alignment 4 + OpDecorate %x Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %void = OpTypeVoid @@ -20,17 +26,17 @@ %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %_ptr_Function_uint = OpTypePointer Function %uint %6 = OpFunction %void DontInline %5 - %7 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %8 = OpLabel - %10 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %12 = OpVariable %_ptr_Function_uint Function - OpStore %10 %7 Aligned 4 - %13 = OpLoad %_ptr_CrossWorkgroup_uint %10 Aligned 4 - %15 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %13 %uint_0 - OpStore %15 %uint_0 Aligned 4 - %16 = OpLoad %_ptr_CrossWorkgroup_uint %10 Aligned 4 - %17 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %16 %uint_0 - %18 = OpLoad %uint %17 Aligned 4 - OpStore %12 %18 Aligned 4 + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %x = OpVariable %_ptr_Function_uint Function + OpStore %A_addr %A Aligned 4 + %13 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %13 %uint_0 + OpStore %arrayidx %uint_0 Aligned 4 + %16 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 + %arrayidx1 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %16 %uint_0 + %18 = OpLoad %uint %arrayidx1 Aligned 4 + OpStore %x %18 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/multiplelocals2.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/multiplelocals2.spvasm index a80c921d6d..755c7c3c42 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/multiplelocals2.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/multiplelocals2.spvasm @@ -10,8 +10,25 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %4 "foo" OpSource OpenCL_C 200000 - OpDecorate %16 Alignment 4 - OpDecorate %17 Alignment 4 + OpName %entry "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %for_cond3 "for.cond3" + OpName %for_body5 "for.body5" + OpName %for_inc7 "for.inc7" + OpName %for_end9 "for.end9" + OpName %i "i" + OpName %i2 "i2" + OpName %cmp "cmp" + OpName %inc "inc" + OpName %inc1 "inc1" + OpName %cmp4 "cmp4" + OpName %inc6 "inc6" + OpName %inc8 "inc8" + OpDecorate %i Alignment 4 + OpDecorate %i2 Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_2 = OpConstant %uint 2 @@ -21,42 +38,42 @@ %_ptr_Function_uint = OpTypePointer Function %uint %bool = OpTypeBool %4 = OpFunction %void DontInline %3 - %5 = OpLabel - %16 = OpVariable %_ptr_Function_uint Function - %17 = OpVariable %_ptr_Function_uint Function - OpStore %16 %uint_0 Aligned 4 - OpBranch %6 - %6 = OpLabel - %19 = OpLoad %uint %16 Aligned 4 - %22 = OpSLessThan %bool %19 %uint_2 - OpBranchConditional %22 %7 %9 - %7 = OpLabel - %23 = OpLoad %uint %16 Aligned 4 - %25 = OpIAdd %uint %23 %uint_1 - OpStore %16 %25 Aligned 4 - OpBranch %8 - %8 = OpLabel - %26 = OpLoad %uint %16 Aligned 4 - %27 = OpIAdd %uint %26 %uint_1 - OpStore %16 %27 Aligned 4 - OpBranch %6 - %9 = OpLabel - OpStore %17 %uint_0 Aligned 4 - OpBranch %10 - %10 = OpLabel - %28 = OpLoad %uint %17 Aligned 4 - %29 = OpSLessThan %bool %28 %uint_2 - OpBranchConditional %29 %11 %13 - %11 = OpLabel - %30 = OpLoad %uint %17 Aligned 4 - %31 = OpIAdd %uint %30 %uint_1 - OpStore %17 %31 Aligned 4 - OpBranch %12 - %12 = OpLabel - %32 = OpLoad %uint %17 Aligned 4 - %33 = OpIAdd %uint %32 %uint_1 - OpStore %17 %33 Aligned 4 - OpBranch %10 - %13 = OpLabel + %entry = OpLabel + %i = OpVariable %_ptr_Function_uint Function + %i2 = OpVariable %_ptr_Function_uint Function + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %19 = OpLoad %uint %i Aligned 4 + %cmp = OpSLessThan %bool %19 %uint_2 + OpBranchConditional %cmp %for_body %for_end + %for_body = OpLabel + %23 = OpLoad %uint %i Aligned 4 + %inc = OpIAdd %uint %23 %uint_1 + OpStore %i %inc Aligned 4 + OpBranch %for_inc + %for_inc = OpLabel + %26 = OpLoad %uint %i Aligned 4 + %inc1 = OpIAdd %uint %26 %uint_1 + OpStore %i %inc1 Aligned 4 + OpBranch %for_cond + %for_end = OpLabel + OpStore %i2 %uint_0 Aligned 4 + OpBranch %for_cond3 + %for_cond3 = OpLabel + %28 = OpLoad %uint %i2 Aligned 4 + %cmp4 = OpSLessThan %bool %28 %uint_2 + OpBranchConditional %cmp4 %for_body5 %for_end9 + %for_body5 = OpLabel + %30 = OpLoad %uint %i2 Aligned 4 + %inc6 = OpIAdd %uint %30 %uint_1 + OpStore %i2 %inc6 Aligned 4 + OpBranch %for_inc7 + %for_inc7 = OpLabel + %32 = OpLoad %uint %i2 Aligned 4 + %inc8 = OpIAdd %uint %32 %uint_1 + OpStore %i2 %inc8 Aligned 4 + OpBranch %for_cond3 + %for_end9 = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/no_log/pass.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/no_log/pass.spvasm index debee787da..622f5370ec 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/no_log/pass.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/no_log/pass.spvasm @@ -12,10 +12,15 @@ OpEntryPoint Kernel %9 "foo" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %A "A" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpName %call "call" + OpName %arrayidx "arrayidx" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %13 Alignment 4 + OpDecorate %A_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %v3uint = OpTypeVector %uint 3 @@ -26,14 +31,14 @@ %_ptr_Function__ptr_Workgroup_uint = OpTypePointer Function %_ptr_Workgroup_uint %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_Workgroup_uint - %11 = OpLabel - %13 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - OpStore %13 %10 Aligned 4 + %A = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + OpStore %A_addr %A Aligned 4 %14 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %15 = OpCompositeExtract %uint %14 0 - %16 = OpLoad %_ptr_Workgroup_uint %13 Aligned 4 - %18 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %16 %uint_0 - OpStore %18 %15 Aligned 4 + %call = OpCompositeExtract %uint %14 0 + %16 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %16 %uint_0 + OpStore %arrayidx %call Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/nonterminating.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/nonterminating.spvasm index 6d2fd24784..3cbc288cce 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/nonterminating.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/nonterminating.spvasm @@ -10,11 +10,13 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %4 "foo" OpSource OpenCL_C 200000 + OpName %entry "entry" + OpName %while_body "while.body" %void = OpTypeVoid %3 = OpTypeFunction %void %4 = OpFunction %void DontInline %3 - %5 = OpLabel - OpBranch %6 - %6 = OpLabel - OpBranch %6 + %entry = OpLabel + OpBranch %while_body + %while_body = OpLabel + OpBranch %while_body OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/notunaryoptest.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/notunaryoptest.spvasm index 822eac1bf8..a5ddb2d0b4 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/notunaryoptest.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/notunaryoptest.spvasm @@ -10,7 +10,12 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %4 "foo" OpSource OpenCL_C 200000 - OpDecorate %8 Alignment 4 + OpName %entry "entry" + OpName %x "x" + OpName %tobool "tobool" + OpName %lnot "lnot" + OpName %lnot_ext "lnot.ext" + OpDecorate %x Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 @@ -20,13 +25,13 @@ %bool = OpTypeBool %true = OpConstantTrue %bool %4 = OpFunction %void DontInline %3 - %5 = OpLabel - %8 = OpVariable %_ptr_Function_uint Function - OpStore %8 %uint_1 Aligned 4 - %10 = OpLoad %uint %8 Aligned 4 - %13 = OpINotEqual %bool %10 %uint_0 - %15 = OpLogicalNotEqual %bool %13 %true - %16 = OpSelect %uint %15 %uint_1 %uint_0 - OpStore %8 %16 Aligned 4 + %entry = OpLabel + %x = OpVariable %_ptr_Function_uint Function + OpStore %x %uint_1 Aligned 4 + %10 = OpLoad %uint %x Aligned 4 + %tobool = OpINotEqual %bool %10 %uint_0 + %lnot = OpLogicalNotEqual %bool %tobool %true + %lnot_ext = OpSelect %uint %lnot %uint_1 %uint_0 + OpStore %x %lnot_ext Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/notunaryoptest2.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/notunaryoptest2.spvasm index 650841ae3f..cb6a19c04c 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/notunaryoptest2.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/notunaryoptest2.spvasm @@ -14,9 +14,16 @@ OpExecutionMode %7 ContractionOff OpSource OpenCL_C 200000 OpName %bar "bar" + OpName %entry "entry" + OpName %x "x" + OpName %call "call" + OpName %frombool "frombool" + OpName %tobool "tobool" + OpName %lnot "lnot" + OpName %frombool1 "frombool1" OpDecorate %bar FuncParamAttr Zext OpDecorate %bar LinkageAttributes "bar" Import - OpDecorate %11 Alignment 1 + OpDecorate %x Alignment 1 %uchar = OpTypeInt 8 0 %uchar_0 = OpConstant %uchar 0 %uchar_1 = OpConstant %uchar 1 @@ -29,16 +36,16 @@ %bar = OpFunction %bool None %3 OpFunctionEnd %7 = OpFunction %void DontInline %6 - %8 = OpLabel - %11 = OpVariable %_ptr_Function_uchar Function - %12 = OpFunctionCall %bool %bar - %15 = OpSelect %uchar %12 %uchar_1 %uchar_0 - OpStore %11 %15 Aligned 1 - %16 = OpLoad %uchar %11 Aligned 1 + %entry = OpLabel + %x = OpVariable %_ptr_Function_uchar Function + %call = OpFunctionCall %bool %bar + %frombool = OpSelect %uchar %call %uchar_1 %uchar_0 + OpStore %x %frombool Aligned 1 + %16 = OpLoad %uchar %x Aligned 1 %17 = OpBitwiseAnd %uchar %16 %uchar_1 - %18 = OpINotEqual %bool %17 %uchar_0 - %20 = OpLogicalNotEqual %bool %18 %true - %21 = OpSelect %uchar %20 %uchar_1 %uchar_0 - OpStore %11 %21 Aligned 1 + %tobool = OpINotEqual %bool %17 %uchar_0 + %lnot = OpLogicalNotEqual %bool %tobool %true + %frombool1 = OpSelect %uchar %lnot %uchar_1 %uchar_0 + OpStore %x %frombool1 Aligned 1 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/null_pointers/atomic_null.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/null_pointers/atomic_null.spvasm index 88f72cccb8..62ab487beb 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/null_pointers/atomic_null.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/null_pointers/atomic_null.spvasm @@ -10,6 +10,8 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %4 "foo" OpSource OpenCL_C 200000 + OpName %entry "entry" + OpName %call "call" %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_0 = OpConstant %uint 0 @@ -18,7 +20,7 @@ %_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint %8 = OpConstantNull %_ptr_CrossWorkgroup_uint %4 = OpFunction %void DontInline %3 - %5 = OpLabel - %11 = OpAtomicIIncrement %uint %8 %uint_2 %uint_0 + %entry = OpLabel + %call = OpAtomicIIncrement %uint %8 %uint_2 %uint_0 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/null_pointers/load_from_null.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/null_pointers/load_from_null.spvasm index 4407995d7f..a2c2f60910 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/null_pointers/load_from_null.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/null_pointers/load_from_null.spvasm @@ -12,12 +12,19 @@ OpEntryPoint Kernel %9 "foo" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %b "b" + OpName %entry "entry" + OpName %b_addr "b.addr" + OpName %a "a" + OpName %x "x" + OpName %call "call" + OpName %arrayidx "arrayidx" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %13 Alignment 4 - OpDecorate %14 Alignment 4 - OpDecorate %16 Alignment 4 + OpDecorate %b_addr Alignment 4 + OpDecorate %a Alignment 4 + OpDecorate %x Alignment 4 %uint = OpTypeInt 32 0 %v3uint = OpTypeVector %uint 3 %_ptr_Input_v3uint = OpTypePointer Input %v3uint @@ -29,18 +36,18 @@ %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %17 = OpConstantNull %_ptr_CrossWorkgroup_uint %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpLabel - %13 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %14 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %16 = OpVariable %_ptr_Function_uint Function - OpStore %13 %10 Aligned 4 - OpStore %14 %17 Aligned 4 - %18 = OpLoad %_ptr_CrossWorkgroup_uint %14 Aligned 4 + %b = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %b_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %a = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %x = OpVariable %_ptr_Function_uint Function + OpStore %b_addr %b Aligned 4 + OpStore %a %17 Aligned 4 + %18 = OpLoad %_ptr_CrossWorkgroup_uint %a Aligned 4 %19 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %20 = OpCompositeExtract %uint %19 0 - %21 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %18 %20 - %22 = OpLoad %uint %21 Aligned 4 - OpStore %16 %22 Aligned 4 + %call = OpCompositeExtract %uint %19 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %18 %call + %22 = OpLoad %uint %arrayidx Aligned 4 + OpStore %x %22 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/null_pointers/non_null_pointer_assignment.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/null_pointers/non_null_pointer_assignment.spvasm index fa3dd500f9..cc4e0a9f07 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/null_pointers/non_null_pointer_assignment.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/null_pointers/non_null_pointer_assignment.spvasm @@ -12,13 +12,34 @@ OpEntryPoint Kernel %9 "foo" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %i "i" + OpName %A "A" + OpName %B "B" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_else "if.else" + OpName %if_end "if.end" + OpName %if_then2 "if.then2" + OpName %if_else4 "if.else4" + OpName %if_end7 "if.end7" + OpName %i_addr "i.addr" + OpName %A_addr "A.addr" + OpName %B_addr "B.addr" + OpName %a "a" + OpName %cmp "cmp" + OpName %cmp1 "cmp1" + OpName %call "call" + OpName %call3 "call3" + OpName %arrayidx "arrayidx" + OpName %call5 "call5" + OpName %arrayidx6 "arrayidx6" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %21 Alignment 4 - OpDecorate %23 Alignment 4 - OpDecorate %24 Alignment 4 - OpDecorate %25 Alignment 4 + OpDecorate %i_addr Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %B_addr Alignment 4 + OpDecorate %a Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %v3uint = OpTypeVector %uint 3 @@ -31,51 +52,51 @@ %bool = OpTypeBool %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpLabel - %21 = OpVariable %_ptr_Function_uint Function - %23 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %24 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %25 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %21 %10 Aligned 4 - OpStore %23 %11 Aligned 4 - OpStore %24 %12 Aligned 4 - %26 = OpLoad %uint %21 Aligned 4 - %29 = OpIEqual %bool %26 %uint_0 - OpBranchConditional %29 %14 %15 - %14 = OpLabel - %30 = OpLoad %_ptr_CrossWorkgroup_uint %23 Aligned 4 - OpStore %25 %30 Aligned 4 - OpBranch %16 - %15 = OpLabel - %31 = OpLoad %_ptr_CrossWorkgroup_uint %24 Aligned 4 - OpStore %25 %31 Aligned 4 - OpBranch %16 - %16 = OpLabel - %32 = OpLoad %_ptr_CrossWorkgroup_uint %25 Aligned 4 - %33 = OpLoad %_ptr_CrossWorkgroup_uint %24 Aligned 4 + %i = OpFunctionParameter %uint + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %B = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %i_addr = OpVariable %_ptr_Function_uint Function + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %B_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %a = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %i_addr %i Aligned 4 + OpStore %A_addr %A Aligned 4 + OpStore %B_addr %B Aligned 4 + %26 = OpLoad %uint %i_addr Aligned 4 + %cmp = OpIEqual %bool %26 %uint_0 + OpBranchConditional %cmp %if_then %if_else + %if_then = OpLabel + %30 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 + OpStore %a %30 Aligned 4 + OpBranch %if_end + %if_else = OpLabel + %31 = OpLoad %_ptr_CrossWorkgroup_uint %B_addr Aligned 4 + OpStore %a %31 Aligned 4 + OpBranch %if_end + %if_end = OpLabel + %32 = OpLoad %_ptr_CrossWorkgroup_uint %a Aligned 4 + %33 = OpLoad %_ptr_CrossWorkgroup_uint %B_addr Aligned 4 %34 = OpConvertPtrToU %uint %32 %35 = OpConvertPtrToU %uint %33 - %36 = OpINotEqual %bool %34 %35 - OpBranchConditional %36 %17 %18 - %17 = OpLabel + %cmp1 = OpINotEqual %bool %34 %35 + OpBranchConditional %cmp1 %if_then2 %if_else4 + %if_then2 = OpLabel %37 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %38 = OpCompositeExtract %uint %37 0 - %39 = OpLoad %_ptr_CrossWorkgroup_uint %23 Aligned 4 + %call = OpCompositeExtract %uint %37 0 + %39 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %40 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %41 = OpCompositeExtract %uint %40 0 - %42 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %39 %41 - OpStore %42 %38 Aligned 4 - OpBranch %19 - %18 = OpLabel + %call3 = OpCompositeExtract %uint %40 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %39 %call3 + OpStore %arrayidx %call Aligned 4 + OpBranch %if_end7 + %if_else4 = OpLabel %43 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %44 = OpCompositeExtract %uint %43 0 - %45 = OpLoad %_ptr_CrossWorkgroup_uint %23 Aligned 4 - %46 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %45 %uint_0 - OpStore %46 %44 Aligned 4 - OpBranch %19 - %19 = OpLabel + %call5 = OpCompositeExtract %uint %43 0 + %45 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 + %arrayidx6 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %45 %uint_0 + OpStore %arrayidx6 %call5 Aligned 4 + OpBranch %if_end7 + %if_end7 = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/null_pointers/null_pointer_assignment_equal.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/null_pointers/null_pointer_assignment_equal.spvasm index be3300f3da..f75533b8d6 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/null_pointers/null_pointer_assignment_equal.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/null_pointers/null_pointer_assignment_equal.spvasm @@ -12,12 +12,31 @@ OpEntryPoint Kernel %9 "foo" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %i "i" + OpName %A "A" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_else "if.else" + OpName %if_end "if.end" + OpName %if_then2 "if.then2" + OpName %if_else4 "if.else4" + OpName %if_end7 "if.end7" + OpName %i_addr "i.addr" + OpName %A_addr "A.addr" + OpName %a "a" + OpName %cmp "cmp" + OpName %cmp1 "cmp1" + OpName %call "call" + OpName %call3 "call3" + OpName %arrayidx "arrayidx" + OpName %call5 "call5" + OpName %arrayidx6 "arrayidx6" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %20 Alignment 4 - OpDecorate %22 Alignment 4 - OpDecorate %23 Alignment 4 + OpDecorate %i_addr Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %a Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %v3uint = OpTypeVector %uint 3 @@ -31,46 +50,46 @@ %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %29 = OpConstantNull %_ptr_CrossWorkgroup_uint %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpLabel - %20 = OpVariable %_ptr_Function_uint Function - %22 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %23 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %20 %10 Aligned 4 - OpStore %22 %11 Aligned 4 - %24 = OpLoad %uint %20 Aligned 4 - %27 = OpIEqual %bool %24 %uint_0 - OpBranchConditional %27 %13 %14 - %13 = OpLabel - %28 = OpLoad %_ptr_CrossWorkgroup_uint %22 Aligned 4 - OpStore %23 %28 Aligned 4 - OpBranch %15 - %14 = OpLabel - OpStore %23 %29 Aligned 4 - OpBranch %15 - %15 = OpLabel - %30 = OpLoad %_ptr_CrossWorkgroup_uint %23 Aligned 4 + %i = OpFunctionParameter %uint + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %i_addr = OpVariable %_ptr_Function_uint Function + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %a = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %i_addr %i Aligned 4 + OpStore %A_addr %A Aligned 4 + %24 = OpLoad %uint %i_addr Aligned 4 + %cmp = OpIEqual %bool %24 %uint_0 + OpBranchConditional %cmp %if_then %if_else + %if_then = OpLabel + %28 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 + OpStore %a %28 Aligned 4 + OpBranch %if_end + %if_else = OpLabel + OpStore %a %29 Aligned 4 + OpBranch %if_end + %if_end = OpLabel + %30 = OpLoad %_ptr_CrossWorkgroup_uint %a Aligned 4 %31 = OpConvertPtrToU %uint %30 %32 = OpConvertPtrToU %uint %29 - %33 = OpIEqual %bool %31 %32 - OpBranchConditional %33 %16 %17 - %16 = OpLabel + %cmp1 = OpIEqual %bool %31 %32 + OpBranchConditional %cmp1 %if_then2 %if_else4 + %if_then2 = OpLabel %34 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %35 = OpCompositeExtract %uint %34 0 - %36 = OpLoad %_ptr_CrossWorkgroup_uint %22 Aligned 4 + %call = OpCompositeExtract %uint %34 0 + %36 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %37 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %38 = OpCompositeExtract %uint %37 0 - %39 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %38 - OpStore %39 %35 Aligned 4 - OpBranch %18 - %17 = OpLabel + %call3 = OpCompositeExtract %uint %37 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %call3 + OpStore %arrayidx %call Aligned 4 + OpBranch %if_end7 + %if_else4 = OpLabel %40 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %41 = OpCompositeExtract %uint %40 0 - %42 = OpLoad %_ptr_CrossWorkgroup_uint %22 Aligned 4 - %43 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %42 %uint_0 - OpStore %43 %41 Aligned 4 - OpBranch %18 - %18 = OpLabel + %call5 = OpCompositeExtract %uint %40 0 + %42 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 + %arrayidx6 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %42 %uint_0 + OpStore %arrayidx6 %call5 Aligned 4 + OpBranch %if_end7 + %if_end7 = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/null_pointers/null_pointer_assignment_unequal.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/null_pointers/null_pointer_assignment_unequal.spvasm index 8a8b794a4f..32ac5391b3 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/null_pointers/null_pointer_assignment_unequal.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/null_pointers/null_pointer_assignment_unequal.spvasm @@ -12,12 +12,31 @@ OpEntryPoint Kernel %9 "foo" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %i "i" + OpName %A "A" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_else "if.else" + OpName %if_end "if.end" + OpName %if_then2 "if.then2" + OpName %if_else4 "if.else4" + OpName %if_end7 "if.end7" + OpName %i_addr "i.addr" + OpName %A_addr "A.addr" + OpName %a "a" + OpName %cmp "cmp" + OpName %cmp1 "cmp1" + OpName %call "call" + OpName %call3 "call3" + OpName %arrayidx "arrayidx" + OpName %call5 "call5" + OpName %arrayidx6 "arrayidx6" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %20 Alignment 4 - OpDecorate %22 Alignment 4 - OpDecorate %23 Alignment 4 + OpDecorate %i_addr Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %a Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %v3uint = OpTypeVector %uint 3 @@ -31,46 +50,46 @@ %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %29 = OpConstantNull %_ptr_CrossWorkgroup_uint %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpLabel - %20 = OpVariable %_ptr_Function_uint Function - %22 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %23 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %20 %10 Aligned 4 - OpStore %22 %11 Aligned 4 - %24 = OpLoad %uint %20 Aligned 4 - %27 = OpIEqual %bool %24 %uint_0 - OpBranchConditional %27 %13 %14 - %13 = OpLabel - %28 = OpLoad %_ptr_CrossWorkgroup_uint %22 Aligned 4 - OpStore %23 %28 Aligned 4 - OpBranch %15 - %14 = OpLabel - OpStore %23 %29 Aligned 4 - OpBranch %15 - %15 = OpLabel - %30 = OpLoad %_ptr_CrossWorkgroup_uint %23 Aligned 4 + %i = OpFunctionParameter %uint + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %i_addr = OpVariable %_ptr_Function_uint Function + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %a = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %i_addr %i Aligned 4 + OpStore %A_addr %A Aligned 4 + %24 = OpLoad %uint %i_addr Aligned 4 + %cmp = OpIEqual %bool %24 %uint_0 + OpBranchConditional %cmp %if_then %if_else + %if_then = OpLabel + %28 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 + OpStore %a %28 Aligned 4 + OpBranch %if_end + %if_else = OpLabel + OpStore %a %29 Aligned 4 + OpBranch %if_end + %if_end = OpLabel + %30 = OpLoad %_ptr_CrossWorkgroup_uint %a Aligned 4 %31 = OpConvertPtrToU %uint %30 %32 = OpConvertPtrToU %uint %29 - %33 = OpINotEqual %bool %31 %32 - OpBranchConditional %33 %16 %17 - %16 = OpLabel + %cmp1 = OpINotEqual %bool %31 %32 + OpBranchConditional %cmp1 %if_then2 %if_else4 + %if_then2 = OpLabel %34 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %35 = OpCompositeExtract %uint %34 0 - %36 = OpLoad %_ptr_CrossWorkgroup_uint %22 Aligned 4 + %call = OpCompositeExtract %uint %34 0 + %36 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %37 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %38 = OpCompositeExtract %uint %37 0 - %39 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %38 - OpStore %39 %35 Aligned 4 - OpBranch %18 - %17 = OpLabel + %call3 = OpCompositeExtract %uint %37 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %call3 + OpStore %arrayidx %call Aligned 4 + OpBranch %if_end7 + %if_else4 = OpLabel %40 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %41 = OpCompositeExtract %uint %40 0 - %42 = OpLoad %_ptr_CrossWorkgroup_uint %22 Aligned 4 - %43 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %42 %uint_0 - OpStore %43 %41 Aligned 4 - OpBranch %18 - %18 = OpLabel + %call5 = OpCompositeExtract %uint %40 0 + %42 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 + %arrayidx6 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %42 %uint_0 + OpStore %arrayidx6 %call5 Aligned 4 + OpBranch %if_end7 + %if_end7 = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/null_pointers/null_pointer_choice.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/null_pointers/null_pointer_choice.spvasm index 0348eeb21c..72f7ef583b 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/null_pointers/null_pointer_choice.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/null_pointers/null_pointer_choice.spvasm @@ -12,8 +12,16 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %4 "testKernel" OpSource OpenCL_C 200000 - OpDecorate %11 Alignment 4 - OpDecorate %12 Alignment 4 + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %bufptr "bufptr" + OpName %next "next" + OpName %add_ptr "add.ptr" + OpName %cmp "cmp" + OpName %arrayidx "arrayidx" + OpDecorate %bufptr Alignment 4 + OpDecorate %next Alignment 4 %uchar = OpTypeInt 8 0 %uint = OpTypeInt 32 0 %uint_5 = OpConstant %uint 5 @@ -25,26 +33,26 @@ %bool = OpTypeBool %13 = OpConstantNull %_ptr_Generic_uchar %4 = OpFunction %void DontInline %3 - %5 = OpLabel - %11 = OpVariable %_ptr_Function__ptr_Generic_uchar Function - %12 = OpVariable %_ptr_Function__ptr_Generic_uchar Function - OpStore %12 %13 Aligned 4 - %14 = OpLoad %_ptr_Generic_uchar %12 Aligned 4 - %17 = OpInBoundsPtrAccessChain %_ptr_Generic_uchar %14 %uint_5 - OpStore %11 %17 Aligned 4 - %18 = OpLoad %_ptr_Generic_uchar %11 Aligned 4 + %entry = OpLabel + %bufptr = OpVariable %_ptr_Function__ptr_Generic_uchar Function + %next = OpVariable %_ptr_Function__ptr_Generic_uchar Function + OpStore %next %13 Aligned 4 + %14 = OpLoad %_ptr_Generic_uchar %next Aligned 4 + %add_ptr = OpInBoundsPtrAccessChain %_ptr_Generic_uchar %14 %uint_5 + OpStore %bufptr %add_ptr Aligned 4 + %18 = OpLoad %_ptr_Generic_uchar %bufptr Aligned 4 %19 = OpConvertPtrToU %uint %18 %20 = OpConvertPtrToU %uint %13 - %22 = OpUGreaterThanEqual %bool %19 %20 - OpBranchConditional %22 %6 %7 - %6 = OpLabel - OpStore %11 %13 Aligned 4 - OpBranch %7 - %7 = OpLabel - %23 = OpLoad %_ptr_Generic_uchar %11 Aligned 4 - OpStore %11 %23 Aligned 4 - %24 = OpLoad %_ptr_Generic_uchar %11 Aligned 4 - %25 = OpInBoundsPtrAccessChain %_ptr_Generic_uchar %24 %uint_5 - OpStore %25 %uchar_97 Aligned 1 + %cmp = OpUGreaterThanEqual %bool %19 %20 + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel + OpStore %bufptr %13 Aligned 4 + OpBranch %if_end + %if_end = OpLabel + %23 = OpLoad %_ptr_Generic_uchar %bufptr Aligned 4 + OpStore %bufptr %23 Aligned 4 + %24 = OpLoad %_ptr_Generic_uchar %bufptr Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Generic_uchar %24 %uint_5 + OpStore %arrayidx %uchar_97 Aligned 1 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/null_pointers/null_pointer_greater.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/null_pointers/null_pointer_greater.spvasm index eb9e2823a5..94b0d1469f 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/null_pointers/null_pointer_greater.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/null_pointers/null_pointer_greater.spvasm @@ -13,13 +13,34 @@ OpEntryPoint Kernel %11 "foo" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %i "i" + OpName %A "A" + OpName %B "B" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_else "if.else" + OpName %if_end "if.end" + OpName %if_then2 "if.then2" + OpName %if_else4 "if.else4" + OpName %if_end7 "if.end7" + OpName %i_addr "i.addr" + OpName %A_addr "A.addr" + OpName %B_addr "B.addr" + OpName %a "a" + OpName %cmp "cmp" + OpName %cmp1 "cmp1" + OpName %call "call" + OpName %call3 "call3" + OpName %arrayidx "arrayidx" + OpName %call5 "call5" + OpName %arrayidx6 "arrayidx6" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %23 Alignment 4 - OpDecorate %25 Alignment 4 - OpDecorate %27 Alignment 4 - OpDecorate %28 Alignment 4 + OpDecorate %i_addr Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %B_addr Alignment 4 + OpDecorate %a Alignment 4 %uint = OpTypeInt 32 0 %uchar = OpTypeInt 8 0 %uint_0 = OpConstant %uint 0 @@ -36,49 +57,49 @@ %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %34 = OpConstantNull %_ptr_CrossWorkgroup_uint %11 = OpFunction %void DontInline %10 - %12 = OpFunctionParameter %uint - %13 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %14 = OpFunctionParameter %_ptr_CrossWorkgroup_uchar - %15 = OpLabel - %23 = OpVariable %_ptr_Function_uint Function - %25 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %27 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uchar Function - %28 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %23 %12 Aligned 4 - OpStore %25 %13 Aligned 4 - OpStore %27 %14 Aligned 4 - %29 = OpLoad %uint %23 Aligned 4 - %32 = OpIEqual %bool %29 %uint_0 - OpBranchConditional %32 %16 %17 - %16 = OpLabel - %33 = OpLoad %_ptr_CrossWorkgroup_uint %25 Aligned 4 - OpStore %28 %33 Aligned 4 - OpBranch %18 - %17 = OpLabel - OpStore %28 %34 Aligned 4 - OpBranch %18 - %18 = OpLabel - %35 = OpLoad %_ptr_CrossWorkgroup_uint %28 Aligned 4 + %i = OpFunctionParameter %uint + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %B = OpFunctionParameter %_ptr_CrossWorkgroup_uchar + %entry = OpLabel + %i_addr = OpVariable %_ptr_Function_uint Function + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %B_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uchar Function + %a = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %i_addr %i Aligned 4 + OpStore %A_addr %A Aligned 4 + OpStore %B_addr %B Aligned 4 + %29 = OpLoad %uint %i_addr Aligned 4 + %cmp = OpIEqual %bool %29 %uint_0 + OpBranchConditional %cmp %if_then %if_else + %if_then = OpLabel + %33 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 + OpStore %a %33 Aligned 4 + OpBranch %if_end + %if_else = OpLabel + OpStore %a %34 Aligned 4 + OpBranch %if_end + %if_end = OpLabel + %35 = OpLoad %_ptr_CrossWorkgroup_uint %a Aligned 4 %36 = OpConvertPtrToU %uint %35 %37 = OpConvertPtrToU %uint %34 - %38 = OpUGreaterThan %bool %36 %37 - OpBranchConditional %38 %19 %20 - %19 = OpLabel + %cmp1 = OpUGreaterThan %bool %36 %37 + OpBranchConditional %cmp1 %if_then2 %if_else4 + %if_then2 = OpLabel %39 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %40 = OpCompositeExtract %uint %39 0 - %41 = OpLoad %_ptr_CrossWorkgroup_uint %25 Aligned 4 + %call = OpCompositeExtract %uint %39 0 + %41 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %42 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %43 = OpCompositeExtract %uint %42 0 - %44 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %41 %43 - OpStore %44 %40 Aligned 4 - OpBranch %21 - %20 = OpLabel + %call3 = OpCompositeExtract %uint %42 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %41 %call3 + OpStore %arrayidx %call Aligned 4 + OpBranch %if_end7 + %if_else4 = OpLabel %45 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %46 = OpCompositeExtract %uint %45 0 - %47 = OpLoad %_ptr_CrossWorkgroup_uint %25 Aligned 4 - %48 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %47 %uint_0 - OpStore %48 %46 Aligned 4 - OpBranch %21 - %21 = OpLabel + %call5 = OpCompositeExtract %uint %45 0 + %47 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 + %arrayidx6 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %47 %uint_0 + OpStore %arrayidx6 %call5 Aligned 4 + OpBranch %if_end7 + %if_end7 = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/null_pointers/store_to_null_and_non_null.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/null_pointers/store_to_null_and_non_null.spvasm index 049fdef82c..8e4eab72c6 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/null_pointers/store_to_null_and_non_null.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/null_pointers/store_to_null_and_non_null.spvasm @@ -12,11 +12,21 @@ OpEntryPoint Kernel %9 "foo" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %A "A" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpName %a "a" + OpName %call "call" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" + OpName %call2 "call2" + OpName %call3 "call3" + OpName %arrayidx4 "arrayidx4" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %13 Alignment 4 - OpDecorate %14 Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %a Alignment 4 %uint = OpTypeInt 32 0 %v3uint = OpTypeVector %uint 3 %_ptr_Input_v3uint = OpTypePointer Input %v3uint @@ -27,25 +37,25 @@ %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %15 = OpConstantNull %_ptr_CrossWorkgroup_uint %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpLabel - %13 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %14 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %13 %10 Aligned 4 - OpStore %14 %15 Aligned 4 + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %a = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %A_addr %A Aligned 4 + OpStore %a %15 Aligned 4 %16 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %17 = OpCompositeExtract %uint %16 0 - %18 = OpLoad %_ptr_CrossWorkgroup_uint %14 Aligned 4 + %call = OpCompositeExtract %uint %16 0 + %18 = OpLoad %_ptr_CrossWorkgroup_uint %a Aligned 4 %19 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %20 = OpCompositeExtract %uint %19 0 - %21 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %18 %20 - OpStore %21 %17 Aligned 4 + %call1 = OpCompositeExtract %uint %19 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %18 %call1 + OpStore %arrayidx %call Aligned 4 %22 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %23 = OpCompositeExtract %uint %22 0 - %24 = OpLoad %_ptr_CrossWorkgroup_uint %13 Aligned 4 + %call2 = OpCompositeExtract %uint %22 0 + %24 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %25 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %26 = OpCompositeExtract %uint %25 0 - %27 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %24 %26 - OpStore %27 %23 Aligned 4 + %call3 = OpCompositeExtract %uint %25 0 + %arrayidx4 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %24 %call3 + OpStore %arrayidx4 %call2 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/null_statement.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/null_statement.spvasm index 5f404c789b..c2a0725247 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/null_statement.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/null_statement.spvasm @@ -10,9 +10,10 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %4 "foo" OpSource OpenCL_C 200000 + OpName %entry "entry" %void = OpTypeVoid %3 = OpTypeFunction %void %4 = OpFunction %void DontInline %3 - %5 = OpLabel + %entry = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/pointertests/param_addressof.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/pointertests/param_addressof.spvasm index e7006c98a3..efc517ed3a 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/pointertests/param_addressof.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/pointertests/param_addressof.spvasm @@ -13,14 +13,32 @@ OpEntryPoint Kernel %35 "foo" OpSource OpenCL_C 200000 OpName %baz "baz" + OpName %a "a" + OpName %entry "entry" + OpName %a_addr "a.addr" OpName %bar "bar" + OpName %entry_0 "entry" + OpName %land_lhs_true "land.lhs.true" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %f "f" + OpName %g "g" + OpName %g_ascast "g.ascast" + OpName %g_ascast1 "g.ascast1" + OpName %cmp "cmp" + OpName %cmp2 "cmp2" + OpName %A "A" + OpName %me "me" + OpName %entry_1 "entry" + OpName %A_addr "A.addr" + OpName %me_addr "me.addr" OpDecorate %bar LinkageAttributes "bar" Export OpDecorate %baz LinkageAttributes "baz" Export - OpDecorate %10 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %21 Alignment 4 - OpDecorate %40 Alignment 4 - OpDecorate %41 Alignment 4 + OpDecorate %a_addr Alignment 4 + OpDecorate %f Alignment 4 + OpDecorate %g Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %me_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %void = OpTypeVoid @@ -34,45 +52,45 @@ %34 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %baz = OpFunction %void DontInline %5 - %7 = OpFunctionParameter %_ptr_Generic_uint - %8 = OpLabel - %10 = OpVariable %_ptr_Function__ptr_Generic_uint Function - OpStore %10 %7 Aligned 4 - %11 = OpLoad %_ptr_Generic_uint %10 Aligned 4 + %a = OpFunctionParameter %_ptr_Generic_uint + %entry = OpLabel + %a_addr = OpVariable %_ptr_Function__ptr_Generic_uint Function + OpStore %a_addr %a Aligned 4 + %11 = OpLoad %_ptr_Generic_uint %a_addr Aligned 4 OpStore %11 %uint_1 Aligned 4 OpReturn OpFunctionEnd %bar = OpFunction %void DontInline %13 - %15 = OpLabel - %19 = OpVariable %_ptr_Function__ptr_Generic_uint Function - %21 = OpVariable %_ptr_Function_uint Function - %22 = OpPtrCastToGeneric %_ptr_Generic_uint %21 - OpStore %19 %22 Aligned 4 - %23 = OpPtrCastToGeneric %_ptr_Generic_uint %21 - %24 = OpFunctionCall %void %baz %23 - %25 = OpLoad %_ptr_Generic_uint %19 Aligned 4 + %entry_0 = OpLabel + %f = OpVariable %_ptr_Function__ptr_Generic_uint Function + %g = OpVariable %_ptr_Function_uint Function + %g_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %g + OpStore %f %g_ascast Aligned 4 + %g_ascast1 = OpPtrCastToGeneric %_ptr_Generic_uint %g + %24 = OpFunctionCall %void %baz %g_ascast1 + %25 = OpLoad %_ptr_Generic_uint %f Aligned 4 %26 = OpFunctionCall %void %baz %25 - %27 = OpLoad %uint %21 Aligned 4 - %29 = OpIEqual %bool %27 %uint_1 - OpBranchConditional %29 %16 %18 - %16 = OpLabel - %30 = OpLoad %_ptr_Generic_uint %19 Aligned 4 + %27 = OpLoad %uint %g Aligned 4 + %cmp = OpIEqual %bool %27 %uint_1 + OpBranchConditional %cmp %land_lhs_true %if_end +%land_lhs_true = OpLabel + %30 = OpLoad %_ptr_Generic_uint %f Aligned 4 %31 = OpLoad %uint %30 Aligned 4 - %32 = OpIEqual %bool %31 %uint_1 - OpBranchConditional %32 %17 %18 - %17 = OpLabel - OpBranch %18 - %18 = OpLabel + %cmp2 = OpIEqual %bool %31 %uint_1 + OpBranchConditional %cmp2 %if_then %if_end + %if_then = OpLabel + OpBranch %if_end + %if_end = OpLabel OpReturn OpFunctionEnd %35 = OpFunction %void DontInline %34 - %36 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %37 = OpFunctionParameter %uint - %38 = OpLabel - %40 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %41 = OpVariable %_ptr_Function_uint Function - OpStore %40 %36 Aligned 4 - OpStore %41 %37 Aligned 4 + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %me = OpFunctionParameter %uint + %entry_1 = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %me_addr = OpVariable %_ptr_Function_uint Function + OpStore %A_addr %A Aligned 4 + OpStore %me_addr %me Aligned 4 %42 = OpFunctionCall %void %bar OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/pointertests/pointerarith.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/pointertests/pointerarith.spvasm index a1c7a4594d..151a3cdd08 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/pointertests/pointerarith.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/pointertests/pointerarith.spvasm @@ -10,9 +10,18 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %6 "foo" OpSource OpenCL_C 200000 - OpDecorate %11 Alignment 4 - OpDecorate %13 Alignment 4 - OpDecorate %14 Alignment 4 + OpName %A "A" + OpName %me "me" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpName %me_addr "me.addr" + OpName %q "q" + OpName %shr "shr" + OpName %add "add" + OpName %add_ptr "add.ptr" + OpDecorate %A_addr Alignment 4 + OpDecorate %me_addr Alignment 4 + OpDecorate %q Alignment 4 %uint = OpTypeInt 32 0 %uint_5 = OpConstant %uint 5 %void = OpTypeVoid @@ -21,20 +30,20 @@ %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %_ptr_Function_uint = OpTypePointer Function %uint %6 = OpFunction %void DontInline %5 - %7 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %8 = OpFunctionParameter %uint - %9 = OpLabel - %11 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %13 = OpVariable %_ptr_Function_uint Function - %14 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %11 %7 Aligned 4 - OpStore %13 %8 Aligned 4 - %15 = OpLoad %_ptr_CrossWorkgroup_uint %11 Aligned 4 - %16 = OpLoad %uint %13 Aligned 4 - %17 = OpLoad %uint %13 Aligned 4 - %19 = OpShiftRightLogical %uint %17 %uint_5 - %20 = OpIAdd %uint %16 %19 - %21 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %15 %20 - OpStore %14 %21 Aligned 4 + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %me = OpFunctionParameter %uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %me_addr = OpVariable %_ptr_Function_uint Function + %q = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %A_addr %A Aligned 4 + OpStore %me_addr %me Aligned 4 + %15 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 + %16 = OpLoad %uint %me_addr Aligned 4 + %17 = OpLoad %uint %me_addr Aligned 4 + %shr = OpShiftRightLogical %uint %17 %uint_5 + %add = OpIAdd %uint %16 %shr + %add_ptr = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %15 %add + OpStore %q %add_ptr Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/pointertests/test_opencl_local_array.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/pointertests/test_opencl_local_array.spvasm index 3447e279e7..d0a206010f 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/pointertests/test_opencl_local_array.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/pointertests/test_opencl_local_array.spvasm @@ -11,6 +11,7 @@ OpEntryPoint Kernel %9 "foo" OpSource OpenCL_C 200000 OpName %foo_A "foo.A" + OpName %entry "entry" OpDecorate %foo_A Alignment 4 %uint = OpTypeInt 32 0 %uint_10 = OpConstant %uint 10 @@ -20,6 +21,6 @@ %8 = OpTypeFunction %void %foo_A = OpVariable %_ptr_Workgroup__arr_uint_uint_10 Workgroup %9 = OpFunction %void DontInline %8 - %10 = OpLabel + %entry = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/pointertests/test_opencl_local_param.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/pointertests/test_opencl_local_param.spvasm index 37c486178d..fba2fd85e6 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/pointertests/test_opencl_local_param.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/pointertests/test_opencl_local_param.spvasm @@ -10,8 +10,13 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %7 "foo" OpSource OpenCL_C 200000 - OpDecorate %12 Alignment 4 - OpDecorate %14 Alignment 4 + OpName %p "p" + OpName %q "q" + OpName %entry "entry" + OpName %p_addr "p.addr" + OpName %q_addr "q.addr" + OpDecorate %p_addr Alignment 4 + OpDecorate %q_addr Alignment 4 %uint = OpTypeInt 32 0 %void = OpTypeVoid %_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint @@ -20,12 +25,12 @@ %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %_ptr_Function__ptr_Workgroup_uint = OpTypePointer Function %_ptr_Workgroup_uint %7 = OpFunction %void DontInline %6 - %8 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %9 = OpFunctionParameter %_ptr_Workgroup_uint - %10 = OpLabel - %12 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %14 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - OpStore %12 %8 Aligned 4 - OpStore %14 %9 Aligned 4 + %p = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %q = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %q_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + OpStore %p_addr %p Aligned 4 + OpStore %q_addr %q Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/pointertests/test_return_pointer.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/pointertests/test_return_pointer.spvasm index 389bfe90d9..578b17cf97 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/pointertests/test_return_pointer.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/pointertests/test_return_pointer.spvasm @@ -13,13 +13,24 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" OpName %bar "bar" + OpName %p "p" + OpName %entry "entry" + OpName %p_addr "p.addr" + OpName %A "A" + OpName %entry_0 "entry" + OpName %A_addr "A.addr" + OpName %q "q" + OpName %call "call" + OpName %call1 "call1" + OpName %call2 "call2" + OpName %arrayidx "arrayidx" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %bar LinkageAttributes "bar" Export OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %12 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %20 Alignment 4 + OpDecorate %p_addr Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %q Alignment 4 %uint = OpTypeInt 32 0 %v3uint = OpTypeVector %uint 3 %_ptr_Input_v3uint = OpTypePointer Input %v3uint @@ -30,28 +41,28 @@ %15 = OpTypeFunction %void %_ptr_Workgroup_uint %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %bar = OpFunction %_ptr_Workgroup_uint DontInline %7 - %9 = OpFunctionParameter %_ptr_Workgroup_uint - %10 = OpLabel - %12 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - OpStore %12 %9 Aligned 4 - %13 = OpLoad %_ptr_Workgroup_uint %12 Aligned 4 + %p = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + OpStore %p_addr %p Aligned 4 + %13 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 OpReturnValue %13 OpFunctionEnd %16 = OpFunction %void DontInline %15 - %17 = OpFunctionParameter %_ptr_Workgroup_uint - %18 = OpLabel - %19 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %20 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - OpStore %19 %17 Aligned 4 - %21 = OpLoad %_ptr_Workgroup_uint %19 Aligned 4 - %22 = OpFunctionCall %_ptr_Workgroup_uint %bar %21 - OpStore %20 %22 Aligned 4 + %A = OpFunctionParameter %_ptr_Workgroup_uint + %entry_0 = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %q = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + OpStore %A_addr %A Aligned 4 + %21 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %call = OpFunctionCall %_ptr_Workgroup_uint %bar %21 + OpStore %q %call Aligned 4 %23 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %24 = OpCompositeExtract %uint %23 0 - %25 = OpLoad %_ptr_Workgroup_uint %20 Aligned 4 + %call1 = OpCompositeExtract %uint %23 0 + %25 = OpLoad %_ptr_Workgroup_uint %q Aligned 4 %26 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %27 = OpCompositeExtract %uint %26 0 - %28 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %25 %27 - OpStore %28 %24 Aligned 4 + %call2 = OpCompositeExtract %uint %26 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %25 %call2 + OpStore %arrayidx %call1 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/pow2/64bit_loopcounter.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/pow2/64bit_loopcounter.spvasm index 38e607ed46..5c2f8a2bc9 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/pow2/64bit_loopcounter.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/pow2/64bit_loopcounter.spvasm @@ -14,12 +14,27 @@ OpEntryPoint Kernel %10 "foo" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %A "A" + OpName %n "n" + OpName %entry "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %A_addr "A.addr" + OpName %n_addr "n.addr" + OpName %i "i" + OpName %conv "conv" + OpName %cmp "cmp" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %shr "shr" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %19 Alignment 4 - OpDecorate %21 Alignment 4 - OpDecorate %24 Alignment 8 + OpDecorate %A_addr Alignment 4 + OpDecorate %n_addr Alignment 4 + OpDecorate %i Alignment 8 %uint = OpTypeInt 32 0 %ulong = OpTypeInt 64 0 %ulong_0 = OpConstant %ulong 0 @@ -37,34 +52,34 @@ %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %double_0 = OpConstant %double 0 %10 = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_double - %12 = OpFunctionParameter %uint - %13 = OpLabel - %19 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_double Function - %21 = OpVariable %_ptr_Function_uint Function - %24 = OpVariable %_ptr_Function_ulong Function - OpStore %19 %11 Aligned 4 - OpStore %21 %12 Aligned 4 - %25 = OpLoad %uint %21 Aligned 4 - %26 = OpSConvert %ulong %25 - OpStore %24 %26 Aligned 8 - OpBranch %14 - %14 = OpLabel - %27 = OpLoad %ulong %24 Aligned 8 - %30 = OpSGreaterThan %bool %27 %ulong_0 - OpBranchConditional %30 %15 %17 - %15 = OpLabel - %31 = OpLoad %_ptr_CrossWorkgroup_double %19 Aligned 4 + %A = OpFunctionParameter %_ptr_CrossWorkgroup_double + %n = OpFunctionParameter %uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_double Function + %n_addr = OpVariable %_ptr_Function_uint Function + %i = OpVariable %_ptr_Function_ulong Function + OpStore %A_addr %A Aligned 4 + OpStore %n_addr %n Aligned 4 + %25 = OpLoad %uint %n_addr Aligned 4 + %conv = OpSConvert %ulong %25 + OpStore %i %conv Aligned 8 + OpBranch %for_cond + %for_cond = OpLabel + %27 = OpLoad %ulong %i Aligned 8 + %cmp = OpSGreaterThan %bool %27 %ulong_0 + OpBranchConditional %cmp %for_body %for_end + %for_body = OpLabel + %31 = OpLoad %_ptr_CrossWorkgroup_double %A_addr Aligned 4 %32 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %33 = OpCompositeExtract %uint %32 0 - %34 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_double %31 %33 - OpStore %34 %double_0 Aligned 8 - OpBranch %16 - %16 = OpLabel - %36 = OpLoad %ulong %24 Aligned 8 - %38 = OpShiftRightArithmetic %ulong %36 %ulong_1 - OpStore %24 %38 Aligned 8 - OpBranch %14 - %17 = OpLabel + %call = OpCompositeExtract %uint %32 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_double %31 %call + OpStore %arrayidx %double_0 Aligned 8 + OpBranch %for_inc + %for_inc = OpLabel + %36 = OpLoad %ulong %i Aligned 8 + %shr = OpShiftRightArithmetic %ulong %36 %ulong_1 + OpStore %i %shr Aligned 8 + OpBranch %for_cond + %for_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/pow2/64bit_relational.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/pow2/64bit_relational.spvasm index c96c718432..4ce1bff95f 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/pow2/64bit_relational.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/pow2/64bit_relational.spvasm @@ -14,13 +14,30 @@ OpEntryPoint Kernel %10 "foo" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %A "A" + OpName %n "n" + OpName %entry "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %A_addr "A.addr" + OpName %n_addr "n.addr" + OpName %j "j" + OpName %i "i" + OpName %conv "conv" + OpName %cmp "cmp" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %mul "mul" + OpName %shr "shr" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %19 Alignment 4 - OpDecorate %21 Alignment 4 - OpDecorate %24 Alignment 8 - OpDecorate %25 Alignment 8 + OpDecorate %A_addr Alignment 4 + OpDecorate %n_addr Alignment 4 + OpDecorate %j Alignment 8 + OpDecorate %i Alignment 8 %uint = OpTypeInt 32 0 %ulong = OpTypeInt 64 0 %ulong_1 = OpConstant %ulong 1 @@ -39,39 +56,39 @@ %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %double_0 = OpConstant %double 0 %10 = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_double - %12 = OpFunctionParameter %uint - %13 = OpLabel - %19 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_double Function - %21 = OpVariable %_ptr_Function_uint Function - %24 = OpVariable %_ptr_Function_ulong Function - %25 = OpVariable %_ptr_Function_ulong Function - OpStore %19 %11 Aligned 4 - OpStore %21 %12 Aligned 4 - OpStore %24 %ulong_1 Aligned 8 - %27 = OpLoad %uint %21 Aligned 4 - %28 = OpSConvert %ulong %27 - OpStore %25 %28 Aligned 8 - OpBranch %14 - %14 = OpLabel - %29 = OpLoad %ulong %25 Aligned 8 - %32 = OpSGreaterThan %bool %29 %ulong_0 - OpBranchConditional %32 %15 %17 - %15 = OpLabel - %33 = OpLoad %_ptr_CrossWorkgroup_double %19 Aligned 4 + %A = OpFunctionParameter %_ptr_CrossWorkgroup_double + %n = OpFunctionParameter %uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_double Function + %n_addr = OpVariable %_ptr_Function_uint Function + %j = OpVariable %_ptr_Function_ulong Function + %i = OpVariable %_ptr_Function_ulong Function + OpStore %A_addr %A Aligned 4 + OpStore %n_addr %n Aligned 4 + OpStore %j %ulong_1 Aligned 8 + %27 = OpLoad %uint %n_addr Aligned 4 + %conv = OpSConvert %ulong %27 + OpStore %i %conv Aligned 8 + OpBranch %for_cond + %for_cond = OpLabel + %29 = OpLoad %ulong %i Aligned 8 + %cmp = OpSGreaterThan %bool %29 %ulong_0 + OpBranchConditional %cmp %for_body %for_end + %for_body = OpLabel + %33 = OpLoad %_ptr_CrossWorkgroup_double %A_addr Aligned 4 %34 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %35 = OpCompositeExtract %uint %34 0 - %36 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_double %33 %35 - OpStore %36 %double_0 Aligned 8 - %38 = OpLoad %ulong %24 Aligned 8 - %40 = OpIMul %ulong %38 %ulong_2 - OpStore %24 %40 Aligned 8 - OpBranch %16 - %16 = OpLabel - %41 = OpLoad %ulong %25 Aligned 8 - %42 = OpShiftRightArithmetic %ulong %41 %ulong_1 - OpStore %25 %42 Aligned 8 - OpBranch %14 - %17 = OpLabel + %call = OpCompositeExtract %uint %34 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_double %33 %call + OpStore %arrayidx %double_0 Aligned 8 + %38 = OpLoad %ulong %j Aligned 8 + %mul = OpIMul %ulong %38 %ulong_2 + OpStore %j %mul Aligned 8 + OpBranch %for_inc + %for_inc = OpLabel + %41 = OpLoad %ulong %i Aligned 8 + %shr = OpShiftRightArithmetic %ulong %41 %ulong_1 + OpStore %i %shr Aligned 8 + OpBranch %for_cond + %for_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/predicated_undef.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/predicated_undef.spvasm index 0bf9241efa..3bb29e1b77 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/predicated_undef.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/predicated_undef.spvasm @@ -13,14 +13,27 @@ OpSource OpenCL_C 200000 OpName %k_sum "k.sum" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %input "input" + OpName %output "output" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %input_addr "input.addr" + OpName %output_addr "output.addr" + OpName %temp "temp" + OpName %offset "offset" + OpName %call "call" + OpName %cmp "cmp" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import OpDecorate %k_sum Alignment 4 - OpDecorate %20 Alignment 4 - OpDecorate %21 Alignment 4 - OpDecorate %23 Alignment 4 - OpDecorate %24 Alignment 4 + OpDecorate %input_addr Alignment 4 + OpDecorate %output_addr Alignment 4 + OpDecorate %temp Alignment 4 + OpDecorate %offset Alignment 4 %uint = OpTypeInt 32 0 %uint_1024 = OpConstant %uint 1024 %uint_1 = OpConstant %uint 1 @@ -39,28 +52,28 @@ %k_sum = OpVariable %_ptr_Workgroup__arr_uint_uint_1024 Workgroup %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %13 = OpFunction %void DontInline %12 - %14 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %15 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %16 = OpLabel - %20 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %21 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %23 = OpVariable %_ptr_Function_uint Function - %24 = OpVariable %_ptr_Function_uint Function - OpStore %20 %14 Aligned 4 - OpStore %21 %15 Aligned 4 - OpStore %24 %uint_1 Aligned 4 + %input = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %output = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %input_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%output_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %temp = OpVariable %_ptr_Function_uint Function + %offset = OpVariable %_ptr_Function_uint Function + OpStore %input_addr %input Aligned 4 + OpStore %output_addr %output Aligned 4 + OpStore %offset %uint_1 Aligned 4 %26 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %27 = OpCompositeExtract %uint %26 0 - %28 = OpLoad %uint %24 Aligned 4 - %30 = OpUGreaterThanEqual %bool %27 %28 - OpBranchConditional %30 %17 %18 - %17 = OpLabel - %31 = OpLoad %uint %23 Aligned 4 + %call = OpCompositeExtract %uint %26 0 + %28 = OpLoad %uint %offset Aligned 4 + %cmp = OpUGreaterThanEqual %bool %call %28 + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel + %31 = OpLoad %uint %temp Aligned 4 %32 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %33 = OpCompositeExtract %uint %32 0 - %36 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %k_sum %uint_0 %33 - OpStore %36 %31 Aligned 4 - OpBranch %18 - %18 = OpLabel + %call1 = OpCompositeExtract %uint %32 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %k_sum %uint_0 %call1 + OpStore %arrayidx %31 Aligned 4 + OpBranch %if_end + %if_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/reducedstrength_generalised.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/reducedstrength_generalised.spvasm index d6f42d7775..a409d8f920 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/reducedstrength_generalised.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/reducedstrength_generalised.spvasm @@ -13,15 +13,42 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInWorkgroupSize "__spirv_BuiltInWorkgroupSize" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %data "data" + OpName %entry "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_cond1 "for.cond1" + OpName %for_body5 "for.body5" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %for_inc10 "for.inc10" + OpName %for_end13 "for.end13" + OpName %data_addr "data.addr" + OpName %i "i" + OpName %j "j" + OpName %call "call" + OpName %mul "mul" + OpName %cmp "cmp" + OpName %call2 "call2" + OpName %mul3 "mul3" + OpName %cmp4 "cmp4" + OpName %call6 "call6" + OpName %call7 "call7" + OpName %add "add" + OpName %arrayidx "arrayidx" + OpName %call8 "call8" + OpName %add9 "add9" + OpName %call11 "call11" + OpName %add12 "add12" OpDecorate %__spirv_BuiltInWorkgroupSize BuiltIn WorkgroupSize OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInWorkgroupSize Constant OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInWorkgroupSize LinkageAttributes "__spirv_BuiltInWorkgroupSize" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %22 Alignment 4 - OpDecorate %24 Alignment 4 - OpDecorate %25 Alignment 4 + OpDecorate %data_addr Alignment 4 + OpDecorate %i Alignment 4 + OpDecorate %j Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_10 = OpConstant %uint 10 @@ -36,59 +63,59 @@ %__spirv_BuiltInWorkgroupSize = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %10 = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_Workgroup_uint - %12 = OpLabel - %22 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %24 = OpVariable %_ptr_Function_uint Function - %25 = OpVariable %_ptr_Function_uint Function - OpStore %22 %11 Aligned 4 - OpStore %24 %uint_0 Aligned 4 - OpBranch %13 - %13 = OpLabel - %27 = OpLoad %uint %24 Aligned 4 + %data = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %data_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %i = OpVariable %_ptr_Function_uint Function + %j = OpVariable %_ptr_Function_uint Function + OpStore %data_addr %data Aligned 4 + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %27 = OpLoad %uint %i Aligned 4 %28 = OpLoad %v3uint %__spirv_BuiltInWorkgroupSize Aligned 16 - %29 = OpCompositeExtract %uint %28 0 - %31 = OpIMul %uint %29 %uint_10 - %33 = OpULessThan %bool %27 %31 - OpBranchConditional %33 %14 %20 - %14 = OpLabel - %34 = OpLoad %uint %24 Aligned 4 - OpStore %25 %34 Aligned 4 - OpBranch %15 - %15 = OpLabel - %35 = OpLoad %uint %25 Aligned 4 + %call = OpCompositeExtract %uint %28 0 + %mul = OpIMul %uint %call %uint_10 + %cmp = OpULessThan %bool %27 %mul + OpBranchConditional %cmp %for_body %for_end13 + %for_body = OpLabel + %34 = OpLoad %uint %i Aligned 4 + OpStore %j %34 Aligned 4 + OpBranch %for_cond1 + %for_cond1 = OpLabel + %35 = OpLoad %uint %j Aligned 4 %36 = OpLoad %v3uint %__spirv_BuiltInWorkgroupSize Aligned 16 - %37 = OpCompositeExtract %uint %36 0 - %38 = OpIMul %uint %37 %uint_10 - %39 = OpULessThan %bool %35 %38 - OpBranchConditional %39 %16 %18 - %16 = OpLabel + %call2 = OpCompositeExtract %uint %36 0 + %mul3 = OpIMul %uint %call2 %uint_10 + %cmp4 = OpULessThan %bool %35 %mul3 + OpBranchConditional %cmp4 %for_body5 %for_end + %for_body5 = OpLabel %40 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %41 = OpCompositeExtract %uint %40 0 - %42 = OpLoad %_ptr_Workgroup_uint %22 Aligned 4 - %43 = OpLoad %uint %25 Aligned 4 + %call6 = OpCompositeExtract %uint %40 0 + %42 = OpLoad %_ptr_Workgroup_uint %data_addr Aligned 4 + %43 = OpLoad %uint %j Aligned 4 %44 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %45 = OpCompositeExtract %uint %44 0 - %46 = OpIAdd %uint %43 %45 - %47 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %42 %46 - OpStore %47 %41 Aligned 4 - OpBranch %17 - %17 = OpLabel + %call7 = OpCompositeExtract %uint %44 0 + %add = OpIAdd %uint %43 %call7 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %42 %add + OpStore %arrayidx %call6 Aligned 4 + OpBranch %for_inc + %for_inc = OpLabel %48 = OpLoad %v3uint %__spirv_BuiltInWorkgroupSize Aligned 16 - %49 = OpCompositeExtract %uint %48 0 - %50 = OpLoad %uint %25 Aligned 4 - %51 = OpIAdd %uint %50 %49 - OpStore %25 %51 Aligned 4 - OpBranch %15 - %18 = OpLabel - OpBranch %19 - %19 = OpLabel + %call8 = OpCompositeExtract %uint %48 0 + %50 = OpLoad %uint %j Aligned 4 + %add9 = OpIAdd %uint %50 %call8 + OpStore %j %add9 Aligned 4 + OpBranch %for_cond1 + %for_end = OpLabel + OpBranch %for_inc10 + %for_inc10 = OpLabel %52 = OpLoad %v3uint %__spirv_BuiltInWorkgroupSize Aligned 16 - %53 = OpCompositeExtract %uint %52 0 - %54 = OpLoad %uint %24 Aligned 4 - %55 = OpIAdd %uint %54 %53 - OpStore %24 %55 Aligned 4 - OpBranch %13 - %20 = OpLabel + %call11 = OpCompositeExtract %uint %52 0 + %54 = OpLoad %uint %i Aligned 4 + %add12 = OpIAdd %uint %54 %call11 + OpStore %i %add12 Aligned 4 + OpBranch %for_cond + %for_end13 = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/report_global_id/test1.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/report_global_id/test1.spvasm index f62c187f30..c41ccd1fb1 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/report_global_id/test1.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/report_global_id/test1.spvasm @@ -12,11 +12,41 @@ OpEntryPoint Kernel %9 "foo" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %p "p" + OpName %x "x" + OpName %entry "entry" + OpName %land_lhs_true "land.lhs.true" + OpName %land_lhs_true3 "land.lhs.true3" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %land_lhs_true10 "land.lhs.true10" + OpName %land_lhs_true13 "land.lhs.true13" + OpName %if_then16 "if.then16" + OpName %if_end19 "if.end19" + OpName %p_addr "p.addr" + OpName %x_addr "x.addr" + OpName %call "call" + OpName %cmp "cmp" + OpName %call1 "call1" + OpName %cmp2 "cmp2" + OpName %call4 "call4" + OpName %cmp5 "cmp5" + OpName %call6 "call6" + OpName %call7 "call7" + OpName %arrayidx "arrayidx" + OpName %call8 "call8" + OpName %cmp9 "cmp9" + OpName %call11 "call11" + OpName %cmp12 "cmp12" + OpName %call14 "call14" + OpName %cmp15 "cmp15" + OpName %call17 "call17" + OpName %arrayidx18 "arrayidx18" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %22 Alignment 4 - OpDecorate %24 Alignment 4 + OpDecorate %p_addr Alignment 4 + OpDecorate %x_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_1 = OpConstant %uint 1 @@ -34,59 +64,59 @@ %bool = OpTypeBool %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %uint - %12 = OpLabel - %22 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %24 = OpVariable %_ptr_Function_uint Function - OpStore %22 %10 Aligned 4 - OpStore %24 %11 Aligned 4 + %p = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %x = OpFunctionParameter %uint + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %x_addr = OpVariable %_ptr_Function_uint Function + OpStore %p_addr %p Aligned 4 + OpStore %x_addr %x Aligned 4 %25 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %26 = OpCompositeExtract %uint %25 0 - %29 = OpIEqual %bool %26 %uint_0 - OpBranchConditional %29 %13 %16 - %13 = OpLabel + %call = OpCompositeExtract %uint %25 0 + %cmp = OpIEqual %bool %call %uint_0 + OpBranchConditional %cmp %land_lhs_true %if_end +%land_lhs_true = OpLabel %30 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %31 = OpCompositeExtract %uint %30 1 - %33 = OpIEqual %bool %31 %uint_1 - OpBranchConditional %33 %14 %16 - %14 = OpLabel + %call1 = OpCompositeExtract %uint %30 1 + %cmp2 = OpIEqual %bool %call1 %uint_1 + OpBranchConditional %cmp2 %land_lhs_true3 %if_end +%land_lhs_true3 = OpLabel %34 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %35 = OpCompositeExtract %uint %34 2 - %37 = OpIEqual %bool %35 %uint_2 - OpBranchConditional %37 %15 %16 - %15 = OpLabel + %call4 = OpCompositeExtract %uint %34 2 + %cmp5 = OpIEqual %bool %call4 %uint_2 + OpBranchConditional %cmp5 %if_then %if_end + %if_then = OpLabel %38 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %39 = OpCompositeExtract %uint %38 1 - %40 = OpLoad %_ptr_CrossWorkgroup_uint %22 Aligned 4 + %call6 = OpCompositeExtract %uint %38 1 + %40 = OpLoad %_ptr_CrossWorkgroup_uint %p_addr Aligned 4 %41 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %42 = OpCompositeExtract %uint %41 0 - %43 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %40 %42 - OpStore %43 %39 Aligned 4 - OpBranch %16 - %16 = OpLabel + %call7 = OpCompositeExtract %uint %41 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %40 %call7 + OpStore %arrayidx %call6 Aligned 4 + OpBranch %if_end + %if_end = OpLabel %44 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %45 = OpCompositeExtract %uint %44 0 - %47 = OpIEqual %bool %45 %uint_8 - OpBranchConditional %47 %17 %20 - %17 = OpLabel + %call8 = OpCompositeExtract %uint %44 0 + %cmp9 = OpIEqual %bool %call8 %uint_8 + OpBranchConditional %cmp9 %land_lhs_true10 %if_end19 +%land_lhs_true10 = OpLabel %48 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %49 = OpCompositeExtract %uint %48 1 - %51 = OpIEqual %bool %49 %uint_13 - OpBranchConditional %51 %18 %20 - %18 = OpLabel + %call11 = OpCompositeExtract %uint %48 1 + %cmp12 = OpIEqual %bool %call11 %uint_13 + OpBranchConditional %cmp12 %land_lhs_true13 %if_end19 +%land_lhs_true13 = OpLabel %52 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %53 = OpCompositeExtract %uint %52 2 - %55 = OpIEqual %bool %53 %uint_21 - OpBranchConditional %55 %19 %20 - %19 = OpLabel + %call14 = OpCompositeExtract %uint %52 2 + %cmp15 = OpIEqual %bool %call14 %uint_21 + OpBranchConditional %cmp15 %if_then16 %if_end19 + %if_then16 = OpLabel %56 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %57 = OpCompositeExtract %uint %56 1 - %58 = OpLoad %_ptr_CrossWorkgroup_uint %22 Aligned 4 - %59 = OpLoad %uint %24 Aligned 4 - %60 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %58 %59 - OpStore %60 %57 Aligned 4 - OpBranch %20 - %20 = OpLabel + %call17 = OpCompositeExtract %uint %56 1 + %58 = OpLoad %_ptr_CrossWorkgroup_uint %p_addr Aligned 4 + %59 = OpLoad %uint %x_addr Aligned 4 + %arrayidx18 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %58 %59 + OpStore %arrayidx18 %call17 Aligned 4 + OpBranch %if_end19 + %if_end19 = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/report_global_id/test2.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/report_global_id/test2.spvasm index 9a8b35ae1f..fbf059a89c 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/report_global_id/test2.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/report_global_id/test2.spvasm @@ -12,11 +12,28 @@ OpEntryPoint Kernel %9 "foo" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %p "p" + OpName %x "x" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %if_then5 "if.then5" + OpName %if_end7 "if.end7" + OpName %p_addr "p.addr" + OpName %x_addr "x.addr" + OpName %call "call" + OpName %cmp "cmp" + OpName %call1 "call1" + OpName %call2 "call2" + OpName %arrayidx "arrayidx" + OpName %call3 "call3" + OpName %cmp4 "cmp4" + OpName %arrayidx6 "arrayidx6" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %18 Alignment 4 - OpDecorate %20 Alignment 4 + OpDecorate %p_addr Alignment 4 + OpDecorate %x_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_7 = OpConstant %uint 7 @@ -31,37 +48,37 @@ %bool = OpTypeBool %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %uint - %12 = OpLabel - %18 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %20 = OpVariable %_ptr_Function_uint Function - OpStore %18 %10 Aligned 4 - OpStore %20 %11 Aligned 4 + %p = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %x = OpFunctionParameter %uint + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %x_addr = OpVariable %_ptr_Function_uint Function + OpStore %p_addr %p Aligned 4 + OpStore %x_addr %x Aligned 4 %21 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %22 = OpCompositeExtract %uint %21 0 - %25 = OpIEqual %bool %22 %uint_0 - OpBranchConditional %25 %13 %14 - %13 = OpLabel + %call = OpCompositeExtract %uint %21 0 + %cmp = OpIEqual %bool %call %uint_0 + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel %26 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %27 = OpCompositeExtract %uint %26 1 - %28 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 + %call1 = OpCompositeExtract %uint %26 1 + %28 = OpLoad %_ptr_CrossWorkgroup_uint %p_addr Aligned 4 %29 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %30 = OpCompositeExtract %uint %29 0 - %31 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %28 %30 - OpStore %31 %27 Aligned 4 - OpBranch %14 - %14 = OpLabel + %call2 = OpCompositeExtract %uint %29 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %28 %call2 + OpStore %arrayidx %call1 Aligned 4 + OpBranch %if_end + %if_end = OpLabel %32 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %33 = OpCompositeExtract %uint %32 0 - %35 = OpIEqual %bool %33 %uint_7 - OpBranchConditional %35 %15 %16 - %15 = OpLabel - %36 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %37 = OpLoad %uint %20 Aligned 4 - %38 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %37 - OpStore %38 %uint_45 Aligned 4 - OpBranch %16 - %16 = OpLabel + %call3 = OpCompositeExtract %uint %32 0 + %cmp4 = OpIEqual %bool %call3 %uint_7 + OpBranchConditional %cmp4 %if_then5 %if_end7 + %if_then5 = OpLabel + %36 = OpLoad %_ptr_CrossWorkgroup_uint %p_addr Aligned 4 + %37 = OpLoad %uint %x_addr Aligned 4 + %arrayidx6 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %36 %37 + OpStore %arrayidx6 %uint_45 Aligned 4 + OpBranch %if_end7 + %if_end7 = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/return_tests/id_dependent_return.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/return_tests/id_dependent_return.spvasm index 94af798e8e..66a931acf5 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/return_tests/id_dependent_return.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/return_tests/id_dependent_return.spvasm @@ -12,10 +12,17 @@ OpEntryPoint Kernel %8 "foo" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %x "x" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %x_addr "x.addr" + OpName %call "call" + OpName %cmp "cmp" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %14 Alignment 4 + OpDecorate %x_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_25 = OpConstant %uint 25 %v3uint = OpTypeVector %uint 3 @@ -26,16 +33,16 @@ %bool = OpTypeBool %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %8 = OpFunction %void DontInline %7 - %9 = OpFunctionParameter %uint - %10 = OpLabel - %14 = OpVariable %_ptr_Function_uint Function - OpStore %14 %9 Aligned 4 + %x = OpFunctionParameter %uint + %entry = OpLabel + %x_addr = OpVariable %_ptr_Function_uint Function + OpStore %x_addr %x Aligned 4 %15 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %16 = OpCompositeExtract %uint %15 0 - %19 = OpULessThan %bool %16 %uint_25 - OpBranchConditional %19 %11 %12 - %11 = OpLabel - OpBranch %12 - %12 = OpLabel + %call = OpCompositeExtract %uint %15 0 + %cmp = OpULessThan %bool %call %uint_25 + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel + OpBranch %if_end + %if_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/return_tests/multiloop_return.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/return_tests/multiloop_return.spvasm index 8476a0de5a..cacd4a4657 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/return_tests/multiloop_return.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/return_tests/multiloop_return.spvasm @@ -13,19 +13,71 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" OpName %bar "bar" + OpName %y "y" + OpName %entry "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %for_cond1 "for.cond1" + OpName %for_body3 "for.body3" + OpName %for_cond5 "for.cond5" + OpName %for_body7 "for.body7" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %for_inc10 "for.inc10" + OpName %for_end12 "for.end12" + OpName %for_inc13 "for.inc13" + OpName %for_end15 "for.end15" + OpName %for_cond16 "for.cond16" + OpName %for_body18 "for.body18" + OpName %for_inc20 "for.inc20" + OpName %for_end22 "for.end22" + OpName %return "return" + OpName %retval "retval" + OpName %y_addr "y.addr" + OpName %result "result" + OpName %j "j" + OpName %k "k" + OpName %w "w" + OpName %q "q" + OpName %cmp "cmp" + OpName %add "add" + OpName %inc "inc" + OpName %cmp2 "cmp2" + OpName %add4 "add4" + OpName %call "call" + OpName %cmp6 "cmp6" + OpName %add8 "add8" + OpName %cmp9 "cmp9" + OpName %inc11 "inc11" + OpName %inc14 "inc14" + OpName %cmp17 "cmp17" + OpName %add19 "add19" + OpName %inc21 "inc21" + OpName %entry_0 "entry" + OpName %for_cond_0 "for.cond" + OpName %for_body_0 "for.body" + OpName %for_inc_0 "for.inc" + OpName %for_end_0 "for.end" + OpName %x "x" + OpName %i "i" + OpName %cmp_0 "cmp" + OpName %call_0 "call" + OpName %inc_0 "inc" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %bar LinkageAttributes "bar" Export OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %30 Alignment 4 - OpDecorate %31 Alignment 4 - OpDecorate %32 Alignment 4 - OpDecorate %33 Alignment 4 - OpDecorate %34 Alignment 4 - OpDecorate %35 Alignment 4 - OpDecorate %36 Alignment 4 - OpDecorate %84 Alignment 4 - OpDecorate %85 Alignment 4 + OpDecorate %retval Alignment 4 + OpDecorate %y_addr Alignment 4 + OpDecorate %result Alignment 4 + OpDecorate %j Alignment 4 + OpDecorate %k Alignment 4 + OpDecorate %w Alignment 4 + OpDecorate %q Alignment 4 + OpDecorate %x Alignment 4 + OpDecorate %i Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_100 = OpConstant %uint 100 @@ -41,125 +93,125 @@ %77 = OpTypeFunction %void %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %bar = OpFunction %uint DontInline %6 - %8 = OpFunctionParameter %uint - %9 = OpLabel - %30 = OpVariable %_ptr_Function_uint Function - %31 = OpVariable %_ptr_Function_uint Function - %32 = OpVariable %_ptr_Function_uint Function - %33 = OpVariable %_ptr_Function_uint Function - %34 = OpVariable %_ptr_Function_uint Function - %35 = OpVariable %_ptr_Function_uint Function - %36 = OpVariable %_ptr_Function_uint Function - OpStore %31 %8 Aligned 4 - OpStore %32 %uint_0 Aligned 4 - OpStore %33 %uint_0 Aligned 4 - OpBranch %10 - %10 = OpLabel - %38 = OpLoad %uint %33 Aligned 4 - %41 = OpSLessThan %bool %38 %uint_100 - OpBranchConditional %41 %11 %13 - %11 = OpLabel - %42 = OpLoad %uint %33 Aligned 4 - %43 = OpLoad %uint %32 Aligned 4 - %44 = OpIAdd %uint %43 %42 - OpStore %32 %44 Aligned 4 - OpBranch %12 - %12 = OpLabel - %45 = OpLoad %uint %33 Aligned 4 - %47 = OpIAdd %uint %45 %uint_1 - OpStore %33 %47 Aligned 4 - OpBranch %10 - %13 = OpLabel - OpStore %34 %uint_0 Aligned 4 - OpBranch %14 - %14 = OpLabel - %48 = OpLoad %uint %34 Aligned 4 - %49 = OpSLessThan %bool %48 %uint_100 - OpBranchConditional %49 %15 %23 - %15 = OpLabel - %50 = OpLoad %uint %34 Aligned 4 - %51 = OpLoad %uint %32 Aligned 4 - %52 = OpIAdd %uint %51 %50 - OpStore %32 %52 Aligned 4 - OpStore %35 %uint_0 Aligned 4 - OpBranch %16 - %16 = OpLabel - %53 = OpLoad %uint %35 Aligned 4 + %y = OpFunctionParameter %uint + %entry = OpLabel + %retval = OpVariable %_ptr_Function_uint Function + %y_addr = OpVariable %_ptr_Function_uint Function + %result = OpVariable %_ptr_Function_uint Function + %j = OpVariable %_ptr_Function_uint Function + %k = OpVariable %_ptr_Function_uint Function + %w = OpVariable %_ptr_Function_uint Function + %q = OpVariable %_ptr_Function_uint Function + OpStore %y_addr %y Aligned 4 + OpStore %result %uint_0 Aligned 4 + OpStore %j %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %38 = OpLoad %uint %j Aligned 4 + %cmp = OpSLessThan %bool %38 %uint_100 + OpBranchConditional %cmp %for_body %for_end + %for_body = OpLabel + %42 = OpLoad %uint %j Aligned 4 + %43 = OpLoad %uint %result Aligned 4 + %add = OpIAdd %uint %43 %42 + OpStore %result %add Aligned 4 + OpBranch %for_inc + %for_inc = OpLabel + %45 = OpLoad %uint %j Aligned 4 + %inc = OpIAdd %uint %45 %uint_1 + OpStore %j %inc Aligned 4 + OpBranch %for_cond + %for_end = OpLabel + OpStore %k %uint_0 Aligned 4 + OpBranch %for_cond1 + %for_cond1 = OpLabel + %48 = OpLoad %uint %k Aligned 4 + %cmp2 = OpSLessThan %bool %48 %uint_100 + OpBranchConditional %cmp2 %for_body3 %for_end15 + %for_body3 = OpLabel + %50 = OpLoad %uint %k Aligned 4 + %51 = OpLoad %uint %result Aligned 4 + %add4 = OpIAdd %uint %51 %50 + OpStore %result %add4 Aligned 4 + OpStore %w %uint_0 Aligned 4 + OpBranch %for_cond5 + %for_cond5 = OpLabel + %53 = OpLoad %uint %w Aligned 4 %54 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %55 = OpCompositeExtract %uint %54 0 - %56 = OpULessThan %bool %53 %55 - OpBranchConditional %56 %17 %21 - %17 = OpLabel - %57 = OpLoad %uint %35 Aligned 4 - %58 = OpLoad %uint %32 Aligned 4 - %59 = OpIAdd %uint %58 %57 - OpStore %32 %59 Aligned 4 - %60 = OpLoad %uint %32 Aligned 4 - %62 = OpSGreaterThan %bool %60 %uint_1000 - OpBranchConditional %62 %18 %19 - %18 = OpLabel - OpStore %30 %uint_0 Aligned 4 - OpBranch %28 - %19 = OpLabel - OpBranch %20 - %20 = OpLabel - %63 = OpLoad %uint %35 Aligned 4 - %64 = OpIAdd %uint %63 %uint_1 - OpStore %35 %64 Aligned 4 - OpBranch %16 - %21 = OpLabel - OpBranch %22 - %22 = OpLabel - %65 = OpLoad %uint %34 Aligned 4 - %66 = OpIAdd %uint %65 %uint_1 - OpStore %34 %66 Aligned 4 - OpBranch %14 - %23 = OpLabel - OpStore %36 %uint_0 Aligned 4 - OpBranch %24 - %24 = OpLabel - %67 = OpLoad %uint %36 Aligned 4 - %68 = OpSLessThan %bool %67 %uint_100 - OpBranchConditional %68 %25 %27 - %25 = OpLabel - %69 = OpLoad %uint %36 Aligned 4 - %70 = OpLoad %uint %32 Aligned 4 - %71 = OpIAdd %uint %70 %69 - OpStore %32 %71 Aligned 4 - OpBranch %26 - %26 = OpLabel - %72 = OpLoad %uint %36 Aligned 4 - %73 = OpIAdd %uint %72 %uint_1 - OpStore %36 %73 Aligned 4 - OpBranch %24 - %27 = OpLabel - %74 = OpLoad %uint %32 Aligned 4 - OpStore %30 %74 Aligned 4 - OpBranch %28 - %28 = OpLabel - %75 = OpLoad %uint %30 Aligned 4 + %call = OpCompositeExtract %uint %54 0 + %cmp6 = OpULessThan %bool %53 %call + OpBranchConditional %cmp6 %for_body7 %for_end12 + %for_body7 = OpLabel + %57 = OpLoad %uint %w Aligned 4 + %58 = OpLoad %uint %result Aligned 4 + %add8 = OpIAdd %uint %58 %57 + OpStore %result %add8 Aligned 4 + %60 = OpLoad %uint %result Aligned 4 + %cmp9 = OpSGreaterThan %bool %60 %uint_1000 + OpBranchConditional %cmp9 %if_then %if_end + %if_then = OpLabel + OpStore %retval %uint_0 Aligned 4 + OpBranch %return + %if_end = OpLabel + OpBranch %for_inc10 + %for_inc10 = OpLabel + %63 = OpLoad %uint %w Aligned 4 + %inc11 = OpIAdd %uint %63 %uint_1 + OpStore %w %inc11 Aligned 4 + OpBranch %for_cond5 + %for_end12 = OpLabel + OpBranch %for_inc13 + %for_inc13 = OpLabel + %65 = OpLoad %uint %k Aligned 4 + %inc14 = OpIAdd %uint %65 %uint_1 + OpStore %k %inc14 Aligned 4 + OpBranch %for_cond1 + %for_end15 = OpLabel + OpStore %q %uint_0 Aligned 4 + OpBranch %for_cond16 + %for_cond16 = OpLabel + %67 = OpLoad %uint %q Aligned 4 + %cmp17 = OpSLessThan %bool %67 %uint_100 + OpBranchConditional %cmp17 %for_body18 %for_end22 + %for_body18 = OpLabel + %69 = OpLoad %uint %q Aligned 4 + %70 = OpLoad %uint %result Aligned 4 + %add19 = OpIAdd %uint %70 %69 + OpStore %result %add19 Aligned 4 + OpBranch %for_inc20 + %for_inc20 = OpLabel + %72 = OpLoad %uint %q Aligned 4 + %inc21 = OpIAdd %uint %72 %uint_1 + OpStore %q %inc21 Aligned 4 + OpBranch %for_cond16 + %for_end22 = OpLabel + %74 = OpLoad %uint %result Aligned 4 + OpStore %retval %74 Aligned 4 + OpBranch %return + %return = OpLabel + %75 = OpLoad %uint %retval Aligned 4 OpReturnValue %75 OpFunctionEnd %78 = OpFunction %void DontInline %77 - %79 = OpLabel - %84 = OpVariable %_ptr_Function_uint Function - %85 = OpVariable %_ptr_Function_uint Function - OpStore %85 %uint_0 Aligned 4 - OpBranch %80 - %80 = OpLabel - %86 = OpLoad %uint %85 Aligned 4 - %88 = OpSLessThan %bool %86 %uint_200 - OpBranchConditional %88 %81 %83 - %81 = OpLabel - %89 = OpLoad %uint %85 Aligned 4 - %90 = OpFunctionCall %uint %bar %89 - OpStore %84 %90 Aligned 4 - OpBranch %82 - %82 = OpLabel - %91 = OpLoad %uint %85 Aligned 4 - %92 = OpIAdd %uint %91 %uint_1 - OpStore %85 %92 Aligned 4 - OpBranch %80 - %83 = OpLabel + %entry_0 = OpLabel + %x = OpVariable %_ptr_Function_uint Function + %i = OpVariable %_ptr_Function_uint Function + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond_0 + %for_cond_0 = OpLabel + %86 = OpLoad %uint %i Aligned 4 + %cmp_0 = OpSLessThan %bool %86 %uint_200 + OpBranchConditional %cmp_0 %for_body_0 %for_end_0 + %for_body_0 = OpLabel + %89 = OpLoad %uint %i Aligned 4 + %call_0 = OpFunctionCall %uint %bar %89 + OpStore %x %call_0 Aligned 4 + OpBranch %for_inc_0 + %for_inc_0 = OpLabel + %91 = OpLoad %uint %i Aligned 4 + %inc_0 = OpIAdd %uint %91 %uint_1 + OpStore %i %inc_0 Aligned 4 + OpBranch %for_cond_0 + %for_end_0 = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/return_tests/multiloop_return_simplified.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/return_tests/multiloop_return_simplified.spvasm index 9021f58d65..4ea4c3bd8f 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/return_tests/multiloop_return_simplified.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/return_tests/multiloop_return_simplified.spvasm @@ -10,10 +10,33 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %5 "bar" OpSource OpenCL_C 200000 - OpDecorate %19 Alignment 4 - OpDecorate %20 Alignment 4 - OpDecorate %21 Alignment 4 - OpDecorate %22 Alignment 4 + OpName %y "y" + OpName %entry "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %for_cond3 "for.cond3" + OpName %for_body5 "for.body5" + OpName %for_inc7 "for.inc7" + OpName %for_end9 "for.end9" + OpName %y_addr "y.addr" + OpName %result "result" + OpName %j "j" + OpName %j2 "j2" + OpName %cmp "cmp" + OpName %cmp1 "cmp1" + OpName %add "add" + OpName %inc "inc" + OpName %cmp4 "cmp4" + OpName %add6 "add6" + OpName %inc8 "inc8" + OpDecorate %y_addr Alignment 4 + OpDecorate %result Alignment 4 + OpDecorate %j Alignment 4 + OpDecorate %j2 Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_100 = OpConstant %uint 100 @@ -24,55 +47,55 @@ %_ptr_Function_uint = OpTypePointer Function %uint %bool = OpTypeBool %5 = OpFunction %void DontInline %4 - %6 = OpFunctionParameter %uint - %7 = OpLabel - %19 = OpVariable %_ptr_Function_uint Function - %20 = OpVariable %_ptr_Function_uint Function - %21 = OpVariable %_ptr_Function_uint Function - %22 = OpVariable %_ptr_Function_uint Function - OpStore %19 %6 Aligned 4 - OpStore %20 %uint_0 Aligned 4 - OpStore %21 %uint_0 Aligned 4 - OpBranch %8 - %8 = OpLabel - %24 = OpLoad %uint %21 Aligned 4 - %27 = OpSLessThan %bool %24 %uint_100 - OpBranchConditional %27 %9 %13 - %9 = OpLabel - %28 = OpLoad %uint %20 Aligned 4 - %30 = OpSGreaterThan %bool %28 %uint_1000 - OpBranchConditional %30 %10 %11 - %10 = OpLabel - OpBranch %17 - %11 = OpLabel - %31 = OpLoad %uint %21 Aligned 4 - %32 = OpLoad %uint %20 Aligned 4 - %33 = OpIAdd %uint %32 %31 - OpStore %20 %33 Aligned 4 - OpBranch %12 - %12 = OpLabel - %34 = OpLoad %uint %21 Aligned 4 - %36 = OpIAdd %uint %34 %uint_1 - OpStore %21 %36 Aligned 4 - OpBranch %8 - %13 = OpLabel - OpStore %22 %uint_0 Aligned 4 - OpBranch %14 - %14 = OpLabel - %37 = OpLoad %uint %22 Aligned 4 - %38 = OpSLessThan %bool %37 %uint_100 - OpBranchConditional %38 %15 %17 - %15 = OpLabel - %39 = OpLoad %uint %22 Aligned 4 - %40 = OpLoad %uint %20 Aligned 4 - %41 = OpIAdd %uint %40 %39 - OpStore %20 %41 Aligned 4 - OpBranch %16 - %16 = OpLabel - %42 = OpLoad %uint %22 Aligned 4 - %43 = OpIAdd %uint %42 %uint_1 - OpStore %22 %43 Aligned 4 - OpBranch %14 - %17 = OpLabel + %y = OpFunctionParameter %uint + %entry = OpLabel + %y_addr = OpVariable %_ptr_Function_uint Function + %result = OpVariable %_ptr_Function_uint Function + %j = OpVariable %_ptr_Function_uint Function + %j2 = OpVariable %_ptr_Function_uint Function + OpStore %y_addr %y Aligned 4 + OpStore %result %uint_0 Aligned 4 + OpStore %j %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %24 = OpLoad %uint %j Aligned 4 + %cmp = OpSLessThan %bool %24 %uint_100 + OpBranchConditional %cmp %for_body %for_end + %for_body = OpLabel + %28 = OpLoad %uint %result Aligned 4 + %cmp1 = OpSGreaterThan %bool %28 %uint_1000 + OpBranchConditional %cmp1 %if_then %if_end + %if_then = OpLabel + OpBranch %for_end9 + %if_end = OpLabel + %31 = OpLoad %uint %j Aligned 4 + %32 = OpLoad %uint %result Aligned 4 + %add = OpIAdd %uint %32 %31 + OpStore %result %add Aligned 4 + OpBranch %for_inc + %for_inc = OpLabel + %34 = OpLoad %uint %j Aligned 4 + %inc = OpIAdd %uint %34 %uint_1 + OpStore %j %inc Aligned 4 + OpBranch %for_cond + %for_end = OpLabel + OpStore %j2 %uint_0 Aligned 4 + OpBranch %for_cond3 + %for_cond3 = OpLabel + %37 = OpLoad %uint %j2 Aligned 4 + %cmp4 = OpSLessThan %bool %37 %uint_100 + OpBranchConditional %cmp4 %for_body5 %for_end9 + %for_body5 = OpLabel + %39 = OpLoad %uint %j2 Aligned 4 + %40 = OpLoad %uint %result Aligned 4 + %add6 = OpIAdd %uint %40 %39 + OpStore %result %add6 Aligned 4 + OpBranch %for_inc7 + %for_inc7 = OpLabel + %42 = OpLoad %uint %j2 Aligned 4 + %inc8 = OpIAdd %uint %42 %uint_1 + OpStore %j2 %inc8 Aligned 4 + OpBranch %for_cond3 + %for_end9 = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/return_tests/simple_return.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/return_tests/simple_return.spvasm index 5bc925c2c6..bfdcea3559 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/return_tests/simple_return.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/return_tests/simple_return.spvasm @@ -12,10 +12,23 @@ OpEntryPoint Kernel %8 "foo" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %x "x" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %while_cond "while.cond" + OpName %while_body "while.body" + OpName %while_end "while.end" + OpName %if_end "if.end" + OpName %return "return" + OpName %x_addr "x.addr" + OpName %call "call" + OpName %cmp "cmp" + OpName %add "add" + OpName %cmp1 "cmp1" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %18 Alignment 4 + OpDecorate %x_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_25 = OpConstant %uint 25 %uint_100 = OpConstant %uint 100 @@ -28,27 +41,27 @@ %bool = OpTypeBool %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %8 = OpFunction %void DontInline %7 - %9 = OpFunctionParameter %uint - %10 = OpLabel - %18 = OpVariable %_ptr_Function_uint Function - OpStore %18 %9 Aligned 4 + %x = OpFunctionParameter %uint + %entry = OpLabel + %x_addr = OpVariable %_ptr_Function_uint Function + OpStore %x_addr %x Aligned 4 %19 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %20 = OpCompositeExtract %uint %19 0 - %23 = OpULessThan %bool %20 %uint_25 - OpBranchConditional %23 %11 %15 - %11 = OpLabel - OpBranch %12 - %12 = OpLabel - %24 = OpLoad %uint %18 Aligned 4 - %26 = OpIAdd %uint %24 %uint_100 - %28 = OpSLessThan %bool %26 %uint_102 - OpBranchConditional %28 %13 %14 - %13 = OpLabel - OpBranch %16 - %14 = OpLabel - OpBranch %15 - %15 = OpLabel - OpBranch %16 - %16 = OpLabel + %call = OpCompositeExtract %uint %19 0 + %cmp = OpULessThan %bool %call %uint_25 + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel + OpBranch %while_cond + %while_cond = OpLabel + %24 = OpLoad %uint %x_addr Aligned 4 + %add = OpIAdd %uint %24 %uint_100 + %cmp1 = OpSLessThan %bool %add %uint_102 + OpBranchConditional %cmp1 %while_body %while_end + %while_body = OpLabel + OpBranch %return + %while_end = OpLabel + OpBranch %if_end + %if_end = OpLabel + OpBranch %return + %return = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/rightshiftequals.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/rightshiftequals.spvasm index 7840656042..8b256802f9 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/rightshiftequals.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/rightshiftequals.spvasm @@ -10,8 +10,15 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %4 "foo" OpSource OpenCL_C 200000 - OpDecorate %8 Alignment 4 - OpDecorate %9 Alignment 4 + OpName %entry "entry" + OpName %x "x" + OpName %y "y" + OpName %shr_mask "shr.mask" + OpName %shr "shr" + OpName %shr_mask1 "shr.mask1" + OpName %shr2 "shr2" + OpDecorate %x Alignment 4 + OpDecorate %y Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_2 = OpConstant %uint 2 @@ -20,20 +27,20 @@ %3 = OpTypeFunction %void %_ptr_Function_uint = OpTypePointer Function %uint %4 = OpFunction %void DontInline %3 - %5 = OpLabel - %8 = OpVariable %_ptr_Function_uint Function - %9 = OpVariable %_ptr_Function_uint Function - OpStore %8 %uint_1 Aligned 4 - OpStore %9 %uint_2 Aligned 4 - %12 = OpLoad %uint %8 Aligned 4 - %13 = OpLoad %uint %8 Aligned 4 - %15 = OpBitwiseAnd %uint %12 %uint_31 - %16 = OpShiftRightLogical %uint %13 %15 - OpStore %8 %16 Aligned 4 - %17 = OpLoad %uint %8 Aligned 4 - %18 = OpLoad %uint %9 Aligned 4 - %19 = OpBitwiseAnd %uint %17 %uint_31 - %20 = OpShiftRightArithmetic %uint %18 %19 - OpStore %9 %20 Aligned 4 + %entry = OpLabel + %x = OpVariable %_ptr_Function_uint Function + %y = OpVariable %_ptr_Function_uint Function + OpStore %x %uint_1 Aligned 4 + OpStore %y %uint_2 Aligned 4 + %12 = OpLoad %uint %x Aligned 4 + %13 = OpLoad %uint %x Aligned 4 + %shr_mask = OpBitwiseAnd %uint %12 %uint_31 + %shr = OpShiftRightLogical %uint %13 %shr_mask + OpStore %x %shr Aligned 4 + %17 = OpLoad %uint %x Aligned 4 + %18 = OpLoad %uint %y Aligned 4 + %shr_mask1 = OpBitwiseAnd %uint %17 %uint_31 + %shr2 = OpShiftRightArithmetic %uint %18 %shr_mask1 + OpStore %y %shr2 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/saturate/sadd.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/saturate/sadd.spvasm index 1b25e034eb..4aab0cec65 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/saturate/sadd.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/saturate/sadd.spvasm @@ -12,11 +12,23 @@ OpEntryPoint Kernel %9 "test" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %A "A" + OpName %B "B" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpName %B_addr "B.addr" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" + OpName %arrayidx2 "arrayidx2" + OpName %call3 "call3" + OpName %call4 "call4" + OpName %arrayidx5 "arrayidx5" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %14 Alignment 4 - OpDecorate %15 Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %B_addr Alignment 4 %uint = OpTypeInt 32 0 %v3uint = OpTypeVector %uint 3 %_ptr_Input_v3uint = OpTypePointer Input %v3uint @@ -26,28 +38,28 @@ %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpLabel - %14 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %15 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %14 %10 Aligned 4 - OpStore %15 %11 Aligned 4 - %16 = OpLoad %_ptr_CrossWorkgroup_uint %14 Aligned 4 + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %B = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %B_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %A_addr %A Aligned 4 + OpStore %B_addr %B Aligned 4 + %16 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %17 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %18 = OpCompositeExtract %uint %17 0 - %19 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %16 %18 - %20 = OpLoad %uint %19 Aligned 4 - %21 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 + %call = OpCompositeExtract %uint %17 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %16 %call + %20 = OpLoad %uint %arrayidx Aligned 4 + %21 = OpLoad %_ptr_CrossWorkgroup_uint %B_addr Aligned 4 %22 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %23 = OpCompositeExtract %uint %22 0 - %24 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %21 %23 - %25 = OpLoad %uint %24 Aligned 4 - %26 = OpExtInst %uint %1 s_add_sat %20 %25 - %27 = OpLoad %_ptr_CrossWorkgroup_uint %14 Aligned 4 + %call1 = OpCompositeExtract %uint %22 0 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %21 %call1 + %25 = OpLoad %uint %arrayidx2 Aligned 4 + %call3 = OpExtInst %uint %1 s_add_sat %20 %25 + %27 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %28 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %29 = OpCompositeExtract %uint %28 0 - %30 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %27 %29 - OpStore %30 %26 Aligned 4 + %call4 = OpCompositeExtract %uint %28 0 + %arrayidx5 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %27 %call4 + OpStore %arrayidx5 %call3 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/saturate/ssub.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/saturate/ssub.spvasm index ca47e29454..250dbdb363 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/saturate/ssub.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/saturate/ssub.spvasm @@ -12,11 +12,23 @@ OpEntryPoint Kernel %9 "test" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %A "A" + OpName %B "B" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpName %B_addr "B.addr" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" + OpName %arrayidx2 "arrayidx2" + OpName %call3 "call3" + OpName %call4 "call4" + OpName %arrayidx5 "arrayidx5" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %14 Alignment 4 - OpDecorate %15 Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %B_addr Alignment 4 %uint = OpTypeInt 32 0 %v3uint = OpTypeVector %uint 3 %_ptr_Input_v3uint = OpTypePointer Input %v3uint @@ -26,28 +38,28 @@ %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpLabel - %14 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %15 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %14 %10 Aligned 4 - OpStore %15 %11 Aligned 4 - %16 = OpLoad %_ptr_CrossWorkgroup_uint %14 Aligned 4 + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %B = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %B_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %A_addr %A Aligned 4 + OpStore %B_addr %B Aligned 4 + %16 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %17 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %18 = OpCompositeExtract %uint %17 0 - %19 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %16 %18 - %20 = OpLoad %uint %19 Aligned 4 - %21 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 + %call = OpCompositeExtract %uint %17 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %16 %call + %20 = OpLoad %uint %arrayidx Aligned 4 + %21 = OpLoad %_ptr_CrossWorkgroup_uint %B_addr Aligned 4 %22 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %23 = OpCompositeExtract %uint %22 0 - %24 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %21 %23 - %25 = OpLoad %uint %24 Aligned 4 - %26 = OpExtInst %uint %1 s_sub_sat %20 %25 - %27 = OpLoad %_ptr_CrossWorkgroup_uint %14 Aligned 4 + %call1 = OpCompositeExtract %uint %22 0 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %21 %call1 + %25 = OpLoad %uint %arrayidx2 Aligned 4 + %call3 = OpExtInst %uint %1 s_sub_sat %20 %25 + %27 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %28 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %29 = OpCompositeExtract %uint %28 0 - %30 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %27 %29 - OpStore %30 %26 Aligned 4 + %call4 = OpCompositeExtract %uint %28 0 + %arrayidx5 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %27 %call4 + OpStore %arrayidx5 %call3 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/saturate/uadd.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/saturate/uadd.spvasm index 1f8e6a115e..afb5f015e1 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/saturate/uadd.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/saturate/uadd.spvasm @@ -12,11 +12,23 @@ OpEntryPoint Kernel %9 "test" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %A "A" + OpName %B "B" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpName %B_addr "B.addr" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" + OpName %arrayidx2 "arrayidx2" + OpName %call3 "call3" + OpName %call4 "call4" + OpName %arrayidx5 "arrayidx5" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %14 Alignment 4 - OpDecorate %15 Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %B_addr Alignment 4 %uint = OpTypeInt 32 0 %v3uint = OpTypeVector %uint 3 %_ptr_Input_v3uint = OpTypePointer Input %v3uint @@ -26,28 +38,28 @@ %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpLabel - %14 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %15 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %14 %10 Aligned 4 - OpStore %15 %11 Aligned 4 - %16 = OpLoad %_ptr_CrossWorkgroup_uint %14 Aligned 4 + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %B = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %B_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %A_addr %A Aligned 4 + OpStore %B_addr %B Aligned 4 + %16 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %17 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %18 = OpCompositeExtract %uint %17 0 - %19 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %16 %18 - %20 = OpLoad %uint %19 Aligned 4 - %21 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 + %call = OpCompositeExtract %uint %17 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %16 %call + %20 = OpLoad %uint %arrayidx Aligned 4 + %21 = OpLoad %_ptr_CrossWorkgroup_uint %B_addr Aligned 4 %22 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %23 = OpCompositeExtract %uint %22 0 - %24 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %21 %23 - %25 = OpLoad %uint %24 Aligned 4 - %26 = OpExtInst %uint %1 u_add_sat %20 %25 - %27 = OpLoad %_ptr_CrossWorkgroup_uint %14 Aligned 4 + %call1 = OpCompositeExtract %uint %22 0 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %21 %call1 + %25 = OpLoad %uint %arrayidx2 Aligned 4 + %call3 = OpExtInst %uint %1 u_add_sat %20 %25 + %27 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %28 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %29 = OpCompositeExtract %uint %28 0 - %30 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %27 %29 - OpStore %30 %26 Aligned 4 + %call4 = OpCompositeExtract %uint %28 0 + %arrayidx5 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %27 %call4 + OpStore %arrayidx5 %call3 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/saturate/usub.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/saturate/usub.spvasm index fd0699d13b..15fe5ae9a7 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/saturate/usub.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/saturate/usub.spvasm @@ -12,11 +12,23 @@ OpEntryPoint Kernel %9 "test" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %A "A" + OpName %B "B" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpName %B_addr "B.addr" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" + OpName %arrayidx2 "arrayidx2" + OpName %call3 "call3" + OpName %call4 "call4" + OpName %arrayidx5 "arrayidx5" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %14 Alignment 4 - OpDecorate %15 Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %B_addr Alignment 4 %uint = OpTypeInt 32 0 %v3uint = OpTypeVector %uint 3 %_ptr_Input_v3uint = OpTypePointer Input %v3uint @@ -26,28 +38,28 @@ %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpLabel - %14 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %15 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %14 %10 Aligned 4 - OpStore %15 %11 Aligned 4 - %16 = OpLoad %_ptr_CrossWorkgroup_uint %14 Aligned 4 + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %B = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %B_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %A_addr %A Aligned 4 + OpStore %B_addr %B Aligned 4 + %16 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %17 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %18 = OpCompositeExtract %uint %17 0 - %19 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %16 %18 - %20 = OpLoad %uint %19 Aligned 4 - %21 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 + %call = OpCompositeExtract %uint %17 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %16 %call + %20 = OpLoad %uint %arrayidx Aligned 4 + %21 = OpLoad %_ptr_CrossWorkgroup_uint %B_addr Aligned 4 %22 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %23 = OpCompositeExtract %uint %22 0 - %24 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %21 %23 - %25 = OpLoad %uint %24 Aligned 4 - %26 = OpExtInst %uint %1 u_sub_sat %20 %25 - %27 = OpLoad %_ptr_CrossWorkgroup_uint %14 Aligned 4 + %call1 = OpCompositeExtract %uint %22 0 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %21 %call1 + %25 = OpLoad %uint %arrayidx2 Aligned 4 + %call3 = OpExtInst %uint %1 u_sub_sat %20 %25 + %27 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 %28 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %29 = OpCompositeExtract %uint %28 0 - %30 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %27 %29 - OpStore %30 %26 Aligned 4 + %call4 = OpCompositeExtract %uint %28 0 + %arrayidx5 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %27 %call4 + OpStore %arrayidx5 %call3 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/shared_int.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/shared_int.spvasm index 7d1d526fa6..7e960a7086 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/shared_int.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/shared_int.spvasm @@ -13,6 +13,8 @@ OpSource OpenCL_C 200000 OpName %foo_a "foo.a" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %entry "entry" + OpName %call "call" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import @@ -26,9 +28,9 @@ %foo_a = OpVariable %_ptr_Workgroup_uint Workgroup %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %10 = OpFunction %void DontInline %9 - %11 = OpLabel + %entry = OpLabel %12 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %13 = OpCompositeExtract %uint %12 0 - OpStore %foo_a %13 Aligned 4 + %call = OpCompositeExtract %uint %12 0 + OpStore %foo_a %call Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/shuffle/shuffle.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/shuffle/shuffle.spvasm index b4e336c645..a09649d82e 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/shuffle/shuffle.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/shuffle/shuffle.spvasm @@ -12,11 +12,21 @@ OpEntryPoint Kernel %10 "test" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %A "A" + OpName %mask "mask" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpName %mask_addr "mask.addr" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" + OpName %call2 "call2" + OpName %arrayidx3 "arrayidx3" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %15 Alignment 4 - OpDecorate %17 Alignment 16 + OpDecorate %A_addr Alignment 4 + OpDecorate %mask_addr Alignment 16 %uint = OpTypeInt 32 0 %v3uint = OpTypeVector %uint 3 %_ptr_Input_v3uint = OpTypePointer Input %v3uint @@ -28,24 +38,24 @@ %_ptr_Function_v4uint = OpTypePointer Function %v4uint %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %10 = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_v4uint - %12 = OpFunctionParameter %v4uint - %13 = OpLabel - %15 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_v4uint Function - %17 = OpVariable %_ptr_Function_v4uint Function - OpStore %15 %11 Aligned 4 - OpStore %17 %12 Aligned 16 - %18 = OpLoad %_ptr_CrossWorkgroup_v4uint %15 Aligned 4 + %A = OpFunctionParameter %_ptr_CrossWorkgroup_v4uint + %mask = OpFunctionParameter %v4uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_v4uint Function + %mask_addr = OpVariable %_ptr_Function_v4uint Function + OpStore %A_addr %A Aligned 4 + OpStore %mask_addr %mask Aligned 16 + %18 = OpLoad %_ptr_CrossWorkgroup_v4uint %A_addr Aligned 4 %19 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %20 = OpCompositeExtract %uint %19 0 - %21 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_v4uint %18 %20 - %22 = OpLoad %v4uint %21 Aligned 16 - %23 = OpLoad %v4uint %17 Aligned 16 - %24 = OpExtInst %v4uint %1 shuffle %22 %23 - %25 = OpLoad %_ptr_CrossWorkgroup_v4uint %15 Aligned 4 + %call = OpCompositeExtract %uint %19 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_v4uint %18 %call + %22 = OpLoad %v4uint %arrayidx Aligned 16 + %23 = OpLoad %v4uint %mask_addr Aligned 16 + %call1 = OpExtInst %v4uint %1 shuffle %22 %23 + %25 = OpLoad %_ptr_CrossWorkgroup_v4uint %A_addr Aligned 4 %26 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %27 = OpCompositeExtract %uint %26 0 - %28 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_v4uint %25 %27 - OpStore %28 %24 Aligned 16 + %call2 = OpCompositeExtract %uint %26 0 + %arrayidx3 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_v4uint %25 %call2 + OpStore %arrayidx3 %call1 Aligned 16 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/shuffle/shuffle2.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/shuffle/shuffle2.spvasm index 7ebd6503d8..95e9d4cbba 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/shuffle/shuffle2.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/shuffle/shuffle2.spvasm @@ -13,13 +13,29 @@ OpEntryPoint Kernel %12 "test" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %A "A" + OpName %B "B" + OpName %C "C" + OpName %mask "mask" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpName %B_addr "B.addr" + OpName %C_addr "C.addr" + OpName %mask_addr "mask.addr" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" + OpName %arrayidx2 "arrayidx2" + OpName %call3 "call3" + OpName %call4 "call4" + OpName %arrayidx5 "arrayidx5" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %19 Alignment 4 - OpDecorate %20 Alignment 4 - OpDecorate %22 Alignment 4 - OpDecorate %24 Alignment 32 + OpDecorate %A_addr Alignment 4 + OpDecorate %B_addr Alignment 4 + OpDecorate %C_addr Alignment 4 + OpDecorate %mask_addr Alignment 32 %uint = OpTypeInt 32 0 %v3uint = OpTypeVector %uint 3 %_ptr_Input_v3uint = OpTypePointer Input %v3uint @@ -34,35 +50,35 @@ %_ptr_Function_v8uint = OpTypePointer Function %v8uint %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %12 = OpFunction %void DontInline %11 - %13 = OpFunctionParameter %_ptr_CrossWorkgroup_v4uint - %14 = OpFunctionParameter %_ptr_CrossWorkgroup_v4uint - %15 = OpFunctionParameter %_ptr_CrossWorkgroup_v8uint - %16 = OpFunctionParameter %v8uint - %17 = OpLabel - %19 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_v4uint Function - %20 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_v4uint Function - %22 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_v8uint Function - %24 = OpVariable %_ptr_Function_v8uint Function - OpStore %19 %13 Aligned 4 - OpStore %20 %14 Aligned 4 - OpStore %22 %15 Aligned 4 - OpStore %24 %16 Aligned 32 - %25 = OpLoad %_ptr_CrossWorkgroup_v4uint %19 Aligned 4 + %A = OpFunctionParameter %_ptr_CrossWorkgroup_v4uint + %B = OpFunctionParameter %_ptr_CrossWorkgroup_v4uint + %C = OpFunctionParameter %_ptr_CrossWorkgroup_v8uint + %mask = OpFunctionParameter %v8uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_v4uint Function + %B_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_v4uint Function + %C_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_v8uint Function + %mask_addr = OpVariable %_ptr_Function_v8uint Function + OpStore %A_addr %A Aligned 4 + OpStore %B_addr %B Aligned 4 + OpStore %C_addr %C Aligned 4 + OpStore %mask_addr %mask Aligned 32 + %25 = OpLoad %_ptr_CrossWorkgroup_v4uint %A_addr Aligned 4 %26 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %27 = OpCompositeExtract %uint %26 0 - %28 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_v4uint %25 %27 - %29 = OpLoad %v4uint %28 Aligned 16 - %30 = OpLoad %_ptr_CrossWorkgroup_v4uint %20 Aligned 4 + %call = OpCompositeExtract %uint %26 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_v4uint %25 %call + %29 = OpLoad %v4uint %arrayidx Aligned 16 + %30 = OpLoad %_ptr_CrossWorkgroup_v4uint %B_addr Aligned 4 %31 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %32 = OpCompositeExtract %uint %31 0 - %33 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_v4uint %30 %32 - %34 = OpLoad %v4uint %33 Aligned 16 - %35 = OpLoad %v8uint %24 Aligned 32 - %36 = OpExtInst %v8uint %1 shuffle2 %29 %34 %35 - %37 = OpLoad %_ptr_CrossWorkgroup_v8uint %22 Aligned 4 + %call1 = OpCompositeExtract %uint %31 0 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_v4uint %30 %call1 + %34 = OpLoad %v4uint %arrayidx2 Aligned 16 + %35 = OpLoad %v8uint %mask_addr Aligned 32 + %call3 = OpExtInst %v8uint %1 shuffle2 %29 %34 %35 + %37 = OpLoad %_ptr_CrossWorkgroup_v8uint %C_addr Aligned 4 %38 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %39 = OpCompositeExtract %uint %38 0 - %40 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_v8uint %37 %39 - OpStore %40 %36 Aligned 32 + %call4 = OpCompositeExtract %uint %38 0 + %arrayidx5 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_v8uint %37 %call4 + OpStore %arrayidx5 %call3 Aligned 32 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/simpleparampassing.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/simpleparampassing.spvasm index 175abb85d3..a62d95c2a9 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/simpleparampassing.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/simpleparampassing.spvasm @@ -12,8 +12,12 @@ OpEntryPoint Kernel %11 "foo" OpSource OpenCL_C 200000 OpName %f "f" + OpName %x "x" + OpName %entry "entry" + OpName %x_addr "x.addr" + OpName %entry_0 "entry" OpDecorate %f LinkageAttributes "f" Export - OpDecorate %9 Alignment 4 + OpDecorate %x_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %void = OpTypeVoid @@ -21,14 +25,14 @@ %_ptr_Function_uint = OpTypePointer Function %uint %10 = OpTypeFunction %void %f = OpFunction %void DontInline %4 - %6 = OpFunctionParameter %uint - %7 = OpLabel - %9 = OpVariable %_ptr_Function_uint Function - OpStore %9 %6 Aligned 4 + %x = OpFunctionParameter %uint + %entry = OpLabel + %x_addr = OpVariable %_ptr_Function_uint Function + OpStore %x_addr %x Aligned 4 OpReturn OpFunctionEnd %11 = OpFunction %void DontInline %10 - %12 = OpLabel + %entry_0 = OpLabel %14 = OpFunctionCall %void %f %uint_2 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/simpleprocedurecall.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/simpleprocedurecall.spvasm index 8f1f9d0685..d9f380481a 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/simpleprocedurecall.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/simpleprocedurecall.spvasm @@ -12,15 +12,17 @@ OpEntryPoint Kernel %6 "foo" OpSource OpenCL_C 200000 OpName %bar "bar" + OpName %entry "entry" + OpName %entry_0 "entry" OpDecorate %bar LinkageAttributes "bar" Export %void = OpTypeVoid %3 = OpTypeFunction %void %bar = OpFunction %void DontInline %3 - %5 = OpLabel + %entry = OpLabel OpReturn OpFunctionEnd %6 = OpFunction %void DontInline %3 - %7 = OpLabel + %entry_0 = OpLabel %8 = OpFunctionCall %void %bar OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/simplereturn.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/simplereturn.spvasm index 60baba531b..68d5d63712 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/simplereturn.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/simplereturn.spvasm @@ -12,9 +12,16 @@ OpEntryPoint Kernel %14 "foo" OpSource OpenCL_C 200000 OpName %f "f" + OpName %x "x" + OpName %entry "entry" + OpName %x_addr "x.addr" + OpName %add "add" + OpName %entry_0 "entry" + OpName %y "y" + OpName %call "call" OpDecorate %f LinkageAttributes "f" Export - OpDecorate %8 Alignment 4 - OpDecorate %16 Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %y Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_2 = OpConstant %uint 2 @@ -23,18 +30,18 @@ %void = OpTypeVoid %13 = OpTypeFunction %void %f = OpFunction %uint DontInline %3 - %5 = OpFunctionParameter %uint - %6 = OpLabel - %8 = OpVariable %_ptr_Function_uint Function - OpStore %8 %5 Aligned 4 - %9 = OpLoad %uint %8 Aligned 4 - %11 = OpIAdd %uint %9 %uint_1 - OpReturnValue %11 + %x = OpFunctionParameter %uint + %entry = OpLabel + %x_addr = OpVariable %_ptr_Function_uint Function + OpStore %x_addr %x Aligned 4 + %9 = OpLoad %uint %x_addr Aligned 4 + %add = OpIAdd %uint %9 %uint_1 + OpReturnValue %add OpFunctionEnd %14 = OpFunction %void DontInline %13 - %15 = OpLabel - %16 = OpVariable %_ptr_Function_uint Function - %18 = OpFunctionCall %uint %f %uint_2 - OpStore %16 %18 Aligned 4 + %entry_0 = OpLabel + %y = OpVariable %_ptr_Function_uint Function + %call = OpFunctionCall %uint %f %uint_2 + OpStore %y %call Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/skeletonbinomialoptions.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/skeletonbinomialoptions.spvasm index 86ffc6de09..19b1b16ac9 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/skeletonbinomialoptions.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/skeletonbinomialoptions.spvasm @@ -10,11 +10,37 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %4 "binomial_options_kernel" OpSource OpenCL_C 200000 - OpDecorate %20 Alignment 4 - OpDecorate %21 Alignment 4 - OpDecorate %22 Alignment 4 - OpDecorate %23 Alignment 4 - OpDecorate %24 Alignment 4 + OpName %entry "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_cond1 "for.cond1" + OpName %for_body3 "for.body3" + OpName %for_cond5 "for.cond5" + OpName %for_body7 "for.body7" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %for_inc8 "for.inc8" + OpName %for_end9 "for.end9" + OpName %for_inc10 "for.inc10" + OpName %for_end12 "for.end12" + OpName %i "i" + OpName %c_base "c_base" + OpName %c_start "c_start" + OpName %c_end "c_end" + OpName %k "k" + OpName %cmp "cmp" + OpName %cmp2 "cmp2" + OpName %sub "sub" + OpName %sub4 "sub4" + OpName %cmp6 "cmp6" + OpName %dec "dec" + OpName %add "add" + OpName %sub11 "sub11" + OpDecorate %i Alignment 4 + OpDecorate %c_base Alignment 4 + OpDecorate %c_start Alignment 4 + OpDecorate %c_end Alignment 4 + OpDecorate %k Alignment 4 %uint = OpTypeInt 32 0 %uint_1024 = OpConstant %uint 1024 %uint_0 = OpConstant %uint 0 @@ -30,64 +56,64 @@ %_ptr_Function_uint = OpTypePointer Function %uint %bool = OpTypeBool %4 = OpFunction %void DontInline %3 - %5 = OpLabel - %20 = OpVariable %_ptr_Function_uint Function - %21 = OpVariable %_ptr_Function_uint Function - %22 = OpVariable %_ptr_Function_uint Function - %23 = OpVariable %_ptr_Function_uint Function - %24 = OpVariable %_ptr_Function_uint Function - OpStore %20 %uint_1024 Aligned 4 - OpBranch %6 - %6 = OpLabel - %26 = OpLoad %uint %20 Aligned 4 - %29 = OpSGreaterThan %bool %26 %uint_0 - OpBranchConditional %29 %7 %17 - %7 = OpLabel - OpStore %21 %uint_0 Aligned 4 - OpBranch %8 - %8 = OpLabel - %30 = OpLoad %uint %21 Aligned 4 - %31 = OpLoad %uint %20 Aligned 4 - %32 = OpSLessThan %bool %30 %31 - OpBranchConditional %32 %9 %15 - %9 = OpLabel - OpStore %22 %uint_255 Aligned 4 - %34 = OpLoad %uint %22 Aligned 4 - %36 = OpISub %uint %34 %uint_16 - OpStore %23 %36 Aligned 4 + %entry = OpLabel + %i = OpVariable %_ptr_Function_uint Function + %c_base = OpVariable %_ptr_Function_uint Function + %c_start = OpVariable %_ptr_Function_uint Function + %c_end = OpVariable %_ptr_Function_uint Function + %k = OpVariable %_ptr_Function_uint Function + OpStore %i %uint_1024 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %26 = OpLoad %uint %i Aligned 4 + %cmp = OpSGreaterThan %bool %26 %uint_0 + OpBranchConditional %cmp %for_body %for_end12 + %for_body = OpLabel + OpStore %c_base %uint_0 Aligned 4 + OpBranch %for_cond1 + %for_cond1 = OpLabel + %30 = OpLoad %uint %c_base Aligned 4 + %31 = OpLoad %uint %i Aligned 4 + %cmp2 = OpSLessThan %bool %30 %31 + OpBranchConditional %cmp2 %for_body3 %for_end9 + %for_body3 = OpLabel + OpStore %c_start %uint_255 Aligned 4 + %34 = OpLoad %uint %c_start Aligned 4 + %sub = OpISub %uint %34 %uint_16 + OpStore %c_end %sub Aligned 4 OpControlBarrier %uint_2 %uint_2 %uint_272 - %39 = OpLoad %uint %22 Aligned 4 - %41 = OpISub %uint %39 %uint_1 - OpStore %24 %41 Aligned 4 - OpBranch %10 - %10 = OpLabel - %42 = OpLoad %uint %24 Aligned 4 - %43 = OpLoad %uint %23 Aligned 4 - %44 = OpSGreaterThanEqual %bool %42 %43 - OpBranchConditional %44 %11 %13 - %11 = OpLabel + %39 = OpLoad %uint %c_start Aligned 4 + %sub4 = OpISub %uint %39 %uint_1 + OpStore %k %sub4 Aligned 4 + OpBranch %for_cond5 + %for_cond5 = OpLabel + %42 = OpLoad %uint %k Aligned 4 + %43 = OpLoad %uint %c_end Aligned 4 + %cmp6 = OpSGreaterThanEqual %bool %42 %43 + OpBranchConditional %cmp6 %for_body7 %for_end + %for_body7 = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_272 - OpBranch %12 - %12 = OpLabel - %45 = OpLoad %uint %24 Aligned 4 - %47 = OpIAdd %uint %45 %uint_4294967295 - OpStore %24 %47 Aligned 4 - OpBranch %10 - %13 = OpLabel + OpBranch %for_inc + %for_inc = OpLabel + %45 = OpLoad %uint %k Aligned 4 + %dec = OpIAdd %uint %45 %uint_4294967295 + OpStore %k %dec Aligned 4 + OpBranch %for_cond5 + %for_end = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_272 - OpBranch %14 - %14 = OpLabel - %48 = OpLoad %uint %21 Aligned 4 - %50 = OpIAdd %uint %48 %uint_240 - OpStore %21 %50 Aligned 4 - OpBranch %8 - %15 = OpLabel - OpBranch %16 - %16 = OpLabel - %51 = OpLoad %uint %20 Aligned 4 - %52 = OpISub %uint %51 %uint_16 - OpStore %20 %52 Aligned 4 - OpBranch %6 - %17 = OpLabel + OpBranch %for_inc8 + %for_inc8 = OpLabel + %48 = OpLoad %uint %c_base Aligned 4 + %add = OpIAdd %uint %48 %uint_240 + OpStore %c_base %add Aligned 4 + OpBranch %for_cond1 + %for_end9 = OpLabel + OpBranch %for_inc10 + %for_inc10 = OpLabel + %51 = OpLoad %uint %i Aligned 4 + %sub11 = OpISub %uint %51 %uint_16 + OpStore %i %sub11 Aligned 4 + OpBranch %for_cond + %for_end12 = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/barrier_divergence/fail.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/barrier_divergence/fail.spvasm index c689964b42..cf69f93ead 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/barrier_divergence/fail.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/barrier_divergence/fail.spvasm @@ -1,4 +1,4 @@ -; @Config: 4, 1, 2 +; @Config: 3, 1, 3 ; SPIR-V ; Version: 1.0 ; Generator: Khronos LLVM/SPIR-V Translator; 14 @@ -12,10 +12,20 @@ OpEntryPoint Kernel %9 "foo" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %a "a" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %a_addr "a.addr" + OpName %call "call" + OpName %cmp "cmp" + OpName %call1 "call1" + OpName %call2 "call2" + OpName %arrayidx "arrayidx" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %15 Alignment 4 + OpDecorate %a_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_3 = OpConstant %uint 3 %uint_2 = OpConstant %uint 2 @@ -29,24 +39,24 @@ %bool = OpTypeBool %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_Workgroup_uint - %11 = OpLabel - %15 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - OpStore %15 %10 Aligned 4 + %a = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %a_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + OpStore %a_addr %a Aligned 4 %16 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %17 = OpCompositeExtract %uint %16 0 - %20 = OpIEqual %bool %17 %uint_3 - OpBranchConditional %20 %12 %13 - %12 = OpLabel + %call = OpCompositeExtract %uint %16 0 + %cmp = OpIEqual %bool %call %uint_3 + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_528 - OpBranch %13 - %13 = OpLabel + OpBranch %if_end + %if_end = OpLabel %23 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %24 = OpCompositeExtract %uint %23 0 - %25 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 + %call1 = OpCompositeExtract %uint %23 0 + %25 = OpLoad %_ptr_Workgroup_uint %a_addr Aligned 4 %26 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %27 = OpCompositeExtract %uint %26 0 - %28 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %25 %27 - OpStore %28 %24 Aligned 4 + %call2 = OpCompositeExtract %uint %26 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %25 %call2 + OpStore %arrayidx %call1 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/barrier_divergence/pass.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/barrier_divergence/pass.spvasm index a3532b3fe2..d061f9ee82 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/barrier_divergence/pass.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/barrier_divergence/pass.spvasm @@ -12,11 +12,22 @@ OpEntryPoint Kernel %9 "foo" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %a "a" + OpName %b "b" + OpName %entry "entry" + OpName %a_addr "a.addr" + OpName %b_addr "b.addr" + OpName %call "call" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" + OpName %call2 "call2" + OpName %call3 "call3" + OpName %arrayidx4 "arrayidx4" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %14 Alignment 4 - OpDecorate %15 Alignment 4 + OpDecorate %a_addr Alignment 4 + OpDecorate %b_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %uint_528 = OpConstant %uint 528 @@ -28,27 +39,27 @@ %_ptr_Function__ptr_Workgroup_uint = OpTypePointer Function %_ptr_Workgroup_uint %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_Workgroup_uint - %11 = OpFunctionParameter %_ptr_Workgroup_uint - %12 = OpLabel - %14 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %15 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - OpStore %14 %10 Aligned 4 - OpStore %15 %11 Aligned 4 + %a = OpFunctionParameter %_ptr_Workgroup_uint + %b = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %a_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %b_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + OpStore %a_addr %a Aligned 4 + OpStore %b_addr %b Aligned 4 %16 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %17 = OpCompositeExtract %uint %16 0 - %18 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 + %call = OpCompositeExtract %uint %16 0 + %18 = OpLoad %_ptr_Workgroup_uint %a_addr Aligned 4 %19 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %20 = OpCompositeExtract %uint %19 0 - %21 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %18 %20 - OpStore %21 %17 Aligned 4 + %call1 = OpCompositeExtract %uint %19 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %18 %call1 + OpStore %arrayidx %call Aligned 4 OpControlBarrier %uint_2 %uint_2 %uint_528 %24 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %25 = OpCompositeExtract %uint %24 0 - %26 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 + %call2 = OpCompositeExtract %uint %24 0 + %26 = OpLoad %_ptr_Workgroup_uint %b_addr Aligned 4 %27 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %28 = OpCompositeExtract %uint %27 0 - %29 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %26 %28 - OpStore %29 %25 Aligned 4 + %call3 = OpCompositeExtract %uint %27 0 + %arrayidx4 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %26 %call3 + OpStore %arrayidx4 %call2 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/needs_source_location_ensures.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/needs_source_location_ensures.spvasm index f4a902894a..b4961b33d4 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/needs_source_location_ensures.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/needs_source_location_ensures.spvasm @@ -13,13 +13,33 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %bar "bar" + OpName %p "p" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %p_addr "p.addr" + OpName %call "call" + OpName %cmp "cmp" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" + OpName %p_0 "p" + OpName %entry_0 "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %p_addr_0 "p.addr" + OpName %i "i" + OpName %call_0 "call" + OpName %cmp_0 "cmp" + OpName %inc "inc" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %bar LinkageAttributes "bar" Export OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %15 Alignment 4 - OpDecorate %33 Alignment 4 - OpDecorate %35 Alignment 4 + OpDecorate %p_addr Alignment 4 + OpDecorate %p_addr_0 Alignment 4 + OpDecorate %i Alignment 4 %uint = OpTypeInt 32 0 %uint_24 = OpConstant %uint 24 %uint_0 = OpConstant %uint 0 @@ -34,47 +54,47 @@ %_ptr_Function_uint = OpTypePointer Function %uint %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %bar = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpLabel - %15 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %15 %10 Aligned 4 + %p = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %p_addr %p Aligned 4 %16 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %17 = OpCompositeExtract %uint %16 0 - %20 = OpIEqual %bool %17 %uint_24 - OpBranchConditional %20 %12 %13 - %12 = OpLabel + %call = OpCompositeExtract %uint %16 0 + %cmp = OpIEqual %bool %call %uint_24 + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel %21 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %22 = OpCompositeExtract %uint %21 0 - %23 = OpLoad %_ptr_CrossWorkgroup_uint %15 Aligned 4 - %25 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %23 %uint_0 - OpStore %25 %22 Aligned 4 - OpBranch %13 - %13 = OpLabel + %call1 = OpCompositeExtract %uint %21 0 + %23 = OpLoad %_ptr_CrossWorkgroup_uint %p_addr Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %23 %uint_0 + OpStore %arrayidx %call1 Aligned 4 + OpBranch %if_end + %if_end = OpLabel OpReturn OpFunctionEnd %26 = OpFunction %void DontInline %8 - %27 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %28 = OpLabel - %33 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %35 = OpVariable %_ptr_Function_uint Function - OpStore %33 %27 Aligned 4 - %36 = OpLoad %_ptr_CrossWorkgroup_uint %33 Aligned 4 + %p_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_0 = OpLabel + %p_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %i = OpVariable %_ptr_Function_uint Function + OpStore %p_addr_0 %p_0 Aligned 4 + %36 = OpLoad %_ptr_CrossWorkgroup_uint %p_addr_0 Aligned 4 %37 = OpFunctionCall %void %bar %36 - OpStore %35 %uint_0 Aligned 4 - OpBranch %29 - %29 = OpLabel - %38 = OpLoad %uint %35 Aligned 4 + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %38 = OpLoad %uint %i Aligned 4 %39 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %40 = OpCompositeExtract %uint %39 0 - %41 = OpULessThan %bool %38 %40 - OpBranchConditional %41 %30 %32 - %30 = OpLabel - OpBranch %31 - %31 = OpLabel - %42 = OpLoad %uint %35 Aligned 4 - %44 = OpIAdd %uint %42 %uint_1 - OpStore %35 %44 Aligned 4 - OpBranch %29 - %32 = OpLabel + %call_0 = OpCompositeExtract %uint %39 0 + %cmp_0 = OpULessThan %bool %38 %call_0 + OpBranchConditional %cmp_0 %for_body %for_end + %for_body = OpLabel + OpBranch %for_inc + %for_inc = OpLabel + %42 = OpLoad %uint %i Aligned 4 + %inc = OpIAdd %uint %42 %uint_1 + OpStore %i %inc Aligned 4 + OpBranch %for_cond + %for_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/needs_source_location_requires.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/needs_source_location_requires.spvasm index cfd6c9050d..c8a1a3b29b 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/needs_source_location_requires.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/needs_source_location_requires.spvasm @@ -13,13 +13,33 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %bar "bar" + OpName %p "p" + OpName %entry "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %p_addr "p.addr" + OpName %i "i" + OpName %call "call" + OpName %cmp "cmp" + OpName %inc "inc" + OpName %call1 "call1" + OpName %cmp2 "cmp2" + OpName %call3 "call3" + OpName %arrayidx "arrayidx" + OpName %p_0 "p" + OpName %entry_0 "entry" + OpName %p_addr_0 "p.addr" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %bar LinkageAttributes "bar" Export OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %19 Alignment 4 - OpDecorate %21 Alignment 4 - OpDecorate %43 Alignment 4 + OpDecorate %p_addr Alignment 4 + OpDecorate %i Alignment 4 + OpDecorate %p_addr_0 Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_1 = OpConstant %uint 1 @@ -34,48 +54,48 @@ %bool = OpTypeBool %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %bar = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpLabel - %19 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %21 = OpVariable %_ptr_Function_uint Function - OpStore %19 %10 Aligned 4 - OpStore %21 %uint_0 Aligned 4 - OpBranch %12 - %12 = OpLabel - %23 = OpLoad %uint %21 Aligned 4 + %p = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %i = OpVariable %_ptr_Function_uint Function + OpStore %p_addr %p Aligned 4 + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %23 = OpLoad %uint %i Aligned 4 %24 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %25 = OpCompositeExtract %uint %24 0 - %27 = OpULessThan %bool %23 %25 - OpBranchConditional %27 %13 %15 - %13 = OpLabel - OpBranch %14 - %14 = OpLabel - %28 = OpLoad %uint %21 Aligned 4 - %30 = OpIAdd %uint %28 %uint_1 - OpStore %21 %30 Aligned 4 - OpBranch %12 - %15 = OpLabel + %call = OpCompositeExtract %uint %24 0 + %cmp = OpULessThan %bool %23 %call + OpBranchConditional %cmp %for_body %for_end + %for_body = OpLabel + OpBranch %for_inc + %for_inc = OpLabel + %28 = OpLoad %uint %i Aligned 4 + %inc = OpIAdd %uint %28 %uint_1 + OpStore %i %inc Aligned 4 + OpBranch %for_cond + %for_end = OpLabel %31 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %32 = OpCompositeExtract %uint %31 0 - %34 = OpIEqual %bool %32 %uint_24 - OpBranchConditional %34 %16 %17 - %16 = OpLabel + %call1 = OpCompositeExtract %uint %31 0 + %cmp2 = OpIEqual %bool %call1 %uint_24 + OpBranchConditional %cmp2 %if_then %if_end + %if_then = OpLabel %35 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %36 = OpCompositeExtract %uint %35 0 - %37 = OpLoad %_ptr_CrossWorkgroup_uint %19 Aligned 4 - %38 = OpLoad %uint %21 Aligned 4 - %39 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %37 %38 - OpStore %39 %36 Aligned 4 - OpBranch %17 - %17 = OpLabel + %call3 = OpCompositeExtract %uint %35 0 + %37 = OpLoad %_ptr_CrossWorkgroup_uint %p_addr Aligned 4 + %38 = OpLoad %uint %i Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %37 %38 + OpStore %arrayidx %call3 Aligned 4 + OpBranch %if_end + %if_end = OpLabel OpReturn OpFunctionEnd %40 = OpFunction %void DontInline %8 - %41 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %42 = OpLabel - %43 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %43 %41 Aligned 4 - %44 = OpLoad %_ptr_CrossWorkgroup_uint %43 Aligned 4 + %p_0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_0 = OpLabel + %p_addr_0 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %p_addr_0 %p_0 Aligned 4 + %44 = OpLoad %_ptr_CrossWorkgroup_uint %p_addr_0 Aligned 4 %45 = OpFunctionCall %void %bar %44 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/race_from_call.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/race_from_call.spvasm index 89586242cb..0d0f8adedf 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/race_from_call.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/race_from_call.spvasm @@ -13,12 +13,25 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" OpName %foo "foo" + OpName %p "p" + OpName %entry "entry" + OpName %p_addr "p.addr" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %p_0 "p" + OpName %entry_0 "entry" + OpName %p_addr_0 "p.addr" + OpName %call_0 "call" + OpName %call1 "call1" + OpName %call2 "call2" + OpName %add "add" + OpName %arrayidx_0 "arrayidx" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %foo LinkageAttributes "foo" Export OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %12 Alignment 4 - OpDecorate %23 Alignment 4 + OpDecorate %p_addr Alignment 4 + OpDecorate %p_addr_0 Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %v3uint = OpTypeVector %uint 3 @@ -30,31 +43,31 @@ %19 = OpTypeFunction %void %_ptr_Workgroup_uint %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %foo = OpFunction %uint DontInline %7 - %9 = OpFunctionParameter %_ptr_Workgroup_uint - %10 = OpLabel - %12 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - OpStore %12 %9 Aligned 4 - %13 = OpLoad %_ptr_Workgroup_uint %12 Aligned 4 + %p = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + OpStore %p_addr %p Aligned 4 + %13 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 %14 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %15 = OpCompositeExtract %uint %14 0 - %16 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %13 %15 - %17 = OpLoad %uint %16 Aligned 4 + %call = OpCompositeExtract %uint %14 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %13 %call + %17 = OpLoad %uint %arrayidx Aligned 4 OpReturnValue %17 OpFunctionEnd %20 = OpFunction %void DontInline %19 - %21 = OpFunctionParameter %_ptr_Workgroup_uint - %22 = OpLabel - %23 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - OpStore %23 %21 Aligned 4 - %24 = OpLoad %_ptr_Workgroup_uint %23 Aligned 4 - %25 = OpFunctionCall %uint %foo %24 + %p_0 = OpFunctionParameter %_ptr_Workgroup_uint + %entry_0 = OpLabel + %p_addr_0 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + OpStore %p_addr_0 %p_0 Aligned 4 + %24 = OpLoad %_ptr_Workgroup_uint %p_addr_0 Aligned 4 + %call_0 = OpFunctionCall %uint %foo %24 %26 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %27 = OpCompositeExtract %uint %26 0 - %28 = OpLoad %_ptr_Workgroup_uint %23 Aligned 4 + %call1 = OpCompositeExtract %uint %26 0 + %28 = OpLoad %_ptr_Workgroup_uint %p_addr_0 Aligned 4 %29 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %30 = OpCompositeExtract %uint %29 0 - %32 = OpIAdd %uint %30 %uint_1 - %33 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %28 %32 - OpStore %33 %27 Aligned 4 + %call2 = OpCompositeExtract %uint %29 0 + %add = OpIAdd %uint %call2 %uint_1 + %arrayidx_0 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %28 %add + OpStore %arrayidx_0 %call1 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/race_from_call_in_loop.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/race_from_call_in_loop.spvasm index 5d3dcd2e1c..054da49c1c 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/race_from_call_in_loop.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/race_from_call_in_loop.spvasm @@ -13,13 +13,33 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" OpName %foo "foo" + OpName %A "A" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %p "p" + OpName %entry_0 "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %p_addr "p.addr" + OpName %i "i" + OpName %cmp "cmp" + OpName %call_0 "call" + OpName %inc "inc" + OpName %call1 "call1" + OpName %call2 "call2" + OpName %add "add" + OpName %arrayidx_0 "arrayidx" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %foo LinkageAttributes "foo" Export OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %12 Alignment 4 - OpDecorate %27 Alignment 4 - OpDecorate %29 Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %p_addr Alignment 4 + OpDecorate %i Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_100 = OpConstant %uint 100 @@ -35,46 +55,46 @@ %bool = OpTypeBool %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %foo = OpFunction %uint DontInline %7 - %9 = OpFunctionParameter %_ptr_Workgroup_uint - %10 = OpLabel - %12 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - OpStore %12 %9 Aligned 4 - %13 = OpLoad %_ptr_Workgroup_uint %12 Aligned 4 + %A = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + OpStore %A_addr %A Aligned 4 + %13 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 %14 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %15 = OpCompositeExtract %uint %14 0 - %16 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %13 %15 - %17 = OpLoad %uint %16 Aligned 4 + %call = OpCompositeExtract %uint %14 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %13 %call + %17 = OpLoad %uint %arrayidx Aligned 4 OpReturnValue %17 OpFunctionEnd %20 = OpFunction %void DontInline %19 - %21 = OpFunctionParameter %_ptr_Workgroup_uint - %22 = OpLabel - %27 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %29 = OpVariable %_ptr_Function_uint Function - OpStore %27 %21 Aligned 4 - OpStore %29 %uint_0 Aligned 4 - OpBranch %23 - %23 = OpLabel - %31 = OpLoad %uint %29 Aligned 4 - %34 = OpSLessThan %bool %31 %uint_100 - OpBranchConditional %34 %24 %26 - %24 = OpLabel - %35 = OpLoad %_ptr_Workgroup_uint %27 Aligned 4 - %36 = OpFunctionCall %uint %foo %35 - OpBranch %25 - %25 = OpLabel - %37 = OpLoad %uint %29 Aligned 4 - %39 = OpIAdd %uint %37 %uint_1 - OpStore %29 %39 Aligned 4 - OpBranch %23 - %26 = OpLabel + %p = OpFunctionParameter %_ptr_Workgroup_uint + %entry_0 = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %i = OpVariable %_ptr_Function_uint Function + OpStore %p_addr %p Aligned 4 + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %31 = OpLoad %uint %i Aligned 4 + %cmp = OpSLessThan %bool %31 %uint_100 + OpBranchConditional %cmp %for_body %for_end + %for_body = OpLabel + %35 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 + %call_0 = OpFunctionCall %uint %foo %35 + OpBranch %for_inc + %for_inc = OpLabel + %37 = OpLoad %uint %i Aligned 4 + %inc = OpIAdd %uint %37 %uint_1 + OpStore %i %inc Aligned 4 + OpBranch %for_cond + %for_end = OpLabel %40 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %41 = OpCompositeExtract %uint %40 0 - %42 = OpLoad %_ptr_Workgroup_uint %27 Aligned 4 + %call1 = OpCompositeExtract %uint %40 0 + %42 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 %43 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %44 = OpCompositeExtract %uint %43 0 - %45 = OpIAdd %uint %44 %uint_1 - %46 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %42 %45 - OpStore %46 %41 Aligned 4 + %call2 = OpCompositeExtract %uint %43 0 + %add = OpIAdd %uint %call2 %uint_1 + %arrayidx_0 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %42 %add + OpStore %arrayidx_0 %call1 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/race_with_loop.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/race_with_loop.spvasm index 210440b870..5f8a059759 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/race_with_loop.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/race_with_loop.spvasm @@ -1,4 +1,4 @@ -; @Config: 2, 1, 1 +; @Config: 3, 1, 3 ; SPIR-V ; Version: 1.0 ; Generator: Khronos LLVM/SPIR-V Translator; 14 @@ -12,12 +12,30 @@ OpEntryPoint Kernel %9 "foo" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %p "p" + OpName %entry "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %p_addr "p.addr" + OpName %x "x" + OpName %i "i" + OpName %cmp "cmp" + OpName %arrayidx "arrayidx" + OpName %add "add" + OpName %add1 "add1" + OpName %arrayidx2 "arrayidx2" + OpName %add3 "add3" + OpName %inc "inc" + OpName %call "call" + OpName %arrayidx4 "arrayidx4" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %20 Alignment 4 + OpDecorate %p_addr Alignment 4 + OpDecorate %x Alignment 4 + OpDecorate %i Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_100 = OpConstant %uint 100 @@ -32,47 +50,47 @@ %bool = OpTypeBool %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_Workgroup_uint - %11 = OpLabel - %17 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - %20 = OpVariable %_ptr_Function_uint Function - OpStore %17 %10 Aligned 4 - OpStore %19 %uint_0 Aligned 4 - OpStore %20 %uint_0 Aligned 4 - OpBranch %12 - %12 = OpLabel - %22 = OpLoad %uint %20 Aligned 4 - %25 = OpSLessThan %bool %22 %uint_100 - OpBranchConditional %25 %13 %15 - %13 = OpLabel - %26 = OpLoad %_ptr_Workgroup_uint %17 Aligned 4 - %27 = OpLoad %uint %20 Aligned 4 - %28 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %26 %27 - %29 = OpLoad %uint %28 Aligned 4 - %30 = OpLoad %uint %19 Aligned 4 - %31 = OpIAdd %uint %30 %29 - OpStore %19 %31 Aligned 4 - %32 = OpLoad %_ptr_Workgroup_uint %17 Aligned 4 - %33 = OpLoad %uint %20 Aligned 4 - %35 = OpIAdd %uint %33 %uint_1 - %36 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %32 %35 - %37 = OpLoad %uint %36 Aligned 4 - %38 = OpLoad %uint %19 Aligned 4 - %39 = OpIAdd %uint %38 %37 - OpStore %19 %39 Aligned 4 - OpBranch %14 - %14 = OpLabel - %40 = OpLoad %uint %20 Aligned 4 - %41 = OpIAdd %uint %40 %uint_1 - OpStore %20 %41 Aligned 4 - OpBranch %12 - %15 = OpLabel - %42 = OpLoad %uint %19 Aligned 4 - %43 = OpLoad %_ptr_Workgroup_uint %17 Aligned 4 + %p = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %x = OpVariable %_ptr_Function_uint Function + %i = OpVariable %_ptr_Function_uint Function + OpStore %p_addr %p Aligned 4 + OpStore %x %uint_0 Aligned 4 + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %22 = OpLoad %uint %i Aligned 4 + %cmp = OpSLessThan %bool %22 %uint_100 + OpBranchConditional %cmp %for_body %for_end + %for_body = OpLabel + %26 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 + %27 = OpLoad %uint %i Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %26 %27 + %29 = OpLoad %uint %arrayidx Aligned 4 + %30 = OpLoad %uint %x Aligned 4 + %add = OpIAdd %uint %30 %29 + OpStore %x %add Aligned 4 + %32 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 + %33 = OpLoad %uint %i Aligned 4 + %add1 = OpIAdd %uint %33 %uint_1 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %32 %add1 + %37 = OpLoad %uint %arrayidx2 Aligned 4 + %38 = OpLoad %uint %x Aligned 4 + %add3 = OpIAdd %uint %38 %37 + OpStore %x %add3 Aligned 4 + OpBranch %for_inc + %for_inc = OpLabel + %40 = OpLoad %uint %i Aligned 4 + %inc = OpIAdd %uint %40 %uint_1 + OpStore %i %inc Aligned 4 + OpBranch %for_cond + %for_end = OpLabel + %42 = OpLoad %uint %x Aligned 4 + %43 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 %44 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %45 = OpCompositeExtract %uint %44 0 - %46 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %43 %45 - OpStore %46 %42 Aligned 4 + %call = OpCompositeExtract %uint %44 0 + %arrayidx4 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %43 %call + OpStore %arrayidx4 %42 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/races/fail/read_write.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/races/fail/read_write.spvasm index 2b1a1f5a3c..17128c8feb 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/races/fail/read_write.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/races/fail/read_write.spvasm @@ -12,11 +12,22 @@ OpEntryPoint Kernel %9 "foo" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %a "a" + OpName %b "b" + OpName %entry "entry" + OpName %a_addr "a.addr" + OpName %b_addr "b.addr" + OpName %arrayidx "arrayidx" + OpName %call "call" + OpName %arrayidx1 "arrayidx1" + OpName %call2 "call2" + OpName %call3 "call3" + OpName %arrayidx4 "arrayidx4" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %14 Alignment 4 - OpDecorate %15 Alignment 4 + OpDecorate %a_addr Alignment 4 + OpDecorate %b_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_8 = OpConstant %uint 8 %v3uint = OpTypeVector %uint 3 @@ -27,27 +38,27 @@ %_ptr_Function__ptr_Workgroup_uint = OpTypePointer Function %_ptr_Workgroup_uint %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_Workgroup_uint - %11 = OpFunctionParameter %_ptr_Workgroup_uint - %12 = OpLabel - %14 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %15 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - OpStore %14 %10 Aligned 4 - OpStore %15 %11 Aligned 4 - %16 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 - %18 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %16 %uint_8 - %19 = OpLoad %uint %18 Aligned 4 - %20 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 + %a = OpFunctionParameter %_ptr_Workgroup_uint + %b = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %a_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %b_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + OpStore %a_addr %a Aligned 4 + OpStore %b_addr %b Aligned 4 + %16 = OpLoad %_ptr_Workgroup_uint %a_addr Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %16 %uint_8 + %19 = OpLoad %uint %arrayidx Aligned 4 + %20 = OpLoad %_ptr_Workgroup_uint %b_addr Aligned 4 %21 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %22 = OpCompositeExtract %uint %21 0 - %23 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %20 %22 - OpStore %23 %19 Aligned 4 + %call = OpCompositeExtract %uint %21 0 + %arrayidx1 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %20 %call + OpStore %arrayidx1 %19 Aligned 4 %24 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %25 = OpCompositeExtract %uint %24 0 - %26 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 + %call2 = OpCompositeExtract %uint %24 0 + %26 = OpLoad %_ptr_Workgroup_uint %a_addr Aligned 4 %27 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %28 = OpCompositeExtract %uint %27 0 - %29 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %26 %28 - OpStore %29 %25 Aligned 4 + %call3 = OpCompositeExtract %uint %27 0 + %arrayidx4 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %26 %call3 + OpStore %arrayidx4 %call2 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/races/fail/write_read.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/races/fail/write_read.spvasm index dc8e584e6d..bc386f1c6a 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/races/fail/write_read.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/races/fail/write_read.spvasm @@ -12,11 +12,22 @@ OpEntryPoint Kernel %9 "foo" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %a "a" + OpName %b "b" + OpName %entry "entry" + OpName %a_addr "a.addr" + OpName %b_addr "b.addr" + OpName %call "call" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" + OpName %arrayidx2 "arrayidx2" + OpName %call3 "call3" + OpName %arrayidx4 "arrayidx4" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %14 Alignment 4 - OpDecorate %15 Alignment 4 + OpDecorate %a_addr Alignment 4 + OpDecorate %b_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_3 = OpConstant %uint 3 %v3uint = OpTypeVector %uint 3 @@ -27,27 +38,27 @@ %_ptr_Function__ptr_Workgroup_uint = OpTypePointer Function %_ptr_Workgroup_uint %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_Workgroup_uint - %11 = OpFunctionParameter %_ptr_Workgroup_uint - %12 = OpLabel - %14 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %15 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - OpStore %14 %10 Aligned 4 - OpStore %15 %11 Aligned 4 + %a = OpFunctionParameter %_ptr_Workgroup_uint + %b = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %a_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %b_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + OpStore %a_addr %a Aligned 4 + OpStore %b_addr %b Aligned 4 %16 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %17 = OpCompositeExtract %uint %16 0 - %18 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 + %call = OpCompositeExtract %uint %16 0 + %18 = OpLoad %_ptr_Workgroup_uint %a_addr Aligned 4 %19 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %20 = OpCompositeExtract %uint %19 0 - %21 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %18 %20 - OpStore %21 %17 Aligned 4 - %22 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 - %24 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %22 %uint_3 - %25 = OpLoad %uint %24 Aligned 4 - %26 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 + %call1 = OpCompositeExtract %uint %19 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %18 %call1 + OpStore %arrayidx %call Aligned 4 + %22 = OpLoad %_ptr_Workgroup_uint %a_addr Aligned 4 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %22 %uint_3 + %25 = OpLoad %uint %arrayidx2 Aligned 4 + %26 = OpLoad %_ptr_Workgroup_uint %b_addr Aligned 4 %27 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %28 = OpCompositeExtract %uint %27 0 - %29 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %26 %28 - OpStore %29 %25 Aligned 4 + %call3 = OpCompositeExtract %uint %27 0 + %arrayidx4 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %26 %call3 + OpStore %arrayidx4 %25 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/races/fail/write_write/elem_width_16.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/races/fail/write_write/elem_width_16.spvasm index 4f11f18c92..2d195f5ca6 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/races/fail/write_write/elem_width_16.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/races/fail/write_write/elem_width_16.spvasm @@ -13,11 +13,19 @@ OpEntryPoint Kernel %11 "foo" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %p "p" + OpName %q "q" + OpName %entry "entry" + OpName %p_addr "p.addr" + OpName %q_addr "q.addr" + OpName %call "call" + OpName %conv "conv" + OpName %arrayidx "arrayidx" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %16 Alignment 4 - OpDecorate %18 Alignment 4 + OpDecorate %p_addr Alignment 4 + OpDecorate %q_addr Alignment 4 %uint = OpTypeInt 32 0 %ushort = OpTypeInt 16 0 %uint_3 = OpConstant %uint 3 @@ -31,21 +39,21 @@ %_ptr_Function__ptr_CrossWorkgroup_ushort = OpTypePointer Function %_ptr_CrossWorkgroup_ushort %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %11 = OpFunction %void DontInline %10 - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpFunctionParameter %_ptr_CrossWorkgroup_ushort - %14 = OpLabel - %16 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %18 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_ushort Function - OpStore %16 %12 Aligned 4 - OpStore %18 %13 Aligned 4 - %19 = OpLoad %_ptr_CrossWorkgroup_ushort %18 Aligned 4 + %p = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %q = OpFunctionParameter %_ptr_CrossWorkgroup_ushort + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %q_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_ushort Function + OpStore %p_addr %p Aligned 4 + OpStore %q_addr %q Aligned 4 + %19 = OpLoad %_ptr_CrossWorkgroup_ushort %q_addr Aligned 4 %20 = OpBitcast %_ptr_CrossWorkgroup_uint %19 - OpStore %16 %20 Aligned 4 + OpStore %p_addr %20 Aligned 4 %21 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %22 = OpCompositeExtract %uint %21 0 - %23 = OpUConvert %ushort %22 - %24 = OpLoad %_ptr_CrossWorkgroup_ushort %18 Aligned 4 - %26 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_ushort %24 %uint_3 - OpStore %26 %23 Aligned 2 + %call = OpCompositeExtract %uint %21 0 + %conv = OpUConvert %ushort %call + %24 = OpLoad %_ptr_CrossWorkgroup_ushort %q_addr Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_ushort %24 %uint_3 + OpStore %arrayidx %conv Aligned 2 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/races/fail/write_write/loop.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/races/fail/write_write/loop.spvasm index ee5d1ffcb7..a73fecbd27 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/races/fail/write_write/loop.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/races/fail/write_write/loop.spvasm @@ -12,11 +12,36 @@ OpEntryPoint Kernel %9 "foo" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %p "p" + OpName %entry "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %if_then6 "if.then6" + OpName %if_end10 "if.end10" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %p_addr "p.addr" + OpName %i "i" + OpName %cmp "cmp" + OpName %call "call" + OpName %cmp1 "cmp1" + OpName %call2 "call2" + OpName %call3 "call3" + OpName %arrayidx "arrayidx" + OpName %call4 "call4" + OpName %cmp5 "cmp5" + OpName %call7 "call7" + OpName %call8 "call8" + OpName %add "add" + OpName %arrayidx9 "arrayidx9" + OpName %inc "inc" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %21 Alignment 4 - OpDecorate %23 Alignment 4 + OpDecorate %p_addr Alignment 4 + OpDecorate %i Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_100 = OpConstant %uint 100 @@ -33,53 +58,53 @@ %bool = OpTypeBool %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_Workgroup_uint - %11 = OpLabel - %21 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %23 = OpVariable %_ptr_Function_uint Function - OpStore %21 %10 Aligned 4 - OpStore %23 %uint_0 Aligned 4 - OpBranch %12 - %12 = OpLabel - %25 = OpLoad %uint %23 Aligned 4 - %28 = OpSLessThan %bool %25 %uint_100 - OpBranchConditional %28 %13 %19 - %13 = OpLabel + %p = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %i = OpVariable %_ptr_Function_uint Function + OpStore %p_addr %p Aligned 4 + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %25 = OpLoad %uint %i Aligned 4 + %cmp = OpSLessThan %bool %25 %uint_100 + OpBranchConditional %cmp %for_body %for_end + %for_body = OpLabel %29 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %30 = OpCompositeExtract %uint %29 0 - %32 = OpIEqual %bool %30 %uint_5 - OpBranchConditional %32 %14 %15 - %14 = OpLabel + %call = OpCompositeExtract %uint %29 0 + %cmp1 = OpIEqual %bool %call %uint_5 + OpBranchConditional %cmp1 %if_then %if_end + %if_then = OpLabel %33 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %34 = OpCompositeExtract %uint %33 0 - %35 = OpLoad %_ptr_Workgroup_uint %21 Aligned 4 + %call2 = OpCompositeExtract %uint %33 0 + %35 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 %36 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %37 = OpCompositeExtract %uint %36 0 - %38 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %35 %37 - OpStore %38 %34 Aligned 4 - OpBranch %15 - %15 = OpLabel + %call3 = OpCompositeExtract %uint %36 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %35 %call3 + OpStore %arrayidx %call2 Aligned 4 + OpBranch %if_end + %if_end = OpLabel %39 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %40 = OpCompositeExtract %uint %39 0 - %42 = OpIEqual %bool %40 %uint_4 - OpBranchConditional %42 %16 %17 - %16 = OpLabel + %call4 = OpCompositeExtract %uint %39 0 + %cmp5 = OpIEqual %bool %call4 %uint_4 + OpBranchConditional %cmp5 %if_then6 %if_end10 + %if_then6 = OpLabel %43 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %44 = OpCompositeExtract %uint %43 0 - %45 = OpLoad %_ptr_Workgroup_uint %21 Aligned 4 + %call7 = OpCompositeExtract %uint %43 0 + %45 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 %46 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %47 = OpCompositeExtract %uint %46 0 - %49 = OpIAdd %uint %47 %uint_1 - %50 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %45 %49 - OpStore %50 %44 Aligned 4 - OpBranch %17 - %17 = OpLabel - OpBranch %18 - %18 = OpLabel - %51 = OpLoad %uint %23 Aligned 4 - %52 = OpIAdd %uint %51 %uint_1 - OpStore %23 %52 Aligned 4 - OpBranch %12 - %19 = OpLabel + %call8 = OpCompositeExtract %uint %46 0 + %add = OpIAdd %uint %call8 %uint_1 + %arrayidx9 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %45 %add + OpStore %arrayidx9 %call7 Aligned 4 + OpBranch %if_end10 + %if_end10 = OpLabel + OpBranch %for_inc + %for_inc = OpLabel + %51 = OpLoad %uint %i Aligned 4 + %inc = OpIAdd %uint %51 %uint_1 + OpStore %i %inc Aligned 4 + OpBranch %for_cond + %for_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/races/fail/write_write/normal.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/races/fail/write_write/normal.spvasm index a431a61fbb..758fb64fea 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/races/fail/write_write/normal.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/races/fail/write_write/normal.spvasm @@ -12,10 +12,21 @@ OpEntryPoint Kernel %9 "foo" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %a "a" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %a_addr "a.addr" + OpName %call "call" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" + OpName %call2 "call2" + OpName %cmp "cmp" + OpName %arrayidx3 "arrayidx3" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %15 Alignment 4 + OpDecorate %a_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_7 = OpConstant %uint 7 @@ -28,26 +39,26 @@ %bool = OpTypeBool %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_Workgroup_uint - %11 = OpLabel - %15 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - OpStore %15 %10 Aligned 4 + %a = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %a_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + OpStore %a_addr %a Aligned 4 %16 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %17 = OpCompositeExtract %uint %16 0 - %18 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 + %call = OpCompositeExtract %uint %16 0 + %18 = OpLoad %_ptr_Workgroup_uint %a_addr Aligned 4 %19 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %20 = OpCompositeExtract %uint %19 0 - %21 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %18 %20 - OpStore %21 %17 Aligned 4 + %call1 = OpCompositeExtract %uint %19 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %18 %call1 + OpStore %arrayidx %call Aligned 4 %22 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %23 = OpCompositeExtract %uint %22 0 - %26 = OpIEqual %bool %23 %uint_0 - OpBranchConditional %26 %12 %13 - %12 = OpLabel - %27 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 - %29 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %27 %uint_7 - OpStore %29 %uint_0 Aligned 4 - OpBranch %13 - %13 = OpLabel + %call2 = OpCompositeExtract %uint %22 0 + %cmp = OpIEqual %bool %call2 %uint_0 + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel + %27 = OpLoad %_ptr_Workgroup_uint %a_addr Aligned 4 + %arrayidx3 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %27 %uint_7 + OpStore %arrayidx3 %uint_0 Aligned 4 + OpBranch %if_end + %if_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/races/pass/no_race.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/races/pass/no_race.spvasm index 7f7016566e..8cf6e2ad92 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/races/pass/no_race.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/races/pass/no_race.spvasm @@ -12,12 +12,35 @@ OpEntryPoint Kernel %9 "foo" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %p "p" + OpName %q "q" + OpName %r "r" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %if_then6 "if.then6" + OpName %if_end11 "if.end11" + OpName %p_addr "p.addr" + OpName %q_addr "q.addr" + OpName %r_addr "r.addr" + OpName %call "call" + OpName %cmp "cmp" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" + OpName %call2 "call2" + OpName %arrayidx3 "arrayidx3" + OpName %call4 "call4" + OpName %cmp5 "cmp5" + OpName %call7 "call7" + OpName %arrayidx8 "arrayidx8" + OpName %call9 "call9" + OpName %arrayidx10 "arrayidx10" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %19 Alignment 4 - OpDecorate %20 Alignment 4 - OpDecorate %21 Alignment 4 + OpDecorate %p_addr Alignment 4 + OpDecorate %q_addr Alignment 4 + OpDecorate %r_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_10 = OpConstant %uint 10 %v3uint = OpTypeVector %uint 3 @@ -29,49 +52,49 @@ %bool = OpTypeBool %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_Workgroup_uint - %11 = OpFunctionParameter %_ptr_Workgroup_uint - %12 = OpFunctionParameter %_ptr_Workgroup_uint - %13 = OpLabel - %19 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %20 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %21 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - OpStore %19 %10 Aligned 4 - OpStore %20 %11 Aligned 4 - OpStore %21 %12 Aligned 4 + %p = OpFunctionParameter %_ptr_Workgroup_uint + %q = OpFunctionParameter %_ptr_Workgroup_uint + %r = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %q_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %r_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + OpStore %p_addr %p Aligned 4 + OpStore %q_addr %q Aligned 4 + OpStore %r_addr %r Aligned 4 %22 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %23 = OpCompositeExtract %uint %22 0 - %26 = OpUGreaterThan %bool %23 %uint_10 - OpBranchConditional %26 %14 %15 - %14 = OpLabel - %27 = OpLoad %_ptr_Workgroup_uint %20 Aligned 4 + %call = OpCompositeExtract %uint %22 0 + %cmp = OpUGreaterThan %bool %call %uint_10 + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel + %27 = OpLoad %_ptr_Workgroup_uint %q_addr Aligned 4 %28 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %29 = OpCompositeExtract %uint %28 0 - %30 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %27 %29 - %31 = OpLoad %uint %30 Aligned 4 - %32 = OpLoad %_ptr_Workgroup_uint %19 Aligned 4 + %call1 = OpCompositeExtract %uint %28 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %27 %call1 + %31 = OpLoad %uint %arrayidx Aligned 4 + %32 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 %33 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %34 = OpCompositeExtract %uint %33 0 - %35 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %32 %34 - OpStore %35 %31 Aligned 4 - OpBranch %15 - %15 = OpLabel + %call2 = OpCompositeExtract %uint %33 0 + %arrayidx3 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %32 %call2 + OpStore %arrayidx3 %31 Aligned 4 + OpBranch %if_end + %if_end = OpLabel %36 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %37 = OpCompositeExtract %uint %36 0 - %38 = OpULessThanEqual %bool %37 %uint_10 - OpBranchConditional %38 %16 %17 - %16 = OpLabel - %39 = OpLoad %_ptr_Workgroup_uint %19 Aligned 4 + %call4 = OpCompositeExtract %uint %36 0 + %cmp5 = OpULessThanEqual %bool %call4 %uint_10 + OpBranchConditional %cmp5 %if_then6 %if_end11 + %if_then6 = OpLabel + %39 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 %40 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %41 = OpCompositeExtract %uint %40 0 - %42 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %39 %41 - %43 = OpLoad %uint %42 Aligned 4 - %44 = OpLoad %_ptr_Workgroup_uint %21 Aligned 4 + %call7 = OpCompositeExtract %uint %40 0 + %arrayidx8 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %39 %call7 + %43 = OpLoad %uint %arrayidx8 Aligned 4 + %44 = OpLoad %_ptr_Workgroup_uint %r_addr Aligned 4 %45 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %46 = OpCompositeExtract %uint %45 0 - %47 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %44 %46 - OpStore %47 %43 Aligned 4 - OpBranch %17 - %17 = OpLabel + %call9 = OpCompositeExtract %uint %45 0 + %arrayidx10 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %44 %call9 + OpStore %arrayidx10 %43 Aligned 4 + OpBranch %if_end11 + %if_end11 = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/races/pass/read_read.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/races/pass/read_read.spvasm index d79a389c6e..36c122557b 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/races/pass/read_read.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/races/pass/read_read.spvasm @@ -12,12 +12,27 @@ OpEntryPoint Kernel %9 "foo" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %p "p" + OpName %q "q" + OpName %r "r" + OpName %entry "entry" + OpName %p_addr "p.addr" + OpName %q_addr "q.addr" + OpName %r_addr "r.addr" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" + OpName %arrayidx2 "arrayidx2" + OpName %call3 "call3" + OpName %arrayidx4 "arrayidx4" + OpName %call5 "call5" + OpName %arrayidx6 "arrayidx6" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %15 Alignment 4 - OpDecorate %16 Alignment 4 - OpDecorate %17 Alignment 4 + OpDecorate %p_addr Alignment 4 + OpDecorate %q_addr Alignment 4 + OpDecorate %r_addr Alignment 4 %uint = OpTypeInt 32 0 %v3uint = OpTypeVector %uint 3 %_ptr_Input_v3uint = OpTypePointer Input %v3uint @@ -27,35 +42,35 @@ %_ptr_Function__ptr_Workgroup_uint = OpTypePointer Function %_ptr_Workgroup_uint %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_Workgroup_uint - %11 = OpFunctionParameter %_ptr_Workgroup_uint - %12 = OpFunctionParameter %_ptr_Workgroup_uint - %13 = OpLabel - %15 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %16 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %17 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - OpStore %15 %10 Aligned 4 - OpStore %16 %11 Aligned 4 - OpStore %17 %12 Aligned 4 - %18 = OpLoad %_ptr_Workgroup_uint %16 Aligned 4 + %p = OpFunctionParameter %_ptr_Workgroup_uint + %q = OpFunctionParameter %_ptr_Workgroup_uint + %r = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %q_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %r_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + OpStore %p_addr %p Aligned 4 + OpStore %q_addr %q Aligned 4 + OpStore %r_addr %r Aligned 4 + %18 = OpLoad %_ptr_Workgroup_uint %q_addr Aligned 4 %19 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %20 = OpCompositeExtract %uint %19 0 - %21 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %18 %20 - %22 = OpLoad %uint %21 Aligned 4 - %23 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 + %call = OpCompositeExtract %uint %19 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %18 %call + %22 = OpLoad %uint %arrayidx Aligned 4 + %23 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 %24 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %25 = OpCompositeExtract %uint %24 0 - %26 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %23 %25 - OpStore %26 %22 Aligned 4 - %27 = OpLoad %_ptr_Workgroup_uint %16 Aligned 4 + %call1 = OpCompositeExtract %uint %24 0 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %23 %call1 + OpStore %arrayidx2 %22 Aligned 4 + %27 = OpLoad %_ptr_Workgroup_uint %q_addr Aligned 4 %28 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %29 = OpCompositeExtract %uint %28 0 - %30 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %27 %29 - %31 = OpLoad %uint %30 Aligned 4 - %32 = OpLoad %_ptr_Workgroup_uint %17 Aligned 4 + %call3 = OpCompositeExtract %uint %28 0 + %arrayidx4 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %27 %call3 + %31 = OpLoad %uint %arrayidx4 Aligned 4 + %32 = OpLoad %_ptr_Workgroup_uint %r_addr Aligned 4 %33 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %34 = OpCompositeExtract %uint %33 0 - %35 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %32 %34 - OpStore %35 %31 Aligned 4 + %call5 = OpCompositeExtract %uint %33 0 + %arrayidx6 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %32 %call5 + OpStore %arrayidx6 %31 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/races_from_indirect_calls.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/races_from_indirect_calls.spvasm index 186895f8e5..d9edb5a661 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/races_from_indirect_calls.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/sourcelocation_tests/races_from_indirect_calls.spvasm @@ -13,9 +13,56 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" OpName %jazz "jazz" + OpName %x "x" + OpName %y "y" + OpName %z "z" + OpName %entry "entry" + OpName %x_addr "x.addr" + OpName %y_addr "y.addr" + OpName %z_addr "z.addr" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" + OpName %add "add" + OpName %arrayidx2 "arrayidx2" + OpName %add3 "add3" + OpName %call4 "call4" + OpName %add5 "add5" + OpName %arrayidx6 "arrayidx6" + OpName %add7 "add7" OpName %sim "sim" + OpName %x_0 "x" + OpName %b "b" + OpName %entry_0 "entry" + OpName %x_addr_0 "x.addr" + OpName %b_addr "b.addr" + OpName %call_0 "call" OpName %bar "bar" + OpName %a "a" + OpName %entry_1 "entry" + OpName %a_addr "a.addr" + OpName %call_1 "call" + OpName %arrayidx_0 "arrayidx" + OpName %call1_0 "call1" + OpName %add_0 "add" + OpName %arrayidx2_0 "arrayidx2" + OpName %call3 "call3" + OpName %add4 "add4" OpName %foo "foo" + OpName %p "p" + OpName %entry_2 "entry" + OpName %p_addr "p.addr" + OpName %call_2 "call" + OpName %call1_1 "call1" + OpName %arrayidx_1 "arrayidx" + OpName %p_0 "p" + OpName %entry_3 "entry" + OpName %p_addr_0 "p.addr" + OpName %call_3 "call" + OpName %call1_2 "call1" + OpName %call2 "call2" + OpName %add_1 "add" + OpName %arrayidx_2 "arrayidx" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %sim LinkageAttributes "sim" Export @@ -23,14 +70,14 @@ OpDecorate %bar LinkageAttributes "bar" Export OpDecorate %jazz LinkageAttributes "jazz" Export OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %14 Alignment 4 - OpDecorate %15 Alignment 4 - OpDecorate %16 Alignment 4 - OpDecorate %43 Alignment 4 - OpDecorate %44 Alignment 4 - OpDecorate %54 Alignment 4 - OpDecorate %73 Alignment 4 - OpDecorate %86 Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %y_addr Alignment 4 + OpDecorate %z_addr Alignment 4 + OpDecorate %x_addr_0 Alignment 4 + OpDecorate %b_addr Alignment 4 + OpDecorate %a_addr Alignment 4 + OpDecorate %p_addr Alignment 4 + OpDecorate %p_addr_0 Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 @@ -47,100 +94,100 @@ %82 = OpTypeFunction %void %_ptr_Workgroup_uint %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %jazz = OpFunction %uint DontInline %7 - %9 = OpFunctionParameter %_ptr_Workgroup_uint - %10 = OpFunctionParameter %_ptr_Workgroup_uint - %11 = OpFunctionParameter %_ptr_Workgroup_uint - %12 = OpLabel - %14 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %15 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %16 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - OpStore %14 %9 Aligned 4 - OpStore %15 %10 Aligned 4 - OpStore %16 %11 Aligned 4 - %17 = OpLoad %_ptr_Workgroup_uint %14 Aligned 4 + %x = OpFunctionParameter %_ptr_Workgroup_uint + %y = OpFunctionParameter %_ptr_Workgroup_uint + %z = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %x_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %y_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %z_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + OpStore %x_addr %x Aligned 4 + OpStore %y_addr %y Aligned 4 + OpStore %z_addr %z Aligned 4 + %17 = OpLoad %_ptr_Workgroup_uint %x_addr Aligned 4 %18 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %19 = OpCompositeExtract %uint %18 0 - %20 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %17 %19 - %21 = OpLoad %uint %20 Aligned 4 - %22 = OpLoad %_ptr_Workgroup_uint %15 Aligned 4 + %call = OpCompositeExtract %uint %18 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %17 %call + %21 = OpLoad %uint %arrayidx Aligned 4 + %22 = OpLoad %_ptr_Workgroup_uint %y_addr Aligned 4 %23 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %24 = OpCompositeExtract %uint %23 0 - %26 = OpIAdd %uint %24 %uint_1 - %27 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %22 %26 - %28 = OpLoad %uint %27 Aligned 4 - %29 = OpIAdd %uint %21 %28 - %30 = OpLoad %_ptr_Workgroup_uint %16 Aligned 4 + %call1 = OpCompositeExtract %uint %23 0 + %add = OpIAdd %uint %call1 %uint_1 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %22 %add + %28 = OpLoad %uint %arrayidx2 Aligned 4 + %add3 = OpIAdd %uint %21 %28 + %30 = OpLoad %_ptr_Workgroup_uint %z_addr Aligned 4 %31 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %32 = OpCompositeExtract %uint %31 0 - %33 = OpIAdd %uint %32 %uint_1 - %34 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %30 %33 - %35 = OpLoad %uint %34 Aligned 4 - %36 = OpIAdd %uint %29 %35 - OpReturnValue %36 + %call4 = OpCompositeExtract %uint %31 0 + %add5 = OpIAdd %uint %call4 %uint_1 + %arrayidx6 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %30 %add5 + %35 = OpLoad %uint %arrayidx6 Aligned 4 + %add7 = OpIAdd %uint %add3 %35 + OpReturnValue %add7 OpFunctionEnd %sim = OpFunction %uint DontInline %37 - %39 = OpFunctionParameter %uint - %40 = OpFunctionParameter %_ptr_Workgroup_uint - %41 = OpLabel - %43 = OpVariable %_ptr_Function_uint Function - %44 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - OpStore %43 %39 Aligned 4 - OpStore %44 %40 Aligned 4 - %45 = OpLoad %_ptr_Workgroup_uint %44 Aligned 4 - %46 = OpLoad %_ptr_Workgroup_uint %44 Aligned 4 - %47 = OpLoad %_ptr_Workgroup_uint %44 Aligned 4 - %48 = OpFunctionCall %uint %jazz %45 %46 %47 + %x_0 = OpFunctionParameter %uint + %b = OpFunctionParameter %_ptr_Workgroup_uint + %entry_0 = OpLabel + %x_addr_0 = OpVariable %_ptr_Function_uint Function + %b_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + OpStore %x_addr_0 %x_0 Aligned 4 + OpStore %b_addr %b Aligned 4 + %45 = OpLoad %_ptr_Workgroup_uint %b_addr Aligned 4 + %46 = OpLoad %_ptr_Workgroup_uint %b_addr Aligned 4 + %47 = OpLoad %_ptr_Workgroup_uint %b_addr Aligned 4 + %call_0 = OpFunctionCall %uint %jazz %45 %46 %47 OpReturnValue %uint_0 OpFunctionEnd %bar = OpFunction %uint DontInline %50 - %52 = OpFunctionParameter %_ptr_Workgroup_uint - %53 = OpLabel - %54 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - OpStore %54 %52 Aligned 4 - %55 = OpLoad %_ptr_Workgroup_uint %54 Aligned 4 + %a = OpFunctionParameter %_ptr_Workgroup_uint + %entry_1 = OpLabel + %a_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + OpStore %a_addr %a Aligned 4 + %55 = OpLoad %_ptr_Workgroup_uint %a_addr Aligned 4 %56 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %57 = OpCompositeExtract %uint %56 0 - %58 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %55 %57 - %59 = OpLoad %uint %58 Aligned 4 - %60 = OpLoad %_ptr_Workgroup_uint %54 Aligned 4 + %call_1 = OpCompositeExtract %uint %56 0 + %arrayidx_0 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %55 %call_1 + %59 = OpLoad %uint %arrayidx_0 Aligned 4 + %60 = OpLoad %_ptr_Workgroup_uint %a_addr Aligned 4 %61 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %62 = OpCompositeExtract %uint %61 0 - %64 = OpIAdd %uint %62 %uint_2 - %65 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %60 %64 - %66 = OpLoad %uint %65 Aligned 4 - %67 = OpLoad %_ptr_Workgroup_uint %54 Aligned 4 - %68 = OpFunctionCall %uint %sim %66 %67 - %69 = OpIAdd %uint %59 %68 - OpReturnValue %69 + %call1_0 = OpCompositeExtract %uint %61 0 + %add_0 = OpIAdd %uint %call1_0 %uint_2 +%arrayidx2_0 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %60 %add_0 + %66 = OpLoad %uint %arrayidx2_0 Aligned 4 + %67 = OpLoad %_ptr_Workgroup_uint %a_addr Aligned 4 + %call3 = OpFunctionCall %uint %sim %66 %67 + %add4 = OpIAdd %uint %59 %call3 + OpReturnValue %add4 OpFunctionEnd %foo = OpFunction %uint DontInline %50 - %71 = OpFunctionParameter %_ptr_Workgroup_uint - %72 = OpLabel - %73 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - OpStore %73 %71 Aligned 4 - %74 = OpLoad %_ptr_Workgroup_uint %73 Aligned 4 - %75 = OpFunctionCall %uint %bar %74 - %76 = OpLoad %_ptr_Workgroup_uint %73 Aligned 4 + %p = OpFunctionParameter %_ptr_Workgroup_uint + %entry_2 = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + OpStore %p_addr %p Aligned 4 + %74 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 + %call_2 = OpFunctionCall %uint %bar %74 + %76 = OpLoad %_ptr_Workgroup_uint %p_addr Aligned 4 %77 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %78 = OpCompositeExtract %uint %77 0 - %79 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %76 %78 - %80 = OpLoad %uint %79 Aligned 4 + %call1_1 = OpCompositeExtract %uint %77 0 + %arrayidx_1 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %76 %call1_1 + %80 = OpLoad %uint %arrayidx_1 Aligned 4 OpReturnValue %80 OpFunctionEnd %83 = OpFunction %void DontInline %82 - %84 = OpFunctionParameter %_ptr_Workgroup_uint - %85 = OpLabel - %86 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - OpStore %86 %84 Aligned 4 - %87 = OpLoad %_ptr_Workgroup_uint %86 Aligned 4 - %88 = OpFunctionCall %uint %foo %87 + %p_0 = OpFunctionParameter %_ptr_Workgroup_uint + %entry_3 = OpLabel + %p_addr_0 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + OpStore %p_addr_0 %p_0 Aligned 4 + %87 = OpLoad %_ptr_Workgroup_uint %p_addr_0 Aligned 4 + %call_3 = OpFunctionCall %uint %foo %87 %89 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %90 = OpCompositeExtract %uint %89 0 - %91 = OpLoad %_ptr_Workgroup_uint %86 Aligned 4 + %call1_2 = OpCompositeExtract %uint %89 0 + %91 = OpLoad %_ptr_Workgroup_uint %p_addr_0 Aligned 4 %92 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %93 = OpCompositeExtract %uint %92 0 - %94 = OpIAdd %uint %93 %uint_1 - %95 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %91 %94 - OpStore %95 %90 Aligned 4 + %call2 = OpCompositeExtract %uint %92 0 + %add_1 = OpIAdd %uint %call2 %uint_1 + %arrayidx_2 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %91 %add_1 + OpStore %arrayidx_2 %call1_2 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_2d_global_index_inference.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_2d_global_index_inference.spvasm index d5f1a91e06..0ce3920368 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_2d_global_index_inference.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_2d_global_index_inference.spvasm @@ -14,7 +14,47 @@ OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %__spirv_BuiltInGlobalSize "__spirv_BuiltInGlobalSize" OpName %bar "bar" + OpName %entry "entry" + OpName %call "call" OpName %baz "baz" + OpName %x "x" + OpName %entry_0 "entry" + OpName %x_addr "x.addr" + OpName %A "A" + OpName %B "B" + OpName %entry_1 "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %x_addr_i "x.addr.i" + OpName %A_addr "A.addr" + OpName %B_addr "B.addr" + OpName %gidX "gidX" + OpName %gidY "gidY" + OpName %globalSize "globalSize" + OpName %t "t" + OpName %i "i" + OpName %call_i "call.i" + OpName %call1 "call1" + OpName %call2 "call2" + OpName %call4 "call4" + OpName %mul "mul" + OpName %call5 "call5" + OpName %add "add" + OpName %cmp "cmp" + OpName %call6 "call6" + OpName %call7 "call7" + OpName %mul8 "mul8" + OpName %add9 "add9" + OpName %arrayidx "arrayidx" + OpName %add10 "add10" + OpName %mul11 "mul11" + OpName %add12 "add12" + OpName %arrayidx13 "arrayidx13" + OpName %arrayidx14 "arrayidx14" + OpName %inc "inc" + OpName %inc15 "inc15" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalSize BuiltIn GlobalSize OpDecorate %__spirv_BuiltInGlobalInvocationId Constant @@ -23,15 +63,15 @@ OpDecorate %baz LinkageAttributes "baz" Export OpDecorate %__spirv_BuiltInGlobalSize LinkageAttributes "__spirv_BuiltInGlobalSize" Import OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %17 Alignment 4 - OpDecorate %30 Alignment 4 - OpDecorate %32 Alignment 4 - OpDecorate %33 Alignment 4 - OpDecorate %34 Alignment 4 - OpDecorate %35 Alignment 4 - OpDecorate %36 Alignment 4 - OpDecorate %37 Alignment 4 - OpDecorate %38 Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %x_addr_i Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %B_addr Alignment 4 + OpDecorate %gidX Alignment 4 + OpDecorate %gidY Alignment 4 + OpDecorate %globalSize Alignment 4 + OpDecorate %t Alignment 4 + OpDecorate %i Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_100 = OpConstant %uint 100 @@ -50,90 +90,90 @@ %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInGlobalSize = OpVariable %_ptr_Input_v3uint Input %bar = OpFunction %uint Inline %7 - %9 = OpLabel + %entry = OpLabel %10 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %11 = OpCompositeExtract %uint %10 0 - OpReturnValue %11 + %call = OpCompositeExtract %uint %10 0 + OpReturnValue %call OpFunctionEnd %baz = OpFunction %uint Inline %12 - %14 = OpFunctionParameter %uint - %15 = OpLabel - %17 = OpVariable %_ptr_Function_uint Function - OpStore %17 %14 Aligned 4 - %18 = OpLoad %uint %17 Aligned 4 + %x = OpFunctionParameter %uint + %entry_0 = OpLabel + %x_addr = OpVariable %_ptr_Function_uint Function + OpStore %x_addr %x Aligned 4 + %18 = OpLoad %uint %x_addr Aligned 4 OpReturnValue %18 OpFunctionEnd %22 = OpFunction %void DontInline %21 - %23 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %24 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %25 = OpLabel - %30 = OpVariable %_ptr_Function_uint Function - %32 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %33 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %34 = OpVariable %_ptr_Function_uint Function - %35 = OpVariable %_ptr_Function_uint Function - %36 = OpVariable %_ptr_Function_uint Function - %37 = OpVariable %_ptr_Function_uint Function - %38 = OpVariable %_ptr_Function_uint Function - OpStore %32 %23 Aligned 4 - OpStore %33 %24 Aligned 4 + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %B = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_1 = OpLabel + %x_addr_i = OpVariable %_ptr_Function_uint Function + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %B_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %gidX = OpVariable %_ptr_Function_uint Function + %gidY = OpVariable %_ptr_Function_uint Function + %globalSize = OpVariable %_ptr_Function_uint Function + %t = OpVariable %_ptr_Function_uint Function + %i = OpVariable %_ptr_Function_uint Function + OpStore %A_addr %A Aligned 4 + OpStore %B_addr %B Aligned 4 %39 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %40 = OpCompositeExtract %uint %39 0 - OpStore %34 %40 Aligned 4 + %call_i = OpCompositeExtract %uint %39 0 + OpStore %gidX %call_i Aligned 4 %41 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %42 = OpCompositeExtract %uint %41 1 - OpStore %35 %42 Aligned 4 + %call1 = OpCompositeExtract %uint %41 1 + OpStore %gidY %call1 Aligned 4 %43 = OpLoad %v3uint %__spirv_BuiltInGlobalSize Aligned 16 - %44 = OpCompositeExtract %uint %43 0 - OpStore %30 %44 Aligned 4 - %45 = OpLoad %uint %30 Aligned 4 - OpStore %36 %45 Aligned 4 - %46 = OpLoad %uint %35 Aligned 4 + %call2 = OpCompositeExtract %uint %43 0 + OpStore %x_addr_i %call2 Aligned 4 + %45 = OpLoad %uint %x_addr_i Aligned 4 + OpStore %globalSize %45 Aligned 4 + %46 = OpLoad %uint %gidY Aligned 4 %47 = OpLoad %v3uint %__spirv_BuiltInGlobalSize Aligned 16 - %48 = OpCompositeExtract %uint %47 0 - %49 = OpIMul %uint %46 %48 + %call4 = OpCompositeExtract %uint %47 0 + %mul = OpIMul %uint %46 %call4 %50 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %51 = OpCompositeExtract %uint %50 0 - %52 = OpIAdd %uint %49 %51 - OpStore %37 %52 Aligned 4 - OpStore %38 %uint_0 Aligned 4 - OpBranch %26 - %26 = OpLabel - %54 = OpLoad %uint %38 Aligned 4 - %57 = OpSLessThan %bool %54 %uint_100 - OpBranchConditional %57 %27 %29 - %27 = OpLabel - %58 = OpLoad %_ptr_CrossWorkgroup_uint %33 Aligned 4 + %call5 = OpCompositeExtract %uint %50 0 + %add = OpIAdd %uint %mul %call5 + OpStore %t %add Aligned 4 + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %54 = OpLoad %uint %i Aligned 4 + %cmp = OpSLessThan %bool %54 %uint_100 + OpBranchConditional %cmp %for_body %for_end + %for_body = OpLabel + %58 = OpLoad %_ptr_CrossWorkgroup_uint %B_addr Aligned 4 %59 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %60 = OpCompositeExtract %uint %59 1 + %call6 = OpCompositeExtract %uint %59 1 %61 = OpLoad %v3uint %__spirv_BuiltInGlobalSize Aligned 16 - %62 = OpCompositeExtract %uint %61 0 - %63 = OpIMul %uint %60 %62 - %64 = OpLoad %uint %34 Aligned 4 - %65 = OpIAdd %uint %63 %64 - %66 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %58 %65 - %67 = OpLoad %uint %66 Aligned 4 - %69 = OpIAdd %uint %67 %uint_2 - %70 = OpLoad %_ptr_CrossWorkgroup_uint %32 Aligned 4 - %71 = OpLoad %uint %35 Aligned 4 - %72 = OpLoad %uint %36 Aligned 4 - %73 = OpIMul %uint %71 %72 - %74 = OpLoad %uint %34 Aligned 4 - %75 = OpIAdd %uint %73 %74 - %76 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %70 %75 - OpStore %76 %69 Aligned 4 - %77 = OpLoad %_ptr_CrossWorkgroup_uint %33 Aligned 4 - %78 = OpLoad %uint %37 Aligned 4 - %79 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %77 %78 - %80 = OpLoad %uint %79 Aligned 4 - %82 = OpIAdd %uint %80 %uint_1 - OpStore %79 %82 Aligned 4 - OpBranch %28 - %28 = OpLabel - %83 = OpLoad %uint %38 Aligned 4 - %84 = OpIAdd %uint %83 %uint_1 - OpStore %38 %84 Aligned 4 - OpBranch %26 - %29 = OpLabel + %call7 = OpCompositeExtract %uint %61 0 + %mul8 = OpIMul %uint %call6 %call7 + %64 = OpLoad %uint %gidX Aligned 4 + %add9 = OpIAdd %uint %mul8 %64 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %58 %add9 + %67 = OpLoad %uint %arrayidx Aligned 4 + %add10 = OpIAdd %uint %67 %uint_2 + %70 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 + %71 = OpLoad %uint %gidY Aligned 4 + %72 = OpLoad %uint %globalSize Aligned 4 + %mul11 = OpIMul %uint %71 %72 + %74 = OpLoad %uint %gidX Aligned 4 + %add12 = OpIAdd %uint %mul11 %74 + %arrayidx13 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %70 %add12 + OpStore %arrayidx13 %add10 Aligned 4 + %77 = OpLoad %_ptr_CrossWorkgroup_uint %B_addr Aligned 4 + %78 = OpLoad %uint %t Aligned 4 + %arrayidx14 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %77 %78 + %80 = OpLoad %uint %arrayidx14 Aligned 4 + %inc = OpIAdd %uint %80 %uint_1 + OpStore %arrayidx14 %inc Aligned 4 + OpBranch %for_inc + %for_inc = OpLabel + %83 = OpLoad %uint %i Aligned 4 + %inc15 = OpIAdd %uint %83 %uint_1 + OpStore %i %inc15 Aligned 4 + OpBranch %for_cond + %for_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_2d_local_index_inference.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_2d_local_index_inference.spvasm index 86d65052e7..afb95d4205 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_2d_local_index_inference.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_2d_local_index_inference.spvasm @@ -16,7 +16,43 @@ OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" OpName %__spirv_BuiltInWorkgroupSize "__spirv_BuiltInWorkgroupSize" OpName %bar "bar" + OpName %entry "entry" + OpName %call "call" OpName %baz "baz" + OpName %x "x" + OpName %entry_0 "entry" + OpName %x_addr "x.addr" + OpName %entry_1 "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %x_addr_i "x.addr.i" + OpName %tidX "tidX" + OpName %tidY "tidY" + OpName %localSize "localSize" + OpName %t "t" + OpName %i "i" + OpName %call_i "call.i" + OpName %call1 "call1" + OpName %call2 "call2" + OpName %call4 "call4" + OpName %mul "mul" + OpName %call5 "call5" + OpName %add "add" + OpName %cmp "cmp" + OpName %call6 "call6" + OpName %call7 "call7" + OpName %mul8 "mul8" + OpName %add9 "add9" + OpName %arrayidx "arrayidx" + OpName %add10 "add10" + OpName %mul11 "mul11" + OpName %add12 "add12" + OpName %arrayidx13 "arrayidx13" + OpName %arrayidx14 "arrayidx14" + OpName %inc "inc" + OpName %inc15 "inc15" OpDecorate %__spirv_BuiltInWorkgroupSize BuiltIn WorkgroupSize OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant @@ -27,13 +63,13 @@ OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import OpDecorate %foo_A Alignment 4 OpDecorate %foo_B Alignment 4 - OpDecorate %22 Alignment 4 - OpDecorate %32 Alignment 4 - OpDecorate %33 Alignment 4 - OpDecorate %34 Alignment 4 - OpDecorate %35 Alignment 4 - OpDecorate %36 Alignment 4 - OpDecorate %37 Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %x_addr_i Alignment 4 + OpDecorate %tidX Alignment 4 + OpDecorate %tidY Alignment 4 + OpDecorate %localSize Alignment 4 + OpDecorate %t Alignment 4 + OpDecorate %i Alignment 4 %uint = OpTypeInt 32 0 %uint_1024 = OpConstant %uint 1024 %uint_0 = OpConstant %uint 0 @@ -56,81 +92,81 @@ %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInWorkgroupSize = OpVariable %_ptr_Input_v3uint Input %bar = OpFunction %uint Inline %12 - %14 = OpLabel + %entry = OpLabel %15 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %16 = OpCompositeExtract %uint %15 0 - OpReturnValue %16 + %call = OpCompositeExtract %uint %15 0 + OpReturnValue %call OpFunctionEnd %baz = OpFunction %uint Inline %17 - %19 = OpFunctionParameter %uint - %20 = OpLabel - %22 = OpVariable %_ptr_Function_uint Function - OpStore %22 %19 Aligned 4 - %23 = OpLoad %uint %22 Aligned 4 + %x = OpFunctionParameter %uint + %entry_0 = OpLabel + %x_addr = OpVariable %_ptr_Function_uint Function + OpStore %x_addr %x Aligned 4 + %23 = OpLoad %uint %x_addr Aligned 4 OpReturnValue %23 OpFunctionEnd %26 = OpFunction %void DontInline %25 - %27 = OpLabel - %32 = OpVariable %_ptr_Function_uint Function - %33 = OpVariable %_ptr_Function_uint Function - %34 = OpVariable %_ptr_Function_uint Function - %35 = OpVariable %_ptr_Function_uint Function - %36 = OpVariable %_ptr_Function_uint Function - %37 = OpVariable %_ptr_Function_uint Function + %entry_1 = OpLabel + %x_addr_i = OpVariable %_ptr_Function_uint Function + %tidX = OpVariable %_ptr_Function_uint Function + %tidY = OpVariable %_ptr_Function_uint Function + %localSize = OpVariable %_ptr_Function_uint Function + %t = OpVariable %_ptr_Function_uint Function + %i = OpVariable %_ptr_Function_uint Function %38 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %39 = OpCompositeExtract %uint %38 0 - OpStore %33 %39 Aligned 4 + %call_i = OpCompositeExtract %uint %38 0 + OpStore %tidX %call_i Aligned 4 %40 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %41 = OpCompositeExtract %uint %40 1 - OpStore %34 %41 Aligned 4 + %call1 = OpCompositeExtract %uint %40 1 + OpStore %tidY %call1 Aligned 4 %42 = OpLoad %v3uint %__spirv_BuiltInWorkgroupSize Aligned 16 - %43 = OpCompositeExtract %uint %42 0 - OpStore %32 %43 Aligned 4 - %44 = OpLoad %uint %32 Aligned 4 - OpStore %35 %44 Aligned 4 - %45 = OpLoad %uint %34 Aligned 4 + %call2 = OpCompositeExtract %uint %42 0 + OpStore %x_addr_i %call2 Aligned 4 + %44 = OpLoad %uint %x_addr_i Aligned 4 + OpStore %localSize %44 Aligned 4 + %45 = OpLoad %uint %tidY Aligned 4 %46 = OpLoad %v3uint %__spirv_BuiltInWorkgroupSize Aligned 16 - %47 = OpCompositeExtract %uint %46 0 - %48 = OpIMul %uint %45 %47 + %call4 = OpCompositeExtract %uint %46 0 + %mul = OpIMul %uint %45 %call4 %49 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %50 = OpCompositeExtract %uint %49 0 - %51 = OpIAdd %uint %48 %50 - OpStore %36 %51 Aligned 4 - OpStore %37 %uint_0 Aligned 4 - OpBranch %28 - %28 = OpLabel - %53 = OpLoad %uint %37 Aligned 4 - %56 = OpSLessThan %bool %53 %uint_100 - OpBranchConditional %56 %29 %31 - %29 = OpLabel + %call5 = OpCompositeExtract %uint %49 0 + %add = OpIAdd %uint %mul %call5 + OpStore %t %add Aligned 4 + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %53 = OpLoad %uint %i Aligned 4 + %cmp = OpSLessThan %bool %53 %uint_100 + OpBranchConditional %cmp %for_body %for_end + %for_body = OpLabel %57 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %58 = OpCompositeExtract %uint %57 1 + %call6 = OpCompositeExtract %uint %57 1 %59 = OpLoad %v3uint %__spirv_BuiltInWorkgroupSize Aligned 16 - %60 = OpCompositeExtract %uint %59 0 - %61 = OpIMul %uint %58 %60 - %62 = OpLoad %uint %33 Aligned 4 - %63 = OpIAdd %uint %61 %62 - %65 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %foo_B %uint_0 %63 - %66 = OpLoad %uint %65 Aligned 4 - %68 = OpIAdd %uint %66 %uint_2 - %69 = OpLoad %uint %34 Aligned 4 - %70 = OpLoad %uint %35 Aligned 4 - %71 = OpIMul %uint %69 %70 - %72 = OpLoad %uint %33 Aligned 4 - %73 = OpIAdd %uint %71 %72 - %74 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %foo_A %uint_0 %73 - OpStore %74 %68 Aligned 4 - %75 = OpLoad %uint %36 Aligned 4 - %76 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %foo_B %uint_0 %75 - %77 = OpLoad %uint %76 Aligned 4 - %79 = OpIAdd %uint %77 %uint_1 - OpStore %76 %79 Aligned 4 - OpBranch %30 - %30 = OpLabel - %80 = OpLoad %uint %37 Aligned 4 - %81 = OpIAdd %uint %80 %uint_1 - OpStore %37 %81 Aligned 4 - OpBranch %28 - %31 = OpLabel + %call7 = OpCompositeExtract %uint %59 0 + %mul8 = OpIMul %uint %call6 %call7 + %62 = OpLoad %uint %tidX Aligned 4 + %add9 = OpIAdd %uint %mul8 %62 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %foo_B %uint_0 %add9 + %66 = OpLoad %uint %arrayidx Aligned 4 + %add10 = OpIAdd %uint %66 %uint_2 + %69 = OpLoad %uint %tidY Aligned 4 + %70 = OpLoad %uint %localSize Aligned 4 + %mul11 = OpIMul %uint %69 %70 + %72 = OpLoad %uint %tidX Aligned 4 + %add12 = OpIAdd %uint %mul11 %72 + %arrayidx13 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %foo_A %uint_0 %add12 + OpStore %arrayidx13 %add10 Aligned 4 + %75 = OpLoad %uint %t Aligned 4 + %arrayidx14 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %foo_B %uint_0 %75 + %77 = OpLoad %uint %arrayidx14 Aligned 4 + %inc = OpIAdd %uint %77 %uint_1 + OpStore %arrayidx14 %inc Aligned 4 + OpBranch %for_inc + %for_inc = OpLabel + %80 = OpLoad %uint %i Aligned 4 + %inc15 = OpIAdd %uint %80 %uint_1 + OpStore %i %inc15 Aligned 4 + OpBranch %for_cond + %for_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_2d_local_index_inference_2.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_2d_local_index_inference_2.spvasm index 1a5c8bb692..436fc7d3ad 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_2d_local_index_inference_2.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_2d_local_index_inference_2.spvasm @@ -15,7 +15,34 @@ OpName %foo_B "foo.B" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" OpName %bar "bar" + OpName %entry "entry" + OpName %call "call" OpName %baz "baz" + OpName %x "x" + OpName %entry_0 "entry" + OpName %x_addr "x.addr" + OpName %entry_1 "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %tidX "tidX" + OpName %tidY "tidY" + OpName %i "i" + OpName %call_i "call.i" + OpName %call1 "call1" + OpName %cmp "cmp" + OpName %call2 "call2" + OpName %arrayidx "arrayidx" + OpName %arrayidx3 "arrayidx3" + OpName %add "add" + OpName %arrayidx4 "arrayidx4" + OpName %arrayidx5 "arrayidx5" + OpName %arrayidx6 "arrayidx6" + OpName %call7 "call7" + OpName %arrayidx8 "arrayidx8" + OpName %inc "inc" + OpName %inc9 "inc9" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %bar LinkageAttributes "bar" Export @@ -23,10 +50,10 @@ OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import OpDecorate %foo_A Alignment 4 OpDecorate %foo_B Alignment 4 - OpDecorate %22 Alignment 4 - OpDecorate %32 Alignment 4 - OpDecorate %33 Alignment 4 - OpDecorate %34 Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %tidX Alignment 4 + OpDecorate %tidY Alignment 4 + OpDecorate %i Alignment 4 %uint = OpTypeInt 32 0 %uint_16 = OpConstant %uint 16 %uint_0 = OpConstant %uint 0 @@ -50,63 +77,63 @@ %foo_B = OpVariable %_ptr_Workgroup__arr__arr_uint_uint_16_uint_16 Workgroup %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %bar = OpFunction %uint Inline %12 - %14 = OpLabel + %entry = OpLabel %15 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %16 = OpCompositeExtract %uint %15 0 - OpReturnValue %16 + %call = OpCompositeExtract %uint %15 0 + OpReturnValue %call OpFunctionEnd %baz = OpFunction %uint Inline %17 - %19 = OpFunctionParameter %uint - %20 = OpLabel - %22 = OpVariable %_ptr_Function_uint Function - OpStore %22 %19 Aligned 4 - %23 = OpLoad %uint %22 Aligned 4 + %x = OpFunctionParameter %uint + %entry_0 = OpLabel + %x_addr = OpVariable %_ptr_Function_uint Function + OpStore %x_addr %x Aligned 4 + %23 = OpLoad %uint %x_addr Aligned 4 OpReturnValue %23 OpFunctionEnd %26 = OpFunction %void DontInline %25 - %27 = OpLabel - %32 = OpVariable %_ptr_Function_uint Function - %33 = OpVariable %_ptr_Function_uint Function - %34 = OpVariable %_ptr_Function_uint Function + %entry_1 = OpLabel + %tidX = OpVariable %_ptr_Function_uint Function + %tidY = OpVariable %_ptr_Function_uint Function + %i = OpVariable %_ptr_Function_uint Function %35 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %36 = OpCompositeExtract %uint %35 0 - OpStore %32 %36 Aligned 4 + %call_i = OpCompositeExtract %uint %35 0 + OpStore %tidX %call_i Aligned 4 %37 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %38 = OpCompositeExtract %uint %37 1 - OpStore %33 %38 Aligned 4 - OpStore %34 %uint_0 Aligned 4 - OpBranch %28 - %28 = OpLabel - %40 = OpLoad %uint %34 Aligned 4 - %43 = OpSLessThan %bool %40 %uint_100 - OpBranchConditional %43 %29 %31 - %29 = OpLabel + %call1 = OpCompositeExtract %uint %37 1 + OpStore %tidY %call1 Aligned 4 + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %40 = OpLoad %uint %i Aligned 4 + %cmp = OpSLessThan %bool %40 %uint_100 + OpBranchConditional %cmp %for_body %for_end + %for_body = OpLabel %44 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %45 = OpCompositeExtract %uint %44 1 - %47 = OpInBoundsPtrAccessChain %_ptr_Workgroup__arr_uint_uint_16 %foo_B %uint_0 %45 - %48 = OpLoad %uint %32 Aligned 4 - %50 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %47 %uint_0 %48 - %51 = OpLoad %uint %50 Aligned 4 - %53 = OpIAdd %uint %51 %uint_2 - %54 = OpLoad %uint %33 Aligned 4 - %55 = OpInBoundsPtrAccessChain %_ptr_Workgroup__arr_uint_uint_16 %foo_A %uint_0 %54 - %56 = OpLoad %uint %32 Aligned 4 - %57 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %55 %uint_0 %56 - OpStore %57 %53 Aligned 4 - %58 = OpLoad %uint %33 Aligned 4 - %59 = OpInBoundsPtrAccessChain %_ptr_Workgroup__arr_uint_uint_16 %foo_B %uint_0 %58 + %call2 = OpCompositeExtract %uint %44 1 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup__arr_uint_uint_16 %foo_B %uint_0 %call2 + %48 = OpLoad %uint %tidX Aligned 4 + %arrayidx3 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %arrayidx %uint_0 %48 + %51 = OpLoad %uint %arrayidx3 Aligned 4 + %add = OpIAdd %uint %51 %uint_2 + %54 = OpLoad %uint %tidY Aligned 4 + %arrayidx4 = OpInBoundsPtrAccessChain %_ptr_Workgroup__arr_uint_uint_16 %foo_A %uint_0 %54 + %56 = OpLoad %uint %tidX Aligned 4 + %arrayidx5 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %arrayidx4 %uint_0 %56 + OpStore %arrayidx5 %add Aligned 4 + %58 = OpLoad %uint %tidY Aligned 4 + %arrayidx6 = OpInBoundsPtrAccessChain %_ptr_Workgroup__arr_uint_uint_16 %foo_B %uint_0 %58 %60 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %61 = OpCompositeExtract %uint %60 0 - %62 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %59 %uint_0 %61 - %63 = OpLoad %uint %62 Aligned 4 - %65 = OpIAdd %uint %63 %uint_1 - OpStore %62 %65 Aligned 4 - OpBranch %30 - %30 = OpLabel - %66 = OpLoad %uint %34 Aligned 4 - %67 = OpIAdd %uint %66 %uint_1 - OpStore %34 %67 Aligned 4 - OpBranch %28 - %31 = OpLabel + %call7 = OpCompositeExtract %uint %60 0 + %arrayidx8 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %arrayidx6 %uint_0 %call7 + %63 = OpLoad %uint %arrayidx8 Aligned 4 + %inc = OpIAdd %uint %63 %uint_1 + OpStore %arrayidx8 %inc Aligned 4 + OpBranch %for_inc + %for_inc = OpLabel + %66 = OpLoad %uint %i Aligned 4 + %inc9 = OpIAdd %uint %66 %uint_1 + OpStore %i %inc9 Aligned 4 + OpBranch %for_cond + %for_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_address_of_bug.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_address_of_bug.spvasm index e50731b4be..d0a4d89571 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_address_of_bug.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_address_of_bug.spvasm @@ -11,8 +11,12 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %4 "foo" OpSource OpenCL_C 200000 - OpDecorate %9 Alignment 4 - OpDecorate %11 Alignment 4 + OpName %entry "entry" + OpName %p "p" + OpName %a "a" + OpName %a_ascast "a.ascast" + OpDecorate %p Alignment 4 + OpDecorate %a Alignment 4 %uint = OpTypeInt 32 0 %void = OpTypeVoid %3 = OpTypeFunction %void @@ -20,10 +24,10 @@ %_ptr_Function__ptr_Generic_uint = OpTypePointer Function %_ptr_Generic_uint %_ptr_Function_uint = OpTypePointer Function %uint %4 = OpFunction %void DontInline %3 - %5 = OpLabel - %9 = OpVariable %_ptr_Function__ptr_Generic_uint Function - %11 = OpVariable %_ptr_Function_uint Function - %12 = OpPtrCastToGeneric %_ptr_Generic_uint %11 - OpStore %9 %12 Aligned 4 + %entry = OpLabel + %p = OpVariable %_ptr_Function__ptr_Generic_uint Function + %a = OpVariable %_ptr_Function_uint Function + %a_ascast = OpPtrCastToGeneric %_ptr_Generic_uint %a + OpStore %p %a_ascast Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_for_benign_read_write_bug.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_for_benign_read_write_bug.spvasm index 57c529cba4..59217d6fb1 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_for_benign_read_write_bug.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_for_benign_read_write_bug.spvasm @@ -11,7 +11,12 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %6 "foo" OpSource OpenCL_C 200000 - OpDecorate %10 Alignment 4 + OpName %p "p" + OpName %entry "entry" + OpName %p_addr "p.addr" + OpName %arrayidx "arrayidx" + OpName %inc "inc" + OpDecorate %p_addr Alignment 4 %ushort = OpTypeInt 16 0 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 @@ -21,14 +26,14 @@ %5 = OpTypeFunction %void %_ptr_Workgroup_ushort %_ptr_Function__ptr_Workgroup_ushort = OpTypePointer Function %_ptr_Workgroup_ushort %6 = OpFunction %void DontInline %5 - %7 = OpFunctionParameter %_ptr_Workgroup_ushort - %8 = OpLabel - %10 = OpVariable %_ptr_Function__ptr_Workgroup_ushort Function - OpStore %10 %7 Aligned 4 - %11 = OpLoad %_ptr_Workgroup_ushort %10 Aligned 4 - %14 = OpInBoundsPtrAccessChain %_ptr_Workgroup_ushort %11 %uint_0 - %15 = OpLoad %ushort %14 Aligned 2 - %17 = OpIAdd %ushort %15 %ushort_1 - OpStore %14 %17 Aligned 2 + %p = OpFunctionParameter %_ptr_Workgroup_ushort + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_Workgroup_ushort Function + OpStore %p_addr %p Aligned 4 + %11 = OpLoad %_ptr_Workgroup_ushort %p_addr Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_ushort %11 %uint_0 + %15 = OpLoad %ushort %arrayidx Aligned 2 + %inc = OpIAdd %ushort %15 %ushort_1 + OpStore %arrayidx %inc Aligned 2 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_for_ssa_bug.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_for_ssa_bug.spvasm index 38ebe9fc39..e4a550d5e0 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_for_ssa_bug.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_for_ssa_bug.spvasm @@ -12,11 +12,28 @@ OpEntryPoint Kernel %9 "foo" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %A "A" + OpName %entry "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %A_addr "A.addr" + OpName %k "k" + OpName %cmp "cmp" + OpName %call "call" + OpName %cmp1 "cmp1" + OpName %add "add" + OpName %call2 "call2" + OpName %arrayidx "arrayidx" + OpName %inc "inc" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %19 Alignment 4 - OpDecorate %21 Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %k Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_8 = OpConstant %uint 8 @@ -33,39 +50,39 @@ %bool = OpTypeBool %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_Workgroup_uint - %11 = OpLabel - %19 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %21 = OpVariable %_ptr_Function_uint Function - OpStore %19 %10 Aligned 4 - OpStore %21 %uint_0 Aligned 4 - OpBranch %12 - %12 = OpLabel - %23 = OpLoad %uint %21 Aligned 4 - %26 = OpULessThan %bool %23 %uint_8 - OpBranchConditional %26 %13 %17 - %13 = OpLabel + %A = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %k = OpVariable %_ptr_Function_uint Function + OpStore %A_addr %A Aligned 4 + OpStore %k %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %23 = OpLoad %uint %k Aligned 4 + %cmp = OpULessThan %bool %23 %uint_8 + OpBranchConditional %cmp %for_body %for_end + %for_body = OpLabel %27 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %28 = OpCompositeExtract %uint %27 0 - %29 = OpIEqual %bool %28 %uint_0 - OpBranchConditional %29 %14 %15 - %14 = OpLabel - %30 = OpLoad %uint %21 Aligned 4 - %31 = OpIAdd %uint %uint_0 %30 - %32 = OpLoad %_ptr_Workgroup_uint %19 Aligned 4 + %call = OpCompositeExtract %uint %27 0 + %cmp1 = OpIEqual %bool %call %uint_0 + OpBranchConditional %cmp1 %if_then %if_end + %if_then = OpLabel + %30 = OpLoad %uint %k Aligned 4 + %add = OpIAdd %uint %uint_0 %30 + %32 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 %33 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %34 = OpCompositeExtract %uint %33 0 - %35 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %32 %34 - OpStore %35 %31 Aligned 4 - OpBranch %15 - %15 = OpLabel + %call2 = OpCompositeExtract %uint %33 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %32 %call2 + OpStore %arrayidx %add Aligned 4 + OpBranch %if_end + %if_end = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_272 - OpBranch %16 - %16 = OpLabel - %38 = OpLoad %uint %21 Aligned 4 - %40 = OpIAdd %uint %38 %uint_1 - OpStore %21 %40 Aligned 4 - OpBranch %12 - %17 = OpLabel + OpBranch %for_inc + %for_inc = OpLabel + %38 = OpLoad %uint %k Aligned 4 + %inc = OpIAdd %uint %38 %uint_1 + OpStore %k %inc Aligned 4 + OpBranch %for_cond + %for_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_global_id_inference.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_global_id_inference.spvasm index 783be73fa4..08af5534bf 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_global_id_inference.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_global_id_inference.spvasm @@ -15,6 +15,32 @@ OpName %__spirv_BuiltInWorkgroupId "__spirv_BuiltInWorkgroupId" OpName %__spirv_BuiltInWorkgroupSize "__spirv_BuiltInWorkgroupSize" OpName %bar "bar" + OpName %entry "entry" + OpName %call "call" + OpName %A "A" + OpName %B "B" + OpName %entry_0 "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %A_addr "A.addr" + OpName %B_addr "B.addr" + OpName %tid "tid" + OpName %gidx "gidx" + OpName %i "i" + OpName %call_i "call.i" + OpName %call1 "call1" + OpName %call2 "call2" + OpName %mul "mul" + OpName %add "add" + OpName %cmp "cmp" + OpName %arrayidx "arrayidx" + OpName %add3 "add3" + OpName %arrayidx4 "arrayidx4" + OpName %arrayidx5 "arrayidx5" + OpName %inc "inc" + OpName %inc6 "inc6" OpDecorate %__spirv_BuiltInWorkgroupSize BuiltIn WorkgroupSize OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId @@ -25,11 +51,11 @@ OpDecorate %__spirv_BuiltInWorkgroupId LinkageAttributes "__spirv_BuiltInWorkgroupId" Import OpDecorate %__spirv_BuiltInWorkgroupSize LinkageAttributes "__spirv_BuiltInWorkgroupSize" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %25 Alignment 4 - OpDecorate %26 Alignment 4 - OpDecorate %28 Alignment 4 - OpDecorate %29 Alignment 4 - OpDecorate %30 Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %B_addr Alignment 4 + OpDecorate %tid Alignment 4 + OpDecorate %gidx Alignment 4 + OpDecorate %i Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_100 = OpConstant %uint 100 @@ -48,61 +74,61 @@ %__spirv_BuiltInWorkgroupId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInWorkgroupSize = OpVariable %_ptr_Input_v3uint Input %bar = OpFunction %uint Inline %8 - %10 = OpLabel + %entry = OpLabel %11 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %12 = OpCompositeExtract %uint %11 0 - OpReturnValue %12 + %call = OpCompositeExtract %uint %11 0 + OpReturnValue %call OpFunctionEnd %16 = OpFunction %void DontInline %15 - %17 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %18 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %19 = OpLabel - %25 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %26 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %28 = OpVariable %_ptr_Function_uint Function - %29 = OpVariable %_ptr_Function_uint Function - %30 = OpVariable %_ptr_Function_uint Function - OpStore %25 %17 Aligned 4 - OpStore %26 %18 Aligned 4 + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %B = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry_0 = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %B_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %tid = OpVariable %_ptr_Function_uint Function + %gidx = OpVariable %_ptr_Function_uint Function + %i = OpVariable %_ptr_Function_uint Function + OpStore %A_addr %A Aligned 4 + OpStore %B_addr %B Aligned 4 %31 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %32 = OpCompositeExtract %uint %31 0 - OpStore %28 %32 Aligned 4 + %call_i = OpCompositeExtract %uint %31 0 + OpStore %tid %call_i Aligned 4 %33 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %34 = OpCompositeExtract %uint %33 0 + %call1 = OpCompositeExtract %uint %33 0 %35 = OpLoad %v3uint %__spirv_BuiltInWorkgroupSize Aligned 16 - %36 = OpCompositeExtract %uint %35 0 - %37 = OpIMul %uint %34 %36 - %38 = OpLoad %uint %28 Aligned 4 - %39 = OpIAdd %uint %37 %38 - OpStore %29 %39 Aligned 4 - OpStore %30 %uint_0 Aligned 4 - OpBranch %20 - %20 = OpLabel - %41 = OpLoad %uint %30 Aligned 4 - %44 = OpSLessThan %bool %41 %uint_100 - OpBranchConditional %44 %21 %23 - %21 = OpLabel - %45 = OpLoad %_ptr_CrossWorkgroup_uint %26 Aligned 4 - %46 = OpLoad %uint %29 Aligned 4 - %47 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %45 %46 - %48 = OpLoad %uint %47 Aligned 4 - %50 = OpIAdd %uint %48 %uint_2 - %51 = OpLoad %_ptr_CrossWorkgroup_uint %25 Aligned 4 - %52 = OpLoad %uint %29 Aligned 4 - %53 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %51 %52 - OpStore %53 %50 Aligned 4 - %54 = OpLoad %_ptr_CrossWorkgroup_uint %26 Aligned 4 - %55 = OpLoad %uint %29 Aligned 4 - %56 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %54 %55 - %57 = OpLoad %uint %56 Aligned 4 - %59 = OpIAdd %uint %57 %uint_1 - OpStore %56 %59 Aligned 4 - OpBranch %22 - %22 = OpLabel - %60 = OpLoad %uint %30 Aligned 4 - %61 = OpIAdd %uint %60 %uint_1 - OpStore %30 %61 Aligned 4 - OpBranch %20 - %23 = OpLabel + %call2 = OpCompositeExtract %uint %35 0 + %mul = OpIMul %uint %call1 %call2 + %38 = OpLoad %uint %tid Aligned 4 + %add = OpIAdd %uint %mul %38 + OpStore %gidx %add Aligned 4 + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %41 = OpLoad %uint %i Aligned 4 + %cmp = OpSLessThan %bool %41 %uint_100 + OpBranchConditional %cmp %for_body %for_end + %for_body = OpLabel + %45 = OpLoad %_ptr_CrossWorkgroup_uint %B_addr Aligned 4 + %46 = OpLoad %uint %gidx Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %45 %46 + %48 = OpLoad %uint %arrayidx Aligned 4 + %add3 = OpIAdd %uint %48 %uint_2 + %51 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 + %52 = OpLoad %uint %gidx Aligned 4 + %arrayidx4 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %51 %52 + OpStore %arrayidx4 %add3 Aligned 4 + %54 = OpLoad %_ptr_CrossWorkgroup_uint %B_addr Aligned 4 + %55 = OpLoad %uint %gidx Aligned 4 + %arrayidx5 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %54 %55 + %57 = OpLoad %uint %arrayidx5 Aligned 4 + %inc = OpIAdd %uint %57 %uint_1 + OpStore %arrayidx5 %inc Aligned 4 + OpBranch %for_inc + %for_inc = OpLabel + %60 = OpLoad %uint %i Aligned 4 + %inc6 = OpIAdd %uint %60 %uint_1 + OpStore %i %inc6 Aligned 4 + OpBranch %for_cond + %for_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_line_number_problem.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_line_number_problem.spvasm index cd68819991..1620011991 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_line_number_problem.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_line_number_problem.spvasm @@ -13,15 +13,42 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInWorkgroupSize "__spirv_BuiltInWorkgroupSize" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %A "A" + OpName %entry "entry" + OpName %while_cond "while.cond" + OpName %while_body "while.body" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %if_then6 "if.then6" + OpName %if_end11 "if.end11" + OpName %while_end "while.end" + OpName %A_addr "A.addr" + OpName %temp "temp" + OpName %i "i" + OpName %call "call" + OpName %cmp "cmp" + OpName %call1 "call1" + OpName %cmp2 "cmp2" + OpName %call3 "call3" + OpName %sub "sub" + OpName %arrayidx "arrayidx" + OpName %call4 "call4" + OpName %cmp5 "cmp5" + OpName %call7 "call7" + OpName %arrayidx8 "arrayidx8" + OpName %add "add" + OpName %call9 "call9" + OpName %arrayidx10 "arrayidx10" + OpName %mul "mul" OpDecorate %__spirv_BuiltInWorkgroupSize BuiltIn WorkgroupSize OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInWorkgroupSize Constant OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInWorkgroupSize LinkageAttributes "__spirv_BuiltInWorkgroupSize" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %21 Alignment 4 - OpDecorate %23 Alignment 4 - OpDecorate %24 Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %temp Alignment 4 + OpDecorate %i Alignment 4 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_2 = OpConstant %uint 2 @@ -37,62 +64,62 @@ %__spirv_BuiltInWorkgroupSize = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %10 = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_Workgroup_uint - %12 = OpLabel - %21 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %23 = OpVariable %_ptr_Function_uint Function - %24 = OpVariable %_ptr_Function_uint Function - OpStore %21 %11 Aligned 4 - OpStore %24 %uint_1 Aligned 4 - OpBranch %13 - %13 = OpLabel - %26 = OpLoad %uint %24 Aligned 4 + %A = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %temp = OpVariable %_ptr_Function_uint Function + %i = OpVariable %_ptr_Function_uint Function + OpStore %A_addr %A Aligned 4 + OpStore %i %uint_1 Aligned 4 + OpBranch %while_cond + %while_cond = OpLabel + %26 = OpLoad %uint %i Aligned 4 %27 = OpLoad %v3uint %__spirv_BuiltInWorkgroupSize Aligned 16 - %28 = OpCompositeExtract %uint %27 0 - %30 = OpULessThan %bool %26 %28 - OpBranchConditional %30 %14 %19 - %14 = OpLabel - %31 = OpLoad %uint %24 Aligned 4 + %call = OpCompositeExtract %uint %27 0 + %cmp = OpULessThan %bool %26 %call + OpBranchConditional %cmp %while_body %while_end + %while_body = OpLabel + %31 = OpLoad %uint %i Aligned 4 %32 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %33 = OpCompositeExtract %uint %32 0 - %34 = OpULessThan %bool %31 %33 - OpBranchConditional %34 %15 %16 - %15 = OpLabel - %35 = OpLoad %_ptr_Workgroup_uint %21 Aligned 4 + %call1 = OpCompositeExtract %uint %32 0 + %cmp2 = OpULessThan %bool %31 %call1 + OpBranchConditional %cmp2 %if_then %if_end + %if_then = OpLabel + %35 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 %36 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %37 = OpCompositeExtract %uint %36 0 - %38 = OpLoad %uint %24 Aligned 4 - %39 = OpISub %uint %37 %38 - %40 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %35 %39 - %41 = OpLoad %uint %40 Aligned 4 - OpStore %23 %41 Aligned 4 - OpBranch %16 - %16 = OpLabel + %call3 = OpCompositeExtract %uint %36 0 + %38 = OpLoad %uint %i Aligned 4 + %sub = OpISub %uint %call3 %38 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %35 %sub + %41 = OpLoad %uint %arrayidx Aligned 4 + OpStore %temp %41 Aligned 4 + OpBranch %if_end + %if_end = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_272 - %44 = OpLoad %uint %24 Aligned 4 + %44 = OpLoad %uint %i Aligned 4 %45 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %46 = OpCompositeExtract %uint %45 0 - %47 = OpULessThan %bool %44 %46 - OpBranchConditional %47 %17 %18 - %17 = OpLabel - %48 = OpLoad %_ptr_Workgroup_uint %21 Aligned 4 + %call4 = OpCompositeExtract %uint %45 0 + %cmp5 = OpULessThan %bool %44 %call4 + OpBranchConditional %cmp5 %if_then6 %if_end11 + %if_then6 = OpLabel + %48 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 %49 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %50 = OpCompositeExtract %uint %49 0 - %51 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %48 %50 - %52 = OpLoad %uint %51 Aligned 4 - %53 = OpLoad %uint %23 Aligned 4 - %54 = OpIAdd %uint %52 %53 - %55 = OpLoad %_ptr_Workgroup_uint %21 Aligned 4 + %call7 = OpCompositeExtract %uint %49 0 + %arrayidx8 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %48 %call7 + %52 = OpLoad %uint %arrayidx8 Aligned 4 + %53 = OpLoad %uint %temp Aligned 4 + %add = OpIAdd %uint %52 %53 + %55 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 %56 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %57 = OpCompositeExtract %uint %56 0 - %58 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %55 %57 - OpStore %58 %54 Aligned 4 - OpBranch %18 - %18 = OpLabel - %59 = OpLoad %uint %24 Aligned 4 - %60 = OpIMul %uint %59 %uint_2 - OpStore %24 %60 Aligned 4 - OpBranch %13 - %19 = OpLabel + %call9 = OpCompositeExtract %uint %56 0 + %arrayidx10 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %55 %call9 + OpStore %arrayidx10 %add Aligned 4 + OpBranch %if_end11 + %if_end11 = OpLabel + %59 = OpLoad %uint %i Aligned 4 + %mul = OpIMul %uint %59 %uint_2 + OpStore %i %mul Aligned 4 + OpBranch %while_cond + %while_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_local_id_inference.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_local_id_inference.spvasm index 0ce7785509..32af94ddbe 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_local_id_inference.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_local_id_inference.spvasm @@ -12,12 +12,27 @@ OpEntryPoint Kernel %9 "foo" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %A "A" + OpName %entry "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %A_addr "A.addr" + OpName %tid "tid" + OpName %i "i" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %cmp "cmp" + OpName %arrayidx1 "arrayidx1" + OpName %inc "inc" + OpName %inc2 "inc2" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 - OpDecorate %20 Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %tid Alignment 4 + OpDecorate %i Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_100 = OpConstant %uint 100 @@ -32,38 +47,38 @@ %bool = OpTypeBool %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_Workgroup_uint - %11 = OpLabel - %17 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %19 = OpVariable %_ptr_Function_uint Function - %20 = OpVariable %_ptr_Function_uint Function - OpStore %17 %10 Aligned 4 + %A = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %tid = OpVariable %_ptr_Function_uint Function + %i = OpVariable %_ptr_Function_uint Function + OpStore %A_addr %A Aligned 4 %21 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %22 = OpCompositeExtract %uint %21 0 - OpStore %19 %22 Aligned 4 - %23 = OpLoad %_ptr_Workgroup_uint %17 Aligned 4 - %24 = OpLoad %uint %19 Aligned 4 - %25 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %23 %24 - OpStore %25 %uint_0 Aligned 4 - OpStore %20 %uint_0 Aligned 4 - OpBranch %12 - %12 = OpLabel - %27 = OpLoad %uint %20 Aligned 4 - %30 = OpSLessThan %bool %27 %uint_100 - OpBranchConditional %30 %13 %15 - %13 = OpLabel - %31 = OpLoad %_ptr_Workgroup_uint %17 Aligned 4 - %32 = OpLoad %uint %19 Aligned 4 - %33 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %31 %32 - %34 = OpLoad %uint %33 Aligned 4 - %36 = OpIAdd %uint %34 %uint_1 - OpStore %33 %36 Aligned 4 - OpBranch %14 - %14 = OpLabel - %37 = OpLoad %uint %20 Aligned 4 - %38 = OpIAdd %uint %37 %uint_1 - OpStore %20 %38 Aligned 4 - OpBranch %12 - %15 = OpLabel + %call = OpCompositeExtract %uint %21 0 + OpStore %tid %call Aligned 4 + %23 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %24 = OpLoad %uint %tid Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %23 %24 + OpStore %arrayidx %uint_0 Aligned 4 + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %27 = OpLoad %uint %i Aligned 4 + %cmp = OpSLessThan %bool %27 %uint_100 + OpBranchConditional %cmp %for_body %for_end + %for_body = OpLabel + %31 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %32 = OpLoad %uint %tid Aligned 4 + %arrayidx1 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %31 %32 + %34 = OpLoad %uint %arrayidx1 Aligned 4 + %inc = OpIAdd %uint %34 %uint_1 + OpStore %arrayidx1 %inc Aligned 4 + OpBranch %for_inc + %for_inc = OpLabel + %37 = OpLoad %uint %i Aligned 4 + %inc2 = OpIAdd %uint %37 %uint_1 + OpStore %i %inc2 Aligned 4 + OpBranch %for_cond + %for_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_mod_invariants/global_reduce_strength.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_mod_invariants/global_reduce_strength.spvasm index c4d04b45b1..6dff60867d 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_mod_invariants/global_reduce_strength.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_mod_invariants/global_reduce_strength.spvasm @@ -13,18 +13,42 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %A "A" + OpName %B "B" + OpName %C "C" + OpName %entry "entry" + OpName %while_cond "while.cond" + OpName %while_body "while.body" + OpName %while_end "while.end" + OpName %A_addr "A.addr" + OpName %B_addr "B.addr" + OpName %C_addr "C.addr" + OpName %gid "gid" + OpName %i "i" + OpName %index "index" + OpName %call "call" + OpName %cmp "cmp" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" + OpName %call2 "call2" + OpName %add "add" + OpName %arrayidx3 "arrayidx3" + OpName %add4 "add4" + OpName %call5 "call5" + OpName %arrayidx6 "arrayidx6" + OpName %add7 "add7" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %19 Alignment 4 - OpDecorate %20 Alignment 4 - OpDecorate %21 Alignment 4 - OpDecorate %23 Alignment 4 - OpDecorate %24 Alignment 4 - OpDecorate %25 Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %B_addr Alignment 4 + OpDecorate %C_addr Alignment 4 + OpDecorate %gid Alignment 4 + OpDecorate %i Alignment 4 + OpDecorate %index Alignment 4 %uint = OpTypeInt 32 0 %uint_1024 = OpConstant %uint 1024 %uint_10 = OpConstant %uint 10 @@ -41,56 +65,56 @@ %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %10 = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %14 = OpLabel - %19 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %20 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %21 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %23 = OpVariable %_ptr_Function_uint Function - %24 = OpVariable %_ptr_Function_uint Function - %25 = OpVariable %_ptr_Function_uint Function - OpStore %19 %11 Aligned 4 - OpStore %20 %12 Aligned 4 - OpStore %21 %13 Aligned 4 + %A = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %B = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %C = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %B_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %C_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %gid = OpVariable %_ptr_Function_uint Function + %i = OpVariable %_ptr_Function_uint Function + %index = OpVariable %_ptr_Function_uint Function + OpStore %A_addr %A Aligned 4 + OpStore %B_addr %B Aligned 4 + OpStore %C_addr %C Aligned 4 %26 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %27 = OpCompositeExtract %uint %26 0 - OpStore %23 %27 Aligned 4 - %28 = OpLoad %uint %23 Aligned 4 - OpStore %24 %28 Aligned 4 - OpBranch %15 - %15 = OpLabel - %29 = OpLoad %uint %24 Aligned 4 - %32 = OpSLessThan %bool %29 %uint_1024 - OpBranchConditional %32 %16 %17 - %16 = OpLabel + %call = OpCompositeExtract %uint %26 0 + OpStore %gid %call Aligned 4 + %28 = OpLoad %uint %gid Aligned 4 + OpStore %i %28 Aligned 4 + OpBranch %while_cond + %while_cond = OpLabel + %29 = OpLoad %uint %i Aligned 4 + %cmp = OpSLessThan %bool %29 %uint_1024 + OpBranchConditional %cmp %while_body %while_end + %while_body = OpLabel %33 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %34 = OpCompositeExtract %uint %33 0 - %35 = OpLoad %_ptr_CrossWorkgroup_uint %19 Aligned 4 - %36 = OpLoad %uint %24 Aligned 4 - %37 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %35 %36 - OpStore %37 %34 Aligned 4 + %call1 = OpCompositeExtract %uint %33 0 + %35 = OpLoad %_ptr_CrossWorkgroup_uint %A_addr Aligned 4 + %36 = OpLoad %uint %i Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %35 %36 + OpStore %arrayidx %call1 Aligned 4 %38 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %39 = OpCompositeExtract %uint %38 0 - %40 = OpLoad %_ptr_CrossWorkgroup_uint %20 Aligned 4 - %41 = OpLoad %uint %24 Aligned 4 - %43 = OpIAdd %uint %uint_10 %41 - %44 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %40 %43 - OpStore %44 %39 Aligned 4 - %45 = OpLoad %uint %24 Aligned 4 - %47 = OpIAdd %uint %45 %uint_20 - OpStore %25 %47 Aligned 4 + %call2 = OpCompositeExtract %uint %38 0 + %40 = OpLoad %_ptr_CrossWorkgroup_uint %B_addr Aligned 4 + %41 = OpLoad %uint %i Aligned 4 + %add = OpIAdd %uint %uint_10 %41 + %arrayidx3 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %40 %add + OpStore %arrayidx3 %call2 Aligned 4 + %45 = OpLoad %uint %i Aligned 4 + %add4 = OpIAdd %uint %45 %uint_20 + OpStore %index %add4 Aligned 4 %48 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %49 = OpCompositeExtract %uint %48 0 - %50 = OpLoad %_ptr_CrossWorkgroup_uint %21 Aligned 4 - %51 = OpLoad %uint %25 Aligned 4 - %52 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %50 %51 - OpStore %52 %49 Aligned 4 - %53 = OpLoad %uint %24 Aligned 4 - %55 = OpIAdd %uint %53 %uint_256 - OpStore %24 %55 Aligned 4 - OpBranch %15 - %17 = OpLabel + %call5 = OpCompositeExtract %uint %48 0 + %50 = OpLoad %_ptr_CrossWorkgroup_uint %C_addr Aligned 4 + %51 = OpLoad %uint %index Aligned 4 + %arrayidx6 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %50 %51 + OpStore %arrayidx6 %call5 Aligned 4 + %53 = OpLoad %uint %i Aligned 4 + %add7 = OpIAdd %uint %53 %uint_256 + OpStore %i %add7 Aligned 4 + OpBranch %while_cond + %while_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_mod_invariants/local_direct.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_mod_invariants/local_direct.spvasm index 1f9c656dfa..dad5e11f4a 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_mod_invariants/local_direct.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_mod_invariants/local_direct.spvasm @@ -12,14 +12,42 @@ OpEntryPoint Kernel %10 "foo" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %A "A" + OpName %B "B" + OpName %C "C" + OpName %entry "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %A_addr "A.addr" + OpName %B_addr "B.addr" + OpName %C_addr "C.addr" + OpName %lid "lid" + OpName %i "i" + OpName %call "call" + OpName %cmp "cmp" + OpName %call1 "call1" + OpName %mul "mul" + OpName %add "add" + OpName %arrayidx "arrayidx" + OpName %mul2 "mul2" + OpName %call3 "call3" + OpName %add4 "add4" + OpName %arrayidx5 "arrayidx5" + OpName %call6 "call6" + OpName %mul7 "mul7" + OpName %add8 "add8" + OpName %arrayidx9 "arrayidx9" + OpName %inc "inc" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %20 Alignment 4 - OpDecorate %21 Alignment 4 - OpDecorate %23 Alignment 4 - OpDecorate %25 Alignment 4 - OpDecorate %26 Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %B_addr Alignment 4 + OpDecorate %C_addr Alignment 4 + OpDecorate %lid Alignment 4 + OpDecorate %i Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_1024 = OpConstant %uint 1024 @@ -37,59 +65,59 @@ %bool = OpTypeBool %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %10 = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_Workgroup_uint - %12 = OpFunctionParameter %_ptr_Workgroup_uint - %13 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %14 = OpLabel - %20 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %21 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %23 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %25 = OpVariable %_ptr_Function_uint Function - %26 = OpVariable %_ptr_Function_uint Function - OpStore %20 %11 Aligned 4 - OpStore %21 %12 Aligned 4 - OpStore %23 %13 Aligned 4 + %A = OpFunctionParameter %_ptr_Workgroup_uint + %B = OpFunctionParameter %_ptr_Workgroup_uint + %C = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %B_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %C_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %lid = OpVariable %_ptr_Function_uint Function + %i = OpVariable %_ptr_Function_uint Function + OpStore %A_addr %A Aligned 4 + OpStore %B_addr %B Aligned 4 + OpStore %C_addr %C Aligned 4 %27 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %28 = OpCompositeExtract %uint %27 0 - OpStore %25 %28 Aligned 4 - OpStore %26 %uint_0 Aligned 4 - OpBranch %15 - %15 = OpLabel - %30 = OpLoad %uint %26 Aligned 4 - %33 = OpSLessThan %bool %30 %uint_1024 - OpBranchConditional %33 %16 %18 - %16 = OpLabel + %call = OpCompositeExtract %uint %27 0 + OpStore %lid %call Aligned 4 + OpStore %i %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %30 = OpLoad %uint %i Aligned 4 + %cmp = OpSLessThan %bool %30 %uint_1024 + OpBranchConditional %cmp %for_body %for_end + %for_body = OpLabel %34 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %35 = OpCompositeExtract %uint %34 0 - %36 = OpLoad %_ptr_Workgroup_uint %20 Aligned 4 - %37 = OpLoad %uint %26 Aligned 4 - %39 = OpIMul %uint %37 %uint_256 - %40 = OpLoad %uint %25 Aligned 4 - %41 = OpIAdd %uint %39 %40 - %42 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %36 %41 - OpStore %42 %35 Aligned 4 - %43 = OpLoad %_ptr_Workgroup_uint %20 Aligned 4 - %44 = OpLoad %uint %26 Aligned 4 - %45 = OpIMul %uint %44 %uint_256 + %call1 = OpCompositeExtract %uint %34 0 + %36 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %37 = OpLoad %uint %i Aligned 4 + %mul = OpIMul %uint %37 %uint_256 + %40 = OpLoad %uint %lid Aligned 4 + %add = OpIAdd %uint %mul %40 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %36 %add + OpStore %arrayidx %call1 Aligned 4 + %43 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %44 = OpLoad %uint %i Aligned 4 + %mul2 = OpIMul %uint %44 %uint_256 %46 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %47 = OpCompositeExtract %uint %46 0 - %48 = OpIAdd %uint %45 %47 - %49 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %43 %48 - %50 = OpLoad %uint %49 Aligned 4 - %51 = OpLoad %_ptr_Workgroup_uint %21 Aligned 4 + %call3 = OpCompositeExtract %uint %46 0 + %add4 = OpIAdd %uint %mul2 %call3 + %arrayidx5 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %43 %add4 + %50 = OpLoad %uint %arrayidx5 Aligned 4 + %51 = OpLoad %_ptr_Workgroup_uint %B_addr Aligned 4 %52 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %53 = OpCompositeExtract %uint %52 0 - %54 = OpLoad %uint %26 Aligned 4 - %55 = OpIMul %uint %uint_256 %54 - %56 = OpIAdd %uint %53 %55 - %57 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %51 %56 - OpStore %57 %50 Aligned 4 - OpBranch %17 - %17 = OpLabel - %58 = OpLoad %uint %26 Aligned 4 - %60 = OpIAdd %uint %58 %uint_1 - OpStore %26 %60 Aligned 4 - OpBranch %15 - %18 = OpLabel + %call6 = OpCompositeExtract %uint %52 0 + %54 = OpLoad %uint %i Aligned 4 + %mul7 = OpIMul %uint %uint_256 %54 + %add8 = OpIAdd %uint %call6 %mul7 + %arrayidx9 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %51 %add8 + OpStore %arrayidx9 %50 Aligned 4 + OpBranch %for_inc + %for_inc = OpLabel + %58 = OpLoad %uint %i Aligned 4 + %inc = OpIAdd %uint %58 %uint_1 + OpStore %i %inc Aligned 4 + OpBranch %for_cond + %for_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_mod_invariants/local_reduce_strength.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_mod_invariants/local_reduce_strength.spvasm index cccb244e49..315f7ec186 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_mod_invariants/local_reduce_strength.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_mod_invariants/local_reduce_strength.spvasm @@ -13,17 +13,42 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" OpName %__spirv_BuiltInWorkgroupSize "__spirv_BuiltInWorkgroupSize" + OpName %A "A" + OpName %B "B" + OpName %C "C" + OpName %entry "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %A_addr "A.addr" + OpName %B_addr "B.addr" + OpName %C_addr "C.addr" + OpName %i "i" + OpName %index "index" + OpName %call "call" + OpName %cmp "cmp" + OpName %call1 "call1" + OpName %arrayidx "arrayidx" + OpName %call2 "call2" + OpName %add "add" + OpName %arrayidx3 "arrayidx3" + OpName %add4 "add4" + OpName %call5 "call5" + OpName %arrayidx6 "arrayidx6" + OpName %call7 "call7" + OpName %add8 "add8" OpDecorate %__spirv_BuiltInWorkgroupSize BuiltIn WorkgroupSize OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInWorkgroupSize Constant OpDecorate %__spirv_BuiltInWorkgroupSize LinkageAttributes "__spirv_BuiltInWorkgroupSize" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %20 Alignment 4 - OpDecorate %21 Alignment 4 - OpDecorate %22 Alignment 4 - OpDecorate %24 Alignment 4 - OpDecorate %25 Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %B_addr Alignment 4 + OpDecorate %C_addr Alignment 4 + OpDecorate %i Alignment 4 + OpDecorate %index Alignment 4 %uint = OpTypeInt 32 0 %uint_1024 = OpConstant %uint 1024 %uint_10 = OpConstant %uint 10 @@ -39,57 +64,57 @@ %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInWorkgroupSize = OpVariable %_ptr_Input_v3uint Input %10 = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_Workgroup_uint - %12 = OpFunctionParameter %_ptr_Workgroup_uint - %13 = OpFunctionParameter %_ptr_Workgroup_uint - %14 = OpLabel - %20 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %21 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %22 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %24 = OpVariable %_ptr_Function_uint Function - %25 = OpVariable %_ptr_Function_uint Function - OpStore %20 %11 Aligned 4 - OpStore %21 %12 Aligned 4 - OpStore %22 %13 Aligned 4 + %A = OpFunctionParameter %_ptr_Workgroup_uint + %B = OpFunctionParameter %_ptr_Workgroup_uint + %C = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %B_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %C_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %i = OpVariable %_ptr_Function_uint Function + %index = OpVariable %_ptr_Function_uint Function + OpStore %A_addr %A Aligned 4 + OpStore %B_addr %B Aligned 4 + OpStore %C_addr %C Aligned 4 %26 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %27 = OpCompositeExtract %uint %26 0 - OpStore %24 %27 Aligned 4 - OpBranch %15 - %15 = OpLabel - %28 = OpLoad %uint %24 Aligned 4 - %31 = OpSLessThan %bool %28 %uint_1024 - OpBranchConditional %31 %16 %18 - %16 = OpLabel + %call = OpCompositeExtract %uint %26 0 + OpStore %i %call Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %28 = OpLoad %uint %i Aligned 4 + %cmp = OpSLessThan %bool %28 %uint_1024 + OpBranchConditional %cmp %for_body %for_end + %for_body = OpLabel %32 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %33 = OpCompositeExtract %uint %32 0 - %34 = OpLoad %_ptr_Workgroup_uint %20 Aligned 4 - %35 = OpLoad %uint %24 Aligned 4 - %36 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %34 %35 - OpStore %36 %33 Aligned 4 + %call1 = OpCompositeExtract %uint %32 0 + %34 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %35 = OpLoad %uint %i Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %34 %35 + OpStore %arrayidx %call1 Aligned 4 %37 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %38 = OpCompositeExtract %uint %37 0 - %39 = OpLoad %_ptr_Workgroup_uint %21 Aligned 4 - %40 = OpLoad %uint %24 Aligned 4 - %42 = OpIAdd %uint %40 %uint_10 - %43 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %39 %42 - OpStore %43 %38 Aligned 4 - %44 = OpLoad %uint %24 Aligned 4 - %46 = OpIAdd %uint %44 %uint_20 - OpStore %25 %46 Aligned 4 + %call2 = OpCompositeExtract %uint %37 0 + %39 = OpLoad %_ptr_Workgroup_uint %B_addr Aligned 4 + %40 = OpLoad %uint %i Aligned 4 + %add = OpIAdd %uint %40 %uint_10 + %arrayidx3 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %39 %add + OpStore %arrayidx3 %call2 Aligned 4 + %44 = OpLoad %uint %i Aligned 4 + %add4 = OpIAdd %uint %44 %uint_20 + OpStore %index %add4 Aligned 4 %47 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %48 = OpCompositeExtract %uint %47 0 - %49 = OpLoad %_ptr_Workgroup_uint %22 Aligned 4 - %50 = OpLoad %uint %25 Aligned 4 - %51 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %49 %50 - OpStore %51 %48 Aligned 4 - OpBranch %17 - %17 = OpLabel + %call5 = OpCompositeExtract %uint %47 0 + %49 = OpLoad %_ptr_Workgroup_uint %C_addr Aligned 4 + %50 = OpLoad %uint %index Aligned 4 + %arrayidx6 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %49 %50 + OpStore %arrayidx6 %call5 Aligned 4 + OpBranch %for_inc + %for_inc = OpLabel %52 = OpLoad %v3uint %__spirv_BuiltInWorkgroupSize Aligned 16 - %53 = OpCompositeExtract %uint %52 0 - %54 = OpLoad %uint %24 Aligned 4 - %55 = OpIAdd %uint %54 %53 - OpStore %24 %55 Aligned 4 - OpBranch %15 - %18 = OpLabel + %call7 = OpCompositeExtract %uint %52 0 + %54 = OpLoad %uint %i Aligned 4 + %add8 = OpIAdd %uint %54 %call7 + OpStore %i %add8 Aligned 4 + OpBranch %for_cond + %for_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_part_load_store/load_ptr_and_int.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_part_load_store/load_ptr_and_int.spvasm index 9d7cca6fd6..1ab2c27384 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_part_load_store/load_ptr_and_int.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_part_load_store/load_ptr_and_int.spvasm @@ -13,11 +13,28 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %struct_a "struct.a" + OpName %q1 "q1" + OpName %q2 "q2" + OpName %entry "entry" + OpName %q1_addr "q1.addr" + OpName %q2_addr "q2.addr" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %i "i" + OpName %call1 "call1" + OpName %arrayidx2 "arrayidx2" + OpName %i3 "i3" + OpName %call4 "call4" + OpName %arrayidx5 "arrayidx5" + OpName %p "p" + OpName %call6 "call6" + OpName %arrayidx7 "arrayidx7" + OpName %p8 "p8" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %16 Alignment 4 - OpDecorate %17 Alignment 4 + OpDecorate %q1_addr Alignment 4 + OpDecorate %q2_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_1 = OpConstant %uint 1 @@ -32,36 +49,36 @@ %_ptr_CrossWorkgroup__ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %_ptr_CrossWorkgroup_uint %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %11 = OpFunction %void DontInline %10 - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_struct_a - %13 = OpFunctionParameter %_ptr_CrossWorkgroup_struct_a - %14 = OpLabel - %16 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_struct_a Function - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_struct_a Function - OpStore %16 %12 Aligned 4 - OpStore %17 %13 Aligned 4 - %18 = OpLoad %_ptr_CrossWorkgroup_struct_a %16 Aligned 4 + %q1 = OpFunctionParameter %_ptr_CrossWorkgroup_struct_a + %q2 = OpFunctionParameter %_ptr_CrossWorkgroup_struct_a + %entry = OpLabel + %q1_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_struct_a Function + %q2_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_struct_a Function + OpStore %q1_addr %q1 Aligned 4 + OpStore %q2_addr %q2 Aligned 4 + %18 = OpLoad %_ptr_CrossWorkgroup_struct_a %q1_addr Aligned 4 %19 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %20 = OpCompositeExtract %uint %19 0 - %21 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %18 %20 - %24 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %21 %uint_0 %uint_1 - %25 = OpLoad %uint %24 Aligned 4 - %26 = OpLoad %_ptr_CrossWorkgroup_struct_a %17 Aligned 4 + %call = OpCompositeExtract %uint %19 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %18 %call + %i = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %arrayidx %uint_0 %uint_1 + %25 = OpLoad %uint %i Aligned 4 + %26 = OpLoad %_ptr_CrossWorkgroup_struct_a %q2_addr Aligned 4 %27 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %28 = OpCompositeExtract %uint %27 0 - %29 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %26 %28 - %30 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %29 %uint_0 %uint_1 - OpStore %30 %25 Aligned 4 - %31 = OpLoad %_ptr_CrossWorkgroup_struct_a %16 Aligned 4 + %call1 = OpCompositeExtract %uint %27 0 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %26 %call1 + %i3 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %arrayidx2 %uint_0 %uint_1 + OpStore %i3 %25 Aligned 4 + %31 = OpLoad %_ptr_CrossWorkgroup_struct_a %q1_addr Aligned 4 %32 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %33 = OpCompositeExtract %uint %32 0 - %34 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %31 %33 - %36 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup__ptr_CrossWorkgroup_uint %34 %uint_0 %uint_0 - %37 = OpLoad %_ptr_CrossWorkgroup_uint %36 Aligned 4 - %38 = OpLoad %_ptr_CrossWorkgroup_struct_a %17 Aligned 4 + %call4 = OpCompositeExtract %uint %32 0 + %arrayidx5 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %31 %call4 + %p = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup__ptr_CrossWorkgroup_uint %arrayidx5 %uint_0 %uint_0 + %37 = OpLoad %_ptr_CrossWorkgroup_uint %p Aligned 4 + %38 = OpLoad %_ptr_CrossWorkgroup_struct_a %q2_addr Aligned 4 %39 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %40 = OpCompositeExtract %uint %39 0 - %41 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %38 %40 - %42 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup__ptr_CrossWorkgroup_uint %41 %uint_0 %uint_0 - OpStore %42 %37 Aligned 4 + %call6 = OpCompositeExtract %uint %39 0 + %arrayidx7 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %38 %call6 + %p8 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup__ptr_CrossWorkgroup_uint %arrayidx7 %uint_0 %uint_0 + OpStore %p8 %37 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_part_load_store/load_ptr_and_short2.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_part_load_store/load_ptr_and_short2.spvasm index 8e67c7b473..397f3329a0 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_part_load_store/load_ptr_and_short2.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_part_load_store/load_ptr_and_short2.spvasm @@ -14,11 +14,28 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %struct_a "struct.a" + OpName %q1 "q1" + OpName %q2 "q2" + OpName %entry "entry" + OpName %q1_addr "q1.addr" + OpName %q2_addr "q2.addr" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %i "i" + OpName %call1 "call1" + OpName %arrayidx2 "arrayidx2" + OpName %i3 "i3" + OpName %call4 "call4" + OpName %arrayidx5 "arrayidx5" + OpName %p "p" + OpName %call6 "call6" + OpName %arrayidx7 "arrayidx7" + OpName %p8 "p8" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %18 Alignment 4 - OpDecorate %19 Alignment 4 + OpDecorate %q1_addr Alignment 4 + OpDecorate %q2_addr Alignment 4 %uint = OpTypeInt 32 0 %ushort = OpTypeInt 16 0 %uint_0 = OpConstant %uint 0 @@ -36,36 +53,36 @@ %_ptr_CrossWorkgroup__ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %_ptr_CrossWorkgroup_uint %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %13 = OpFunction %void DontInline %12 - %14 = OpFunctionParameter %_ptr_CrossWorkgroup_struct_a - %15 = OpFunctionParameter %_ptr_CrossWorkgroup_struct_a - %16 = OpLabel - %18 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_struct_a Function - %19 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_struct_a Function - OpStore %18 %14 Aligned 4 - OpStore %19 %15 Aligned 4 - %20 = OpLoad %_ptr_CrossWorkgroup_struct_a %18 Aligned 4 + %q1 = OpFunctionParameter %_ptr_CrossWorkgroup_struct_a + %q2 = OpFunctionParameter %_ptr_CrossWorkgroup_struct_a + %entry = OpLabel + %q1_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_struct_a Function + %q2_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_struct_a Function + OpStore %q1_addr %q1 Aligned 4 + OpStore %q2_addr %q2 Aligned 4 + %20 = OpLoad %_ptr_CrossWorkgroup_struct_a %q1_addr Aligned 4 %21 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %22 = OpCompositeExtract %uint %21 0 - %23 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %20 %22 - %27 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_v2ushort %23 %uint_0 %uint_1 - %28 = OpLoad %v2ushort %27 Aligned 4 - %29 = OpLoad %_ptr_CrossWorkgroup_struct_a %19 Aligned 4 + %call = OpCompositeExtract %uint %21 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %20 %call + %i = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_v2ushort %arrayidx %uint_0 %uint_1 + %28 = OpLoad %v2ushort %i Aligned 4 + %29 = OpLoad %_ptr_CrossWorkgroup_struct_a %q2_addr Aligned 4 %30 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %31 = OpCompositeExtract %uint %30 0 - %32 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %29 %31 - %33 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_v2ushort %32 %uint_0 %uint_1 - OpStore %33 %28 Aligned 4 - %34 = OpLoad %_ptr_CrossWorkgroup_struct_a %18 Aligned 4 + %call1 = OpCompositeExtract %uint %30 0 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %29 %call1 + %i3 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_v2ushort %arrayidx2 %uint_0 %uint_1 + OpStore %i3 %28 Aligned 4 + %34 = OpLoad %_ptr_CrossWorkgroup_struct_a %q1_addr Aligned 4 %35 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %36 = OpCompositeExtract %uint %35 0 - %37 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %34 %36 - %39 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup__ptr_CrossWorkgroup_uint %37 %uint_0 %uint_0 - %40 = OpLoad %_ptr_CrossWorkgroup_uint %39 Aligned 4 - %41 = OpLoad %_ptr_CrossWorkgroup_struct_a %19 Aligned 4 + %call4 = OpCompositeExtract %uint %35 0 + %arrayidx5 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %34 %call4 + %p = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup__ptr_CrossWorkgroup_uint %arrayidx5 %uint_0 %uint_0 + %40 = OpLoad %_ptr_CrossWorkgroup_uint %p Aligned 4 + %41 = OpLoad %_ptr_CrossWorkgroup_struct_a %q2_addr Aligned 4 %42 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %43 = OpCompositeExtract %uint %42 0 - %44 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %41 %43 - %45 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup__ptr_CrossWorkgroup_uint %44 %uint_0 %uint_0 - OpStore %45 %40 Aligned 4 + %call6 = OpCompositeExtract %uint %42 0 + %arrayidx7 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %41 %call6 + %p8 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup__ptr_CrossWorkgroup_uint %arrayidx7 %uint_0 %uint_0 + OpStore %p8 %40 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_part_load_store/load_ptr_array_and_int.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_part_load_store/load_ptr_array_and_int.spvasm index 380f801715..6a74b147d8 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_part_load_store/load_ptr_array_and_int.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_part_load_store/load_ptr_array_and_int.spvasm @@ -13,11 +13,30 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %struct_a "struct.a" + OpName %q1 "q1" + OpName %q2 "q2" + OpName %entry "entry" + OpName %q1_addr "q1.addr" + OpName %q2_addr "q2.addr" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %i "i" + OpName %call1 "call1" + OpName %arrayidx2 "arrayidx2" + OpName %i3 "i3" + OpName %call4 "call4" + OpName %arrayidx5 "arrayidx5" + OpName %p "p" + OpName %arrayidx6 "arrayidx6" + OpName %call7 "call7" + OpName %arrayidx8 "arrayidx8" + OpName %p9 "p9" + OpName %arrayidx10 "arrayidx10" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %18 Alignment 4 - OpDecorate %19 Alignment 4 + OpDecorate %q1_addr Alignment 4 + OpDecorate %q2_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_5 = OpConstant %uint 5 %uint_0 = OpConstant %uint 0 @@ -36,38 +55,38 @@ %_ptr_CrossWorkgroup__ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %_ptr_CrossWorkgroup_uint %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %13 = OpFunction %void DontInline %12 - %14 = OpFunctionParameter %_ptr_CrossWorkgroup_struct_a - %15 = OpFunctionParameter %_ptr_CrossWorkgroup_struct_a - %16 = OpLabel - %18 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_struct_a Function - %19 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_struct_a Function - OpStore %18 %14 Aligned 4 - OpStore %19 %15 Aligned 4 - %20 = OpLoad %_ptr_CrossWorkgroup_struct_a %18 Aligned 4 + %q1 = OpFunctionParameter %_ptr_CrossWorkgroup_struct_a + %q2 = OpFunctionParameter %_ptr_CrossWorkgroup_struct_a + %entry = OpLabel + %q1_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_struct_a Function + %q2_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_struct_a Function + OpStore %q1_addr %q1 Aligned 4 + OpStore %q2_addr %q2 Aligned 4 + %20 = OpLoad %_ptr_CrossWorkgroup_struct_a %q1_addr Aligned 4 %21 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %22 = OpCompositeExtract %uint %21 0 - %23 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %20 %22 - %26 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %23 %uint_0 %uint_1 - %27 = OpLoad %uint %26 Aligned 4 - %28 = OpLoad %_ptr_CrossWorkgroup_struct_a %19 Aligned 4 + %call = OpCompositeExtract %uint %21 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %20 %call + %i = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %arrayidx %uint_0 %uint_1 + %27 = OpLoad %uint %i Aligned 4 + %28 = OpLoad %_ptr_CrossWorkgroup_struct_a %q2_addr Aligned 4 %29 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %30 = OpCompositeExtract %uint %29 0 - %31 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %28 %30 - %32 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %31 %uint_0 %uint_1 - OpStore %32 %27 Aligned 4 - %33 = OpLoad %_ptr_CrossWorkgroup_struct_a %18 Aligned 4 + %call1 = OpCompositeExtract %uint %29 0 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %28 %call1 + %i3 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %arrayidx2 %uint_0 %uint_1 + OpStore %i3 %27 Aligned 4 + %33 = OpLoad %_ptr_CrossWorkgroup_struct_a %q1_addr Aligned 4 %34 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %35 = OpCompositeExtract %uint %34 0 - %36 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %33 %35 - %38 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup__arr__ptr_CrossWorkgroup_uint_uint_5 %36 %uint_0 %uint_0 - %41 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup__ptr_CrossWorkgroup_uint %38 %uint_0 %uint_3 - %42 = OpLoad %_ptr_CrossWorkgroup_uint %41 Aligned 4 - %43 = OpLoad %_ptr_CrossWorkgroup_struct_a %19 Aligned 4 + %call4 = OpCompositeExtract %uint %34 0 + %arrayidx5 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %33 %call4 + %p = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup__arr__ptr_CrossWorkgroup_uint_uint_5 %arrayidx5 %uint_0 %uint_0 + %arrayidx6 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup__ptr_CrossWorkgroup_uint %p %uint_0 %uint_3 + %42 = OpLoad %_ptr_CrossWorkgroup_uint %arrayidx6 Aligned 4 + %43 = OpLoad %_ptr_CrossWorkgroup_struct_a %q2_addr Aligned 4 %44 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %45 = OpCompositeExtract %uint %44 0 - %46 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %43 %45 - %47 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup__arr__ptr_CrossWorkgroup_uint_uint_5 %46 %uint_0 %uint_0 - %48 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup__ptr_CrossWorkgroup_uint %47 %uint_0 %uint_3 - OpStore %48 %42 Aligned 4 + %call7 = OpCompositeExtract %uint %44 0 + %arrayidx8 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %43 %call7 + %p9 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup__arr__ptr_CrossWorkgroup_uint_uint_5 %arrayidx8 %uint_0 %uint_0 + %arrayidx10 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup__ptr_CrossWorkgroup_uint %p9 %uint_0 %uint_3 + OpStore %arrayidx10 %42 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_part_load_store/store_int_and_short.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_part_load_store/store_int_and_short.spvasm index 5001893d4a..14c6a149f1 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_part_load_store/store_int_and_short.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_part_load_store/store_int_and_short.spvasm @@ -14,10 +14,19 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %struct_a "struct.a" + OpName %q "q" + OpName %entry "entry" + OpName %q_addr "q.addr" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %i "i" + OpName %call1 "call1" + OpName %arrayidx2 "arrayidx2" + OpName %s "s" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %15 Alignment 4 + OpDecorate %q_addr Alignment 4 %uint = OpTypeInt 32 0 %ushort = OpTypeInt 16 0 %uint_0 = OpConstant %uint 0 @@ -35,21 +44,21 @@ %_ptr_CrossWorkgroup_ushort = OpTypePointer CrossWorkgroup %ushort %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %11 = OpFunction %void DontInline %10 - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_struct_a - %13 = OpLabel - %15 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_struct_a Function - OpStore %15 %12 Aligned 4 - %16 = OpLoad %_ptr_CrossWorkgroup_struct_a %15 Aligned 4 + %q = OpFunctionParameter %_ptr_CrossWorkgroup_struct_a + %entry = OpLabel + %q_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_struct_a Function + OpStore %q_addr %q Aligned 4 + %16 = OpLoad %_ptr_CrossWorkgroup_struct_a %q_addr Aligned 4 %17 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %18 = OpCompositeExtract %uint %17 0 - %19 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %16 %18 - %22 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %19 %uint_0 %uint_0 - OpStore %22 %uint_42 Aligned 4 - %24 = OpLoad %_ptr_CrossWorkgroup_struct_a %15 Aligned 4 + %call = OpCompositeExtract %uint %17 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %16 %call + %i = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %arrayidx %uint_0 %uint_0 + OpStore %i %uint_42 Aligned 4 + %24 = OpLoad %_ptr_CrossWorkgroup_struct_a %q_addr Aligned 4 %25 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %26 = OpCompositeExtract %uint %25 0 - %27 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %24 %26 - %30 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_ushort %27 %uint_0 %uint_1 - OpStore %30 %ushort_43 Aligned 4 + %call1 = OpCompositeExtract %uint %25 0 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %24 %call1 + %s = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_ushort %arrayidx2 %uint_0 %uint_1 + OpStore %s %ushort_43 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_part_load_store/store_ptr_and_int.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_part_load_store/store_ptr_and_int.spvasm index 65b552721c..736856fba8 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_part_load_store/store_ptr_and_int.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_part_load_store/store_ptr_and_int.spvasm @@ -13,11 +13,22 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %struct_a "struct.a" + OpName %p "p" + OpName %q "q" + OpName %entry "entry" + OpName %p_addr "p.addr" + OpName %q_addr "q.addr" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %i "i" + OpName %call1 "call1" + OpName %arrayidx2 "arrayidx2" + OpName %p3 "p3" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %16 Alignment 4 - OpDecorate %18 Alignment 4 + OpDecorate %p_addr Alignment 4 + OpDecorate %q_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_1 = OpConstant %uint 1 @@ -34,25 +45,25 @@ %_ptr_CrossWorkgroup__ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %_ptr_CrossWorkgroup_uint %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %11 = OpFunction %void DontInline %10 - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpFunctionParameter %_ptr_CrossWorkgroup_struct_a - %14 = OpLabel - %16 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %18 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_struct_a Function - OpStore %16 %12 Aligned 4 - OpStore %18 %13 Aligned 4 - %19 = OpLoad %_ptr_CrossWorkgroup_struct_a %18 Aligned 4 + %p = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %q = OpFunctionParameter %_ptr_CrossWorkgroup_struct_a + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %q_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_struct_a Function + OpStore %p_addr %p Aligned 4 + OpStore %q_addr %q Aligned 4 + %19 = OpLoad %_ptr_CrossWorkgroup_struct_a %q_addr Aligned 4 %20 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %21 = OpCompositeExtract %uint %20 0 - %22 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %19 %21 - %25 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %22 %uint_0 %uint_1 - OpStore %25 %uint_42 Aligned 4 - %27 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 - %28 = OpLoad %_ptr_CrossWorkgroup_struct_a %18 Aligned 4 + %call = OpCompositeExtract %uint %20 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %19 %call + %i = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %arrayidx %uint_0 %uint_1 + OpStore %i %uint_42 Aligned 4 + %27 = OpLoad %_ptr_CrossWorkgroup_uint %p_addr Aligned 4 + %28 = OpLoad %_ptr_CrossWorkgroup_struct_a %q_addr Aligned 4 %29 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %30 = OpCompositeExtract %uint %29 0 - %31 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %28 %30 - %33 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup__ptr_CrossWorkgroup_uint %31 %uint_0 %uint_0 - OpStore %33 %27 Aligned 4 + %call1 = OpCompositeExtract %uint %29 0 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %28 %call1 + %p3 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup__ptr_CrossWorkgroup_uint %arrayidx2 %uint_0 %uint_0 + OpStore %p3 %27 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_part_load_store/store_ptr_and_short.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_part_load_store/store_ptr_and_short.spvasm index 2b2613c940..2fad3c95f9 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_part_load_store/store_ptr_and_short.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_part_load_store/store_ptr_and_short.spvasm @@ -14,11 +14,22 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %struct_a "struct.a" + OpName %p "p" + OpName %q "q" + OpName %entry "entry" + OpName %p_addr "p.addr" + OpName %q_addr "q.addr" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %i "i" + OpName %call1 "call1" + OpName %arrayidx2 "arrayidx2" + OpName %p3 "p3" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %17 Alignment 4 - OpDecorate %19 Alignment 4 + OpDecorate %p_addr Alignment 4 + OpDecorate %q_addr Alignment 4 %uint = OpTypeInt 32 0 %ushort = OpTypeInt 16 0 %uint_0 = OpConstant %uint 0 @@ -37,25 +48,25 @@ %_ptr_CrossWorkgroup__ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %_ptr_CrossWorkgroup_uint %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %12 = OpFunction %void DontInline %11 - %13 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %14 = OpFunctionParameter %_ptr_CrossWorkgroup_struct_a - %15 = OpLabel - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %19 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_struct_a Function - OpStore %17 %13 Aligned 4 - OpStore %19 %14 Aligned 4 - %20 = OpLoad %_ptr_CrossWorkgroup_struct_a %19 Aligned 4 + %p = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %q = OpFunctionParameter %_ptr_CrossWorkgroup_struct_a + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %q_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_struct_a Function + OpStore %p_addr %p Aligned 4 + OpStore %q_addr %q Aligned 4 + %20 = OpLoad %_ptr_CrossWorkgroup_struct_a %q_addr Aligned 4 %21 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %22 = OpCompositeExtract %uint %21 0 - %23 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %20 %22 - %27 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_ushort %23 %uint_0 %uint_1 - OpStore %27 %ushort_42 Aligned 4 - %29 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 - %30 = OpLoad %_ptr_CrossWorkgroup_struct_a %19 Aligned 4 + %call = OpCompositeExtract %uint %21 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %20 %call + %i = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_ushort %arrayidx %uint_0 %uint_1 + OpStore %i %ushort_42 Aligned 4 + %29 = OpLoad %_ptr_CrossWorkgroup_uint %p_addr Aligned 4 + %30 = OpLoad %_ptr_CrossWorkgroup_struct_a %q_addr Aligned 4 %31 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %32 = OpCompositeExtract %uint %31 0 - %33 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %30 %32 - %35 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup__ptr_CrossWorkgroup_uint %33 %uint_0 %uint_0 - OpStore %35 %29 Aligned 4 + %call1 = OpCompositeExtract %uint %31 0 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %30 %call1 + %p3 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup__ptr_CrossWorkgroup_uint %arrayidx2 %uint_0 %uint_0 + OpStore %p3 %29 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_part_load_store/store_ptr_and_short2.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_part_load_store/store_ptr_and_short2.spvasm index f93a2893df..f3d89f5fbb 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_part_load_store/store_ptr_and_short2.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_part_load_store/store_ptr_and_short2.spvasm @@ -14,12 +14,24 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %struct_a "struct.a" + OpName %p "p" + OpName %q "q" + OpName %entry "entry" + OpName %p_addr "p.addr" + OpName %q_addr "q.addr" + OpName %_compoundliteral ".compoundliteral" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %i "i" + OpName %call1 "call1" + OpName %arrayidx2 "arrayidx2" + OpName %p3 "p3" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %18 Alignment 4 - OpDecorate %20 Alignment 4 - OpDecorate %22 Alignment 4 + OpDecorate %p_addr Alignment 4 + OpDecorate %q_addr Alignment 4 + OpDecorate %_compoundliteral Alignment 4 %uint = OpTypeInt 32 0 %ushort = OpTypeInt 16 0 %ushort_42 = OpConstant %ushort 42 @@ -42,28 +54,28 @@ %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %25 = OpConstantComposite %v2ushort %ushort_42 %ushort_43 %13 = OpFunction %void DontInline %12 - %14 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %15 = OpFunctionParameter %_ptr_CrossWorkgroup_struct_a - %16 = OpLabel - %18 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %20 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_struct_a Function - %22 = OpVariable %_ptr_Function_v2ushort Function - OpStore %18 %14 Aligned 4 - OpStore %20 %15 Aligned 4 - OpStore %22 %25 Aligned 4 - %26 = OpLoad %v2ushort %22 Aligned 4 - %27 = OpLoad %_ptr_CrossWorkgroup_struct_a %20 Aligned 4 + %p = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %q = OpFunctionParameter %_ptr_CrossWorkgroup_struct_a + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %q_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_struct_a Function +%_compoundliteral = OpVariable %_ptr_Function_v2ushort Function + OpStore %p_addr %p Aligned 4 + OpStore %q_addr %q Aligned 4 + OpStore %_compoundliteral %25 Aligned 4 + %26 = OpLoad %v2ushort %_compoundliteral Aligned 4 + %27 = OpLoad %_ptr_CrossWorkgroup_struct_a %q_addr Aligned 4 %28 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %29 = OpCompositeExtract %uint %28 0 - %30 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %27 %29 - %34 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_v2ushort %30 %uint_0 %uint_1 - OpStore %34 %26 Aligned 4 - %35 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %36 = OpLoad %_ptr_CrossWorkgroup_struct_a %20 Aligned 4 + %call = OpCompositeExtract %uint %28 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %27 %call + %i = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_v2ushort %arrayidx %uint_0 %uint_1 + OpStore %i %26 Aligned 4 + %35 = OpLoad %_ptr_CrossWorkgroup_uint %p_addr Aligned 4 + %36 = OpLoad %_ptr_CrossWorkgroup_struct_a %q_addr Aligned 4 %37 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %38 = OpCompositeExtract %uint %37 0 - %39 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %36 %38 - %41 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup__ptr_CrossWorkgroup_uint %39 %uint_0 %uint_0 - OpStore %41 %35 Aligned 4 + %call1 = OpCompositeExtract %uint %37 0 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %36 %call1 + %p3 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup__ptr_CrossWorkgroup_uint %arrayidx2 %uint_0 %uint_0 + OpStore %p3 %35 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_part_load_store/store_ptr_array_and_int.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_part_load_store/store_ptr_array_and_int.spvasm index 8988f31651..5a3d6b0466 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_part_load_store/store_ptr_array_and_int.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_part_load_store/store_ptr_array_and_int.spvasm @@ -13,11 +13,23 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %struct_a "struct.a" + OpName %p "p" + OpName %q "q" + OpName %entry "entry" + OpName %p_addr "p.addr" + OpName %q_addr "q.addr" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %i "i" + OpName %call1 "call1" + OpName %arrayidx2 "arrayidx2" + OpName %p3 "p3" + OpName %arrayidx4 "arrayidx4" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %18 Alignment 4 - OpDecorate %20 Alignment 4 + OpDecorate %p_addr Alignment 4 + OpDecorate %q_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_5 = OpConstant %uint 5 %uint_0 = OpConstant %uint 0 @@ -38,26 +50,26 @@ %_ptr_CrossWorkgroup__ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %_ptr_CrossWorkgroup_uint %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %13 = OpFunction %void DontInline %12 - %14 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %15 = OpFunctionParameter %_ptr_CrossWorkgroup_struct_a - %16 = OpLabel - %18 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %20 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_struct_a Function - OpStore %18 %14 Aligned 4 - OpStore %20 %15 Aligned 4 - %21 = OpLoad %_ptr_CrossWorkgroup_struct_a %20 Aligned 4 + %p = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %q = OpFunctionParameter %_ptr_CrossWorkgroup_struct_a + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %q_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_struct_a Function + OpStore %p_addr %p Aligned 4 + OpStore %q_addr %q Aligned 4 + %21 = OpLoad %_ptr_CrossWorkgroup_struct_a %q_addr Aligned 4 %22 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %23 = OpCompositeExtract %uint %22 0 - %24 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %21 %23 - %27 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %24 %uint_0 %uint_1 - OpStore %27 %uint_42 Aligned 4 - %29 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 - %30 = OpLoad %_ptr_CrossWorkgroup_struct_a %20 Aligned 4 + %call = OpCompositeExtract %uint %22 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %21 %call + %i = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %arrayidx %uint_0 %uint_1 + OpStore %i %uint_42 Aligned 4 + %29 = OpLoad %_ptr_CrossWorkgroup_uint %p_addr Aligned 4 + %30 = OpLoad %_ptr_CrossWorkgroup_struct_a %q_addr Aligned 4 %31 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %32 = OpCompositeExtract %uint %31 0 - %33 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %30 %32 - %35 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup__arr__ptr_CrossWorkgroup_uint_uint_5 %33 %uint_0 %uint_0 - %38 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup__ptr_CrossWorkgroup_uint %35 %uint_0 %uint_3 - OpStore %38 %29 Aligned 4 + %call1 = OpCompositeExtract %uint %31 0 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct_a %30 %call1 + %p3 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup__arr__ptr_CrossWorkgroup_uint_uint_5 %arrayidx2 %uint_0 %uint_0 + %arrayidx4 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup__ptr_CrossWorkgroup_uint %p3 %uint_0 %uint_3 + OpStore %arrayidx4 %29 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_structs/store_array_element.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_structs/store_array_element.spvasm index 6620dd491a..81c3d8ac96 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_structs/store_array_element.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_structs/store_array_element.spvasm @@ -13,12 +13,20 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %struct_s "struct.s" + OpName %p "p" + OpName %q "q" + OpName %entry "entry" + OpName %p_addr "p.addr" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %a "a" + OpName %arrayidx1 "arrayidx1" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant - OpDecorate %15 FuncParamAttr ByVal + OpDecorate %q FuncParamAttr ByVal OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %15 Alignment 4 - OpDecorate %18 Alignment 4 + OpDecorate %q Alignment 4 + OpDecorate %p_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_5 = OpConstant %uint 5 %uint_0 = OpConstant %uint 0 @@ -36,18 +44,18 @@ %_ptr_Function_uint = OpTypePointer Function %uint %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %13 = OpFunction %void DontInline %12 - %14 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %15 = OpFunctionParameter %_ptr_Function_struct_s - %16 = OpLabel - %18 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %18 %14 Aligned 4 - %19 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 + %p = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %q = OpFunctionParameter %_ptr_Function_struct_s + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %p_addr %p Aligned 4 + %19 = OpLoad %_ptr_CrossWorkgroup_uint %p_addr Aligned 4 %20 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %21 = OpCompositeExtract %uint %20 0 - %22 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %19 %21 - %23 = OpLoad %uint %22 Aligned 4 - %26 = OpInBoundsPtrAccessChain %_ptr_Function__arr_uint_uint_5 %15 %uint_0 %uint_0 - %29 = OpInBoundsPtrAccessChain %_ptr_Function_uint %26 %uint_0 %uint_3 - OpStore %29 %23 Aligned 4 + %call = OpCompositeExtract %uint %20 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %19 %call + %23 = OpLoad %uint %arrayidx Aligned 4 + %a = OpInBoundsPtrAccessChain %_ptr_Function__arr_uint_uint_5 %q %uint_0 %uint_0 + %arrayidx1 = OpInBoundsPtrAccessChain %_ptr_Function_uint %a %uint_0 %uint_3 + OpStore %arrayidx1 %23 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_structs/store_element.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_structs/store_element.spvasm index 526b3231d7..2ebba5cdac 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_structs/store_element.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_structs/store_element.spvasm @@ -13,12 +13,19 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %struct_s "struct.s" + OpName %p "p" + OpName %q "q" + OpName %entry "entry" + OpName %p_addr "p.addr" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %b "b" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant - OpDecorate %13 FuncParamAttr ByVal + OpDecorate %q FuncParamAttr ByVal OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %13 Alignment 4 - OpDecorate %16 Alignment 4 + OpDecorate %q Alignment 4 + OpDecorate %p_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_1 = OpConstant %uint 1 @@ -33,17 +40,17 @@ %_ptr_Function_uint = OpTypePointer Function %uint %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %11 = OpFunction %void DontInline %10 - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpFunctionParameter %_ptr_Function_struct_s - %14 = OpLabel - %16 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %16 %12 Aligned 4 - %17 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 + %p = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %q = OpFunctionParameter %_ptr_Function_struct_s + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %p_addr %p Aligned 4 + %17 = OpLoad %_ptr_CrossWorkgroup_uint %p_addr Aligned 4 %18 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %19 = OpCompositeExtract %uint %18 0 - %20 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %17 %19 - %21 = OpLoad %uint %20 Aligned 4 - %25 = OpInBoundsPtrAccessChain %_ptr_Function_uint %13 %uint_0 %uint_1 - OpStore %25 %21 Aligned 4 + %call = OpCompositeExtract %uint %18 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %17 %call + %21 = OpLoad %uint %arrayidx Aligned 4 + %b = OpInBoundsPtrAccessChain %_ptr_Function_uint %q %uint_0 %uint_1 + OpStore %b %21 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_structs/store_ptr_element.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_structs/store_ptr_element.spvasm index bbe36cd6ea..51ebeac607 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_structs/store_ptr_element.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_structs/store_ptr_element.spvasm @@ -13,12 +13,20 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %struct_s "struct.s" + OpName %p "p" + OpName %q "q" + OpName %entry "entry" + OpName %p_addr "p.addr" + OpName %p1 "p1" + OpName %p2 "p2" + OpName %call "call" + OpName %arrayidx "arrayidx" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant - OpDecorate %13 FuncParamAttr ByVal + OpDecorate %q FuncParamAttr ByVal OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %13 Alignment 4 - OpDecorate %16 Alignment 4 + OpDecorate %q Alignment 4 + OpDecorate %p_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_5 = OpConstant %uint 5 @@ -32,19 +40,19 @@ %_ptr_Function__ptr_CrossWorkgroup_uint = OpTypePointer Function %_ptr_CrossWorkgroup_uint %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %11 = OpFunction %void DontInline %10 - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpFunctionParameter %_ptr_Function_struct_s - %14 = OpLabel - %16 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %16 %12 Aligned 4 - %17 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 - %19 = OpInBoundsPtrAccessChain %_ptr_Function__ptr_CrossWorkgroup_uint %13 %uint_0 %uint_0 - OpStore %19 %17 Aligned 4 - %20 = OpInBoundsPtrAccessChain %_ptr_Function__ptr_CrossWorkgroup_uint %13 %uint_0 %uint_0 - %21 = OpLoad %_ptr_CrossWorkgroup_uint %20 Aligned 4 + %p = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %q = OpFunctionParameter %_ptr_Function_struct_s + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %p_addr %p Aligned 4 + %17 = OpLoad %_ptr_CrossWorkgroup_uint %p_addr Aligned 4 + %p1 = OpInBoundsPtrAccessChain %_ptr_Function__ptr_CrossWorkgroup_uint %q %uint_0 %uint_0 + OpStore %p1 %17 Aligned 4 + %p2 = OpInBoundsPtrAccessChain %_ptr_Function__ptr_CrossWorkgroup_uint %q %uint_0 %uint_0 + %21 = OpLoad %_ptr_CrossWorkgroup_uint %p2 Aligned 4 %22 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %23 = OpCompositeExtract %uint %22 0 - %24 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %21 %23 - OpStore %24 %uint_5 Aligned 4 + %call = OpCompositeExtract %uint %22 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %21 %call + OpStore %arrayidx %uint_5 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_structs/store_struct_element.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_structs/store_struct_element.spvasm index d45845b778..eeb50b49af 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_structs/store_struct_element.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_structs/store_struct_element.spvasm @@ -14,12 +14,20 @@ OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %struct_s "struct.s" OpName %struct_t "struct.t" + OpName %p "p" + OpName %q "q" + OpName %entry "entry" + OpName %p_addr "p.addr" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %a "a" + OpName %a1 "a1" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant - OpDecorate %14 FuncParamAttr ByVal + OpDecorate %q FuncParamAttr ByVal OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %14 Alignment 4 - OpDecorate %17 Alignment 4 + OpDecorate %q Alignment 4 + OpDecorate %p_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %v3uint = OpTypeVector %uint 3 @@ -35,18 +43,18 @@ %_ptr_Function_uint = OpTypePointer Function %uint %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %12 = OpFunction %void DontInline %11 - %13 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %14 = OpFunctionParameter %_ptr_Function_struct_s - %15 = OpLabel - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %17 %13 Aligned 4 - %18 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 + %p = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %q = OpFunctionParameter %_ptr_Function_struct_s + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %p_addr %p Aligned 4 + %18 = OpLoad %_ptr_CrossWorkgroup_uint %p_addr Aligned 4 %19 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %20 = OpCompositeExtract %uint %19 0 - %21 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %18 %20 - %22 = OpLoad %uint %21 Aligned 4 - %25 = OpInBoundsPtrAccessChain %_ptr_Function_struct_t %14 %uint_0 %uint_0 - %27 = OpInBoundsPtrAccessChain %_ptr_Function_uint %25 %uint_0 %uint_0 - OpStore %27 %22 Aligned 4 + %call = OpCompositeExtract %uint %19 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %18 %call + %22 = OpLoad %uint %arrayidx Aligned 4 + %a = OpInBoundsPtrAccessChain %_ptr_Function_struct_t %q %uint_0 %uint_0 + %a1 = OpInBoundsPtrAccessChain %_ptr_Function_uint %a %uint_0 %uint_0 + OpStore %a1 %22 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_structs/use_array_element.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_structs/use_array_element.spvasm index 0d84f0a76d..f60b0f60fb 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_structs/use_array_element.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_structs/use_array_element.spvasm @@ -13,12 +13,20 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %struct_s "struct.s" + OpName %p "p" + OpName %q "q" + OpName %entry "entry" + OpName %p_addr "p.addr" + OpName %a "a" + OpName %arrayidx "arrayidx" + OpName %call "call" + OpName %arrayidx1 "arrayidx1" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant - OpDecorate %15 FuncParamAttr ByVal + OpDecorate %q FuncParamAttr ByVal OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %15 Alignment 4 - OpDecorate %18 Alignment 4 + OpDecorate %q Alignment 4 + OpDecorate %p_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_6 = OpConstant %uint 6 %uint_0 = OpConstant %uint 0 @@ -36,18 +44,18 @@ %_ptr_Function_uint = OpTypePointer Function %uint %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %13 = OpFunction %void DontInline %12 - %14 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %15 = OpFunctionParameter %_ptr_Function_struct_s - %16 = OpLabel - %18 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %18 %14 Aligned 4 - %21 = OpInBoundsPtrAccessChain %_ptr_Function__arr_uint_uint_6 %15 %uint_0 %uint_0 - %24 = OpInBoundsPtrAccessChain %_ptr_Function_uint %21 %uint_0 %uint_3 - %25 = OpLoad %uint %24 Aligned 4 - %26 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 + %p = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %q = OpFunctionParameter %_ptr_Function_struct_s + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %p_addr %p Aligned 4 + %a = OpInBoundsPtrAccessChain %_ptr_Function__arr_uint_uint_6 %q %uint_0 %uint_0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Function_uint %a %uint_0 %uint_3 + %25 = OpLoad %uint %arrayidx Aligned 4 + %26 = OpLoad %_ptr_CrossWorkgroup_uint %p_addr Aligned 4 %27 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %28 = OpCompositeExtract %uint %27 0 - %29 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %26 %28 - OpStore %29 %25 Aligned 4 + %call = OpCompositeExtract %uint %27 0 + %arrayidx1 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %26 %call + OpStore %arrayidx1 %25 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_structs/use_element.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_structs/use_element.spvasm index 69ef2b2dfe..425c66ba3d 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_structs/use_element.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_structs/use_element.spvasm @@ -13,12 +13,19 @@ OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %struct_s "struct.s" + OpName %p "p" + OpName %q "q" + OpName %entry "entry" + OpName %p_addr "p.addr" + OpName %b "b" + OpName %call "call" + OpName %arrayidx "arrayidx" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant - OpDecorate %13 FuncParamAttr ByVal + OpDecorate %q FuncParamAttr ByVal OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %13 Alignment 4 - OpDecorate %16 Alignment 4 + OpDecorate %q Alignment 4 + OpDecorate %p_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_1 = OpConstant %uint 1 @@ -33,17 +40,17 @@ %_ptr_Function_uint = OpTypePointer Function %uint %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %11 = OpFunction %void DontInline %10 - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpFunctionParameter %_ptr_Function_struct_s - %14 = OpLabel - %16 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %16 %12 Aligned 4 - %20 = OpInBoundsPtrAccessChain %_ptr_Function_uint %13 %uint_0 %uint_1 - %21 = OpLoad %uint %20 Aligned 4 - %22 = OpLoad %_ptr_CrossWorkgroup_uint %16 Aligned 4 + %p = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %q = OpFunctionParameter %_ptr_Function_struct_s + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %p_addr %p Aligned 4 + %b = OpInBoundsPtrAccessChain %_ptr_Function_uint %q %uint_0 %uint_1 + %21 = OpLoad %uint %b Aligned 4 + %22 = OpLoad %_ptr_CrossWorkgroup_uint %p_addr Aligned 4 %23 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %24 = OpCompositeExtract %uint %23 0 - %25 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %22 %24 - OpStore %25 %21 Aligned 4 + %call = OpCompositeExtract %uint %23 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %22 %call + OpStore %arrayidx %21 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_structs/use_struct_element.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_structs/use_struct_element.spvasm index e30ef893ee..2011cf6067 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_structs/use_struct_element.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/test_structs/use_struct_element.spvasm @@ -14,12 +14,20 @@ OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %struct_s "struct.s" OpName %struct_t "struct.t" + OpName %p "p" + OpName %q "q" + OpName %entry "entry" + OpName %p_addr "p.addr" + OpName %a "a" + OpName %a1 "a1" + OpName %call "call" + OpName %arrayidx "arrayidx" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant - OpDecorate %14 FuncParamAttr ByVal + OpDecorate %q FuncParamAttr ByVal OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %14 Alignment 4 - OpDecorate %17 Alignment 4 + OpDecorate %q Alignment 4 + OpDecorate %p_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_1 = OpConstant %uint 1 @@ -36,18 +44,18 @@ %_ptr_Function_uint = OpTypePointer Function %uint %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %12 = OpFunction %void DontInline %11 - %13 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %14 = OpFunctionParameter %_ptr_Function_struct_s - %15 = OpLabel - %17 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %17 %13 Aligned 4 - %21 = OpInBoundsPtrAccessChain %_ptr_Function_struct_t %14 %uint_0 %uint_1 - %23 = OpInBoundsPtrAccessChain %_ptr_Function_uint %21 %uint_0 %uint_0 - %24 = OpLoad %uint %23 Aligned 4 - %25 = OpLoad %_ptr_CrossWorkgroup_uint %17 Aligned 4 + %p = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %q = OpFunctionParameter %_ptr_Function_struct_s + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %p_addr %p Aligned 4 + %a = OpInBoundsPtrAccessChain %_ptr_Function_struct_t %q %uint_0 %uint_1 + %a1 = OpInBoundsPtrAccessChain %_ptr_Function_uint %a %uint_0 %uint_0 + %24 = OpLoad %uint %a1 Aligned 4 + %25 = OpLoad %_ptr_CrossWorkgroup_uint %p_addr Aligned 4 %26 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %27 = OpCompositeExtract %uint %26 0 - %28 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %25 %27 - OpStore %28 %24 Aligned 4 + %call = OpCompositeExtract %uint %26 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %25 %call + OpStore %arrayidx %24 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/transitiveclosuresimplified.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/transitiveclosuresimplified.spvasm index d7d0a6d45c..669606b42a 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/transitiveclosuresimplified.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/transitiveclosuresimplified.spvasm @@ -12,14 +12,76 @@ OpEntryPoint Kernel %10 "transitive_closure_stage1_kernel" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %graph "graph" + OpName %primary_block_buffer "primary_block_buffer" + OpName %entry "entry" + OpName %for_cond "for.cond" + OpName %for_body "for.body" + OpName %if_then "if.then" + OpName %land_lhs_true "land.lhs.true" + OpName %if_then25 "if.then25" + OpName %if_end "if.end" + OpName %if_end33 "if.end33" + OpName %for_inc "for.inc" + OpName %for_end "for.end" + OpName %graph_addr "graph.addr" + OpName %primary_block_buffer_addr "primary_block_buffer.addr" + OpName %idxY "idxY" + OpName %idxX "idxX" + OpName %k "k" + OpName %call "call" + OpName %add "add" + OpName %call1 "call1" + OpName %add2 "add2" + OpName %mul "mul" + OpName %add3 "add3" + OpName %arrayidx "arrayidx" + OpName %call4 "call4" + OpName %mul5 "mul5" + OpName %call6 "call6" + OpName %add7 "add7" + OpName %arrayidx8 "arrayidx8" + OpName %cmp "cmp" + OpName %call9 "call9" + OpName %mul10 "mul10" + OpName %call11 "call11" + OpName %add12 "add12" + OpName %arrayidx13 "arrayidx13" + OpName %cmp14 "cmp14" + OpName %call15 "call15" + OpName %mul16 "mul16" + OpName %add17 "add17" + OpName %arrayidx18 "arrayidx18" + OpName %cmp19 "cmp19" + OpName %mul20 "mul20" + OpName %call21 "call21" + OpName %add22 "add22" + OpName %arrayidx23 "arrayidx23" + OpName %cmp24 "cmp24" + OpName %add26 "add26" + OpName %add27 "add27" + OpName %call28 "call28" + OpName %mul29 "mul29" + OpName %call30 "call30" + OpName %add31 "add31" + OpName %arrayidx32 "arrayidx32" + OpName %inc "inc" + OpName %call34 "call34" + OpName %mul35 "mul35" + OpName %call36 "call36" + OpName %add37 "add37" + OpName %arrayidx38 "arrayidx38" + OpName %mul39 "mul39" + OpName %add40 "add40" + OpName %arrayidx41 "arrayidx41" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %24 Alignment 4 - OpDecorate %26 Alignment 4 - OpDecorate %28 Alignment 4 - OpDecorate %29 Alignment 4 - OpDecorate %30 Alignment 4 + OpDecorate %graph_addr Alignment 4 + OpDecorate %primary_block_buffer_addr Alignment 4 + OpDecorate %idxY Alignment 4 + OpDecorate %idxX Alignment 4 + OpDecorate %k Alignment 4 %uint = OpTypeInt 32 0 %uint_32 = OpConstant %uint 32 %uint_64 = OpConstant %uint 64 @@ -40,121 +102,121 @@ %bool = OpTypeBool %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %10 = OpFunction %void DontInline %9 - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %_ptr_Workgroup_uint - %13 = OpLabel - %24 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %26 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %28 = OpVariable %_ptr_Function_uint Function - %29 = OpVariable %_ptr_Function_uint Function - %30 = OpVariable %_ptr_Function_uint Function - OpStore %24 %11 Aligned 4 - OpStore %26 %12 Aligned 4 + %graph = OpFunctionParameter %_ptr_CrossWorkgroup_uint +%primary_block_buffer = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %graph_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function +%primary_block_buffer_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %idxY = OpVariable %_ptr_Function_uint Function + %idxX = OpVariable %_ptr_Function_uint Function + %k = OpVariable %_ptr_Function_uint Function + OpStore %graph_addr %graph Aligned 4 + OpStore %primary_block_buffer_addr %primary_block_buffer Aligned 4 %31 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %32 = OpCompositeExtract %uint %31 1 - %34 = OpIAdd %uint %uint_32 %32 - OpStore %28 %34 Aligned 4 + %call = OpCompositeExtract %uint %31 1 + %add = OpIAdd %uint %uint_32 %call + OpStore %idxY %add Aligned 4 %35 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %36 = OpCompositeExtract %uint %35 0 - %37 = OpIAdd %uint %uint_32 %36 - OpStore %29 %37 Aligned 4 - %38 = OpLoad %_ptr_CrossWorkgroup_uint %24 Aligned 4 - %39 = OpLoad %uint %28 Aligned 4 - %41 = OpIMul %uint %39 %uint_64 - %42 = OpLoad %uint %29 Aligned 4 - %43 = OpIAdd %uint %41 %42 - %44 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %38 %43 - %45 = OpLoad %uint %44 Aligned 4 - %46 = OpLoad %_ptr_Workgroup_uint %26 Aligned 4 + %call1 = OpCompositeExtract %uint %35 0 + %add2 = OpIAdd %uint %uint_32 %call1 + OpStore %idxX %add2 Aligned 4 + %38 = OpLoad %_ptr_CrossWorkgroup_uint %graph_addr Aligned 4 + %39 = OpLoad %uint %idxY Aligned 4 + %mul = OpIMul %uint %39 %uint_64 + %42 = OpLoad %uint %idxX Aligned 4 + %add3 = OpIAdd %uint %mul %42 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %38 %add3 + %45 = OpLoad %uint %arrayidx Aligned 4 + %46 = OpLoad %_ptr_Workgroup_uint %primary_block_buffer_addr Aligned 4 %47 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %48 = OpCompositeExtract %uint %47 1 - %50 = OpIMul %uint %48 %uint_8 + %call4 = OpCompositeExtract %uint %47 1 + %mul5 = OpIMul %uint %call4 %uint_8 %51 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %52 = OpCompositeExtract %uint %51 0 - %53 = OpIAdd %uint %50 %52 - %54 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %46 %53 - OpStore %54 %45 Aligned 4 + %call6 = OpCompositeExtract %uint %51 0 + %add7 = OpIAdd %uint %mul5 %call6 + %arrayidx8 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %46 %add7 + OpStore %arrayidx8 %45 Aligned 4 OpControlBarrier %uint_2 %uint_2 %uint_272 - OpStore %30 %uint_0 Aligned 4 - OpBranch %14 - %14 = OpLabel - %58 = OpLoad %uint %30 Aligned 4 - %60 = OpULessThan %bool %58 %uint_8 - OpBranchConditional %60 %15 %22 - %15 = OpLabel - %61 = OpLoad %_ptr_Workgroup_uint %26 Aligned 4 + OpStore %k %uint_0 Aligned 4 + OpBranch %for_cond + %for_cond = OpLabel + %58 = OpLoad %uint %k Aligned 4 + %cmp = OpULessThan %bool %58 %uint_8 + OpBranchConditional %cmp %for_body %for_end + %for_body = OpLabel + %61 = OpLoad %_ptr_Workgroup_uint %primary_block_buffer_addr Aligned 4 %62 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %63 = OpCompositeExtract %uint %62 1 - %64 = OpIMul %uint %63 %uint_8 + %call9 = OpCompositeExtract %uint %62 1 + %mul10 = OpIMul %uint %call9 %uint_8 %65 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %66 = OpCompositeExtract %uint %65 0 - %67 = OpIAdd %uint %64 %66 - %68 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %61 %67 - %69 = OpLoad %uint %68 Aligned 4 - %70 = OpIEqual %bool %69 %uint_0 - OpBranchConditional %70 %16 %20 - %16 = OpLabel - %71 = OpLoad %_ptr_Workgroup_uint %26 Aligned 4 + %call11 = OpCompositeExtract %uint %65 0 + %add12 = OpIAdd %uint %mul10 %call11 + %arrayidx13 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %61 %add12 + %69 = OpLoad %uint %arrayidx13 Aligned 4 + %cmp14 = OpIEqual %bool %69 %uint_0 + OpBranchConditional %cmp14 %if_then %if_end33 + %if_then = OpLabel + %71 = OpLoad %_ptr_Workgroup_uint %primary_block_buffer_addr Aligned 4 %72 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %73 = OpCompositeExtract %uint %72 1 - %74 = OpIMul %uint %73 %uint_8 - %75 = OpLoad %uint %30 Aligned 4 - %76 = OpIAdd %uint %74 %75 - %77 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %71 %76 - %78 = OpLoad %uint %77 Aligned 4 - %79 = OpINotEqual %bool %78 %uint_0 - OpBranchConditional %79 %17 %19 - %17 = OpLabel - %80 = OpLoad %_ptr_Workgroup_uint %26 Aligned 4 - %81 = OpLoad %uint %30 Aligned 4 - %82 = OpIMul %uint %81 %uint_8 + %call15 = OpCompositeExtract %uint %72 1 + %mul16 = OpIMul %uint %call15 %uint_8 + %75 = OpLoad %uint %k Aligned 4 + %add17 = OpIAdd %uint %mul16 %75 + %arrayidx18 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %71 %add17 + %78 = OpLoad %uint %arrayidx18 Aligned 4 + %cmp19 = OpINotEqual %bool %78 %uint_0 + OpBranchConditional %cmp19 %land_lhs_true %if_end +%land_lhs_true = OpLabel + %80 = OpLoad %_ptr_Workgroup_uint %primary_block_buffer_addr Aligned 4 + %81 = OpLoad %uint %k Aligned 4 + %mul20 = OpIMul %uint %81 %uint_8 %83 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %84 = OpCompositeExtract %uint %83 0 - %85 = OpIAdd %uint %82 %84 - %86 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %80 %85 - %87 = OpLoad %uint %86 Aligned 4 - %88 = OpINotEqual %bool %87 %uint_0 - OpBranchConditional %88 %18 %19 - %18 = OpLabel - %89 = OpLoad %uint %30 Aligned 4 - %90 = OpIAdd %uint %uint_32 %89 - %91 = OpIAdd %uint %90 %uint_2 - %92 = OpLoad %_ptr_Workgroup_uint %26 Aligned 4 + %call21 = OpCompositeExtract %uint %83 0 + %add22 = OpIAdd %uint %mul20 %call21 + %arrayidx23 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %80 %add22 + %87 = OpLoad %uint %arrayidx23 Aligned 4 + %cmp24 = OpINotEqual %bool %87 %uint_0 + OpBranchConditional %cmp24 %if_then25 %if_end + %if_then25 = OpLabel + %89 = OpLoad %uint %k Aligned 4 + %add26 = OpIAdd %uint %uint_32 %89 + %add27 = OpIAdd %uint %add26 %uint_2 + %92 = OpLoad %_ptr_Workgroup_uint %primary_block_buffer_addr Aligned 4 %93 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %94 = OpCompositeExtract %uint %93 1 - %95 = OpIMul %uint %94 %uint_8 + %call28 = OpCompositeExtract %uint %93 1 + %mul29 = OpIMul %uint %call28 %uint_8 %96 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %97 = OpCompositeExtract %uint %96 0 - %98 = OpIAdd %uint %95 %97 - %99 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %92 %98 - OpStore %99 %91 Aligned 4 - OpBranch %19 - %19 = OpLabel - OpBranch %20 - %20 = OpLabel + %call30 = OpCompositeExtract %uint %96 0 + %add31 = OpIAdd %uint %mul29 %call30 + %arrayidx32 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %92 %add31 + OpStore %arrayidx32 %add27 Aligned 4 + OpBranch %if_end + %if_end = OpLabel + OpBranch %if_end33 + %if_end33 = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_272 - OpBranch %21 - %21 = OpLabel - %100 = OpLoad %uint %30 Aligned 4 - %102 = OpIAdd %uint %100 %uint_1 - OpStore %30 %102 Aligned 4 - OpBranch %14 - %22 = OpLabel - %103 = OpLoad %_ptr_Workgroup_uint %26 Aligned 4 + OpBranch %for_inc + %for_inc = OpLabel + %100 = OpLoad %uint %k Aligned 4 + %inc = OpIAdd %uint %100 %uint_1 + OpStore %k %inc Aligned 4 + OpBranch %for_cond + %for_end = OpLabel + %103 = OpLoad %_ptr_Workgroup_uint %primary_block_buffer_addr Aligned 4 %104 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %105 = OpCompositeExtract %uint %104 1 - %106 = OpIMul %uint %105 %uint_8 + %call34 = OpCompositeExtract %uint %104 1 + %mul35 = OpIMul %uint %call34 %uint_8 %107 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %108 = OpCompositeExtract %uint %107 0 - %109 = OpIAdd %uint %106 %108 - %110 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %103 %109 - %111 = OpLoad %uint %110 Aligned 4 - %112 = OpLoad %_ptr_CrossWorkgroup_uint %24 Aligned 4 - %113 = OpLoad %uint %28 Aligned 4 - %114 = OpIMul %uint %113 %uint_64 - %115 = OpLoad %uint %29 Aligned 4 - %116 = OpIAdd %uint %114 %115 - %117 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %112 %116 - OpStore %117 %111 Aligned 4 + %call36 = OpCompositeExtract %uint %107 0 + %add37 = OpIAdd %uint %mul35 %call36 + %arrayidx38 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %103 %add37 + %111 = OpLoad %uint %arrayidx38 Aligned 4 + %112 = OpLoad %_ptr_CrossWorkgroup_uint %graph_addr Aligned 4 + %113 = OpLoad %uint %idxY Aligned 4 + %mul39 = OpIMul %uint %113 %uint_64 + %115 = OpLoad %uint %idxX Aligned 4 + %add40 = OpIAdd %uint %mul39 %115 + %arrayidx41 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %112 %add40 + OpStore %arrayidx41 %111 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/typestest.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/typestest.spvasm index 271521d510..1963233e42 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/typestest.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/typestest.spvasm @@ -14,9 +14,17 @@ OpExecutionMode %7 ContractionOff OpSource OpenCL_C 200000 OpName %bar "bar" + OpName %entry "entry" + OpName %x "x" + OpName %call "call" + OpName %conv "conv" + OpName %conv1 "conv1" + OpName %add "add" + OpName %conv2 "conv2" + OpName %inc "inc" OpDecorate %bar FuncParamAttr Sext OpDecorate %bar LinkageAttributes "bar" Import - OpDecorate %10 Alignment 1 + OpDecorate %x Alignment 1 %uchar = OpTypeInt 8 0 %uint = OpTypeInt 32 0 %uchar_1 = OpConstant %uchar 1 @@ -27,19 +35,19 @@ %bar = OpFunction %uchar None %3 OpFunctionEnd %7 = OpFunction %void DontInline %6 - %8 = OpLabel - %10 = OpVariable %_ptr_Function_uchar Function - %11 = OpFunctionCall %uchar %bar - OpStore %10 %11 Aligned 1 - %12 = OpLoad %uchar %10 Aligned 1 - %14 = OpSConvert %uint %12 - %15 = OpLoad %uchar %10 Aligned 1 - %16 = OpSConvert %uint %15 - %17 = OpIAdd %uint %14 %16 - %18 = OpUConvert %uchar %17 - OpStore %10 %18 Aligned 1 - %19 = OpLoad %uchar %10 Aligned 1 - %21 = OpIAdd %uchar %19 %uchar_1 - OpStore %10 %21 Aligned 1 + %entry = OpLabel + %x = OpVariable %_ptr_Function_uchar Function + %call = OpFunctionCall %uchar %bar + OpStore %x %call Aligned 1 + %12 = OpLoad %uchar %x Aligned 1 + %conv = OpSConvert %uint %12 + %15 = OpLoad %uchar %x Aligned 1 + %conv1 = OpSConvert %uint %15 + %add = OpIAdd %uint %conv %conv1 + %conv2 = OpUConvert %uchar %add + OpStore %x %conv2 Aligned 1 + %19 = OpLoad %uchar %x Aligned 1 + %inc = OpIAdd %uchar %19 %uchar_1 + OpStore %x %inc Aligned 1 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/unusedreturn.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/unusedreturn.spvasm index 766d203fb4..88657c2cbf 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/unusedreturn.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/unusedreturn.spvasm @@ -12,6 +12,9 @@ OpEntryPoint Kernel %9 "foo" OpSource OpenCL_C 200000 OpName %bar "bar" + OpName %entry "entry" + OpName %entry_0 "entry" + OpName %call "call" OpDecorate %bar LinkageAttributes "bar" Export %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 @@ -19,11 +22,11 @@ %void = OpTypeVoid %8 = OpTypeFunction %void %bar = OpFunction %uint DontInline %3 - %5 = OpLabel + %entry = OpLabel OpReturnValue %uint_0 OpFunctionEnd %9 = OpFunction %void DontInline %8 - %10 = OpLabel - %11 = OpFunctionCall %uint %bar + %entry_0 = OpLabel + %call = OpFunctionCall %uint %bar OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/vectortests/addressofvector.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/vectortests/addressofvector.spvasm index 4c51e14b7c..2e50ad1128 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/vectortests/addressofvector.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/vectortests/addressofvector.spvasm @@ -13,9 +13,15 @@ OpEntryPoint Kernel %13 "foo" OpSource OpenCL_C 200000 OpName %bar "bar" + OpName %p "p" + OpName %entry "entry" + OpName %p_addr "p.addr" + OpName %entry_0 "entry" + OpName %v "v" + OpName %v_ascast "v.ascast" OpDecorate %bar LinkageAttributes "bar" Export - OpDecorate %11 Alignment 4 - OpDecorate %16 Alignment 16 + OpDecorate %p_addr Alignment 4 + OpDecorate %v Alignment 16 %uint = OpTypeInt 32 0 %void = OpTypeVoid %v4uint = OpTypeVector %uint 4 @@ -25,16 +31,16 @@ %12 = OpTypeFunction %void %_ptr_Function_v4uint = OpTypePointer Function %v4uint %bar = OpFunction %void DontInline %6 - %8 = OpFunctionParameter %_ptr_Generic_v4uint - %9 = OpLabel - %11 = OpVariable %_ptr_Function__ptr_Generic_v4uint Function - OpStore %11 %8 Aligned 4 + %p = OpFunctionParameter %_ptr_Generic_v4uint + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_Generic_v4uint Function + OpStore %p_addr %p Aligned 4 OpReturn OpFunctionEnd %13 = OpFunction %void DontInline %12 - %14 = OpLabel - %16 = OpVariable %_ptr_Function_v4uint Function - %17 = OpPtrCastToGeneric %_ptr_Generic_v4uint %16 - %18 = OpFunctionCall %void %bar %17 + %entry_0 = OpLabel + %v = OpVariable %_ptr_Function_v4uint Function + %v_ascast = OpPtrCastToGeneric %_ptr_Generic_v4uint %v + %18 = OpFunctionCall %void %bar %v_ascast OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/vectortests/double2simpleaccess.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/vectortests/double2simpleaccess.spvasm index 7a39bf3cb8..afd068db21 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/vectortests/double2simpleaccess.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/vectortests/double2simpleaccess.spvasm @@ -11,8 +11,11 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %4 "k" OpSource OpenCL_C 200000 - OpDecorate %11 Alignment 8 - OpDecorate %9 Alignment 16 + OpName %entry "entry" + OpName %v "v" + OpName %s "s" + OpDecorate %s Alignment 8 + OpDecorate %v Alignment 16 %void = OpTypeVoid %3 = OpTypeFunction %void %double = OpTypeFloat 64 @@ -21,20 +24,20 @@ %_ptr_Function_double = OpTypePointer Function %double %double_42 = OpConstant %double 42 %4 = OpFunction %void DontInline %3 - %5 = OpLabel - %9 = OpVariable %_ptr_Function_v2double Function - %11 = OpVariable %_ptr_Function_double Function - %12 = OpLoad %v2double %9 Aligned 16 + %entry = OpLabel + %v = OpVariable %_ptr_Function_v2double Function + %s = OpVariable %_ptr_Function_double Function + %12 = OpLoad %v2double %v Aligned 16 %14 = OpCompositeInsert %v2double %double_42 %12 0 - OpStore %9 %14 Aligned 16 - %15 = OpLoad %v2double %9 Aligned 16 + OpStore %v %14 Aligned 16 + %15 = OpLoad %v2double %v Aligned 16 %16 = OpCompositeInsert %v2double %double_42 %15 1 - OpStore %9 %16 Aligned 16 - %17 = OpLoad %v2double %9 Aligned 16 + OpStore %v %16 Aligned 16 + %17 = OpLoad %v2double %v Aligned 16 %18 = OpCompositeExtract %double %17 0 - OpStore %11 %18 Aligned 8 - %19 = OpLoad %v2double %9 Aligned 16 + OpStore %s %18 Aligned 8 + %19 = OpLoad %v2double %v Aligned 16 %20 = OpCompositeExtract %double %19 1 - OpStore %11 %20 Aligned 8 + OpStore %s %20 Aligned 8 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/vectortests/double4simpleaccess.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/vectortests/double4simpleaccess.spvasm index c7ff605195..9a83a0dcbd 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/vectortests/double4simpleaccess.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/vectortests/double4simpleaccess.spvasm @@ -11,8 +11,11 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %4 "k" OpSource OpenCL_C 200000 - OpDecorate %11 Alignment 8 - OpDecorate %9 Alignment 32 + OpName %entry "entry" + OpName %v "v" + OpName %s "s" + OpDecorate %s Alignment 8 + OpDecorate %v Alignment 32 %void = OpTypeVoid %3 = OpTypeFunction %void %double = OpTypeFloat 64 @@ -21,32 +24,32 @@ %_ptr_Function_double = OpTypePointer Function %double %double_42 = OpConstant %double 42 %4 = OpFunction %void DontInline %3 - %5 = OpLabel - %9 = OpVariable %_ptr_Function_v4double Function - %11 = OpVariable %_ptr_Function_double Function - %12 = OpLoad %v4double %9 Aligned 32 + %entry = OpLabel + %v = OpVariable %_ptr_Function_v4double Function + %s = OpVariable %_ptr_Function_double Function + %12 = OpLoad %v4double %v Aligned 32 %14 = OpCompositeInsert %v4double %double_42 %12 0 - OpStore %9 %14 Aligned 32 - %15 = OpLoad %v4double %9 Aligned 32 + OpStore %v %14 Aligned 32 + %15 = OpLoad %v4double %v Aligned 32 %16 = OpCompositeInsert %v4double %double_42 %15 1 - OpStore %9 %16 Aligned 32 - %17 = OpLoad %v4double %9 Aligned 32 + OpStore %v %16 Aligned 32 + %17 = OpLoad %v4double %v Aligned 32 %18 = OpCompositeInsert %v4double %double_42 %17 2 - OpStore %9 %18 Aligned 32 - %19 = OpLoad %v4double %9 Aligned 32 + OpStore %v %18 Aligned 32 + %19 = OpLoad %v4double %v Aligned 32 %20 = OpCompositeInsert %v4double %double_42 %19 3 - OpStore %9 %20 Aligned 32 - %21 = OpLoad %v4double %9 Aligned 32 + OpStore %v %20 Aligned 32 + %21 = OpLoad %v4double %v Aligned 32 %22 = OpCompositeExtract %double %21 0 - OpStore %11 %22 Aligned 8 - %23 = OpLoad %v4double %9 Aligned 32 + OpStore %s %22 Aligned 8 + %23 = OpLoad %v4double %v Aligned 32 %24 = OpCompositeExtract %double %23 1 - OpStore %11 %24 Aligned 8 - %25 = OpLoad %v4double %9 Aligned 32 + OpStore %s %24 Aligned 8 + %25 = OpLoad %v4double %v Aligned 32 %26 = OpCompositeExtract %double %25 2 - OpStore %11 %26 Aligned 8 - %27 = OpLoad %v4double %9 Aligned 32 + OpStore %s %26 Aligned 8 + %27 = OpLoad %v4double %v Aligned 32 %28 = OpCompositeExtract %double %27 3 - OpStore %11 %28 Aligned 8 + OpStore %s %28 Aligned 8 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/vectortests/double8simpleaccess.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/vectortests/double8simpleaccess.spvasm index d504af3d79..2f9417c98f 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/vectortests/double8simpleaccess.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/vectortests/double8simpleaccess.spvasm @@ -12,8 +12,11 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %4 "k" OpSource OpenCL_C 200000 - OpDecorate %11 Alignment 8 - OpDecorate %9 Alignment 64 + OpName %entry "entry" + OpName %v "v" + OpName %s "s" + OpDecorate %s Alignment 8 + OpDecorate %v Alignment 64 %void = OpTypeVoid %3 = OpTypeFunction %void %double = OpTypeFloat 64 @@ -22,56 +25,56 @@ %_ptr_Function_double = OpTypePointer Function %double %double_42 = OpConstant %double 42 %4 = OpFunction %void DontInline %3 - %5 = OpLabel - %9 = OpVariable %_ptr_Function_v8double Function - %11 = OpVariable %_ptr_Function_double Function - %12 = OpLoad %v8double %9 Aligned 64 + %entry = OpLabel + %v = OpVariable %_ptr_Function_v8double Function + %s = OpVariable %_ptr_Function_double Function + %12 = OpLoad %v8double %v Aligned 64 %14 = OpCompositeInsert %v8double %double_42 %12 0 - OpStore %9 %14 Aligned 64 - %15 = OpLoad %v8double %9 Aligned 64 + OpStore %v %14 Aligned 64 + %15 = OpLoad %v8double %v Aligned 64 %16 = OpCompositeInsert %v8double %double_42 %15 1 - OpStore %9 %16 Aligned 64 - %17 = OpLoad %v8double %9 Aligned 64 + OpStore %v %16 Aligned 64 + %17 = OpLoad %v8double %v Aligned 64 %18 = OpCompositeInsert %v8double %double_42 %17 2 - OpStore %9 %18 Aligned 64 - %19 = OpLoad %v8double %9 Aligned 64 + OpStore %v %18 Aligned 64 + %19 = OpLoad %v8double %v Aligned 64 %20 = OpCompositeInsert %v8double %double_42 %19 3 - OpStore %9 %20 Aligned 64 - %21 = OpLoad %v8double %9 Aligned 64 + OpStore %v %20 Aligned 64 + %21 = OpLoad %v8double %v Aligned 64 %22 = OpCompositeInsert %v8double %double_42 %21 4 - OpStore %9 %22 Aligned 64 - %23 = OpLoad %v8double %9 Aligned 64 + OpStore %v %22 Aligned 64 + %23 = OpLoad %v8double %v Aligned 64 %24 = OpCompositeInsert %v8double %double_42 %23 5 - OpStore %9 %24 Aligned 64 - %25 = OpLoad %v8double %9 Aligned 64 + OpStore %v %24 Aligned 64 + %25 = OpLoad %v8double %v Aligned 64 %26 = OpCompositeInsert %v8double %double_42 %25 6 - OpStore %9 %26 Aligned 64 - %27 = OpLoad %v8double %9 Aligned 64 + OpStore %v %26 Aligned 64 + %27 = OpLoad %v8double %v Aligned 64 %28 = OpCompositeInsert %v8double %double_42 %27 7 - OpStore %9 %28 Aligned 64 - %29 = OpLoad %v8double %9 Aligned 64 + OpStore %v %28 Aligned 64 + %29 = OpLoad %v8double %v Aligned 64 %30 = OpCompositeExtract %double %29 0 - OpStore %11 %30 Aligned 8 - %31 = OpLoad %v8double %9 Aligned 64 + OpStore %s %30 Aligned 8 + %31 = OpLoad %v8double %v Aligned 64 %32 = OpCompositeExtract %double %31 1 - OpStore %11 %32 Aligned 8 - %33 = OpLoad %v8double %9 Aligned 64 + OpStore %s %32 Aligned 8 + %33 = OpLoad %v8double %v Aligned 64 %34 = OpCompositeExtract %double %33 2 - OpStore %11 %34 Aligned 8 - %35 = OpLoad %v8double %9 Aligned 64 + OpStore %s %34 Aligned 8 + %35 = OpLoad %v8double %v Aligned 64 %36 = OpCompositeExtract %double %35 3 - OpStore %11 %36 Aligned 8 - %37 = OpLoad %v8double %9 Aligned 64 + OpStore %s %36 Aligned 8 + %37 = OpLoad %v8double %v Aligned 64 %38 = OpCompositeExtract %double %37 4 - OpStore %11 %38 Aligned 8 - %39 = OpLoad %v8double %9 Aligned 64 + OpStore %s %38 Aligned 8 + %39 = OpLoad %v8double %v Aligned 64 %40 = OpCompositeExtract %double %39 5 - OpStore %11 %40 Aligned 8 - %41 = OpLoad %v8double %9 Aligned 64 + OpStore %s %40 Aligned 8 + %41 = OpLoad %v8double %v Aligned 64 %42 = OpCompositeExtract %double %41 6 - OpStore %11 %42 Aligned 8 - %43 = OpLoad %v8double %9 Aligned 64 + OpStore %s %42 Aligned 8 + %43 = OpLoad %v8double %v Aligned 64 %44 = OpCompositeExtract %double %43 7 - OpStore %11 %44 Aligned 8 + OpStore %s %44 Aligned 8 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/vectortests/int3arrayaccess.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/vectortests/int3arrayaccess.spvasm index 1c0a9dae28..d8661ba744 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/vectortests/int3arrayaccess.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/vectortests/int3arrayaccess.spvasm @@ -14,14 +14,24 @@ OpName %foo_vs "foo.vs" OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %p "p" + OpName %entry "entry" + OpName %p_addr "p.addr" + OpName %i "i" + OpName %call "call" + OpName %arrayidx "arrayidx" + OpName %call1 "call1" + OpName %arrayidx2 "arrayidx2" + OpName %call3 "call3" + OpName %arrayidx4 "arrayidx4" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %18 Alignment 4 - OpDecorate %20 Alignment 4 + OpDecorate %p_addr Alignment 4 + OpDecorate %i Alignment 4 OpDecorate %foo_vs Alignment 16 %uint = OpTypeInt 32 0 %uint_2048 = OpConstant %uint 2048 @@ -40,27 +50,27 @@ %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %14 = OpFunction %void DontInline %13 - %15 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %16 = OpLabel - %18 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %20 = OpVariable %_ptr_Function_uint Function - OpStore %18 %15 Aligned 4 - %21 = OpLoad %_ptr_CrossWorkgroup_uint %18 Aligned 4 + %p = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %p_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %i = OpVariable %_ptr_Function_uint Function + OpStore %p_addr %p Aligned 4 + %21 = OpLoad %_ptr_CrossWorkgroup_uint %p_addr Aligned 4 %22 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %23 = OpCompositeExtract %uint %22 0 - %24 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %21 %23 - %25 = OpLoad %uint %24 Aligned 4 + %call = OpCompositeExtract %uint %22 0 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %21 %call + %25 = OpLoad %uint %arrayidx Aligned 4 %26 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %27 = OpCompositeExtract %uint %26 0 - %30 = OpInBoundsPtrAccessChain %_ptr_Workgroup_v3uint %foo_vs %uint_0 %27 - %31 = OpLoad %v3uint %30 Aligned 16 + %call1 = OpCompositeExtract %uint %26 0 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_Workgroup_v3uint %foo_vs %uint_0 %call1 + %31 = OpLoad %v3uint %arrayidx2 Aligned 16 %32 = OpCompositeInsert %v3uint %25 %31 0 - OpStore %30 %32 Aligned 16 + OpStore %arrayidx2 %32 Aligned 16 %33 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %34 = OpCompositeExtract %uint %33 0 - %35 = OpInBoundsPtrAccessChain %_ptr_Workgroup_v3uint %foo_vs %uint_0 %34 - %36 = OpLoad %v3uint %35 Aligned 16 + %call3 = OpCompositeExtract %uint %33 0 + %arrayidx4 = OpInBoundsPtrAccessChain %_ptr_Workgroup_v3uint %foo_vs %uint_0 %call3 + %36 = OpLoad %v3uint %arrayidx4 Aligned 16 %37 = OpCompositeExtract %uint %36 0 - OpStore %20 %37 Volatile|Aligned 4 + OpStore %i %37 Volatile|Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/vectortests/int3load.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/vectortests/int3load.spvasm index 426b851ad6..6cbbc5b2e6 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/vectortests/int3load.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/vectortests/int3load.spvasm @@ -13,10 +13,32 @@ OpExecutionMode %8 ContractionOff OpSource OpenCL_C 200000 OpName %bar "bar" + OpName %entry "entry" + OpName %x "x" + OpName %y "y" + OpName %_compoundliteral ".compoundliteral" + OpName %call "call" + OpName %extractVec "extractVec" + OpName %storetmp "storetmp" + OpName %storetmp1 "storetmp1" + OpName %castToVec4 "castToVec4" + OpName %loadVec4 "loadVec4" + OpName %extractVec2 "extractVec2" + OpName %extractVec3 "extractVec3" + OpName %storetmp4 "storetmp4" + OpName %castToVec45 "castToVec45" + OpName %loadVec46 "loadVec46" + OpName %extractVec7 "extractVec7" + OpName %castToVec48 "castToVec48" + OpName %loadVec49 "loadVec49" + OpName %extractVec10 "extractVec10" + OpName %add "add" + OpName %extractVec11 "extractVec11" + OpName %storetmp12 "storetmp12" OpDecorate %bar LinkageAttributes "bar" Import - OpDecorate %11 Alignment 16 - OpDecorate %12 Alignment 16 - OpDecorate %13 Alignment 16 + OpDecorate %x Alignment 16 + OpDecorate %y Alignment 16 + OpDecorate %_compoundliteral Alignment 16 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %22 = OpUndef %uint @@ -33,31 +55,31 @@ %bar = OpFunction %v3uint None %4 OpFunctionEnd %8 = OpFunction %void DontInline %7 - %9 = OpLabel - %11 = OpVariable %_ptr_Function_v3uint Function - %12 = OpVariable %_ptr_Function_v3uint Function - %13 = OpVariable %_ptr_Function_v3uint Function - %14 = OpFunctionCall %v3uint %bar - %17 = OpVectorShuffle %v4uint %14 %15 0 1 2 4294967295 - %19 = OpBitcast %_ptr_Function_v4uint %11 - OpStore %19 %17 Aligned 16 - %20 = OpBitcast %_ptr_Function_v4uint %13 - OpStore %20 %23 Aligned 16 - %24 = OpBitcast %_ptr_Function_v4uint %13 - %25 = OpLoad %v4uint %24 Aligned 16 - %27 = OpVectorShuffle %v3uint %25 %26 0 1 2 - %28 = OpVectorShuffle %v4uint %27 %15 0 1 2 4294967295 - %29 = OpBitcast %_ptr_Function_v4uint %12 - OpStore %29 %28 Aligned 16 - %30 = OpBitcast %_ptr_Function_v4uint %11 - %31 = OpLoad %v4uint %30 Aligned 16 - %32 = OpVectorShuffle %v3uint %31 %26 0 1 2 - %33 = OpBitcast %_ptr_Function_v4uint %12 - %34 = OpLoad %v4uint %33 Aligned 16 - %35 = OpVectorShuffle %v3uint %34 %26 0 1 2 - %36 = OpIAdd %v3uint %35 %32 - %37 = OpVectorShuffle %v4uint %36 %15 0 1 2 4294967295 - %38 = OpBitcast %_ptr_Function_v4uint %12 - OpStore %38 %37 Aligned 16 + %entry = OpLabel + %x = OpVariable %_ptr_Function_v3uint Function + %y = OpVariable %_ptr_Function_v3uint Function +%_compoundliteral = OpVariable %_ptr_Function_v3uint Function + %call = OpFunctionCall %v3uint %bar + %extractVec = OpVectorShuffle %v4uint %call %15 0 1 2 4294967295 + %storetmp = OpBitcast %_ptr_Function_v4uint %x + OpStore %storetmp %extractVec Aligned 16 + %storetmp1 = OpBitcast %_ptr_Function_v4uint %_compoundliteral + OpStore %storetmp1 %23 Aligned 16 + %castToVec4 = OpBitcast %_ptr_Function_v4uint %_compoundliteral + %loadVec4 = OpLoad %v4uint %castToVec4 Aligned 16 +%extractVec2 = OpVectorShuffle %v3uint %loadVec4 %26 0 1 2 +%extractVec3 = OpVectorShuffle %v4uint %extractVec2 %15 0 1 2 4294967295 + %storetmp4 = OpBitcast %_ptr_Function_v4uint %y + OpStore %storetmp4 %extractVec3 Aligned 16 +%castToVec45 = OpBitcast %_ptr_Function_v4uint %x + %loadVec46 = OpLoad %v4uint %castToVec45 Aligned 16 +%extractVec7 = OpVectorShuffle %v3uint %loadVec46 %26 0 1 2 +%castToVec48 = OpBitcast %_ptr_Function_v4uint %y + %loadVec49 = OpLoad %v4uint %castToVec48 Aligned 16 +%extractVec10 = OpVectorShuffle %v3uint %loadVec49 %26 0 1 2 + %add = OpIAdd %v3uint %extractVec10 %extractVec7 +%extractVec11 = OpVectorShuffle %v4uint %add %15 0 1 2 4294967295 + %storetmp12 = OpBitcast %_ptr_Function_v4uint %y + OpStore %storetmp12 %extractVec11 Aligned 16 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/vectortests/int3store.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/vectortests/int3store.spvasm index c119ba21cf..73f4f982f6 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/vectortests/int3store.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/vectortests/int3store.spvasm @@ -13,8 +13,13 @@ OpExecutionMode %8 ContractionOff OpSource OpenCL_C 200000 OpName %bar "bar" + OpName %entry "entry" + OpName %x "x" + OpName %call "call" + OpName %extractVec "extractVec" + OpName %storetmp "storetmp" OpDecorate %bar LinkageAttributes "bar" Import - OpDecorate %11 Alignment 16 + OpDecorate %x Alignment 16 %uint = OpTypeInt 32 0 %v3uint = OpTypeVector %uint 3 %4 = OpTypeFunction %v3uint @@ -27,11 +32,11 @@ %bar = OpFunction %v3uint None %4 OpFunctionEnd %8 = OpFunction %void DontInline %7 - %9 = OpLabel - %11 = OpVariable %_ptr_Function_v3uint Function - %12 = OpFunctionCall %v3uint %bar - %15 = OpVectorShuffle %v4uint %12 %13 0 1 2 4294967295 - %17 = OpBitcast %_ptr_Function_v4uint %11 - OpStore %17 %15 Aligned 16 + %entry = OpLabel + %x = OpVariable %_ptr_Function_v3uint Function + %call = OpFunctionCall %v3uint %bar + %extractVec = OpVectorShuffle %v4uint %call %13 0 1 2 4294967295 + %storetmp = OpBitcast %_ptr_Function_v4uint %x + OpStore %storetmp %extractVec Aligned 16 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/vectortests/vectorops2.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/vectortests/vectorops2.spvasm index fb090dfceb..97a5f31738 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/vectortests/vectorops2.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/vectortests/vectorops2.spvasm @@ -15,11 +15,45 @@ OpSource OpenCL_C 200000 OpName %bar "bar" OpName %baz "baz" + OpName %entry "entry" + OpName %h "h" + OpName %v "v" + OpName %call "call" + OpName %conv "conv" + OpName %shl "shl" + OpName %conv1 "conv1" + OpName %conv2 "conv2" + OpName %conv3 "conv3" + OpName %shl_mask "shl.mask" + OpName %shl4 "shl4" + OpName %conv5 "conv5" + OpName %call6 "call6" + OpName %extractVec "extractVec" + OpName %storetmp "storetmp" + OpName %castToVec4 "castToVec4" + OpName %loadVec4 "loadVec4" + OpName %extractVec7 "extractVec7" + OpName %castToVec48 "castToVec48" + OpName %loadVec49 "loadVec49" + OpName %extractVec10 "extractVec10" + OpName %shl_mask11 "shl.mask11" + OpName %shl12 "shl12" + OpName %extractVec13 "extractVec13" + OpName %storetmp14 "storetmp14" + OpName %castToVec415 "castToVec415" + OpName %loadVec416 "loadVec416" + OpName %extractVec17 "extractVec17" + OpName %castToVec418 "castToVec418" + OpName %loadVec419 "loadVec419" + OpName %extractVec20 "extractVec20" + OpName %xor "xor" + OpName %extractVec21 "extractVec21" + OpName %storetmp22 "storetmp22" OpDecorate %bar FuncParamAttr Sext OpDecorate %bar LinkageAttributes "bar" Import OpDecorate %baz LinkageAttributes "baz" Import - OpDecorate %13 Alignment 1 - OpDecorate %15 Alignment 4 + OpDecorate %h Alignment 1 + OpDecorate %v Alignment 4 %uchar = OpTypeInt 8 0 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 @@ -42,48 +76,48 @@ %baz = OpFunction %v3uchar None %6 OpFunctionEnd %10 = OpFunction %void DontInline %9 - %11 = OpLabel - %13 = OpVariable %_ptr_Function_uchar Function - %15 = OpVariable %_ptr_Function_v3uchar Function - %16 = OpFunctionCall %uchar %bar - OpStore %13 %16 Aligned 1 - %17 = OpLoad %uchar %13 Aligned 1 - %19 = OpSConvert %uint %17 - %21 = OpShiftLeftLogical %uint %19 %uint_1 - %22 = OpUConvert %uchar %21 - OpStore %13 %22 Aligned 1 - %23 = OpLoad %uchar %13 Aligned 1 - %24 = OpSConvert %uint %23 - %25 = OpLoad %uchar %13 Aligned 1 - %26 = OpSConvert %uint %25 - %28 = OpBitwiseAnd %uint %24 %uint_31 - %29 = OpShiftLeftLogical %uint %26 %28 - %30 = OpUConvert %uchar %29 - OpStore %13 %30 Aligned 1 - %31 = OpFunctionCall %v3uchar %baz - %34 = OpVectorShuffle %v4uchar %31 %32 0 1 2 4294967295 - %36 = OpBitcast %_ptr_Function_v4uchar %15 - OpStore %36 %34 Aligned 4 - %37 = OpBitcast %_ptr_Function_v4uchar %15 - %38 = OpLoad %v4uchar %37 Aligned 4 - %40 = OpVectorShuffle %v3uchar %38 %39 0 1 2 - %41 = OpBitcast %_ptr_Function_v4uchar %15 - %42 = OpLoad %v4uchar %41 Aligned 4 - %43 = OpVectorShuffle %v3uchar %42 %39 0 1 2 - %46 = OpBitwiseAnd %v3uchar %40 %45 - %47 = OpShiftLeftLogical %v3uchar %43 %46 - %48 = OpVectorShuffle %v4uchar %47 %32 0 1 2 4294967295 - %49 = OpBitcast %_ptr_Function_v4uchar %15 - OpStore %49 %48 Aligned 4 - %50 = OpBitcast %_ptr_Function_v4uchar %15 - %51 = OpLoad %v4uchar %50 Aligned 4 - %52 = OpVectorShuffle %v3uchar %51 %39 0 1 2 - %53 = OpBitcast %_ptr_Function_v4uchar %15 - %54 = OpLoad %v4uchar %53 Aligned 4 - %55 = OpVectorShuffle %v3uchar %54 %39 0 1 2 - %56 = OpBitwiseXor %v3uchar %52 %55 - %57 = OpVectorShuffle %v4uchar %56 %32 0 1 2 4294967295 - %58 = OpBitcast %_ptr_Function_v4uchar %15 - OpStore %58 %57 Aligned 4 + %entry = OpLabel + %h = OpVariable %_ptr_Function_uchar Function + %v = OpVariable %_ptr_Function_v3uchar Function + %call = OpFunctionCall %uchar %bar + OpStore %h %call Aligned 1 + %17 = OpLoad %uchar %h Aligned 1 + %conv = OpSConvert %uint %17 + %shl = OpShiftLeftLogical %uint %conv %uint_1 + %conv1 = OpUConvert %uchar %shl + OpStore %h %conv1 Aligned 1 + %23 = OpLoad %uchar %h Aligned 1 + %conv2 = OpSConvert %uint %23 + %25 = OpLoad %uchar %h Aligned 1 + %conv3 = OpSConvert %uint %25 + %shl_mask = OpBitwiseAnd %uint %conv2 %uint_31 + %shl4 = OpShiftLeftLogical %uint %conv3 %shl_mask + %conv5 = OpUConvert %uchar %shl4 + OpStore %h %conv5 Aligned 1 + %call6 = OpFunctionCall %v3uchar %baz + %extractVec = OpVectorShuffle %v4uchar %call6 %32 0 1 2 4294967295 + %storetmp = OpBitcast %_ptr_Function_v4uchar %v + OpStore %storetmp %extractVec Aligned 4 + %castToVec4 = OpBitcast %_ptr_Function_v4uchar %v + %loadVec4 = OpLoad %v4uchar %castToVec4 Aligned 4 +%extractVec7 = OpVectorShuffle %v3uchar %loadVec4 %39 0 1 2 +%castToVec48 = OpBitcast %_ptr_Function_v4uchar %v + %loadVec49 = OpLoad %v4uchar %castToVec48 Aligned 4 +%extractVec10 = OpVectorShuffle %v3uchar %loadVec49 %39 0 1 2 + %shl_mask11 = OpBitwiseAnd %v3uchar %extractVec7 %45 + %shl12 = OpShiftLeftLogical %v3uchar %extractVec10 %shl_mask11 +%extractVec13 = OpVectorShuffle %v4uchar %shl12 %32 0 1 2 4294967295 + %storetmp14 = OpBitcast %_ptr_Function_v4uchar %v + OpStore %storetmp14 %extractVec13 Aligned 4 +%castToVec415 = OpBitcast %_ptr_Function_v4uchar %v + %loadVec416 = OpLoad %v4uchar %castToVec415 Aligned 4 +%extractVec17 = OpVectorShuffle %v3uchar %loadVec416 %39 0 1 2 +%castToVec418 = OpBitcast %_ptr_Function_v4uchar %v + %loadVec419 = OpLoad %v4uchar %castToVec418 Aligned 4 +%extractVec20 = OpVectorShuffle %v3uchar %loadVec419 %39 0 1 2 + %xor = OpBitwiseXor %v3uchar %extractVec17 %extractVec20 +%extractVec21 = OpVectorShuffle %v4uchar %xor %32 0 1 2 4294967295 + %storetmp22 = OpBitcast %_ptr_Function_v4uchar %v + OpStore %storetmp22 %extractVec21 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/vectortests/vectorswizzle.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/vectortests/vectorswizzle.spvasm index c57e3b5f4b..2ca81bd5a2 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/vectortests/vectorswizzle.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/vectortests/vectorswizzle.spvasm @@ -11,11 +11,19 @@ OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %4 "foo" OpSource OpenCL_C 200000 - OpDecorate %17 Alignment 2 - OpDecorate %9 Alignment 4 - OpDecorate %10 Alignment 4 - OpDecorate %11 Alignment 4 - OpDecorate %14 Alignment 4 + OpName %entry "entry" + OpName %start "start" + OpName %_compoundliteral ".compoundliteral" + OpName %temp4 "temp4" + OpName %temp3 "temp3" + OpName %temp2 "temp2" + OpName %extractVec "extractVec" + OpName %storetmp "storetmp" + OpDecorate %temp2 Alignment 2 + OpDecorate %start Alignment 4 + OpDecorate %_compoundliteral Alignment 4 + OpDecorate %temp4 Alignment 4 + OpDecorate %temp3 Alignment 4 %uchar = OpTypeInt 8 0 %uchar_1 = OpConstant %uchar 1 %uchar_2 = OpConstant %uchar 2 @@ -33,25 +41,25 @@ %25 = OpUndef %v4uchar %29 = OpUndef %v3uchar %4 = OpFunction %void DontInline %3 - %5 = OpLabel - %9 = OpVariable %_ptr_Function_v4uchar Function - %10 = OpVariable %_ptr_Function_v4uchar Function - %11 = OpVariable %_ptr_Function_v4uchar Function - %14 = OpVariable %_ptr_Function_v3uchar Function - %17 = OpVariable %_ptr_Function_v2uchar Function - OpStore %10 %22 Aligned 4 - %23 = OpLoad %v4uchar %10 Aligned 4 - OpStore %9 %23 Aligned 4 - %24 = OpLoad %v4uchar %9 Aligned 4 + %entry = OpLabel + %start = OpVariable %_ptr_Function_v4uchar Function +%_compoundliteral = OpVariable %_ptr_Function_v4uchar Function + %temp4 = OpVariable %_ptr_Function_v4uchar Function + %temp3 = OpVariable %_ptr_Function_v3uchar Function + %temp2 = OpVariable %_ptr_Function_v2uchar Function + OpStore %_compoundliteral %22 Aligned 4 + %23 = OpLoad %v4uchar %_compoundliteral Aligned 4 + OpStore %start %23 Aligned 4 + %24 = OpLoad %v4uchar %start Aligned 4 %26 = OpVectorShuffle %v4uchar %24 %25 1 1 0 0 - OpStore %11 %26 Aligned 4 - %27 = OpLoad %v4uchar %9 Aligned 4 + OpStore %temp4 %26 Aligned 4 + %27 = OpLoad %v4uchar %start Aligned 4 %28 = OpVectorShuffle %v3uchar %27 %25 2 1 0 - %30 = OpVectorShuffle %v4uchar %28 %29 0 1 2 4294967295 - %31 = OpBitcast %_ptr_Function_v4uchar %14 - OpStore %31 %30 Aligned 4 - %32 = OpLoad %v3uchar %14 Aligned 4 + %extractVec = OpVectorShuffle %v4uchar %28 %29 0 1 2 4294967295 + %storetmp = OpBitcast %_ptr_Function_v4uchar %temp3 + OpStore %storetmp %extractVec Aligned 4 + %32 = OpLoad %v3uchar %temp3 Aligned 4 %33 = OpVectorShuffle %v2uchar %32 %29 2 0 - OpStore %17 %33 Aligned 2 + OpStore %temp2 %33 Aligned 2 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/warpsync/broken_shuffle.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/warpsync/broken_shuffle.spvasm index c93eb03b14..6145fc13c2 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/warpsync/broken_shuffle.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/warpsync/broken_shuffle.spvasm @@ -12,13 +12,27 @@ OpEntryPoint Kernel %9 "shuffle" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %A "A" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpName %tid "tid" + OpName %warp "warp" + OpName %B "B" + OpName %call "call" + OpName %div "div" + OpName %mul "mul" + OpName %add_ptr "add.ptr" + OpName %add "add" + OpName %rem "rem" + OpName %arrayidx "arrayidx" + OpName %arrayidx1 "arrayidx1" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %13 Alignment 4 - OpDecorate %15 Alignment 4 - OpDecorate %16 Alignment 4 - OpDecorate %17 Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %tid Alignment 4 + OpDecorate %warp Alignment 4 + OpDecorate %B Alignment 4 %uint = OpTypeInt 32 0 %uint_32 = OpConstant %uint 32 %uint_1 = OpConstant %uint 1 @@ -31,33 +45,33 @@ %_ptr_Function_uint = OpTypePointer Function %uint %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_Workgroup_uint - %11 = OpLabel - %13 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %15 = OpVariable %_ptr_Function_uint Function - %16 = OpVariable %_ptr_Function_uint Function - %17 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - OpStore %13 %10 Aligned 4 + %A = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %tid = OpVariable %_ptr_Function_uint Function + %warp = OpVariable %_ptr_Function_uint Function + %B = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + OpStore %A_addr %A Aligned 4 %18 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %19 = OpCompositeExtract %uint %18 0 - OpStore %15 %19 Aligned 4 - %20 = OpLoad %uint %15 Aligned 4 - %22 = OpSDiv %uint %20 %uint_32 - OpStore %16 %22 Aligned 4 - %23 = OpLoad %_ptr_Workgroup_uint %13 Aligned 4 - %24 = OpLoad %uint %16 Aligned 4 - %25 = OpIMul %uint %24 %uint_32 - %26 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %23 %25 - OpStore %17 %26 Aligned 4 - %27 = OpLoad %_ptr_Workgroup_uint %17 Aligned 4 - %28 = OpLoad %uint %15 Aligned 4 - %30 = OpIAdd %uint %28 %uint_1 - %31 = OpSRem %uint %30 %uint_32 - %32 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %27 %31 - %33 = OpLoad %uint %32 Aligned 4 - %34 = OpLoad %_ptr_Workgroup_uint %13 Aligned 4 - %35 = OpLoad %uint %15 Aligned 4 - %36 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %34 %35 - OpStore %36 %33 Aligned 4 + %call = OpCompositeExtract %uint %18 0 + OpStore %tid %call Aligned 4 + %20 = OpLoad %uint %tid Aligned 4 + %div = OpSDiv %uint %20 %uint_32 + OpStore %warp %div Aligned 4 + %23 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %24 = OpLoad %uint %warp Aligned 4 + %mul = OpIMul %uint %24 %uint_32 + %add_ptr = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %23 %mul + OpStore %B %add_ptr Aligned 4 + %27 = OpLoad %_ptr_Workgroup_uint %B Aligned 4 + %28 = OpLoad %uint %tid Aligned 4 + %add = OpIAdd %uint %28 %uint_1 + %rem = OpSRem %uint %add %uint_32 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %27 %rem + %33 = OpLoad %uint %arrayidx Aligned 4 + %34 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %35 = OpLoad %uint %tid Aligned 4 + %arrayidx1 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %34 %35 + OpStore %arrayidx1 %33 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/warpsync/intragroup_scan.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/warpsync/intragroup_scan.spvasm index d0fbbdc720..2582680e61 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/warpsync/intragroup_scan.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/warpsync/intragroup_scan.spvasm @@ -13,19 +13,130 @@ OpSource OpenCL_C 200000 OpName %scan_temp "scan.temp" OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %A "A" + OpName %entry "entry" + OpName %if_then_i20 "if.then.i20" + OpName %if_end_i22 "if.end.i22" + OpName %if_then4_i28 "if.then4.i28" + OpName %if_end10_i30 "if.end10.i30" + OpName %if_then12_i36 "if.then12.i36" + OpName %if_end18_i38 "if.end18.i38" + OpName %if_then20_i44 "if.then20.i44" + OpName %if_end26_i46 "if.end26.i46" + OpName %if_then28_i52 "if.then28.i52" + OpName %scan_warp_exit53 "scan_warp.exit53" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %if_then4 "if.then4" + OpName %if_then_i "if.then.i" + OpName %if_end_i "if.end.i" + OpName %if_then4_i "if.then4.i" + OpName %if_end10_i "if.end10.i" + OpName %if_then12_i "if.then12.i" + OpName %if_end18_i "if.end18.i" + OpName %if_then20_i "if.then20.i" + OpName %if_end26_i "if.end26.i" + OpName %if_then28_i "if.then28.i" + OpName %scan_warp_exit "scan_warp.exit" + OpName %if_end5 "if.end5" + OpName %A_addr_i9 "A.addr.i9" + OpName %tid_i10 "tid.i10" + OpName %lane_i11 "lane.i11" + OpName %A_addr_i "A.addr.i" + OpName %tid_i "tid.i" + OpName %lane_i "lane.i" + OpName %A_addr "A.addr" + OpName %tid "tid" + OpName %lane "lane" + OpName %call "call" + OpName %rem "rem" + OpName %call_i12 "call.i12" + OpName %rem_i13 "rem.i13" + OpName %cmp_i14 "cmp.i14" + OpName %sub_i15 "sub.i15" + OpName %arrayidx_i16 "arrayidx.i16" + OpName %arrayidx1_i17 "arrayidx1.i17" + OpName %add_i18 "add.i18" + OpName %arrayidx2_i19 "arrayidx2.i19" + OpName %cmp3_i21 "cmp3.i21" + OpName %sub5_i23 "sub5.i23" + OpName %arrayidx6_i24 "arrayidx6.i24" + OpName %arrayidx7_i25 "arrayidx7.i25" + OpName %add8_i26 "add8.i26" + OpName %arrayidx9_i27 "arrayidx9.i27" + OpName %cmp11_i29 "cmp11.i29" + OpName %sub13_i31 "sub13.i31" + OpName %arrayidx14_i32 "arrayidx14.i32" + OpName %arrayidx15_i33 "arrayidx15.i33" + OpName %add16_i34 "add16.i34" + OpName %arrayidx17_i35 "arrayidx17.i35" + OpName %cmp19_i37 "cmp19.i37" + OpName %sub21_i39 "sub21.i39" + OpName %arrayidx22_i40 "arrayidx22.i40" + OpName %arrayidx23_i41 "arrayidx23.i41" + OpName %add24_i42 "add24.i42" + OpName %arrayidx25_i43 "arrayidx25.i43" + OpName %cmp27_i45 "cmp27.i45" + OpName %sub29_i47 "sub29.i47" + OpName %arrayidx30_i48 "arrayidx30.i48" + OpName %arrayidx31_i49 "arrayidx31.i49" + OpName %add32_i50 "add32.i50" + OpName %arrayidx33_i51 "arrayidx33.i51" + OpName %cmp "cmp" + OpName %arrayidx "arrayidx" + OpName %div "div" + OpName %arrayidx1 "arrayidx1" + OpName %div2 "div2" + OpName %cmp3 "cmp3" + OpName %call_i "call.i" + OpName %rem_i "rem.i" + OpName %cmp_i "cmp.i" + OpName %sub_i "sub.i" + OpName %arrayidx_i "arrayidx.i" + OpName %arrayidx1_i "arrayidx1.i" + OpName %add_i "add.i" + OpName %arrayidx2_i "arrayidx2.i" + OpName %cmp3_i "cmp3.i" + OpName %sub5_i "sub5.i" + OpName %arrayidx6_i "arrayidx6.i" + OpName %arrayidx7_i "arrayidx7.i" + OpName %add8_i "add8.i" + OpName %arrayidx9_i "arrayidx9.i" + OpName %cmp11_i "cmp11.i" + OpName %sub13_i "sub13.i" + OpName %arrayidx14_i "arrayidx14.i" + OpName %arrayidx15_i "arrayidx15.i" + OpName %add16_i "add16.i" + OpName %arrayidx17_i "arrayidx17.i" + OpName %cmp19_i "cmp19.i" + OpName %sub21_i "sub21.i" + OpName %arrayidx22_i "arrayidx22.i" + OpName %arrayidx23_i "arrayidx23.i" + OpName %add24_i "add24.i" + OpName %arrayidx25_i "arrayidx25.i" + OpName %cmp27_i "cmp27.i" + OpName %sub29_i "sub29.i" + OpName %arrayidx30_i "arrayidx30.i" + OpName %arrayidx31_i "arrayidx31.i" + OpName %add32_i "add32.i" + OpName %arrayidx33_i "arrayidx33.i" + OpName %div6 "div6" + OpName %arrayidx7 "arrayidx7" + OpName %arrayidx8 "arrayidx8" + OpName %add "add" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import OpDecorate %scan_temp Alignment 4 - OpDecorate %41 Alignment 4 - OpDecorate %43 Alignment 4 - OpDecorate %44 Alignment 4 - OpDecorate %45 Alignment 4 - OpDecorate %46 Alignment 4 - OpDecorate %47 Alignment 4 - OpDecorate %48 Alignment 4 - OpDecorate %49 Alignment 4 - OpDecorate %50 Alignment 4 + OpDecorate %A_addr_i9 Alignment 4 + OpDecorate %tid_i10 Alignment 4 + OpDecorate %lane_i11 Alignment 4 + OpDecorate %A_addr_i Alignment 4 + OpDecorate %tid_i Alignment 4 + OpDecorate %lane_i Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %tid Alignment 4 + OpDecorate %lane Alignment 4 %uint = OpTypeInt 32 0 %uint_32 = OpConstant %uint 32 %uint_1 = OpConstant %uint 1 @@ -49,273 +160,273 @@ %scan_temp = OpVariable %_ptr_Workgroup__arr_uint_uint_32 Workgroup %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %13 = OpFunction %void DontInline %12 - %14 = OpFunctionParameter %_ptr_Workgroup_uint - %15 = OpLabel - %41 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %43 = OpVariable %_ptr_Function_uint Function - %44 = OpVariable %_ptr_Function_uint Function - %45 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %46 = OpVariable %_ptr_Function_uint Function - %47 = OpVariable %_ptr_Function_uint Function - %48 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %49 = OpVariable %_ptr_Function_uint Function - %50 = OpVariable %_ptr_Function_uint Function - OpStore %48 %14 Aligned 4 + %A = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %A_addr_i9 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %tid_i10 = OpVariable %_ptr_Function_uint Function + %lane_i11 = OpVariable %_ptr_Function_uint Function + %A_addr_i = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %tid_i = OpVariable %_ptr_Function_uint Function + %lane_i = OpVariable %_ptr_Function_uint Function + %A_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %tid = OpVariable %_ptr_Function_uint Function + %lane = OpVariable %_ptr_Function_uint Function + OpStore %A_addr %A Aligned 4 %51 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %52 = OpCompositeExtract %uint %51 0 - OpStore %49 %52 Aligned 4 - %53 = OpLoad %uint %49 Aligned 4 - %54 = OpUMod %uint %53 %uint_32 - OpStore %50 %54 Aligned 4 - %55 = OpLoad %_ptr_Workgroup_uint %48 Aligned 4 - OpStore %41 %55 Aligned 4 + %call = OpCompositeExtract %uint %51 0 + OpStore %tid %call Aligned 4 + %53 = OpLoad %uint %tid Aligned 4 + %rem = OpUMod %uint %53 %uint_32 + OpStore %lane %rem Aligned 4 + %55 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + OpStore %A_addr_i9 %55 Aligned 4 %56 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %57 = OpCompositeExtract %uint %56 0 - OpStore %43 %57 Aligned 4 - %58 = OpLoad %uint %43 Aligned 4 - %59 = OpUMod %uint %58 %uint_32 - OpStore %44 %59 Aligned 4 - %60 = OpLoad %uint %44 Aligned 4 - %63 = OpUGreaterThanEqual %bool %60 %uint_1 + %call_i12 = OpCompositeExtract %uint %56 0 + OpStore %tid_i10 %call_i12 Aligned 4 + %58 = OpLoad %uint %tid_i10 Aligned 4 + %rem_i13 = OpUMod %uint %58 %uint_32 + OpStore %lane_i11 %rem_i13 Aligned 4 + %60 = OpLoad %uint %lane_i11 Aligned 4 + %cmp_i14 = OpUGreaterThanEqual %bool %60 %uint_1 %65 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %scan_temp %uint_0 %uint_0 - OpBranchConditional %63 %16 %17 - %16 = OpLabel - %66 = OpLoad %_ptr_Workgroup_uint %41 Aligned 4 - %67 = OpLoad %uint %43 Aligned 4 - %68 = OpISub %uint %67 %uint_1 - %69 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %66 %68 - %70 = OpLoad %uint %69 Aligned 4 - %71 = OpLoad %_ptr_Workgroup_uint %41 Aligned 4 - %72 = OpLoad %uint %43 Aligned 4 - %73 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %71 %72 - %74 = OpLoad %uint %73 Aligned 4 - %75 = OpIAdd %uint %70 %74 - %76 = OpLoad %_ptr_Workgroup_uint %41 Aligned 4 - %77 = OpLoad %uint %43 Aligned 4 - %78 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %76 %77 - OpStore %78 %75 Aligned 4 - OpBranch %17 - %17 = OpLabel - %79 = OpLoad %uint %44 Aligned 4 - %81 = OpUGreaterThanEqual %bool %79 %uint_2 - OpBranchConditional %81 %18 %19 - %18 = OpLabel - %82 = OpLoad %_ptr_Workgroup_uint %41 Aligned 4 - %83 = OpLoad %uint %43 Aligned 4 - %84 = OpISub %uint %83 %uint_2 - %85 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %82 %84 - %86 = OpLoad %uint %85 Aligned 4 - %87 = OpLoad %_ptr_Workgroup_uint %41 Aligned 4 - %88 = OpLoad %uint %43 Aligned 4 - %89 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %87 %88 - %90 = OpLoad %uint %89 Aligned 4 - %91 = OpIAdd %uint %86 %90 - %92 = OpLoad %_ptr_Workgroup_uint %41 Aligned 4 - %93 = OpLoad %uint %43 Aligned 4 - %94 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %92 %93 - OpStore %94 %91 Aligned 4 - OpBranch %19 - %19 = OpLabel - %95 = OpLoad %uint %44 Aligned 4 - %97 = OpUGreaterThanEqual %bool %95 %uint_4 - OpBranchConditional %97 %20 %21 - %20 = OpLabel - %98 = OpLoad %_ptr_Workgroup_uint %41 Aligned 4 - %99 = OpLoad %uint %43 Aligned 4 - %100 = OpISub %uint %99 %uint_4 - %101 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %98 %100 - %102 = OpLoad %uint %101 Aligned 4 - %103 = OpLoad %_ptr_Workgroup_uint %41 Aligned 4 - %104 = OpLoad %uint %43 Aligned 4 - %105 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %103 %104 - %106 = OpLoad %uint %105 Aligned 4 - %107 = OpIAdd %uint %102 %106 - %108 = OpLoad %_ptr_Workgroup_uint %41 Aligned 4 - %109 = OpLoad %uint %43 Aligned 4 - %110 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %108 %109 - OpStore %110 %107 Aligned 4 - OpBranch %21 - %21 = OpLabel - %111 = OpLoad %uint %44 Aligned 4 - %113 = OpUGreaterThanEqual %bool %111 %uint_8 - OpBranchConditional %113 %22 %23 - %22 = OpLabel - %114 = OpLoad %_ptr_Workgroup_uint %41 Aligned 4 - %115 = OpLoad %uint %43 Aligned 4 - %116 = OpISub %uint %115 %uint_8 - %117 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %114 %116 - %118 = OpLoad %uint %117 Aligned 4 - %119 = OpLoad %_ptr_Workgroup_uint %41 Aligned 4 - %120 = OpLoad %uint %43 Aligned 4 - %121 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %119 %120 - %122 = OpLoad %uint %121 Aligned 4 - %123 = OpIAdd %uint %118 %122 - %124 = OpLoad %_ptr_Workgroup_uint %41 Aligned 4 - %125 = OpLoad %uint %43 Aligned 4 - %126 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %124 %125 - OpStore %126 %123 Aligned 4 - OpBranch %23 - %23 = OpLabel - %127 = OpLoad %uint %44 Aligned 4 - %129 = OpUGreaterThanEqual %bool %127 %uint_16 - OpBranchConditional %129 %24 %25 - %24 = OpLabel - %130 = OpLoad %_ptr_Workgroup_uint %41 Aligned 4 - %131 = OpLoad %uint %43 Aligned 4 - %132 = OpISub %uint %131 %uint_16 - %133 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %130 %132 - %134 = OpLoad %uint %133 Aligned 4 - %135 = OpLoad %_ptr_Workgroup_uint %41 Aligned 4 - %136 = OpLoad %uint %43 Aligned 4 - %137 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %135 %136 - %138 = OpLoad %uint %137 Aligned 4 - %139 = OpIAdd %uint %134 %138 - %140 = OpLoad %_ptr_Workgroup_uint %41 Aligned 4 - %141 = OpLoad %uint %43 Aligned 4 - %142 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %140 %141 - OpStore %142 %139 Aligned 4 - OpBranch %25 - %25 = OpLabel + OpBranchConditional %cmp_i14 %if_then_i20 %if_end_i22 +%if_then_i20 = OpLabel + %66 = OpLoad %_ptr_Workgroup_uint %A_addr_i9 Aligned 4 + %67 = OpLoad %uint %tid_i10 Aligned 4 + %sub_i15 = OpISub %uint %67 %uint_1 +%arrayidx_i16 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %66 %sub_i15 + %70 = OpLoad %uint %arrayidx_i16 Aligned 4 + %71 = OpLoad %_ptr_Workgroup_uint %A_addr_i9 Aligned 4 + %72 = OpLoad %uint %tid_i10 Aligned 4 +%arrayidx1_i17 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %71 %72 + %74 = OpLoad %uint %arrayidx1_i17 Aligned 4 + %add_i18 = OpIAdd %uint %70 %74 + %76 = OpLoad %_ptr_Workgroup_uint %A_addr_i9 Aligned 4 + %77 = OpLoad %uint %tid_i10 Aligned 4 +%arrayidx2_i19 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %76 %77 + OpStore %arrayidx2_i19 %add_i18 Aligned 4 + OpBranch %if_end_i22 + %if_end_i22 = OpLabel + %79 = OpLoad %uint %lane_i11 Aligned 4 + %cmp3_i21 = OpUGreaterThanEqual %bool %79 %uint_2 + OpBranchConditional %cmp3_i21 %if_then4_i28 %if_end10_i30 +%if_then4_i28 = OpLabel + %82 = OpLoad %_ptr_Workgroup_uint %A_addr_i9 Aligned 4 + %83 = OpLoad %uint %tid_i10 Aligned 4 + %sub5_i23 = OpISub %uint %83 %uint_2 +%arrayidx6_i24 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %82 %sub5_i23 + %86 = OpLoad %uint %arrayidx6_i24 Aligned 4 + %87 = OpLoad %_ptr_Workgroup_uint %A_addr_i9 Aligned 4 + %88 = OpLoad %uint %tid_i10 Aligned 4 +%arrayidx7_i25 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %87 %88 + %90 = OpLoad %uint %arrayidx7_i25 Aligned 4 + %add8_i26 = OpIAdd %uint %86 %90 + %92 = OpLoad %_ptr_Workgroup_uint %A_addr_i9 Aligned 4 + %93 = OpLoad %uint %tid_i10 Aligned 4 +%arrayidx9_i27 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %92 %93 + OpStore %arrayidx9_i27 %add8_i26 Aligned 4 + OpBranch %if_end10_i30 +%if_end10_i30 = OpLabel + %95 = OpLoad %uint %lane_i11 Aligned 4 + %cmp11_i29 = OpUGreaterThanEqual %bool %95 %uint_4 + OpBranchConditional %cmp11_i29 %if_then12_i36 %if_end18_i38 +%if_then12_i36 = OpLabel + %98 = OpLoad %_ptr_Workgroup_uint %A_addr_i9 Aligned 4 + %99 = OpLoad %uint %tid_i10 Aligned 4 + %sub13_i31 = OpISub %uint %99 %uint_4 +%arrayidx14_i32 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %98 %sub13_i31 + %102 = OpLoad %uint %arrayidx14_i32 Aligned 4 + %103 = OpLoad %_ptr_Workgroup_uint %A_addr_i9 Aligned 4 + %104 = OpLoad %uint %tid_i10 Aligned 4 +%arrayidx15_i33 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %103 %104 + %106 = OpLoad %uint %arrayidx15_i33 Aligned 4 + %add16_i34 = OpIAdd %uint %102 %106 + %108 = OpLoad %_ptr_Workgroup_uint %A_addr_i9 Aligned 4 + %109 = OpLoad %uint %tid_i10 Aligned 4 +%arrayidx17_i35 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %108 %109 + OpStore %arrayidx17_i35 %add16_i34 Aligned 4 + OpBranch %if_end18_i38 +%if_end18_i38 = OpLabel + %111 = OpLoad %uint %lane_i11 Aligned 4 + %cmp19_i37 = OpUGreaterThanEqual %bool %111 %uint_8 + OpBranchConditional %cmp19_i37 %if_then20_i44 %if_end26_i46 +%if_then20_i44 = OpLabel + %114 = OpLoad %_ptr_Workgroup_uint %A_addr_i9 Aligned 4 + %115 = OpLoad %uint %tid_i10 Aligned 4 + %sub21_i39 = OpISub %uint %115 %uint_8 +%arrayidx22_i40 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %114 %sub21_i39 + %118 = OpLoad %uint %arrayidx22_i40 Aligned 4 + %119 = OpLoad %_ptr_Workgroup_uint %A_addr_i9 Aligned 4 + %120 = OpLoad %uint %tid_i10 Aligned 4 +%arrayidx23_i41 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %119 %120 + %122 = OpLoad %uint %arrayidx23_i41 Aligned 4 + %add24_i42 = OpIAdd %uint %118 %122 + %124 = OpLoad %_ptr_Workgroup_uint %A_addr_i9 Aligned 4 + %125 = OpLoad %uint %tid_i10 Aligned 4 +%arrayidx25_i43 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %124 %125 + OpStore %arrayidx25_i43 %add24_i42 Aligned 4 + OpBranch %if_end26_i46 +%if_end26_i46 = OpLabel + %127 = OpLoad %uint %lane_i11 Aligned 4 + %cmp27_i45 = OpUGreaterThanEqual %bool %127 %uint_16 + OpBranchConditional %cmp27_i45 %if_then28_i52 %scan_warp_exit53 +%if_then28_i52 = OpLabel + %130 = OpLoad %_ptr_Workgroup_uint %A_addr_i9 Aligned 4 + %131 = OpLoad %uint %tid_i10 Aligned 4 + %sub29_i47 = OpISub %uint %131 %uint_16 +%arrayidx30_i48 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %130 %sub29_i47 + %134 = OpLoad %uint %arrayidx30_i48 Aligned 4 + %135 = OpLoad %_ptr_Workgroup_uint %A_addr_i9 Aligned 4 + %136 = OpLoad %uint %tid_i10 Aligned 4 +%arrayidx31_i49 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %135 %136 + %138 = OpLoad %uint %arrayidx31_i49 Aligned 4 + %add32_i50 = OpIAdd %uint %134 %138 + %140 = OpLoad %_ptr_Workgroup_uint %A_addr_i9 Aligned 4 + %141 = OpLoad %uint %tid_i10 Aligned 4 +%arrayidx33_i51 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %140 %141 + OpStore %arrayidx33_i51 %add32_i50 Aligned 4 + OpBranch %scan_warp_exit53 +%scan_warp_exit53 = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_272 - %144 = OpLoad %uint %50 Aligned 4 - %146 = OpIEqual %bool %144 %uint_31 - OpBranchConditional %146 %26 %27 - %26 = OpLabel - %147 = OpLoad %_ptr_Workgroup_uint %48 Aligned 4 - %148 = OpLoad %uint %49 Aligned 4 - %149 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %147 %148 - %150 = OpLoad %uint %149 Aligned 4 - %151 = OpLoad %uint %49 Aligned 4 - %152 = OpUDiv %uint %151 %uint_32 - %153 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %scan_temp %uint_0 %152 - OpStore %153 %150 Aligned 4 - OpBranch %27 - %27 = OpLabel + %144 = OpLoad %uint %lane Aligned 4 + %cmp = OpIEqual %bool %144 %uint_31 + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel + %147 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %148 = OpLoad %uint %tid Aligned 4 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %147 %148 + %150 = OpLoad %uint %arrayidx Aligned 4 + %151 = OpLoad %uint %tid Aligned 4 + %div = OpUDiv %uint %151 %uint_32 + %arrayidx1 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %scan_temp %uint_0 %div + OpStore %arrayidx1 %150 Aligned 4 + OpBranch %if_end + %if_end = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_272 - %154 = OpLoad %uint %49 Aligned 4 - %155 = OpUDiv %uint %154 %uint_32 - %156 = OpIEqual %bool %155 %uint_0 - OpBranchConditional %156 %28 %39 - %28 = OpLabel - OpStore %45 %65 Aligned 4 + %154 = OpLoad %uint %tid Aligned 4 + %div2 = OpUDiv %uint %154 %uint_32 + %cmp3 = OpIEqual %bool %div2 %uint_0 + OpBranchConditional %cmp3 %if_then4 %if_end5 + %if_then4 = OpLabel + OpStore %A_addr_i %65 Aligned 4 %157 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %158 = OpCompositeExtract %uint %157 0 - OpStore %46 %158 Aligned 4 - %159 = OpLoad %uint %46 Aligned 4 - %160 = OpUMod %uint %159 %uint_32 - OpStore %47 %160 Aligned 4 - %161 = OpLoad %uint %47 Aligned 4 - %162 = OpUGreaterThanEqual %bool %161 %uint_1 - OpBranchConditional %162 %29 %30 - %29 = OpLabel - %163 = OpLoad %_ptr_Workgroup_uint %45 Aligned 4 - %164 = OpLoad %uint %46 Aligned 4 - %165 = OpISub %uint %164 %uint_1 - %166 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %163 %165 - %167 = OpLoad %uint %166 Aligned 4 - %168 = OpLoad %_ptr_Workgroup_uint %45 Aligned 4 - %169 = OpLoad %uint %46 Aligned 4 - %170 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %168 %169 - %171 = OpLoad %uint %170 Aligned 4 - %172 = OpIAdd %uint %167 %171 - %173 = OpLoad %_ptr_Workgroup_uint %45 Aligned 4 - %174 = OpLoad %uint %46 Aligned 4 - %175 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %173 %174 - OpStore %175 %172 Aligned 4 - OpBranch %30 - %30 = OpLabel - %176 = OpLoad %uint %47 Aligned 4 - %177 = OpUGreaterThanEqual %bool %176 %uint_2 - OpBranchConditional %177 %31 %32 - %31 = OpLabel - %178 = OpLoad %_ptr_Workgroup_uint %45 Aligned 4 - %179 = OpLoad %uint %46 Aligned 4 - %180 = OpISub %uint %179 %uint_2 - %181 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %178 %180 - %182 = OpLoad %uint %181 Aligned 4 - %183 = OpLoad %_ptr_Workgroup_uint %45 Aligned 4 - %184 = OpLoad %uint %46 Aligned 4 - %185 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %183 %184 - %186 = OpLoad %uint %185 Aligned 4 - %187 = OpIAdd %uint %182 %186 - %188 = OpLoad %_ptr_Workgroup_uint %45 Aligned 4 - %189 = OpLoad %uint %46 Aligned 4 - %190 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %188 %189 - OpStore %190 %187 Aligned 4 - OpBranch %32 - %32 = OpLabel - %191 = OpLoad %uint %47 Aligned 4 - %192 = OpUGreaterThanEqual %bool %191 %uint_4 - OpBranchConditional %192 %33 %34 - %33 = OpLabel - %193 = OpLoad %_ptr_Workgroup_uint %45 Aligned 4 - %194 = OpLoad %uint %46 Aligned 4 - %195 = OpISub %uint %194 %uint_4 - %196 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %193 %195 - %197 = OpLoad %uint %196 Aligned 4 - %198 = OpLoad %_ptr_Workgroup_uint %45 Aligned 4 - %199 = OpLoad %uint %46 Aligned 4 - %200 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %198 %199 - %201 = OpLoad %uint %200 Aligned 4 - %202 = OpIAdd %uint %197 %201 - %203 = OpLoad %_ptr_Workgroup_uint %45 Aligned 4 - %204 = OpLoad %uint %46 Aligned 4 - %205 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %203 %204 - OpStore %205 %202 Aligned 4 - OpBranch %34 - %34 = OpLabel - %206 = OpLoad %uint %47 Aligned 4 - %207 = OpUGreaterThanEqual %bool %206 %uint_8 - OpBranchConditional %207 %35 %36 - %35 = OpLabel - %208 = OpLoad %_ptr_Workgroup_uint %45 Aligned 4 - %209 = OpLoad %uint %46 Aligned 4 - %210 = OpISub %uint %209 %uint_8 - %211 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %208 %210 - %212 = OpLoad %uint %211 Aligned 4 - %213 = OpLoad %_ptr_Workgroup_uint %45 Aligned 4 - %214 = OpLoad %uint %46 Aligned 4 - %215 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %213 %214 - %216 = OpLoad %uint %215 Aligned 4 - %217 = OpIAdd %uint %212 %216 - %218 = OpLoad %_ptr_Workgroup_uint %45 Aligned 4 - %219 = OpLoad %uint %46 Aligned 4 - %220 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %218 %219 - OpStore %220 %217 Aligned 4 - OpBranch %36 - %36 = OpLabel - %221 = OpLoad %uint %47 Aligned 4 - %222 = OpUGreaterThanEqual %bool %221 %uint_16 - OpBranchConditional %222 %37 %38 - %37 = OpLabel - %223 = OpLoad %_ptr_Workgroup_uint %45 Aligned 4 - %224 = OpLoad %uint %46 Aligned 4 - %225 = OpISub %uint %224 %uint_16 - %226 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %223 %225 - %227 = OpLoad %uint %226 Aligned 4 - %228 = OpLoad %_ptr_Workgroup_uint %45 Aligned 4 - %229 = OpLoad %uint %46 Aligned 4 - %230 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %228 %229 - %231 = OpLoad %uint %230 Aligned 4 - %232 = OpIAdd %uint %227 %231 - %233 = OpLoad %_ptr_Workgroup_uint %45 Aligned 4 - %234 = OpLoad %uint %46 Aligned 4 - %235 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %233 %234 - OpStore %235 %232 Aligned 4 - OpBranch %38 - %38 = OpLabel - OpBranch %39 - %39 = OpLabel + %call_i = OpCompositeExtract %uint %157 0 + OpStore %tid_i %call_i Aligned 4 + %159 = OpLoad %uint %tid_i Aligned 4 + %rem_i = OpUMod %uint %159 %uint_32 + OpStore %lane_i %rem_i Aligned 4 + %161 = OpLoad %uint %lane_i Aligned 4 + %cmp_i = OpUGreaterThanEqual %bool %161 %uint_1 + OpBranchConditional %cmp_i %if_then_i %if_end_i + %if_then_i = OpLabel + %163 = OpLoad %_ptr_Workgroup_uint %A_addr_i Aligned 4 + %164 = OpLoad %uint %tid_i Aligned 4 + %sub_i = OpISub %uint %164 %uint_1 + %arrayidx_i = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %163 %sub_i + %167 = OpLoad %uint %arrayidx_i Aligned 4 + %168 = OpLoad %_ptr_Workgroup_uint %A_addr_i Aligned 4 + %169 = OpLoad %uint %tid_i Aligned 4 +%arrayidx1_i = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %168 %169 + %171 = OpLoad %uint %arrayidx1_i Aligned 4 + %add_i = OpIAdd %uint %167 %171 + %173 = OpLoad %_ptr_Workgroup_uint %A_addr_i Aligned 4 + %174 = OpLoad %uint %tid_i Aligned 4 +%arrayidx2_i = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %173 %174 + OpStore %arrayidx2_i %add_i Aligned 4 + OpBranch %if_end_i + %if_end_i = OpLabel + %176 = OpLoad %uint %lane_i Aligned 4 + %cmp3_i = OpUGreaterThanEqual %bool %176 %uint_2 + OpBranchConditional %cmp3_i %if_then4_i %if_end10_i + %if_then4_i = OpLabel + %178 = OpLoad %_ptr_Workgroup_uint %A_addr_i Aligned 4 + %179 = OpLoad %uint %tid_i Aligned 4 + %sub5_i = OpISub %uint %179 %uint_2 +%arrayidx6_i = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %178 %sub5_i + %182 = OpLoad %uint %arrayidx6_i Aligned 4 + %183 = OpLoad %_ptr_Workgroup_uint %A_addr_i Aligned 4 + %184 = OpLoad %uint %tid_i Aligned 4 +%arrayidx7_i = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %183 %184 + %186 = OpLoad %uint %arrayidx7_i Aligned 4 + %add8_i = OpIAdd %uint %182 %186 + %188 = OpLoad %_ptr_Workgroup_uint %A_addr_i Aligned 4 + %189 = OpLoad %uint %tid_i Aligned 4 +%arrayidx9_i = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %188 %189 + OpStore %arrayidx9_i %add8_i Aligned 4 + OpBranch %if_end10_i + %if_end10_i = OpLabel + %191 = OpLoad %uint %lane_i Aligned 4 + %cmp11_i = OpUGreaterThanEqual %bool %191 %uint_4 + OpBranchConditional %cmp11_i %if_then12_i %if_end18_i +%if_then12_i = OpLabel + %193 = OpLoad %_ptr_Workgroup_uint %A_addr_i Aligned 4 + %194 = OpLoad %uint %tid_i Aligned 4 + %sub13_i = OpISub %uint %194 %uint_4 +%arrayidx14_i = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %193 %sub13_i + %197 = OpLoad %uint %arrayidx14_i Aligned 4 + %198 = OpLoad %_ptr_Workgroup_uint %A_addr_i Aligned 4 + %199 = OpLoad %uint %tid_i Aligned 4 +%arrayidx15_i = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %198 %199 + %201 = OpLoad %uint %arrayidx15_i Aligned 4 + %add16_i = OpIAdd %uint %197 %201 + %203 = OpLoad %_ptr_Workgroup_uint %A_addr_i Aligned 4 + %204 = OpLoad %uint %tid_i Aligned 4 +%arrayidx17_i = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %203 %204 + OpStore %arrayidx17_i %add16_i Aligned 4 + OpBranch %if_end18_i + %if_end18_i = OpLabel + %206 = OpLoad %uint %lane_i Aligned 4 + %cmp19_i = OpUGreaterThanEqual %bool %206 %uint_8 + OpBranchConditional %cmp19_i %if_then20_i %if_end26_i +%if_then20_i = OpLabel + %208 = OpLoad %_ptr_Workgroup_uint %A_addr_i Aligned 4 + %209 = OpLoad %uint %tid_i Aligned 4 + %sub21_i = OpISub %uint %209 %uint_8 +%arrayidx22_i = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %208 %sub21_i + %212 = OpLoad %uint %arrayidx22_i Aligned 4 + %213 = OpLoad %_ptr_Workgroup_uint %A_addr_i Aligned 4 + %214 = OpLoad %uint %tid_i Aligned 4 +%arrayidx23_i = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %213 %214 + %216 = OpLoad %uint %arrayidx23_i Aligned 4 + %add24_i = OpIAdd %uint %212 %216 + %218 = OpLoad %_ptr_Workgroup_uint %A_addr_i Aligned 4 + %219 = OpLoad %uint %tid_i Aligned 4 +%arrayidx25_i = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %218 %219 + OpStore %arrayidx25_i %add24_i Aligned 4 + OpBranch %if_end26_i + %if_end26_i = OpLabel + %221 = OpLoad %uint %lane_i Aligned 4 + %cmp27_i = OpUGreaterThanEqual %bool %221 %uint_16 + OpBranchConditional %cmp27_i %if_then28_i %scan_warp_exit +%if_then28_i = OpLabel + %223 = OpLoad %_ptr_Workgroup_uint %A_addr_i Aligned 4 + %224 = OpLoad %uint %tid_i Aligned 4 + %sub29_i = OpISub %uint %224 %uint_16 +%arrayidx30_i = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %223 %sub29_i + %227 = OpLoad %uint %arrayidx30_i Aligned 4 + %228 = OpLoad %_ptr_Workgroup_uint %A_addr_i Aligned 4 + %229 = OpLoad %uint %tid_i Aligned 4 +%arrayidx31_i = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %228 %229 + %231 = OpLoad %uint %arrayidx31_i Aligned 4 + %add32_i = OpIAdd %uint %227 %231 + %233 = OpLoad %_ptr_Workgroup_uint %A_addr_i Aligned 4 + %234 = OpLoad %uint %tid_i Aligned 4 +%arrayidx33_i = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %233 %234 + OpStore %arrayidx33_i %add32_i Aligned 4 + OpBranch %scan_warp_exit +%scan_warp_exit = OpLabel + OpBranch %if_end5 + %if_end5 = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_272 - %236 = OpLoad %uint %49 Aligned 4 - %237 = OpUDiv %uint %236 %uint_32 - %238 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %scan_temp %uint_0 %237 - %239 = OpLoad %uint %238 Aligned 4 - %240 = OpLoad %_ptr_Workgroup_uint %48 Aligned 4 - %241 = OpLoad %uint %49 Aligned 4 - %242 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %240 %241 - %243 = OpLoad %uint %242 Aligned 4 - %244 = OpIAdd %uint %243 %239 - OpStore %242 %244 Aligned 4 + %236 = OpLoad %uint %tid Aligned 4 + %div6 = OpUDiv %uint %236 %uint_32 + %arrayidx7 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %scan_temp %uint_0 %div6 + %239 = OpLoad %uint %arrayidx7 Aligned 4 + %240 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %241 = OpLoad %uint %tid Aligned 4 + %arrayidx8 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %240 %241 + %243 = OpLoad %uint %arrayidx8 Aligned 4 + %add = OpIAdd %uint %243 %239 + OpStore %arrayidx8 %add Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/warpsync/scan_warp.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/warpsync/scan_warp.spvasm index e10b824a9c..502f0229e3 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/warpsync/scan_warp.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/warpsync/scan_warp.spvasm @@ -12,12 +12,59 @@ OpEntryPoint Kernel %9 "scan" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %A "A" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %if_then4 "if.then4" + OpName %if_end10 "if.end10" + OpName %if_then12 "if.then12" + OpName %if_end18 "if.end18" + OpName %if_then20 "if.then20" + OpName %if_end26 "if.end26" + OpName %if_then28 "if.then28" + OpName %if_end34 "if.end34" + OpName %A_addr "A.addr" + OpName %tid "tid" + OpName %lane "lane" + OpName %call "call" + OpName %and "and" + OpName %cmp "cmp" + OpName %sub "sub" + OpName %arrayidx "arrayidx" + OpName %arrayidx1 "arrayidx1" + OpName %add "add" + OpName %arrayidx2 "arrayidx2" + OpName %cmp3 "cmp3" + OpName %sub5 "sub5" + OpName %arrayidx6 "arrayidx6" + OpName %arrayidx7 "arrayidx7" + OpName %add8 "add8" + OpName %arrayidx9 "arrayidx9" + OpName %cmp11 "cmp11" + OpName %sub13 "sub13" + OpName %arrayidx14 "arrayidx14" + OpName %arrayidx15 "arrayidx15" + OpName %add16 "add16" + OpName %arrayidx17 "arrayidx17" + OpName %cmp19 "cmp19" + OpName %sub21 "sub21" + OpName %arrayidx22 "arrayidx22" + OpName %arrayidx23 "arrayidx23" + OpName %add24 "add24" + OpName %arrayidx25 "arrayidx25" + OpName %cmp27 "cmp27" + OpName %sub29 "sub29" + OpName %arrayidx30 "arrayidx30" + OpName %arrayidx31 "arrayidx31" + OpName %add32 "add32" + OpName %arrayidx33 "arrayidx33" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %23 Alignment 4 - OpDecorate %25 Alignment 4 - OpDecorate %26 Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %tid Alignment 4 + OpDecorate %lane Alignment 4 %uint = OpTypeInt 32 0 %uint_31 = OpConstant %uint 31 %uint_1 = OpConstant %uint 1 @@ -35,117 +82,117 @@ %bool = OpTypeBool %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_Workgroup_uint - %11 = OpLabel - %23 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %25 = OpVariable %_ptr_Function_uint Function - %26 = OpVariable %_ptr_Function_uint Function - OpStore %23 %10 Aligned 4 + %A = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %tid = OpVariable %_ptr_Function_uint Function + %lane = OpVariable %_ptr_Function_uint Function + OpStore %A_addr %A Aligned 4 %27 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %28 = OpCompositeExtract %uint %27 0 - OpStore %25 %28 Aligned 4 - %29 = OpLoad %uint %25 Aligned 4 - %31 = OpBitwiseAnd %uint %29 %uint_31 - OpStore %26 %31 Aligned 4 - %32 = OpLoad %uint %26 Aligned 4 - %35 = OpUGreaterThanEqual %bool %32 %uint_1 - OpBranchConditional %35 %12 %13 - %12 = OpLabel - %36 = OpLoad %_ptr_Workgroup_uint %23 Aligned 4 - %37 = OpLoad %uint %25 Aligned 4 - %38 = OpISub %uint %37 %uint_1 - %39 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %36 %38 - %40 = OpLoad %uint %39 Aligned 4 - %41 = OpLoad %_ptr_Workgroup_uint %23 Aligned 4 - %42 = OpLoad %uint %25 Aligned 4 - %43 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %41 %42 - %44 = OpLoad %uint %43 Aligned 4 - %45 = OpIAdd %uint %40 %44 - %46 = OpLoad %_ptr_Workgroup_uint %23 Aligned 4 - %47 = OpLoad %uint %25 Aligned 4 - %48 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %46 %47 - OpStore %48 %45 Aligned 4 - OpBranch %13 - %13 = OpLabel - %49 = OpLoad %uint %26 Aligned 4 - %51 = OpUGreaterThanEqual %bool %49 %uint_2 - OpBranchConditional %51 %14 %15 - %14 = OpLabel - %52 = OpLoad %_ptr_Workgroup_uint %23 Aligned 4 - %53 = OpLoad %uint %25 Aligned 4 - %54 = OpISub %uint %53 %uint_2 - %55 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %52 %54 - %56 = OpLoad %uint %55 Aligned 4 - %57 = OpLoad %_ptr_Workgroup_uint %23 Aligned 4 - %58 = OpLoad %uint %25 Aligned 4 - %59 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %57 %58 - %60 = OpLoad %uint %59 Aligned 4 - %61 = OpIAdd %uint %56 %60 - %62 = OpLoad %_ptr_Workgroup_uint %23 Aligned 4 - %63 = OpLoad %uint %25 Aligned 4 - %64 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %62 %63 - OpStore %64 %61 Aligned 4 - OpBranch %15 - %15 = OpLabel - %65 = OpLoad %uint %26 Aligned 4 - %67 = OpUGreaterThanEqual %bool %65 %uint_4 - OpBranchConditional %67 %16 %17 - %16 = OpLabel - %68 = OpLoad %_ptr_Workgroup_uint %23 Aligned 4 - %69 = OpLoad %uint %25 Aligned 4 - %70 = OpISub %uint %69 %uint_4 - %71 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %68 %70 - %72 = OpLoad %uint %71 Aligned 4 - %73 = OpLoad %_ptr_Workgroup_uint %23 Aligned 4 - %74 = OpLoad %uint %25 Aligned 4 - %75 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %73 %74 - %76 = OpLoad %uint %75 Aligned 4 - %77 = OpIAdd %uint %72 %76 - %78 = OpLoad %_ptr_Workgroup_uint %23 Aligned 4 - %79 = OpLoad %uint %25 Aligned 4 - %80 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %78 %79 - OpStore %80 %77 Aligned 4 - OpBranch %17 - %17 = OpLabel - %81 = OpLoad %uint %26 Aligned 4 - %83 = OpUGreaterThanEqual %bool %81 %uint_8 - OpBranchConditional %83 %18 %19 - %18 = OpLabel - %84 = OpLoad %_ptr_Workgroup_uint %23 Aligned 4 - %85 = OpLoad %uint %25 Aligned 4 - %86 = OpISub %uint %85 %uint_8 - %87 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %84 %86 - %88 = OpLoad %uint %87 Aligned 4 - %89 = OpLoad %_ptr_Workgroup_uint %23 Aligned 4 - %90 = OpLoad %uint %25 Aligned 4 - %91 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %89 %90 - %92 = OpLoad %uint %91 Aligned 4 - %93 = OpIAdd %uint %88 %92 - %94 = OpLoad %_ptr_Workgroup_uint %23 Aligned 4 - %95 = OpLoad %uint %25 Aligned 4 - %96 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %94 %95 - OpStore %96 %93 Aligned 4 - OpBranch %19 - %19 = OpLabel - %97 = OpLoad %uint %26 Aligned 4 - %99 = OpUGreaterThanEqual %bool %97 %uint_16 - OpBranchConditional %99 %20 %21 - %20 = OpLabel - %100 = OpLoad %_ptr_Workgroup_uint %23 Aligned 4 - %101 = OpLoad %uint %25 Aligned 4 - %102 = OpISub %uint %101 %uint_16 - %103 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %100 %102 - %104 = OpLoad %uint %103 Aligned 4 - %105 = OpLoad %_ptr_Workgroup_uint %23 Aligned 4 - %106 = OpLoad %uint %25 Aligned 4 - %107 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %105 %106 - %108 = OpLoad %uint %107 Aligned 4 - %109 = OpIAdd %uint %104 %108 - %110 = OpLoad %_ptr_Workgroup_uint %23 Aligned 4 - %111 = OpLoad %uint %25 Aligned 4 - %112 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %110 %111 - OpStore %112 %109 Aligned 4 - OpBranch %21 - %21 = OpLabel + %call = OpCompositeExtract %uint %27 0 + OpStore %tid %call Aligned 4 + %29 = OpLoad %uint %tid Aligned 4 + %and = OpBitwiseAnd %uint %29 %uint_31 + OpStore %lane %and Aligned 4 + %32 = OpLoad %uint %lane Aligned 4 + %cmp = OpUGreaterThanEqual %bool %32 %uint_1 + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel + %36 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %37 = OpLoad %uint %tid Aligned 4 + %sub = OpISub %uint %37 %uint_1 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %36 %sub + %40 = OpLoad %uint %arrayidx Aligned 4 + %41 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %42 = OpLoad %uint %tid Aligned 4 + %arrayidx1 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %41 %42 + %44 = OpLoad %uint %arrayidx1 Aligned 4 + %add = OpIAdd %uint %40 %44 + %46 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %47 = OpLoad %uint %tid Aligned 4 + %arrayidx2 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %46 %47 + OpStore %arrayidx2 %add Aligned 4 + OpBranch %if_end + %if_end = OpLabel + %49 = OpLoad %uint %lane Aligned 4 + %cmp3 = OpUGreaterThanEqual %bool %49 %uint_2 + OpBranchConditional %cmp3 %if_then4 %if_end10 + %if_then4 = OpLabel + %52 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %53 = OpLoad %uint %tid Aligned 4 + %sub5 = OpISub %uint %53 %uint_2 + %arrayidx6 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %52 %sub5 + %56 = OpLoad %uint %arrayidx6 Aligned 4 + %57 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %58 = OpLoad %uint %tid Aligned 4 + %arrayidx7 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %57 %58 + %60 = OpLoad %uint %arrayidx7 Aligned 4 + %add8 = OpIAdd %uint %56 %60 + %62 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %63 = OpLoad %uint %tid Aligned 4 + %arrayidx9 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %62 %63 + OpStore %arrayidx9 %add8 Aligned 4 + OpBranch %if_end10 + %if_end10 = OpLabel + %65 = OpLoad %uint %lane Aligned 4 + %cmp11 = OpUGreaterThanEqual %bool %65 %uint_4 + OpBranchConditional %cmp11 %if_then12 %if_end18 + %if_then12 = OpLabel + %68 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %69 = OpLoad %uint %tid Aligned 4 + %sub13 = OpISub %uint %69 %uint_4 + %arrayidx14 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %68 %sub13 + %72 = OpLoad %uint %arrayidx14 Aligned 4 + %73 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %74 = OpLoad %uint %tid Aligned 4 + %arrayidx15 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %73 %74 + %76 = OpLoad %uint %arrayidx15 Aligned 4 + %add16 = OpIAdd %uint %72 %76 + %78 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %79 = OpLoad %uint %tid Aligned 4 + %arrayidx17 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %78 %79 + OpStore %arrayidx17 %add16 Aligned 4 + OpBranch %if_end18 + %if_end18 = OpLabel + %81 = OpLoad %uint %lane Aligned 4 + %cmp19 = OpUGreaterThanEqual %bool %81 %uint_8 + OpBranchConditional %cmp19 %if_then20 %if_end26 + %if_then20 = OpLabel + %84 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %85 = OpLoad %uint %tid Aligned 4 + %sub21 = OpISub %uint %85 %uint_8 + %arrayidx22 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %84 %sub21 + %88 = OpLoad %uint %arrayidx22 Aligned 4 + %89 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %90 = OpLoad %uint %tid Aligned 4 + %arrayidx23 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %89 %90 + %92 = OpLoad %uint %arrayidx23 Aligned 4 + %add24 = OpIAdd %uint %88 %92 + %94 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %95 = OpLoad %uint %tid Aligned 4 + %arrayidx25 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %94 %95 + OpStore %arrayidx25 %add24 Aligned 4 + OpBranch %if_end26 + %if_end26 = OpLabel + %97 = OpLoad %uint %lane Aligned 4 + %cmp27 = OpUGreaterThanEqual %bool %97 %uint_16 + OpBranchConditional %cmp27 %if_then28 %if_end34 + %if_then28 = OpLabel + %100 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %101 = OpLoad %uint %tid Aligned 4 + %sub29 = OpISub %uint %101 %uint_16 + %arrayidx30 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %100 %sub29 + %104 = OpLoad %uint %arrayidx30 Aligned 4 + %105 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %106 = OpLoad %uint %tid Aligned 4 + %arrayidx31 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %105 %106 + %108 = OpLoad %uint %arrayidx31 Aligned 4 + %add32 = OpIAdd %uint %104 %108 + %110 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %111 = OpLoad %uint %tid Aligned 4 + %arrayidx33 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %110 %111 + OpStore %arrayidx33 %add32 Aligned 4 + OpBranch %if_end34 + %if_end34 = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/gpuverify/warpsync/shuffle.spvasm b/dartagnan/src/test/resources/spirv/opencl/gpuverify/warpsync/shuffle.spvasm index c93eb03b14..6145fc13c2 100644 --- a/dartagnan/src/test/resources/spirv/opencl/gpuverify/warpsync/shuffle.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/gpuverify/warpsync/shuffle.spvasm @@ -12,13 +12,27 @@ OpEntryPoint Kernel %9 "shuffle" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %A "A" + OpName %entry "entry" + OpName %A_addr "A.addr" + OpName %tid "tid" + OpName %warp "warp" + OpName %B "B" + OpName %call "call" + OpName %div "div" + OpName %mul "mul" + OpName %add_ptr "add.ptr" + OpName %add "add" + OpName %rem "rem" + OpName %arrayidx "arrayidx" + OpName %arrayidx1 "arrayidx1" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %13 Alignment 4 - OpDecorate %15 Alignment 4 - OpDecorate %16 Alignment 4 - OpDecorate %17 Alignment 4 + OpDecorate %A_addr Alignment 4 + OpDecorate %tid Alignment 4 + OpDecorate %warp Alignment 4 + OpDecorate %B Alignment 4 %uint = OpTypeInt 32 0 %uint_32 = OpConstant %uint 32 %uint_1 = OpConstant %uint 1 @@ -31,33 +45,33 @@ %_ptr_Function_uint = OpTypePointer Function %uint %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_Workgroup_uint - %11 = OpLabel - %13 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - %15 = OpVariable %_ptr_Function_uint Function - %16 = OpVariable %_ptr_Function_uint Function - %17 = OpVariable %_ptr_Function__ptr_Workgroup_uint Function - OpStore %13 %10 Aligned 4 + %A = OpFunctionParameter %_ptr_Workgroup_uint + %entry = OpLabel + %A_addr = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + %tid = OpVariable %_ptr_Function_uint Function + %warp = OpVariable %_ptr_Function_uint Function + %B = OpVariable %_ptr_Function__ptr_Workgroup_uint Function + OpStore %A_addr %A Aligned 4 %18 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %19 = OpCompositeExtract %uint %18 0 - OpStore %15 %19 Aligned 4 - %20 = OpLoad %uint %15 Aligned 4 - %22 = OpSDiv %uint %20 %uint_32 - OpStore %16 %22 Aligned 4 - %23 = OpLoad %_ptr_Workgroup_uint %13 Aligned 4 - %24 = OpLoad %uint %16 Aligned 4 - %25 = OpIMul %uint %24 %uint_32 - %26 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %23 %25 - OpStore %17 %26 Aligned 4 - %27 = OpLoad %_ptr_Workgroup_uint %17 Aligned 4 - %28 = OpLoad %uint %15 Aligned 4 - %30 = OpIAdd %uint %28 %uint_1 - %31 = OpSRem %uint %30 %uint_32 - %32 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %27 %31 - %33 = OpLoad %uint %32 Aligned 4 - %34 = OpLoad %_ptr_Workgroup_uint %13 Aligned 4 - %35 = OpLoad %uint %15 Aligned 4 - %36 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %34 %35 - OpStore %36 %33 Aligned 4 + %call = OpCompositeExtract %uint %18 0 + OpStore %tid %call Aligned 4 + %20 = OpLoad %uint %tid Aligned 4 + %div = OpSDiv %uint %20 %uint_32 + OpStore %warp %div Aligned 4 + %23 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %24 = OpLoad %uint %warp Aligned 4 + %mul = OpIMul %uint %24 %uint_32 + %add_ptr = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %23 %mul + OpStore %B %add_ptr Aligned 4 + %27 = OpLoad %_ptr_Workgroup_uint %B Aligned 4 + %28 = OpLoad %uint %tid Aligned 4 + %add = OpIAdd %uint %28 %uint_1 + %rem = OpSRem %uint %add %uint_32 + %arrayidx = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %27 %rem + %33 = OpLoad %uint %arrayidx Aligned 4 + %34 = OpLoad %_ptr_Workgroup_uint %A_addr Aligned 4 + %35 = OpLoad %uint %tid Aligned 4 + %arrayidx1 = OpInBoundsPtrAccessChain %_ptr_Workgroup_uint %34 %35 + OpStore %arrayidx1 %33 Aligned 4 OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/patterns/corr.spvasm b/dartagnan/src/test/resources/spirv/opencl/patterns/corr.spvasm index 7196f1018f..63588c5237 100644 --- a/dartagnan/src/test/resources/spirv/opencl/patterns/corr.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/patterns/corr.spvasm @@ -1,9 +1,9 @@ -; @Input: %10 = {0} -; @Input: %11 = {0} -; @Input: %12 = {0} -; @Input: %13 = {0} -; @Input: %14 = {0} -; @Output: not exists (%11[0] == 2 and %12[0] == 1 and %13[0] == 1 and %14[0] == 2) +; @Input: %x = {0} +; @Input: %r0 = {0} +; @Input: %r1 = {0} +; @Input: %r2 = {0} +; @Input: %r3 = {0} +; @Output: not exists (%r0[0] == 2 and %r1[0] == 1 and %r2[0] == 1 and %r3[0] == 2) ; @Config: 1, 1, 4 ; SPIR-V ; Version: 1.0 @@ -19,14 +19,45 @@ OpEntryPoint Kernel %9 "test" %__spirv_BuiltInWorkgroupId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInWorkgroupId "__spirv_BuiltInWorkgroupId" + OpName %x "x" + OpName %r0 "r0" + OpName %r1 "r1" + OpName %r2 "r2" + OpName %r3 "r3" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %if_then5 "if.then5" + OpName %if_end8 "if.end8" + OpName %if_then11 "if.then11" + OpName %if_end12 "if.end12" + OpName %if_then15 "if.then15" + OpName %if_end16 "if.end16" + OpName %x_addr "x.addr" + OpName %r0_addr "r0.addr" + OpName %r1_addr "r1.addr" + OpName %r2_addr "r2.addr" + OpName %r3_addr "r3.addr" + OpName %call "call" + OpName %cmp "cmp" + OpName %call1 "call1" + OpName %call2 "call2" + OpName %call3 "call3" + OpName %cmp4 "cmp4" + OpName %call6 "call6" + OpName %call7 "call7" + OpName %call9 "call9" + OpName %cmp10 "cmp10" + OpName %call13 "call13" + OpName %cmp14 "cmp14" OpDecorate %__spirv_BuiltInWorkgroupId BuiltIn WorkgroupId OpDecorate %__spirv_BuiltInWorkgroupId Constant OpDecorate %__spirv_BuiltInWorkgroupId LinkageAttributes "__spirv_BuiltInWorkgroupId" Import - OpDecorate %25 Alignment 4 - OpDecorate %26 Alignment 4 - OpDecorate %27 Alignment 4 - OpDecorate %28 Alignment 4 - OpDecorate %29 Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %r0_addr Alignment 4 + OpDecorate %r1_addr Alignment 4 + OpDecorate %r2_addr Alignment 4 + OpDecorate %r3_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_1 = OpConstant %uint 1 @@ -42,75 +73,75 @@ %_ptr_Generic_uint = OpTypePointer Generic %uint %__spirv_BuiltInWorkgroupId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %14 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %15 = OpLabel - %25 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %26 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %27 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %28 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %29 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %25 %10 Aligned 4 - OpStore %26 %11 Aligned 4 - OpStore %27 %12 Aligned 4 - OpStore %28 %13 Aligned 4 - OpStore %29 %14 Aligned 4 + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %r0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %r1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %r2 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %r3 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %r0_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %r1_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %r2_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %r3_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %x_addr %x Aligned 4 + OpStore %r0_addr %r0 Aligned 4 + OpStore %r1_addr %r1 Aligned 4 + OpStore %r2_addr %r2 Aligned 4 + OpStore %r3_addr %r3 Aligned 4 %30 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %31 = OpCompositeExtract %uint %30 0 - %34 = OpIEqual %bool %31 %uint_0 - OpBranchConditional %34 %16 %17 - %16 = OpLabel - %35 = OpLoad %_ptr_CrossWorkgroup_uint %25 Aligned 4 + %call = OpCompositeExtract %uint %30 0 + %cmp = OpIEqual %bool %call %uint_0 + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel + %35 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 %37 = OpPtrCastToGeneric %_ptr_Generic_uint %35 - %39 = OpAtomicLoad %uint %37 %uint_1 %uint_0 - %40 = OpLoad %_ptr_CrossWorkgroup_uint %26 Aligned 4 - OpStore %40 %39 Aligned 4 - %41 = OpLoad %_ptr_CrossWorkgroup_uint %25 Aligned 4 + %call1 = OpAtomicLoad %uint %37 %uint_1 %uint_0 + %40 = OpLoad %_ptr_CrossWorkgroup_uint %r0_addr Aligned 4 + OpStore %40 %call1 Aligned 4 + %41 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 %42 = OpPtrCastToGeneric %_ptr_Generic_uint %41 - %43 = OpAtomicLoad %uint %42 %uint_1 %uint_0 - %44 = OpLoad %_ptr_CrossWorkgroup_uint %27 Aligned 4 - OpStore %44 %43 Aligned 4 - OpBranch %17 - %17 = OpLabel + %call2 = OpAtomicLoad %uint %42 %uint_1 %uint_0 + %44 = OpLoad %_ptr_CrossWorkgroup_uint %r1_addr Aligned 4 + OpStore %44 %call2 Aligned 4 + OpBranch %if_end + %if_end = OpLabel %45 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %46 = OpCompositeExtract %uint %45 0 - %47 = OpIEqual %bool %46 %uint_1 - OpBranchConditional %47 %18 %19 - %18 = OpLabel - %48 = OpLoad %_ptr_CrossWorkgroup_uint %25 Aligned 4 + %call3 = OpCompositeExtract %uint %45 0 + %cmp4 = OpIEqual %bool %call3 %uint_1 + OpBranchConditional %cmp4 %if_then5 %if_end8 + %if_then5 = OpLabel + %48 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 %49 = OpPtrCastToGeneric %_ptr_Generic_uint %48 - %50 = OpAtomicLoad %uint %49 %uint_1 %uint_0 - %51 = OpLoad %_ptr_CrossWorkgroup_uint %28 Aligned 4 - OpStore %51 %50 Aligned 4 - %52 = OpLoad %_ptr_CrossWorkgroup_uint %25 Aligned 4 + %call6 = OpAtomicLoad %uint %49 %uint_1 %uint_0 + %51 = OpLoad %_ptr_CrossWorkgroup_uint %r2_addr Aligned 4 + OpStore %51 %call6 Aligned 4 + %52 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 %53 = OpPtrCastToGeneric %_ptr_Generic_uint %52 - %54 = OpAtomicLoad %uint %53 %uint_1 %uint_0 - %55 = OpLoad %_ptr_CrossWorkgroup_uint %29 Aligned 4 - OpStore %55 %54 Aligned 4 - OpBranch %19 - %19 = OpLabel + %call7 = OpAtomicLoad %uint %53 %uint_1 %uint_0 + %55 = OpLoad %_ptr_CrossWorkgroup_uint %r3_addr Aligned 4 + OpStore %55 %call7 Aligned 4 + OpBranch %if_end8 + %if_end8 = OpLabel %56 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %57 = OpCompositeExtract %uint %56 0 - %59 = OpIEqual %bool %57 %uint_2 - OpBranchConditional %59 %20 %21 - %20 = OpLabel - %60 = OpLoad %_ptr_CrossWorkgroup_uint %25 Aligned 4 + %call9 = OpCompositeExtract %uint %56 0 + %cmp10 = OpIEqual %bool %call9 %uint_2 + OpBranchConditional %cmp10 %if_then11 %if_end12 + %if_then11 = OpLabel + %60 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 %61 = OpPtrCastToGeneric %_ptr_Generic_uint %60 OpAtomicStore %61 %uint_1 %uint_0 %uint_2 - OpBranch %21 - %21 = OpLabel + OpBranch %if_end12 + %if_end12 = OpLabel %62 = OpLoad %v3uint %__spirv_BuiltInWorkgroupId Aligned 16 - %63 = OpCompositeExtract %uint %62 0 - %65 = OpIEqual %bool %63 %uint_3 - OpBranchConditional %65 %22 %23 - %22 = OpLabel - %66 = OpLoad %_ptr_CrossWorkgroup_uint %25 Aligned 4 + %call13 = OpCompositeExtract %uint %62 0 + %cmp14 = OpIEqual %bool %call13 %uint_3 + OpBranchConditional %cmp14 %if_then15 %if_end16 + %if_then15 = OpLabel + %66 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 %67 = OpPtrCastToGeneric %_ptr_Generic_uint %66 OpAtomicStore %67 %uint_1 %uint_0 %uint_1 - OpBranch %23 - %23 = OpLabel + OpBranch %if_end16 + %if_end16 = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/patterns/iriw.spvasm b/dartagnan/src/test/resources/spirv/opencl/patterns/iriw.spvasm index 74f25319cc..ea80306670 100644 --- a/dartagnan/src/test/resources/spirv/opencl/patterns/iriw.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/patterns/iriw.spvasm @@ -1,10 +1,10 @@ -; @Input: %10 = {0} -; @Input: %11 = {0} -; @Input: %12 = {0} -; @Input: %13 = {0} -; @Input: %14 = {0} -; @Input: %15 = {0} -; @Output: exists (%12[0] == 1 and %13[0] == 0 and %14[0] == 1 and %15[0] == 0) +; @Input: %x = {0} +; @Input: %y = {0} +; @Input: %r0 = {0} +; @Input: %r1 = {0} +; @Input: %r2 = {0} +; @Input: %r3 = {0} +; @Output: exists (%r0[0] == 1 and %r1[0] == 0 and %r2[0] == 1 and %r3[0] == 0) ; @Config: 4, 1, 1 ; SPIR-V ; Version: 1.0 @@ -20,15 +20,48 @@ OpEntryPoint Kernel %9 "test" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %x "x" + OpName %y "y" + OpName %r0 "r0" + OpName %r1 "r1" + OpName %r2 "r2" + OpName %r3 "r3" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_end "if.end" + OpName %if_then3 "if.then3" + OpName %if_end4 "if.end4" + OpName %if_then7 "if.then7" + OpName %if_end10 "if.end10" + OpName %if_then13 "if.then13" + OpName %if_end16 "if.end16" + OpName %x_addr "x.addr" + OpName %y_addr "y.addr" + OpName %r0_addr "r0.addr" + OpName %r1_addr "r1.addr" + OpName %r2_addr "r2.addr" + OpName %r3_addr "r3.addr" + OpName %call "call" + OpName %cmp "cmp" + OpName %call1 "call1" + OpName %cmp2 "cmp2" + OpName %call5 "call5" + OpName %cmp6 "cmp6" + OpName %call8 "call8" + OpName %call9 "call9" + OpName %call11 "call11" + OpName %cmp12 "cmp12" + OpName %call14 "call14" + OpName %call15 "call15" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %26 Alignment 4 - OpDecorate %27 Alignment 4 - OpDecorate %28 Alignment 4 - OpDecorate %29 Alignment 4 - OpDecorate %30 Alignment 4 - OpDecorate %31 Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %y_addr Alignment 4 + OpDecorate %r0_addr Alignment 4 + OpDecorate %r1_addr Alignment 4 + OpDecorate %r2_addr Alignment 4 + OpDecorate %r3_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_1 = OpConstant %uint 1 @@ -45,78 +78,78 @@ %_ptr_Generic_uint = OpTypePointer Generic %uint %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %14 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %15 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %16 = OpLabel - %26 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %27 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %28 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %29 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %30 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %31 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %26 %10 Aligned 4 - OpStore %27 %11 Aligned 4 - OpStore %28 %12 Aligned 4 - OpStore %29 %13 Aligned 4 - OpStore %30 %14 Aligned 4 - OpStore %31 %15 Aligned 4 + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %y = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %r0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %r1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %r2 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %r3 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %y_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %r0_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %r1_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %r2_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %r3_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %x_addr %x Aligned 4 + OpStore %y_addr %y Aligned 4 + OpStore %r0_addr %r0 Aligned 4 + OpStore %r1_addr %r1 Aligned 4 + OpStore %r2_addr %r2 Aligned 4 + OpStore %r3_addr %r3 Aligned 4 %32 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %33 = OpCompositeExtract %uint %32 0 - %36 = OpIEqual %bool %33 %uint_0 - OpBranchConditional %36 %17 %18 - %17 = OpLabel - %37 = OpLoad %_ptr_CrossWorkgroup_uint %26 Aligned 4 + %call = OpCompositeExtract %uint %32 0 + %cmp = OpIEqual %bool %call %uint_0 + OpBranchConditional %cmp %if_then %if_end + %if_then = OpLabel + %37 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 %39 = OpPtrCastToGeneric %_ptr_Generic_uint %37 OpAtomicStore %39 %uint_1 %uint_4 %uint_1 - OpBranch %18 - %18 = OpLabel + OpBranch %if_end + %if_end = OpLabel %42 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %43 = OpCompositeExtract %uint %42 0 - %44 = OpIEqual %bool %43 %uint_1 - OpBranchConditional %44 %19 %20 - %19 = OpLabel - %45 = OpLoad %_ptr_CrossWorkgroup_uint %27 Aligned 4 + %call1 = OpCompositeExtract %uint %42 0 + %cmp2 = OpIEqual %bool %call1 %uint_1 + OpBranchConditional %cmp2 %if_then3 %if_end4 + %if_then3 = OpLabel + %45 = OpLoad %_ptr_CrossWorkgroup_uint %y_addr Aligned 4 %46 = OpPtrCastToGeneric %_ptr_Generic_uint %45 OpAtomicStore %46 %uint_1 %uint_4 %uint_1 - OpBranch %20 - %20 = OpLabel + OpBranch %if_end4 + %if_end4 = OpLabel %47 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %48 = OpCompositeExtract %uint %47 0 - %50 = OpIEqual %bool %48 %uint_2 - OpBranchConditional %50 %21 %22 - %21 = OpLabel - %51 = OpLoad %_ptr_CrossWorkgroup_uint %26 Aligned 4 + %call5 = OpCompositeExtract %uint %47 0 + %cmp6 = OpIEqual %bool %call5 %uint_2 + OpBranchConditional %cmp6 %if_then7 %if_end10 + %if_then7 = OpLabel + %51 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 %52 = OpPtrCastToGeneric %_ptr_Generic_uint %51 - %53 = OpAtomicLoad %uint %52 %uint_1 %uint_2 - %54 = OpLoad %_ptr_CrossWorkgroup_uint %28 Aligned 4 - OpStore %54 %53 Aligned 4 - %55 = OpLoad %_ptr_CrossWorkgroup_uint %27 Aligned 4 + %call8 = OpAtomicLoad %uint %52 %uint_1 %uint_2 + %54 = OpLoad %_ptr_CrossWorkgroup_uint %r0_addr Aligned 4 + OpStore %54 %call8 Aligned 4 + %55 = OpLoad %_ptr_CrossWorkgroup_uint %y_addr Aligned 4 %56 = OpPtrCastToGeneric %_ptr_Generic_uint %55 - %57 = OpAtomicLoad %uint %56 %uint_1 %uint_2 - %58 = OpLoad %_ptr_CrossWorkgroup_uint %29 Aligned 4 - OpStore %58 %57 Aligned 4 - OpBranch %22 - %22 = OpLabel + %call9 = OpAtomicLoad %uint %56 %uint_1 %uint_2 + %58 = OpLoad %_ptr_CrossWorkgroup_uint %r1_addr Aligned 4 + OpStore %58 %call9 Aligned 4 + OpBranch %if_end10 + %if_end10 = OpLabel %59 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %60 = OpCompositeExtract %uint %59 0 - %62 = OpIEqual %bool %60 %uint_3 - OpBranchConditional %62 %23 %24 - %23 = OpLabel - %63 = OpLoad %_ptr_CrossWorkgroup_uint %27 Aligned 4 + %call11 = OpCompositeExtract %uint %59 0 + %cmp12 = OpIEqual %bool %call11 %uint_3 + OpBranchConditional %cmp12 %if_then13 %if_end16 + %if_then13 = OpLabel + %63 = OpLoad %_ptr_CrossWorkgroup_uint %y_addr Aligned 4 %64 = OpPtrCastToGeneric %_ptr_Generic_uint %63 - %65 = OpAtomicLoad %uint %64 %uint_1 %uint_2 - %66 = OpLoad %_ptr_CrossWorkgroup_uint %30 Aligned 4 - OpStore %66 %65 Aligned 4 - %67 = OpLoad %_ptr_CrossWorkgroup_uint %26 Aligned 4 + %call14 = OpAtomicLoad %uint %64 %uint_1 %uint_2 + %66 = OpLoad %_ptr_CrossWorkgroup_uint %r2_addr Aligned 4 + OpStore %66 %call14 Aligned 4 + %67 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 %68 = OpPtrCastToGeneric %_ptr_Generic_uint %67 - %69 = OpAtomicLoad %uint %68 %uint_1 %uint_2 - %70 = OpLoad %_ptr_CrossWorkgroup_uint %31 Aligned 4 - OpStore %70 %69 Aligned 4 - OpBranch %24 - %24 = OpLabel + %call15 = OpAtomicLoad %uint %68 %uint_1 %uint_2 + %70 = OpLoad %_ptr_CrossWorkgroup_uint %r3_addr Aligned 4 + OpStore %70 %call15 Aligned 4 + OpBranch %if_end16 + %if_end16 = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/patterns/mp-acq2rx.spvasm b/dartagnan/src/test/resources/spirv/opencl/patterns/mp-acq2rx.spvasm index 4df1a128d6..7627769e86 100644 --- a/dartagnan/src/test/resources/spirv/opencl/patterns/mp-acq2rx.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/patterns/mp-acq2rx.spvasm @@ -1,9 +1,9 @@ -; @Input: %10 = {0} -; @Input: %11 = {0} -; @Input: %12 = {0} -; @Input: %13 = {0} -; @Output: forall (%12[0] != 1 or %13[0] == 1) -; @Filter: %12[0] == 1 +; @Input: %flag = {0} +; @Input: %data = {0} +; @Input: %r0 = {0} +; @Input: %r1 = {0} +; @Output: forall (%r0[0] != 1 or %r1[0] == 1) +; @Filter: %r0[0] == 1 ; @Config: 2, 1, 1 ; SPIR-V ; Version: 1.0 @@ -19,17 +19,32 @@ OpEntryPoint Kernel %9 "test" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %flag "flag" + OpName %data "data" + OpName %r0 "r0" + OpName %r1 "r1" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_else "if.else" + OpName %if_end "if.end" + OpName %flag_addr "flag.addr" + OpName %data_addr "data.addr" + OpName %r0_addr "r0.addr" + OpName %r1_addr "r1.addr" + OpName %call "call" + OpName %cmp "cmp" + OpName %call1 "call1" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %19 Alignment 4 - OpDecorate %20 Alignment 4 - OpDecorate %21 Alignment 4 - OpDecorate %22 Alignment 4 + OpDecorate %flag_addr Alignment 4 + OpDecorate %data_addr Alignment 4 + OpDecorate %r0_addr Alignment 4 + OpDecorate %r1_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_1 = OpConstant %uint 1 - %uint_2 = OpConstant %uint 2 + %uint_4 = OpConstant %uint 4 %v3uint = OpTypeVector %uint 3 %_ptr_Input_v3uint = OpTypePointer Input %v3uint %void = OpTypeVoid @@ -40,41 +55,41 @@ %_ptr_Generic_uint = OpTypePointer Generic %uint %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %14 = OpLabel - %19 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %20 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %21 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %22 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %19 %10 Aligned 4 - OpStore %20 %11 Aligned 4 - OpStore %21 %12 Aligned 4 - OpStore %22 %13 Aligned 4 + %flag = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %data = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %r0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %r1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %flag_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %data_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %r0_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %r1_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %flag_addr %flag Aligned 4 + OpStore %data_addr %data Aligned 4 + OpStore %r0_addr %r0 Aligned 4 + OpStore %r1_addr %r1 Aligned 4 %23 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %24 = OpCompositeExtract %uint %23 0 - %27 = OpIEqual %bool %24 %uint_0 - OpBranchConditional %27 %15 %16 - %15 = OpLabel - %28 = OpLoad %_ptr_CrossWorkgroup_uint %20 Aligned 4 + %call = OpCompositeExtract %uint %23 0 + %cmp = OpIEqual %bool %call %uint_0 + OpBranchConditional %cmp %if_then %if_else + %if_then = OpLabel + %28 = OpLoad %_ptr_CrossWorkgroup_uint %data_addr Aligned 4 OpStore %28 %uint_1 Aligned 4 - %30 = OpLoad %_ptr_CrossWorkgroup_uint %19 Aligned 4 + %30 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 %32 = OpPtrCastToGeneric %_ptr_Generic_uint %30 - OpAtomicStore %32 %uint_1 %uint_0 %uint_1 - OpBranch %17 - %16 = OpLabel - %33 = OpLoad %_ptr_CrossWorkgroup_uint %19 Aligned 4 - %34 = OpPtrCastToGeneric %_ptr_Generic_uint %33 - %36 = OpAtomicLoad %uint %34 %uint_1 %uint_2 - %37 = OpLoad %_ptr_CrossWorkgroup_uint %21 Aligned 4 - OpStore %37 %36 Aligned 4 - %38 = OpLoad %_ptr_CrossWorkgroup_uint %20 Aligned 4 + OpAtomicStore %32 %uint_1 %uint_4 %uint_1 + OpBranch %if_end + %if_else = OpLabel + %34 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %35 = OpPtrCastToGeneric %_ptr_Generic_uint %34 + %call1 = OpAtomicLoad %uint %35 %uint_1 %uint_0 + %37 = OpLoad %_ptr_CrossWorkgroup_uint %r0_addr Aligned 4 + OpStore %37 %call1 Aligned 4 + %38 = OpLoad %_ptr_CrossWorkgroup_uint %data_addr Aligned 4 %39 = OpLoad %uint %38 Aligned 4 - %40 = OpLoad %_ptr_CrossWorkgroup_uint %22 Aligned 4 + %40 = OpLoad %_ptr_CrossWorkgroup_uint %r1_addr Aligned 4 OpStore %40 %39 Aligned 4 - OpBranch %17 - %17 = OpLabel + OpBranch %if_end + %if_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/patterns/mp-rel2rx.spvasm b/dartagnan/src/test/resources/spirv/opencl/patterns/mp-rel2rx.spvasm index e910d9aa6e..ac0f896d6b 100644 --- a/dartagnan/src/test/resources/spirv/opencl/patterns/mp-rel2rx.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/patterns/mp-rel2rx.spvasm @@ -1,14 +1,14 @@ -; @Input: %10 = {0} -; @Input: %11 = {0} -; @Input: %12 = {0} -; @Input: %13 = {0} -; @Output: forall (%12[0] != 1 or %13[0] == 1) -; @Filter: %12[0] == 1 +; @Input: %flag = {0} +; @Input: %data = {0} +; @Input: %r0 = {0} +; @Input: %r1 = {0} +; @Output: forall (%r0[0] != 1 or %r1[0] == 1) +; @Filter: %r0[0] == 1 ; @Config: 2, 1, 1 ; SPIR-V ; Version: 1.0 ; Generator: Khronos LLVM/SPIR-V Translator; 14 -; Bound: 41 +; Bound: 40 ; Schema: 0 OpCapability Addresses OpCapability Linkage @@ -19,17 +19,31 @@ OpEntryPoint Kernel %9 "test" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %flag "flag" + OpName %data "data" + OpName %r0 "r0" + OpName %r1 "r1" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_else "if.else" + OpName %if_end "if.end" + OpName %flag_addr "flag.addr" + OpName %data_addr "data.addr" + OpName %r0_addr "r0.addr" + OpName %r1_addr "r1.addr" + OpName %call "call" + OpName %cmp "cmp" + OpName %call1 "call1" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %19 Alignment 4 - OpDecorate %20 Alignment 4 - OpDecorate %21 Alignment 4 - OpDecorate %22 Alignment 4 + OpDecorate %flag_addr Alignment 4 + OpDecorate %data_addr Alignment 4 + OpDecorate %r0_addr Alignment 4 + OpDecorate %r1_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_1 = OpConstant %uint 1 - %uint_4 = OpConstant %uint 4 %v3uint = OpTypeVector %uint 3 %_ptr_Input_v3uint = OpTypePointer Input %v3uint %void = OpTypeVoid @@ -40,41 +54,41 @@ %_ptr_Generic_uint = OpTypePointer Generic %uint %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %14 = OpLabel - %19 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %20 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %21 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %22 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %19 %10 Aligned 4 - OpStore %20 %11 Aligned 4 - OpStore %21 %12 Aligned 4 - OpStore %22 %13 Aligned 4 + %flag = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %data = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %r0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %r1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %flag_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %data_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %r0_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %r1_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %flag_addr %flag Aligned 4 + OpStore %data_addr %data Aligned 4 + OpStore %r0_addr %r0 Aligned 4 + OpStore %r1_addr %r1 Aligned 4 %23 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %24 = OpCompositeExtract %uint %23 0 - %27 = OpIEqual %bool %24 %uint_0 - OpBranchConditional %27 %15 %16 - %15 = OpLabel - %28 = OpLoad %_ptr_CrossWorkgroup_uint %20 Aligned 4 + %call = OpCompositeExtract %uint %23 0 + %cmp = OpIEqual %bool %call %uint_0 + OpBranchConditional %cmp %if_then %if_else + %if_then = OpLabel + %28 = OpLoad %_ptr_CrossWorkgroup_uint %data_addr Aligned 4 OpStore %28 %uint_1 Aligned 4 - %30 = OpLoad %_ptr_CrossWorkgroup_uint %19 Aligned 4 + %30 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 %32 = OpPtrCastToGeneric %_ptr_Generic_uint %30 - OpAtomicStore %32 %uint_1 %uint_4 %uint_1 - OpBranch %17 - %16 = OpLabel - %34 = OpLoad %_ptr_CrossWorkgroup_uint %19 Aligned 4 - %35 = OpPtrCastToGeneric %_ptr_Generic_uint %34 - %36 = OpAtomicLoad %uint %35 %uint_1 %uint_0 - %37 = OpLoad %_ptr_CrossWorkgroup_uint %21 Aligned 4 - OpStore %37 %36 Aligned 4 - %38 = OpLoad %_ptr_CrossWorkgroup_uint %20 Aligned 4 - %39 = OpLoad %uint %38 Aligned 4 - %40 = OpLoad %_ptr_CrossWorkgroup_uint %22 Aligned 4 - OpStore %40 %39 Aligned 4 - OpBranch %17 - %17 = OpLabel + OpAtomicStore %32 %uint_1 %uint_0 %uint_1 + OpBranch %if_end + %if_else = OpLabel + %33 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 + %34 = OpPtrCastToGeneric %_ptr_Generic_uint %33 + %call1 = OpAtomicLoad %uint %34 %uint_1 %uint_0 + %36 = OpLoad %_ptr_CrossWorkgroup_uint %r0_addr Aligned 4 + OpStore %36 %call1 Aligned 4 + %37 = OpLoad %_ptr_CrossWorkgroup_uint %data_addr Aligned 4 + %38 = OpLoad %uint %37 Aligned 4 + %39 = OpLoad %_ptr_CrossWorkgroup_uint %r1_addr Aligned 4 + OpStore %39 %38 Aligned 4 + OpBranch %if_end + %if_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/patterns/mp.spvasm b/dartagnan/src/test/resources/spirv/opencl/patterns/mp.spvasm index 02dfbeff40..1d7b4a933b 100644 --- a/dartagnan/src/test/resources/spirv/opencl/patterns/mp.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/patterns/mp.spvasm @@ -1,9 +1,9 @@ -; @Input: %10 = {0} -; @Input: %11 = {0} -; @Input: %12 = {0} -; @Input: %13 = {0} -; @Output: forall (%12[0] != 1 or %13[0] == 1) -; @Filter: %12[0] == 1 +; @Input: %flag = {0} +; @Input: %data = {0} +; @Input: %r0 = {0} +; @Input: %r1 = {0} +; @Output: forall (%r0[0] != 1 or %r1[0] == 1) +; @Filter: %r0[0] == 1 ; @Config: 2, 1, 1 ; SPIR-V ; Version: 1.0 @@ -19,13 +19,28 @@ OpEntryPoint Kernel %9 "test" %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" + OpName %flag "flag" + OpName %data "data" + OpName %r0 "r0" + OpName %r1 "r1" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_else "if.else" + OpName %if_end "if.end" + OpName %flag_addr "flag.addr" + OpName %data_addr "data.addr" + OpName %r0_addr "r0.addr" + OpName %r1_addr "r1.addr" + OpName %call "call" + OpName %cmp "cmp" + OpName %call1 "call1" OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId OpDecorate %__spirv_BuiltInGlobalInvocationId Constant OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %19 Alignment 4 - OpDecorate %20 Alignment 4 - OpDecorate %21 Alignment 4 - OpDecorate %22 Alignment 4 + OpDecorate %flag_addr Alignment 4 + OpDecorate %data_addr Alignment 4 + OpDecorate %r0_addr Alignment 4 + OpDecorate %r1_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_1 = OpConstant %uint 1 @@ -41,41 +56,41 @@ %_ptr_Generic_uint = OpTypePointer Generic %uint %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %14 = OpLabel - %19 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %20 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %21 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %22 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %19 %10 Aligned 4 - OpStore %20 %11 Aligned 4 - OpStore %21 %12 Aligned 4 - OpStore %22 %13 Aligned 4 + %flag = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %data = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %r0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %r1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %flag_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %data_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %r0_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %r1_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %flag_addr %flag Aligned 4 + OpStore %data_addr %data Aligned 4 + OpStore %r0_addr %r0 Aligned 4 + OpStore %r1_addr %r1 Aligned 4 %23 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16 - %24 = OpCompositeExtract %uint %23 0 - %27 = OpIEqual %bool %24 %uint_0 - OpBranchConditional %27 %15 %16 - %15 = OpLabel - %28 = OpLoad %_ptr_CrossWorkgroup_uint %20 Aligned 4 + %call = OpCompositeExtract %uint %23 0 + %cmp = OpIEqual %bool %call %uint_0 + OpBranchConditional %cmp %if_then %if_else + %if_then = OpLabel + %28 = OpLoad %_ptr_CrossWorkgroup_uint %data_addr Aligned 4 OpStore %28 %uint_1 Aligned 4 - %30 = OpLoad %_ptr_CrossWorkgroup_uint %19 Aligned 4 + %30 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 %32 = OpPtrCastToGeneric %_ptr_Generic_uint %30 OpAtomicStore %32 %uint_1 %uint_4 %uint_1 - OpBranch %17 - %16 = OpLabel - %34 = OpLoad %_ptr_CrossWorkgroup_uint %19 Aligned 4 + OpBranch %if_end + %if_else = OpLabel + %34 = OpLoad %_ptr_CrossWorkgroup_uint %flag_addr Aligned 4 %35 = OpPtrCastToGeneric %_ptr_Generic_uint %34 - %37 = OpAtomicLoad %uint %35 %uint_1 %uint_2 - %38 = OpLoad %_ptr_CrossWorkgroup_uint %21 Aligned 4 - OpStore %38 %37 Aligned 4 - %39 = OpLoad %_ptr_CrossWorkgroup_uint %20 Aligned 4 + %call1 = OpAtomicLoad %uint %35 %uint_1 %uint_2 + %38 = OpLoad %_ptr_CrossWorkgroup_uint %r0_addr Aligned 4 + OpStore %38 %call1 Aligned 4 + %39 = OpLoad %_ptr_CrossWorkgroup_uint %data_addr Aligned 4 %40 = OpLoad %uint %39 Aligned 4 - %41 = OpLoad %_ptr_CrossWorkgroup_uint %22 Aligned 4 + %41 = OpLoad %_ptr_CrossWorkgroup_uint %r1_addr Aligned 4 OpStore %41 %40 Aligned 4 - OpBranch %17 - %17 = OpLabel + OpBranch %if_end + %if_end = OpLabel OpReturn OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/opencl/patterns/sb.spvasm b/dartagnan/src/test/resources/spirv/opencl/patterns/sb.spvasm index 5ee63681da..aa15e28996 100644 --- a/dartagnan/src/test/resources/spirv/opencl/patterns/sb.spvasm +++ b/dartagnan/src/test/resources/spirv/opencl/patterns/sb.spvasm @@ -1,8 +1,8 @@ -; @Input: %10 = {0} -; @Input: %11 = {0} -; @Input: %12 = {0} -; @Input: %13 = {0} -; @Output: exists (%12[0] == 0 and %13[0] == 0) +; @Input: %x = {0} +; @Input: %y = {0} +; @Input: %r0 = {0} +; @Input: %r1 = {0} +; @Output: exists (%r0[0] == 0 and %r1[0] == 0) ; @Config: 2, 1, 1 ; SPIR-V ; Version: 1.0 @@ -18,13 +18,29 @@ OpEntryPoint Kernel %9 "test" %__spirv_BuiltInLocalInvocationId OpSource OpenCL_C 200000 OpName %__spirv_BuiltInLocalInvocationId "__spirv_BuiltInLocalInvocationId" + OpName %x "x" + OpName %y "y" + OpName %r0 "r0" + OpName %r1 "r1" + OpName %entry "entry" + OpName %if_then "if.then" + OpName %if_else "if.else" + OpName %if_end "if.end" + OpName %x_addr "x.addr" + OpName %y_addr "y.addr" + OpName %r0_addr "r0.addr" + OpName %r1_addr "r1.addr" + OpName %call "call" + OpName %cmp "cmp" + OpName %call1 "call1" + OpName %call2 "call2" OpDecorate %__spirv_BuiltInLocalInvocationId BuiltIn LocalInvocationId OpDecorate %__spirv_BuiltInLocalInvocationId Constant OpDecorate %__spirv_BuiltInLocalInvocationId LinkageAttributes "__spirv_BuiltInLocalInvocationId" Import - OpDecorate %19 Alignment 4 - OpDecorate %20 Alignment 4 - OpDecorate %21 Alignment 4 - OpDecorate %22 Alignment 4 + OpDecorate %x_addr Alignment 4 + OpDecorate %y_addr Alignment 4 + OpDecorate %r0_addr Alignment 4 + OpDecorate %r1_addr Alignment 4 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %uint_1 = OpConstant %uint 1 @@ -40,43 +56,43 @@ %_ptr_Generic_uint = OpTypePointer Generic %uint %__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3uint Input %9 = OpFunction %void DontInline %8 - %10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %13 = OpFunctionParameter %_ptr_CrossWorkgroup_uint - %14 = OpLabel - %19 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %20 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %21 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - %22 = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function - OpStore %19 %10 Aligned 4 - OpStore %20 %11 Aligned 4 - OpStore %21 %12 Aligned 4 - OpStore %22 %13 Aligned 4 + %x = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %y = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %r0 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %r1 = OpFunctionParameter %_ptr_CrossWorkgroup_uint + %entry = OpLabel + %x_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %y_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %r0_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + %r1_addr = OpVariable %_ptr_Function__ptr_CrossWorkgroup_uint Function + OpStore %x_addr %x Aligned 4 + OpStore %y_addr %y Aligned 4 + OpStore %r0_addr %r0 Aligned 4 + OpStore %r1_addr %r1 Aligned 4 %23 = OpLoad %v3uint %__spirv_BuiltInLocalInvocationId Aligned 16 - %24 = OpCompositeExtract %uint %23 0 - %27 = OpIEqual %bool %24 %uint_0 - OpBranchConditional %27 %15 %16 - %15 = OpLabel - %28 = OpLoad %_ptr_CrossWorkgroup_uint %19 Aligned 4 + %call = OpCompositeExtract %uint %23 0 + %cmp = OpIEqual %bool %call %uint_0 + OpBranchConditional %cmp %if_then %if_else + %if_then = OpLabel + %28 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 %30 = OpPtrCastToGeneric %_ptr_Generic_uint %28 OpAtomicStore %30 %uint_1 %uint_4 %uint_1 - %33 = OpLoad %_ptr_CrossWorkgroup_uint %20 Aligned 4 + %33 = OpLoad %_ptr_CrossWorkgroup_uint %y_addr Aligned 4 %34 = OpPtrCastToGeneric %_ptr_Generic_uint %33 - %36 = OpAtomicLoad %uint %34 %uint_1 %uint_2 - %37 = OpLoad %_ptr_CrossWorkgroup_uint %21 Aligned 4 - OpStore %37 %36 Aligned 4 - OpBranch %17 - %16 = OpLabel - %38 = OpLoad %_ptr_CrossWorkgroup_uint %20 Aligned 4 + %call1 = OpAtomicLoad %uint %34 %uint_1 %uint_2 + %37 = OpLoad %_ptr_CrossWorkgroup_uint %r0_addr Aligned 4 + OpStore %37 %call1 Aligned 4 + OpBranch %if_end + %if_else = OpLabel + %38 = OpLoad %_ptr_CrossWorkgroup_uint %y_addr Aligned 4 %39 = OpPtrCastToGeneric %_ptr_Generic_uint %38 OpAtomicStore %39 %uint_1 %uint_4 %uint_1 - %40 = OpLoad %_ptr_CrossWorkgroup_uint %19 Aligned 4 + %40 = OpLoad %_ptr_CrossWorkgroup_uint %x_addr Aligned 4 %41 = OpPtrCastToGeneric %_ptr_Generic_uint %40 - %42 = OpAtomicLoad %uint %41 %uint_1 %uint_2 - %43 = OpLoad %_ptr_CrossWorkgroup_uint %22 Aligned 4 - OpStore %43 %42 Aligned 4 - OpBranch %17 - %17 = OpLabel + %call2 = OpAtomicLoad %uint %41 %uint_1 %uint_2 + %43 = OpLoad %_ptr_CrossWorkgroup_uint %r1_addr Aligned 4 + OpStore %43 %call2 Aligned 4 + OpBranch %if_end + %if_end = OpLabel OpReturn OpFunctionEnd