From a49c2a932516e682faed64952a03f8755b29ced1 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 9 Nov 2023 14:20:13 +0000 Subject: [PATCH 01/35] [spirv-ll] Fix up invalid OpSpecConstant tests Certain OpSpecConstantOp opcodes are only valid with the Kernel capability, for example: `OpFAdd`, `OpFSub`, `OpFMul`, `OpFDiv`, `OpFMod`. This fixes up our LIT tests which were breaking this rule. --- .../op_spec_constant_op_fadd_double.spvasm | 29 +++++++++-------- .../op_spec_constant_op_fadd_float.spvasm | 28 ++++++++--------- .../op_spec_constant_op_fdiv_double.spvasm | 29 +++++++++-------- .../op_spec_constant_op_fdiv_float.spvasm | 28 ++++++++--------- .../op_spec_constant_op_fmod_double.spvasm | 21 ++++++------- .../op_spec_constant_op_fmod_float.spvasm | 22 ++++++------- ...pec_constant_op_fmod_multi_function.spvasm | 19 ++++++------ .../op_spec_constant_op_fmul_double.spvasm | 31 ++++++++++--------- .../op_spec_constant_op_fmul_float.spvasm | 28 ++++++++--------- .../op_spec_constant_op_fsub_double.spvasm | 29 +++++++++-------- .../op_spec_constant_op_fsub_float.spvasm | 28 ++++++++--------- 11 files changed, 139 insertions(+), 153 deletions(-) diff --git a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fadd_double.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fadd_double.spvasm index fd7099410..cfbed35e0 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fadd_double.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fadd_double.spvasm @@ -15,35 +15,34 @@ ; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} -; RUN: spirv-ll-tool -a Vulkan -c Float64 -c Int64 %spv_file_s | FileCheck %s - OpCapability Shader - OpCapability Float64 - OpCapability Int64 - %1 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint GLCompute %main "main" - OpExecutionMode %main LocalSize 1 1 1 - OpSource GLSL 450 - OpName %main "main" - OpName %res "res" +; RUN: spirv-ll-tool -a OpenCL -b 64 -c Float64 %spv_file_s | FileCheck %s + OpCapability Kernel + OpCapability Addresses + OpCapability Float64 + %1 = OpExtInstImport "OpenCL.std" + OpMemoryModel Physical64 OpenCL + OpEntryPoint Kernel %testfn "testfn" + OpSource OpenCL_C 102000 + OpName %testfn "testfn" + OpName %res "res" OpName %test "test" OpName %const "const" OpDecorate %test SpecId 0 %void = OpTypeVoid %3 = OpTypeFunction %void - %double = OpTypeFloat 64 -%ptr_double = OpTypePointer Function %double + %double = OpTypeFloat 64 + %ptr_double = OpTypePointer Function %double %test = OpSpecConstant %double -42.42 %const = OpConstant %double -42.42 %11 = OpSpecConstantOp %double FAdd %test %const - %main = OpFunction %void None %3 + %testfn = OpFunction %void None %3 %5 = OpLabel %res = OpVariable %ptr_double Function OpStore %res %11 OpReturn OpFunctionEnd ; CHECK: ; ModuleID = '{{.*}}' -; CHECK: define spir_kernel void @main() +; CHECK: define spir_kernel void @testfn() ; CHECK: {{[%@][-a-zA-Z$._0-9][-a-zA-Z$._0-9]*}} = alloca double ; CHECK: store double {{(-?[0-9]+\.[0-9]+e\+[0-9]+|0x[0-9A-F]+)}}, ptr {{[%@][-a-zA-Z$._0-9][-a-zA-Z$._0-9]*}} ; CHECK: ret void diff --git a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fadd_float.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fadd_float.spvasm index 0216c1cf3..a8480102c 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fadd_float.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fadd_float.spvasm @@ -15,35 +15,33 @@ ; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} -; RUN: spirv-ll-tool -a Vulkan -c Float64 -c Int64 %spv_file_s | FileCheck %s - OpCapability Shader - OpCapability Float64 - OpCapability Int64 - %1 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint GLCompute %main "main" - OpExecutionMode %main LocalSize 1 1 1 - OpSource GLSL 450 - OpName %main "main" - OpName %res "res" +; RUN: spirv-ll-tool -a OpenCL -b 64 %spv_file_s | FileCheck %s + OpCapability Kernel + OpCapability Addresses + %1 = OpExtInstImport "OpenCL.std" + OpMemoryModel Physical64 OpenCL + OpEntryPoint Kernel %testfn "testfn" + OpSource OpenCL_C 102000 + OpName %testfn "testfn" + OpName %res "res" OpName %test "test" OpName %const "const" OpDecorate %test SpecId 0 %void = OpTypeVoid %3 = OpTypeFunction %void - %float = OpTypeFloat 32 -%ptr_float = OpTypePointer Function %float + %float = OpTypeFloat 32 + %ptr_float = OpTypePointer Function %float %test = OpSpecConstant %float 42.42 %const = OpConstant %float 42.42 %11 = OpSpecConstantOp %float FAdd %test %const - %main = OpFunction %void None %3 + %testfn = OpFunction %void None %3 %5 = OpLabel %res = OpVariable %ptr_float Function OpStore %res %11 OpReturn OpFunctionEnd ; CHECK: ; ModuleID = '{{.*}}' -; CHECK: define spir_kernel void @main() +; CHECK: define spir_kernel void @testfn() ; CHECK: {{[%@][-a-zA-Z$._0-9][-a-zA-Z$._0-9]*}} = alloca float ; CHECK: store float {{(-?[0-9]+\.[0-9]+e\+[0-9]+|0x[0-9A-F]+)}}, ptr {{[%@][-a-zA-Z$._0-9][-a-zA-Z$._0-9]*}} ; CHECK: ret void diff --git a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fdiv_double.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fdiv_double.spvasm index afa5f3cd2..900dea223 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fdiv_double.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fdiv_double.spvasm @@ -15,35 +15,34 @@ ; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} -; RUN: spirv-ll-tool -a Vulkan -c Float64 -c Int64 %spv_file_s | FileCheck %s - OpCapability Shader - OpCapability Float64 - OpCapability Int64 - %1 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint GLCompute %main "main" - OpExecutionMode %main LocalSize 1 1 1 - OpSource GLSL 450 - OpName %main "main" - OpName %res "res" +; RUN: spirv-ll-tool -a OpenCL -b 64 -c Float64 %spv_file_s | FileCheck %s + OpCapability Kernel + OpCapability Addresses + OpCapability Float64 + %1 = OpExtInstImport "OpenCL.std" + OpMemoryModel Physical64 OpenCL + OpEntryPoint Kernel %testfn "testfn" + OpSource OpenCL_C 102000 + OpName %testfn "testfn" + OpName %res "res" OpName %test "test" OpName %const "const" OpDecorate %test SpecId 0 %void = OpTypeVoid %3 = OpTypeFunction %void - %double = OpTypeFloat 64 -%ptr_double = OpTypePointer Function %double + %double = OpTypeFloat 64 + %ptr_double = OpTypePointer Function %double %test = OpSpecConstant %double -42.42 %const = OpConstant %double -42.42 %11 = OpSpecConstantOp %double FDiv %test %const - %main = OpFunction %void None %3 + %testfn = OpFunction %void None %3 %5 = OpLabel %res = OpVariable %ptr_double Function OpStore %res %11 OpReturn OpFunctionEnd ; CHECK: ; ModuleID = '{{.*}}' -; CHECK: define spir_kernel void @main() +; CHECK: define spir_kernel void @testfn() ; CHECK: {{[%@][-a-zA-Z$._0-9][-a-zA-Z$._0-9]*}} = alloca double ; CHECK: store double {{(-?[0-9]+\.[0-9]+e\+[0-9]+|0x[0-9A-F]+)}}, ptr {{[%@][-a-zA-Z$._0-9][-a-zA-Z$._0-9]*}} ; CHECK: ret void diff --git a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fdiv_float.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fdiv_float.spvasm index a47a28185..90a5b21de 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fdiv_float.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fdiv_float.spvasm @@ -15,35 +15,33 @@ ; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} -; RUN: spirv-ll-tool -a Vulkan -c Float64 -c Int64 %spv_file_s | FileCheck %s - OpCapability Shader - OpCapability Float64 - OpCapability Int64 - %1 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint GLCompute %main "main" - OpExecutionMode %main LocalSize 1 1 1 - OpSource GLSL 450 - OpName %main "main" - OpName %res "res" +; RUN: spirv-ll-tool -a OpenCL -b 64 %spv_file_s | FileCheck %s + OpCapability Kernel + OpCapability Addresses + %1 = OpExtInstImport "OpenCL.std" + OpMemoryModel Physical64 OpenCL + OpEntryPoint Kernel %testfn "testfn" + OpSource OpenCL_C 102000 + OpName %testfn "testfn" + OpName %res "res" OpName %test "test" OpName %const "const" OpDecorate %test SpecId 0 %void = OpTypeVoid %3 = OpTypeFunction %void - %float = OpTypeFloat 32 -%ptr_float = OpTypePointer Function %float + %float = OpTypeFloat 32 + %ptr_float = OpTypePointer Function %float %test = OpSpecConstant %float 42.42 %const = OpConstant %float 42.42 %11 = OpSpecConstantOp %float FDiv %test %const - %main = OpFunction %void None %3 + %testfn = OpFunction %void None %3 %5 = OpLabel %res = OpVariable %ptr_float Function OpStore %res %11 OpReturn OpFunctionEnd ; CHECK: ; ModuleID = '{{.*}}' -; CHECK: define spir_kernel void @main() +; CHECK: define spir_kernel void @testfn() ; CHECK: {{[%@][-a-zA-Z$._0-9][-a-zA-Z$._0-9]*}} = alloca float ; CHECK: store float {{(-?[0-9]+\.[0-9]+e\+[0-9]+|0x[0-9A-F]+)}}, ptr {{[%@][-a-zA-Z$._0-9][-a-zA-Z$._0-9]*}} ; CHECK: ret void diff --git a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fmod_double.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fmod_double.spvasm index 388bf2866..fb8beeb81 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fmod_double.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fmod_double.spvasm @@ -15,16 +15,15 @@ ; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} -; RUN: spirv-ll-tool -a Vulkan -c Float64 -c Int64 %spv_file_s | FileCheck %s - OpCapability Shader +; RUN: spirv-ll-tool -a OpenCL -b 64 -c Float64 %spv_file_s | FileCheck %s + OpCapability Kernel + OpCapability Addresses OpCapability Float64 - OpCapability Int64 - %1 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint GLCompute %main "main" - OpExecutionMode %main LocalSize 1 1 1 - OpSource GLSL 450 - OpName %main "main" + %1 = OpExtInstImport "OpenCL.std" + OpMemoryModel Physical64 OpenCL + OpEntryPoint Kernel %testfn "testfn" + OpSource OpenCL_C 102000 + OpName %testfn "testfn" OpName %res "res" OpName %test "test" OpName %const "const" @@ -36,14 +35,14 @@ %test = OpSpecConstant %double -42.42 %const = OpConstant %double -42.42 %11 = OpSpecConstantOp %double FMod %test %const - %main = OpFunction %void None %3 + %testfn = OpFunction %void None %3 %5 = OpLabel %res = OpVariable %ptr_double Function OpStore %res %11 OpReturn OpFunctionEnd ; CHECK: ; ModuleID = '{{.*}}' -; CHECK: define spir_kernel void @main() #0 { +; CHECK: define spir_kernel void @testfn() #0 ; CHECK: [[MOD:%[a-zA-Z0-9_]+]] = call spir_func double @_Z4fmoddd(double -4.242000e+01, double -4.242000e+01) ; CHECK: [[SPEC:%[a-zA-Z0-9_]+]] = call spir_func double @_Z8copysigndd(double [[MOD]], double -4.242000e+01) ; CHECK: br label {{%[a-zA-Z0-9_]+}} diff --git a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fmod_float.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fmod_float.spvasm index c86cbc24b..fc2a4a1db 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fmod_float.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fmod_float.spvasm @@ -15,16 +15,14 @@ ; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} -; RUN: spirv-ll-tool -a Vulkan -c Float64 -c Int64 %spv_file_s | FileCheck %s - OpCapability Shader - OpCapability Float64 - OpCapability Int64 - %1 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint GLCompute %main "main" - OpExecutionMode %main LocalSize 1 1 1 - OpSource GLSL 450 - OpName %main "main" +; RUN: spirv-ll-tool -a OpenCL -b 64 %spv_file_s | FileCheck %s + OpCapability Kernel + OpCapability Addresses + %1 = OpExtInstImport "OpenCL.std" + OpMemoryModel Physical64 OpenCL + OpEntryPoint Kernel %testfn "testfn" + OpSource OpenCL_C 102000 + OpName %testfn "testfn" OpName %res "res" OpName %test "test" OpName %const "const" @@ -36,14 +34,14 @@ %test = OpSpecConstant %float 42.42 %const = OpConstant %float 42.42 %11 = OpSpecConstantOp %float FMod %test %const - %main = OpFunction %void None %3 + %testfn = OpFunction %void None %3 %5 = OpLabel %res = OpVariable %ptr_float Function OpStore %res %11 OpReturn OpFunctionEnd ; CHECK: ; ModuleID = '{{.*}}' -; CHECK: define spir_kernel void @main() +; CHECK: define spir_kernel void @testfn() ; CHECK: init_spec_constants: ; CHECK: [[MOD:%[a-zA-Z0-9_]+]] = call spir_func float @_Z4fmodff(float 0x404535C280000000, float 0x404535C280000000) ; CHECK: [[CONST:%[a-zA-Z0-9_]+]] = call spir_func float @_Z8copysignff(float [[MOD]], float 0x404535C280000000) diff --git a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fmod_multi_function.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fmod_multi_function.spvasm index 1a89e72e6..86e5fd40c 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fmod_multi_function.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fmod_multi_function.spvasm @@ -15,15 +15,14 @@ ; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} -; RUN: spirv-ll-tool -a Vulkan -c Float64 -c Int64 %spv_file_s | FileCheck %s - OpCapability Shader +; RUN: spirv-ll-tool -a OpenCL -b 64 -c Float64 %spv_file_s | FileCheck %s + OpCapability Kernel + OpCapability Addresses OpCapability Float64 - OpCapability Int64 - %1 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint GLCompute %main "main" - OpExecutionMode %main LocalSize 1 1 1 - OpSource GLSL 450 + %1 = OpExtInstImport "OpenCL.std" + OpMemoryModel Physical64 OpenCL + OpEntryPoint Kernel %testfn "testfn" + OpSource OpenCL_C 102000 OpName %add "add" OpName %main "main" OpName %res "res" @@ -47,7 +46,7 @@ %8 = OpFAdd %double %7 %12 OpReturnValue %8 OpFunctionEnd - %main = OpFunction %void None %3 + %testfn = OpFunction %void None %3 %5 = OpLabel %res = OpVariable %ptr_double Function %20 = OpFunctionCall %double %add %11 %12 @@ -65,7 +64,7 @@ ; CHECK: [[ADD:%[a-zA-Z0-9_]+]] = fadd double {{%[a-zA-Z0-9_]+}}, {{%[a-zA-Z0-9_]+}} ; CHECK: [[RET:%[a-zA-Z0-9_]+]] = fadd double [[ADD]], [[SPEC_B]] ; CHECK: ret double [[RET]] -; CHECK: define spir_kernel void @main() +; CHECK: define spir_kernel void @testfn() ; CHECK: init_spec_constants: ; CHECK: [[MOD_C:%[a-zA-Z0-9_]+]] = call spir_func double @_Z4fmoddd(double 4.242000e+01, double 4.242000e+01) ; CHECK: [[SPEC_C:%[a-zA-Z0-9_]+]] = call spir_func double @_Z8copysigndd(double [[MOD_C]], double 4.242000e+01) diff --git a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fmul_double.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fmul_double.spvasm index c610af10a..756bcd0da 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fmul_double.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fmul_double.spvasm @@ -15,35 +15,36 @@ ; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} -; RUN: spirv-ll-tool -a Vulkan -c Float64 -c Int64 %spv_file_s | FileCheck %s - OpCapability Shader - OpCapability Float64 - OpCapability Int64 - %1 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint GLCompute %main "main" - OpExecutionMode %main LocalSize 1 1 1 - OpSource GLSL 450 - OpName %main "main" - OpName %res "res" +; RUN: spirv-ll-tool -a OpenCL -b 64 -c Float64 %spv_file_s | FileCheck %s + OpCapability Kernel + OpCapability Addresses + OpCapability Float64 + %1 = OpExtInstImport "OpenCL.std" + OpMemoryModel Physical64 OpenCL + OpEntryPoint Kernel %testfn "testfn" + OpSource OpenCL_C 102000 + OpName %testfn "testfn" + OpName %res "res" + OpName %test "test" + OpName %const "const" OpName %test "test" OpName %const "const" OpDecorate %test SpecId 0 %void = OpTypeVoid %3 = OpTypeFunction %void - %double = OpTypeFloat 64 -%ptr_double = OpTypePointer Function %double + %double = OpTypeFloat 64 + %ptr_double = OpTypePointer Function %double %test = OpSpecConstant %double -42.42 %const = OpConstant %double -42.42 %11 = OpSpecConstantOp %double FMul %test %const - %main = OpFunction %void None %3 + %testfn = OpFunction %void None %3 %5 = OpLabel %res = OpVariable %ptr_double Function OpStore %res %11 OpReturn OpFunctionEnd ; CHECK: ; ModuleID = '{{.*}}' -; CHECK: define spir_kernel void @main() +; CHECK: define spir_kernel void @testfn() ; CHECK: {{[%@][-a-zA-Z$._0-9][-a-zA-Z$._0-9]*}} = alloca double ; CHECK: store double {{(-?[0-9]+\.[0-9]+e\+[0-9]+|0x[0-9A-F]+)}}, ptr {{[%@][-a-zA-Z$._0-9][-a-zA-Z$._0-9]*}} ; CHECK: ret void diff --git a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fmul_float.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fmul_float.spvasm index 542d98102..b39750ee1 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fmul_float.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fmul_float.spvasm @@ -15,35 +15,33 @@ ; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} -; RUN: spirv-ll-tool -a Vulkan -c Float64 -c Int64 %spv_file_s | FileCheck %s - OpCapability Shader - OpCapability Float64 - OpCapability Int64 - %1 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint GLCompute %main "main" - OpExecutionMode %main LocalSize 1 1 1 - OpSource GLSL 450 - OpName %main "main" - OpName %res "res" +; RUN: spirv-ll-tool -a OpenCL -b 64 %spv_file_s | FileCheck %s + OpCapability Kernel + OpCapability Addresses + %1 = OpExtInstImport "OpenCL.std" + OpMemoryModel Physical64 OpenCL + OpEntryPoint Kernel %testfn "testfn" + OpSource OpenCL_C 102000 + OpName %testfn "testfn" + OpName %res "res" OpName %test "test" OpName %const "const" OpDecorate %test SpecId 0 %void = OpTypeVoid %3 = OpTypeFunction %void - %float = OpTypeFloat 32 -%ptr_float = OpTypePointer Function %float + %float = OpTypeFloat 32 + %ptr_float = OpTypePointer Function %float %test = OpSpecConstant %float 42.42 %const = OpConstant %float 42.42 %11 = OpSpecConstantOp %float FMul %test %const - %main = OpFunction %void None %3 + %testfn = OpFunction %void None %3 %5 = OpLabel %res = OpVariable %ptr_float Function OpStore %res %11 OpReturn OpFunctionEnd ; CHECK: ; ModuleID = '{{.*}}' -; CHECK: define spir_kernel void @main() +; CHECK: define spir_kernel void @testfn() ; CHECK: {{[%@][-a-zA-Z$._0-9][-a-zA-Z$._0-9]*}} = alloca float ; CHECK: store float {{(-?[0-9]+\.[0-9]+e\+[0-9]+|0x[0-9A-F]+)}}, ptr {{[%@][-a-zA-Z$._0-9][-a-zA-Z$._0-9]*}} ; CHECK: ret void diff --git a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fsub_double.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fsub_double.spvasm index 5c43d57fb..d13f568ee 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fsub_double.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fsub_double.spvasm @@ -15,35 +15,34 @@ ; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} -; RUN: spirv-ll-tool -a Vulkan -c Float64 -c Int64 %spv_file_s | FileCheck %s - OpCapability Shader - OpCapability Float64 - OpCapability Int64 - %1 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint GLCompute %main "main" - OpExecutionMode %main LocalSize 1 1 1 - OpSource GLSL 450 - OpName %main "main" - OpName %res "res" +; RUN: spirv-ll-tool -a OpenCL -b 64 -c Float64 %spv_file_s | FileCheck %s + OpCapability Kernel + OpCapability Addresses + OpCapability Float64 + %1 = OpExtInstImport "OpenCL.std" + OpMemoryModel Physical64 OpenCL + OpEntryPoint Kernel %testfn "testfn" + OpSource OpenCL_C 102000 + OpName %testfn "testfn" + OpName %res "res" OpName %test "test" OpName %const "const" OpDecorate %test SpecId 0 %void = OpTypeVoid %3 = OpTypeFunction %void - %double = OpTypeFloat 64 -%ptr_double = OpTypePointer Function %double + %double = OpTypeFloat 64 + %ptr_double = OpTypePointer Function %double %test = OpSpecConstant %double -42.42 %const = OpConstant %double -42.42 %11 = OpSpecConstantOp %double FSub %test %const - %main = OpFunction %void None %3 + %testfn = OpFunction %void None %3 %5 = OpLabel %res = OpVariable %ptr_double Function OpStore %res %11 OpReturn OpFunctionEnd ; CHECK: ; ModuleID = '{{.*}}' -; CHECK: define spir_kernel void @main() +; CHECK: define spir_kernel void @testfn() ; CHECK: {{[%@][-a-zA-Z$._0-9][-a-zA-Z$._0-9]*}} = alloca double ; CHECK: store double {{(-?[0-9]+\.[0-9]+e\+[0-9]+|0x[0-9A-F]+)}}, ptr {{[%@][-a-zA-Z$._0-9][-a-zA-Z$._0-9]*}} ; CHECK: ret void diff --git a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fsub_float.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fsub_float.spvasm index c24dc6474..9d415d809 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fsub_float.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fsub_float.spvasm @@ -15,35 +15,33 @@ ; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} -; RUN: spirv-ll-tool -a Vulkan -c Float64 -c Int64 %spv_file_s | FileCheck %s - OpCapability Shader - OpCapability Float64 - OpCapability Int64 - %1 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint GLCompute %main "main" - OpExecutionMode %main LocalSize 1 1 1 - OpSource GLSL 450 - OpName %main "main" - OpName %res "res" +; RUN: spirv-ll-tool -a OpenCL -b 64 %spv_file_s | FileCheck %s + OpCapability Kernel + OpCapability Addresses + %1 = OpExtInstImport "OpenCL.std" + OpMemoryModel Physical64 OpenCL + OpEntryPoint Kernel %testfn "testfn" + OpSource OpenCL_C 102000 + OpName %testfn "testfn" + OpName %res "res" OpName %test "test" OpName %const "const" OpDecorate %test SpecId 0 %void = OpTypeVoid %3 = OpTypeFunction %void - %float = OpTypeFloat 32 -%ptr_float = OpTypePointer Function %float + %float = OpTypeFloat 32 + %ptr_float = OpTypePointer Function %float %test = OpSpecConstant %float 42.42 %const = OpConstant %float 42.42 %11 = OpSpecConstantOp %float FSub %test %const - %main = OpFunction %void None %3 + %testfn = OpFunction %void None %3 %5 = OpLabel %res = OpVariable %ptr_float Function OpStore %res %11 OpReturn OpFunctionEnd ; CHECK: ; ModuleID = '{{.*}}' -; CHECK: define spir_kernel void @main() +; CHECK: define spir_kernel void @testfn() ; CHECK: {{[%@][-a-zA-Z$._0-9][-a-zA-Z$._0-9]*}} = alloca float ; CHECK: store float {{(-?[0-9]+\.[0-9]+e\+[0-9]+|0x[0-9A-F]+)}}, ptr {{[%@][-a-zA-Z$._0-9][-a-zA-Z$._0-9]*}} ; CHECK: ret void From 0bda538f2a77ce279be0dded82333ebbaffbfae5 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 9 Nov 2023 14:40:14 +0000 Subject: [PATCH 02/35] [spirv-ll] Fix up tests missing capabilities/extensions All of these tests were making use of ops without declaring the associated capabilities, or using capabilities without the declaring the associated extensions. --- .../test/spvasm/ext_variable_pointers_function_call.spvasm | 3 ++- .../test/spvasm/intel_arbitrary_precision_integers.spvasm | 1 + modules/compiler/spirv-ll/test/spvasm/intel_opt_none.spvasm | 3 ++- .../spirv-ll/test/spvasm/op_atomic_and_generic.spvasm | 3 ++- .../test/spvasm/op_atomic_compare_exchange_generic.spvasm | 3 ++- .../spirv-ll/test/spvasm/op_atomic_exchange_generic.spvasm | 3 ++- .../spirv-ll/test/spvasm/op_copy_memory_sized_double.spvasm | 3 ++- .../spirv-ll/test/spvasm/op_copy_memory_sized_float.spvasm | 3 ++- .../spirv-ll/test/spvasm/op_copy_memory_sized_int.spvasm | 3 ++- .../spirv-ll/test/spvasm/op_copy_memory_sized_long.spvasm | 3 ++- .../spirv-ll/test/spvasm/op_copy_memory_sized_uint.spvasm | 3 ++- .../test/spvasm/op_execution_mode_max_work_dim.spvasm | 3 ++- modules/compiler/spirv-ll/test/spvasm/op_f_mod_half.spvasm | 1 + modules/compiler/spirv-ll/test/spvasm/op_f_rem_half.spvasm | 1 + .../spirv-ll/test/spvasm/op_group_async_copy_double.spvasm | 3 ++- .../test/spvasm/op_image_query_format_1d_buffer.spvasm | 4 ++-- .../test/spvasm/op_image_query_order_1d_buffer.spvasm | 4 ++-- .../spirv-ll/test/spvasm/op_image_read_1d_buffer.spvasm | 4 ++-- .../spirv-ll/test/spvasm/op_image_write_1d_array.spvasm | 3 ++- .../spirv-ll/test/spvasm/op_image_write_1d_buffer.spvasm | 3 ++- modules/compiler/spirv-ll/test/spvasm/op_opencl_arg_md.spvasm | 3 ++- .../test/spvasm/op_spec_constant_generic_pointer.spvasm | 4 ++-- .../spirv-ll/test/spvasm/prioritize_function_names.spvasm | 1 + 23 files changed, 42 insertions(+), 23 deletions(-) diff --git a/modules/compiler/spirv-ll/test/spvasm/ext_variable_pointers_function_call.spvasm b/modules/compiler/spirv-ll/test/spvasm/ext_variable_pointers_function_call.spvasm index 25393373e..fec1edcc9 100644 --- a/modules/compiler/spirv-ll/test/spvasm/ext_variable_pointers_function_call.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/ext_variable_pointers_function_call.spvasm @@ -15,11 +15,12 @@ ; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} -; RUN: spirv-ll-tool -a Vulkan -c VariablePointersStorageBuffer %spv_file_s | FileCheck %s +; RUN: spirv-ll-tool -a Vulkan -c VariablePointersStorageBuffer -e SPV_KHR_variable_pointers %spv_file_s | FileCheck %s ; tests that variable pointers work correctly with functions, that they can be ; passed as arguments and returned OpCapability Shader OpCapability VariablePointersStorageBuffer + OpExtension "SPV_KHR_variable_pointers" %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" diff --git a/modules/compiler/spirv-ll/test/spvasm/intel_arbitrary_precision_integers.spvasm b/modules/compiler/spirv-ll/test/spvasm/intel_arbitrary_precision_integers.spvasm index f6c7fb853..bc0f6d9f7 100644 --- a/modules/compiler/spirv-ll/test/spvasm/intel_arbitrary_precision_integers.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/intel_arbitrary_precision_integers.spvasm @@ -20,6 +20,7 @@ OpCapability Kernel OpCapability Addresses OpCapability ArbitraryPrecisionIntegersINTEL + OpExtension "SPV_INTEL_arbitrary_precision_integers" OpMemoryModel Physical64 OpenCL OpEntryPoint Kernel %kernel "kernel" OpName %kernel "kernel" diff --git a/modules/compiler/spirv-ll/test/spvasm/intel_opt_none.spvasm b/modules/compiler/spirv-ll/test/spvasm/intel_opt_none.spvasm index c57c159c5..af7bbe6c1 100644 --- a/modules/compiler/spirv-ll/test/spvasm/intel_opt_none.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/intel_opt_none.spvasm @@ -16,10 +16,11 @@ ; REQUIRES: spirv-as-v2021.3+ ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} -; RUN: spirv-ll-tool -a OpenCL -b 64 %spv_file_s | FileCheck %s +; RUN: spirv-ll-tool -a OpenCL -b 64 -e SPV_INTEL_optnone %spv_file_s | FileCheck %s OpCapability Addresses OpCapability Kernel OpCapability OptNoneINTEL + OpExtension "SPV_INTEL_optnone" %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical64 OpenCL OpEntryPoint Kernel %4 "foo" diff --git a/modules/compiler/spirv-ll/test/spvasm/op_atomic_and_generic.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_atomic_and_generic.spvasm index 23c0c36d2..8d4198061 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_atomic_and_generic.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_atomic_and_generic.spvasm @@ -15,11 +15,12 @@ ; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} -; RUN: spirv-ll-tool -a OpenCL -b 64 -c Float64 %spv_file_s | FileCheck %s +; RUN: spirv-ll-tool -a OpenCL -b 64 -c Float64 -c GenericPointer %spv_file_s | FileCheck %s OpCapability Kernel OpCapability Addresses OpCapability Float64 OpCapability Int64 + OpCapability GenericPointer OpMemoryModel Physical64 OpenCL OpEntryPoint Kernel %atomic "atomic" OpName %atomic "atomic" diff --git a/modules/compiler/spirv-ll/test/spvasm/op_atomic_compare_exchange_generic.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_atomic_compare_exchange_generic.spvasm index b76ab31fb..922a4649a 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_atomic_compare_exchange_generic.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_atomic_compare_exchange_generic.spvasm @@ -15,11 +15,12 @@ ; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} -; RUN: spirv-ll-tool -a OpenCL -b 64 -c Float64 %spv_file_s | FileCheck %s +; RUN: spirv-ll-tool -a OpenCL -b 64 -c Float64 -c GenericPointer %spv_file_s | FileCheck %s OpCapability Kernel OpCapability Addresses OpCapability Float64 OpCapability Int64 + OpCapability GenericPointer OpMemoryModel Physical64 OpenCL OpEntryPoint Kernel %atomic "atomic" OpName %atomic "atomic" diff --git a/modules/compiler/spirv-ll/test/spvasm/op_atomic_exchange_generic.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_atomic_exchange_generic.spvasm index 77766d5ca..6e83aa423 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_atomic_exchange_generic.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_atomic_exchange_generic.spvasm @@ -15,11 +15,12 @@ ; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} -; RUN: spirv-ll-tool -a OpenCL -b 64 -c Float64 %spv_file_s | FileCheck %s +; RUN: spirv-ll-tool -a OpenCL -b 64 -c Float64 -c GenericPointer %spv_file_s | FileCheck %s OpCapability Kernel OpCapability Addresses OpCapability Float64 OpCapability Int64 + OpCapability GenericPointer OpMemoryModel Physical64 OpenCL OpEntryPoint Kernel %atomic "atomic" OpName %atomic "atomic" diff --git a/modules/compiler/spirv-ll/test/spvasm/op_copy_memory_sized_double.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_copy_memory_sized_double.spvasm index d48864eff..4460e0a9f 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_copy_memory_sized_double.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_copy_memory_sized_double.spvasm @@ -15,11 +15,12 @@ ; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} -; RUN: spirv-ll-tool -a Vulkan -c Float64 -c Int64 %spv_file_s | FileCheck %s +; RUN: spirv-ll-tool -a Vulkan -c Float64 -c Int64 -c Addresses %spv_file_s | FileCheck %s ; CHECK: ; ModuleID = '{{.*}}' OpCapability Shader OpCapability Float64 OpCapability Int64 + OpCapability Addresses %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" diff --git a/modules/compiler/spirv-ll/test/spvasm/op_copy_memory_sized_float.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_copy_memory_sized_float.spvasm index c5ea3cb3a..d281e43af 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_copy_memory_sized_float.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_copy_memory_sized_float.spvasm @@ -15,11 +15,12 @@ ; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} -; RUN: spirv-ll-tool -a Vulkan -c Float64 -c Int64 %spv_file_s | FileCheck %s +; RUN: spirv-ll-tool -a Vulkan -c Float64 -c Int64 -c Addresses %spv_file_s | FileCheck %s ; CHECK: ; ModuleID = '{{.*}}' OpCapability Shader OpCapability Float64 OpCapability Int64 + OpCapability Addresses %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" diff --git a/modules/compiler/spirv-ll/test/spvasm/op_copy_memory_sized_int.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_copy_memory_sized_int.spvasm index 946f22bf7..6bce720f3 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_copy_memory_sized_int.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_copy_memory_sized_int.spvasm @@ -15,9 +15,10 @@ ; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} -; RUN: spirv-ll-tool -a Vulkan -c Float64 -c Int64 %spv_file_s | FileCheck %s +; RUN: spirv-ll-tool -a Vulkan -c Float64 -c Int64 -c Addresses %spv_file_s | FileCheck %s ; CHECK: ; ModuleID = '{{.*}}' OpCapability Shader + OpCapability Addresses OpCapability Float64 OpCapability Int64 %1 = OpExtInstImport "GLSL.std.450" diff --git a/modules/compiler/spirv-ll/test/spvasm/op_copy_memory_sized_long.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_copy_memory_sized_long.spvasm index 92c11f6e4..ca1d2cd3e 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_copy_memory_sized_long.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_copy_memory_sized_long.spvasm @@ -15,11 +15,12 @@ ; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} -; RUN: spirv-ll-tool -a Vulkan -c Float64 -c Int64 %spv_file_s | FileCheck %s +; RUN: spirv-ll-tool -a Vulkan -c Float64 -c Int64 -c Addresses %spv_file_s | FileCheck %s ; CHECK: ; ModuleID = '{{.*}}' OpCapability Shader OpCapability Float64 OpCapability Int64 + OpCapability Addresses %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" diff --git a/modules/compiler/spirv-ll/test/spvasm/op_copy_memory_sized_uint.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_copy_memory_sized_uint.spvasm index 0c217cbb4..b74c578a0 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_copy_memory_sized_uint.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_copy_memory_sized_uint.spvasm @@ -15,11 +15,12 @@ ; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} -; RUN: spirv-ll-tool -a Vulkan -c Float64 -c Int64 %spv_file_s | FileCheck %s +; RUN: spirv-ll-tool -a Vulkan -c Float64 -c Int64 -c Addresses %spv_file_s | FileCheck %s ; CHECK: ; ModuleID = '{{.*}}' OpCapability Shader OpCapability Float64 OpCapability Int64 + OpCapability Addresses %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" diff --git a/modules/compiler/spirv-ll/test/spvasm/op_execution_mode_max_work_dim.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_execution_mode_max_work_dim.spvasm index 8a72a2a42..7ea049b92 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_execution_mode_max_work_dim.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_execution_mode_max_work_dim.spvasm @@ -16,11 +16,12 @@ ; REQUIRES: spirv-as-v2020.0+ ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} -; RUN: spirv-ll-tool -a OpenCL -b 64 %spv_file_s | FileCheck %s +; RUN: spirv-ll-tool -a OpenCL -b 64 -e SPV_INTEL_kernel_attributes %spv_file_s | FileCheck %s OpCapability Kernel OpCapability Addresses OpCapability KernelAttributesINTEL + OpExtension "SPV_INTEL_kernel_attributes" %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical64 OpenCL OpEntryPoint Kernel %foo "metadata" diff --git a/modules/compiler/spirv-ll/test/spvasm/op_f_mod_half.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_f_mod_half.spvasm index 2f7db4aea..c8b06eb2b 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_f_mod_half.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_f_mod_half.spvasm @@ -19,6 +19,7 @@ OpCapability Kernel OpCapability Float16 OpCapability Int64 + OpCapability Addresses %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical64 OpenCL OpEntryPoint Kernel %main "main" diff --git a/modules/compiler/spirv-ll/test/spvasm/op_f_rem_half.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_f_rem_half.spvasm index 031aa649e..885197a91 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_f_rem_half.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_f_rem_half.spvasm @@ -17,6 +17,7 @@ ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} ; RUN: spirv-ll-tool -a OpenCL -b 64 -E %spv_file_s | FileCheck %s OpCapability Kernel + OpCapability Addresses OpCapability Float16 OpCapability Int64 %1 = OpExtInstImport "OpenCL.std" diff --git a/modules/compiler/spirv-ll/test/spvasm/op_group_async_copy_double.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_group_async_copy_double.spvasm index bd9eef7b6..e0aa4677c 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_group_async_copy_double.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_group_async_copy_double.spvasm @@ -16,11 +16,12 @@ ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} ; RUN: %pp-llvm-ver -o %t < %s --llvm-ver %LLVMVER -; RUN: spirv-ll-tool -a OpenCL -b 64 -c Addresses %spv_file_s | FileCheck %t +; RUN: spirv-ll-tool -a OpenCL -b 64 -c Addresses -c Float64 %spv_file_s | FileCheck %t OpCapability Addresses OpCapability Kernel OpCapability Int64 OpCapability Int8 + OpCapability Float64 %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical64 OpenCL OpEntryPoint Kernel %2 "async_copy" diff --git a/modules/compiler/spirv-ll/test/spvasm/op_image_query_format_1d_buffer.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_image_query_format_1d_buffer.spvasm index 36597a742..d30e35428 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_image_query_format_1d_buffer.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_image_query_format_1d_buffer.spvasm @@ -16,10 +16,10 @@ ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} ; RUN: %pp-llvm-ver -o %t < %s --llvm-ver %LLVMVER -; RUN: spirv-ll-tool -a OpenCL -b 64 -c Sampled1D %spv_file_s | FileCheck %t +; RUN: spirv-ll-tool -a OpenCL -b 64 -c SampledBuffer %spv_file_s | FileCheck %t OpCapability Kernel OpCapability Addresses - OpCapability Sampled1D + OpCapability SampledBuffer OpMemoryModel Physical64 OpenCL OpEntryPoint Kernel %image1d_buffer "image1d_buffer" OpSource OpenCL_C 102000 diff --git a/modules/compiler/spirv-ll/test/spvasm/op_image_query_order_1d_buffer.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_image_query_order_1d_buffer.spvasm index 79c2f37e8..4d71f4323 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_image_query_order_1d_buffer.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_image_query_order_1d_buffer.spvasm @@ -16,10 +16,10 @@ ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} ; RUN: %pp-llvm-ver -o %t < %s --llvm-ver %LLVMVER -; RUN: spirv-ll-tool -a OpenCL -b 64 -c Sampled1D %spv_file_s | FileCheck %t +; RUN: spirv-ll-tool -a OpenCL -b 64 -c SampledBuffer %spv_file_s | FileCheck %t OpCapability Kernel OpCapability Addresses - OpCapability Sampled1D + OpCapability SampledBuffer OpMemoryModel Physical64 OpenCL OpEntryPoint Kernel %image1d_buffer "image1d_buffer" OpSource OpenCL_C 102000 diff --git a/modules/compiler/spirv-ll/test/spvasm/op_image_read_1d_buffer.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_image_read_1d_buffer.spvasm index 95e891c79..934df5c9c 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_image_read_1d_buffer.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_image_read_1d_buffer.spvasm @@ -16,11 +16,11 @@ ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} ; RUN: %pp-llvm-ver -o %t < %s --llvm-ver %LLVMVER -; RUN: spirv-ll-tool -a OpenCL -b 64 -c ImageBasic -c Sampled1D %spv_file_s | FileCheck %t +; RUN: spirv-ll-tool -a OpenCL -b 64 -c ImageBasic -c SampledBuffer %spv_file_s | FileCheck %t OpCapability Kernel OpCapability Addresses OpCapability ImageBasic - OpCapability Sampled1D + OpCapability SampledBuffer OpMemoryModel Physical64 OpenCL OpEntryPoint Kernel %image1d_buffer "image1d_buffer" OpSource OpenCL_C 102000 diff --git a/modules/compiler/spirv-ll/test/spvasm/op_image_write_1d_array.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_image_write_1d_array.spvasm index 4691a73c6..8ad31ad29 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_image_write_1d_array.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_image_write_1d_array.spvasm @@ -16,9 +16,10 @@ ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} ; RUN: %pp-llvm-ver -o %t < %s --llvm-ver %LLVMVER -; RUN: spirv-ll-tool -a OpenCL -b 64 -c ImageBasic -c StorageImageWriteWithoutFormat %spv_file_s | FileCheck %t +; RUN: spirv-ll-tool -a OpenCL -b 64 -c ImageBasic -c Sampled1D -c StorageImageWriteWithoutFormat %spv_file_s | FileCheck %t OpCapability Kernel OpCapability Addresses + OpCapability Sampled1D OpCapability ImageBasic OpCapability StorageImageWriteWithoutFormat OpMemoryModel Physical64 OpenCL diff --git a/modules/compiler/spirv-ll/test/spvasm/op_image_write_1d_buffer.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_image_write_1d_buffer.spvasm index ff0f86b2e..6295323f0 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_image_write_1d_buffer.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_image_write_1d_buffer.spvasm @@ -16,10 +16,11 @@ ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} ; RUN: %pp-llvm-ver -o %t < %s --llvm-ver %LLVMVER -; RUN: spirv-ll-tool -a OpenCL -b 64 -c ImageBasic -c StorageImageWriteWithoutFormat %spv_file_s | FileCheck %t +; RUN: spirv-ll-tool -a OpenCL -b 64 -c ImageBasic -c SampledBuffer -c StorageImageWriteWithoutFormat %spv_file_s | FileCheck %t OpCapability Kernel OpCapability Addresses OpCapability ImageBasic + OpCapability SampledBuffer OpCapability StorageImageWriteWithoutFormat OpMemoryModel Physical64 OpenCL OpEntryPoint Kernel %image1d_buffer "image1d_buffer" diff --git a/modules/compiler/spirv-ll/test/spvasm/op_opencl_arg_md.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_opencl_arg_md.spvasm index 159c37348..950586ef3 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_opencl_arg_md.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_opencl_arg_md.spvasm @@ -16,10 +16,11 @@ ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} ; RUN: %pp-llvm-ver -o %t < %s --llvm-ver %LLVMVER -; RUN: spirv-ll-tool -a OpenCL -b 64 %spv_file_s | FileCheck %t +; RUN: spirv-ll-tool -a OpenCL -b 64 -c Int64 %spv_file_s | FileCheck %t OpCapability Kernel OpCapability Addresses + OpCapability Int64 %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical64 OpenCL OpEntryPoint Kernel %my_kernel "my_kernel" diff --git a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_generic_pointer.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_generic_pointer.spvasm index 60754331a..809544d2e 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_generic_pointer.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_generic_pointer.spvasm @@ -30,8 +30,8 @@ %_ptr_ulong = OpTypePointer CrossWorkgroup %ulong %_ptr_Generic_ulong = OpTypePointer Generic %ulong - %_ptr_ptr_ulong = OpTypePointer Private %_ptr_ulong - %_ptr_ptr_Generic_ulong = OpTypePointer Private %_ptr_Generic_ulong + %_ptr_ptr_ulong = OpTypePointer Workgroup %_ptr_ulong + %_ptr_ptr_Generic_ulong = OpTypePointer Workgroup %_ptr_Generic_ulong %ulong_0 = OpConstant %ulong 0 %ulong_1 = OpConstant %ulong 1 diff --git a/modules/compiler/spirv-ll/test/spvasm/prioritize_function_names.spvasm b/modules/compiler/spirv-ll/test/spvasm/prioritize_function_names.spvasm index 3b8773530..578e104ff 100644 --- a/modules/compiler/spirv-ll/test/spvasm/prioritize_function_names.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/prioritize_function_names.spvasm @@ -20,6 +20,7 @@ ; Ensure entry point functions get priority on assignment of their names when there are normal functions with the same name %1 = OpExtInstImport "OpenCL.std" + OpCapability Addresses OpMemoryModel Physical64 OpenCL OpEntryPoint Kernel %44 "signed_ints" OpEntryPoint Kernel %51 "unsigned_ints" From 0196e1efd7a941169e100ca378bdd15530922e53 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 9 Nov 2023 14:44:24 +0000 Subject: [PATCH 03/35] [spirv-ll] Fix up tests using capabilities in invalid layout sections --- .../spirv-ll/test/spvasm/op_atomic_double_add_global.spvasm | 2 +- .../spirv-ll/test/spvasm/op_atomic_double_max_global.spvasm | 2 +- .../spirv-ll/test/spvasm/op_atomic_double_min_global.spvasm | 2 +- .../spirv-ll/test/spvasm/op_atomic_float_add_global.spvasm | 2 +- .../spirv-ll/test/spvasm/op_atomic_float_max_global.spvasm | 2 +- .../spirv-ll/test/spvasm/op_atomic_float_min_global.spvasm | 2 +- .../spirv-ll/test/spvasm/prioritize_function_names.spvasm | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/compiler/spirv-ll/test/spvasm/op_atomic_double_add_global.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_atomic_double_add_global.spvasm index 1ad8cad82..b10f88232 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_atomic_double_add_global.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_atomic_double_add_global.spvasm @@ -16,9 +16,9 @@ ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} ; RUN: spirv-ll-tool -a Vulkan %spv_file_s -e SPV_EXT_shader_atomic_float_add -c Float64 -c AtomicFloat64AddEXT | FileCheck %s - OpExtension "SPV_EXT_shader_atomic_float_add" OpCapability Shader OpCapability AtomicFloat64AddEXT + OpExtension "SPV_EXT_shader_atomic_float_add" %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %atomic "atomic" diff --git a/modules/compiler/spirv-ll/test/spvasm/op_atomic_double_max_global.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_atomic_double_max_global.spvasm index ae2026e56..aa610b1e4 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_atomic_double_max_global.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_atomic_double_max_global.spvasm @@ -16,9 +16,9 @@ ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} ; RUN: spirv-ll-tool -a Vulkan %spv_file_s -e SPV_EXT_shader_atomic_float_min_max -c Float64 -c AtomicFloat64MinMaxEXT | FileCheck %s - OpExtension "SPV_EXT_shader_atomic_float_min_max" OpCapability Shader OpCapability AtomicFloat64MinMaxEXT + OpExtension "SPV_EXT_shader_atomic_float_min_max" %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %atomic "atomic" diff --git a/modules/compiler/spirv-ll/test/spvasm/op_atomic_double_min_global.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_atomic_double_min_global.spvasm index ee6c2decf..ec40be77c 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_atomic_double_min_global.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_atomic_double_min_global.spvasm @@ -16,9 +16,9 @@ ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} ; RUN: spirv-ll-tool -a Vulkan %spv_file_s -e SPV_EXT_shader_atomic_float_min_max -c Float64 -c AtomicFloat64MinMaxEXT | FileCheck %s - OpExtension "SPV_EXT_shader_atomic_float_min_max" OpCapability Shader OpCapability AtomicFloat64MinMaxEXT + OpExtension "SPV_EXT_shader_atomic_float_min_max" %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %atomic "atomic" diff --git a/modules/compiler/spirv-ll/test/spvasm/op_atomic_float_add_global.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_atomic_float_add_global.spvasm index f6a1d5cec..dd4b9549d 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_atomic_float_add_global.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_atomic_float_add_global.spvasm @@ -16,9 +16,9 @@ ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} ; RUN: spirv-ll-tool -a Vulkan %spv_file_s -e SPV_EXT_shader_atomic_float_add -c AtomicFloat32AddEXT | FileCheck %s - OpExtension "SPV_EXT_shader_atomic_float_add" OpCapability Shader OpCapability AtomicFloat32AddEXT + OpExtension "SPV_EXT_shader_atomic_float_add" %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %atomic "atomic" diff --git a/modules/compiler/spirv-ll/test/spvasm/op_atomic_float_max_global.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_atomic_float_max_global.spvasm index 43b5cbfcf..7324dea52 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_atomic_float_max_global.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_atomic_float_max_global.spvasm @@ -16,9 +16,9 @@ ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} ; RUN: spirv-ll-tool -a Vulkan %spv_file_s -e SPV_EXT_shader_atomic_float_min_max -c AtomicFloat32MinMaxEXT | FileCheck %s - OpExtension "SPV_EXT_shader_atomic_float_min_max" OpCapability Shader OpCapability AtomicFloat32MinMaxEXT + OpExtension "SPV_EXT_shader_atomic_float_min_max" %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %atomic "atomic" diff --git a/modules/compiler/spirv-ll/test/spvasm/op_atomic_float_min_global.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_atomic_float_min_global.spvasm index e6915db22..fd976d8fd 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_atomic_float_min_global.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_atomic_float_min_global.spvasm @@ -16,9 +16,9 @@ ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} ; RUN: spirv-ll-tool -a Vulkan %spv_file_s -e SPV_EXT_shader_atomic_float_min_max -c AtomicFloat32MinMaxEXT | FileCheck %s - OpExtension "SPV_EXT_shader_atomic_float_min_max" OpCapability Shader OpCapability AtomicFloat32MinMaxEXT + OpExtension "SPV_EXT_shader_atomic_float_min_max" %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %atomic "atomic" diff --git a/modules/compiler/spirv-ll/test/spvasm/prioritize_function_names.spvasm b/modules/compiler/spirv-ll/test/spvasm/prioritize_function_names.spvasm index 578e104ff..2a19b8136 100644 --- a/modules/compiler/spirv-ll/test/spvasm/prioritize_function_names.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/prioritize_function_names.spvasm @@ -19,8 +19,8 @@ ; Ensure entry point functions get priority on assignment of their names when there are normal functions with the same name -%1 = OpExtInstImport "OpenCL.std" OpCapability Addresses +%1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical64 OpenCL OpEntryPoint Kernel %44 "signed_ints" OpEntryPoint Kernel %51 "unsigned_ints" From 08ba6d48eace90f2296b12709261e5a94efcf86b Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 9 Nov 2023 14:47:05 +0000 Subject: [PATCH 04/35] [spirv-ll] Fix up more tests not declaring capabilities These were obscured by previous errors. --- .../test/spvasm/op_atomic_double_add_global.spvasm | 1 + .../test/spvasm/op_atomic_double_max_global.spvasm | 1 + .../test/spvasm/op_atomic_double_min_global.spvasm | 1 + .../spirv-ll/test/spvasm/prioritize_function_names.spvasm | 8 +++++++- 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/compiler/spirv-ll/test/spvasm/op_atomic_double_add_global.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_atomic_double_add_global.spvasm index b10f88232..1cc63eb31 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_atomic_double_add_global.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_atomic_double_add_global.spvasm @@ -17,6 +17,7 @@ ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} ; RUN: spirv-ll-tool -a Vulkan %spv_file_s -e SPV_EXT_shader_atomic_float_add -c Float64 -c AtomicFloat64AddEXT | FileCheck %s OpCapability Shader + OpCapability Float64 OpCapability AtomicFloat64AddEXT OpExtension "SPV_EXT_shader_atomic_float_add" %1 = OpExtInstImport "GLSL.std.450" diff --git a/modules/compiler/spirv-ll/test/spvasm/op_atomic_double_max_global.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_atomic_double_max_global.spvasm index aa610b1e4..b11e2f50a 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_atomic_double_max_global.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_atomic_double_max_global.spvasm @@ -17,6 +17,7 @@ ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} ; RUN: spirv-ll-tool -a Vulkan %spv_file_s -e SPV_EXT_shader_atomic_float_min_max -c Float64 -c AtomicFloat64MinMaxEXT | FileCheck %s OpCapability Shader + OpCapability Float64 OpCapability AtomicFloat64MinMaxEXT OpExtension "SPV_EXT_shader_atomic_float_min_max" %1 = OpExtInstImport "GLSL.std.450" diff --git a/modules/compiler/spirv-ll/test/spvasm/op_atomic_double_min_global.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_atomic_double_min_global.spvasm index ec40be77c..2fe9116d7 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_atomic_double_min_global.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_atomic_double_min_global.spvasm @@ -17,6 +17,7 @@ ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} ; RUN: spirv-ll-tool -a Vulkan %spv_file_s -e SPV_EXT_shader_atomic_float_min_max -c Float64 -c AtomicFloat64MinMaxEXT | FileCheck %s OpCapability Shader + OpCapability Float64 OpCapability AtomicFloat64MinMaxEXT OpExtension "SPV_EXT_shader_atomic_float_min_max" %1 = OpExtInstImport "GLSL.std.450" diff --git a/modules/compiler/spirv-ll/test/spvasm/prioritize_function_names.spvasm b/modules/compiler/spirv-ll/test/spvasm/prioritize_function_names.spvasm index 2a19b8136..1fc99efdf 100644 --- a/modules/compiler/spirv-ll/test/spvasm/prioritize_function_names.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/prioritize_function_names.spvasm @@ -15,11 +15,17 @@ ; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} -; RUN: spirv-ll-tool -a OpenCL -b 64 %spv_file_s | FileCheck %s +; RUN: spirv-ll-tool -a OpenCL -b 64 -c Float64 %spv_file_s | FileCheck %s ; Ensure entry point functions get priority on assignment of their names when there are normal functions with the same name + OpCapability Kernel OpCapability Addresses + OpCapability Linkage + OpCapability Int8 + OpCapability Int16 + OpCapability Int64 + OpCapability Float64 %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical64 OpenCL OpEntryPoint Kernel %44 "signed_ints" From c80b0b8d911c73f6260d7e1eb99326ca0507eab4 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 9 Nov 2023 14:52:29 +0000 Subject: [PATCH 05/35] [spirv-ll] Fix up tets using OpName in invalid layout sections --- .../spirv-ll/test/spvasm/linkonce_odr.spvasm | 7 ++++--- ...p_control_barrier_variable_execution_scope.spvasm | 3 +-- .../op_control_barrier_variable_memory_scope.spvasm | 3 +-- .../spirv-ll/test/spvasm/op_group_all.spvasm | 7 ++++--- .../spirv-ll/test/spvasm/op_group_any.spvasm | 8 ++++---- .../spirv-ll/test/spvasm/op_group_broadcast.spvasm | 12 ++++++------ .../test/spvasm/op_group_broadcast_2D.spvasm | 7 +++---- .../test/spvasm/op_group_broadcast_3D.spvasm | 7 +++---- .../spirv-ll/test/spvasm/op_group_f_add.spvasm | 8 ++++---- .../spirv-ll/test/spvasm/op_group_f_max.spvasm | 8 ++++---- .../spirv-ll/test/spvasm/op_group_f_min.spvasm | 8 ++++---- .../spirv-ll/test/spvasm/op_group_i_add.spvasm | 12 ++++++------ .../spirv-ll/test/spvasm/op_group_s_max.spvasm | 8 ++++---- .../spirv-ll/test/spvasm/op_group_s_min.spvasm | 8 ++++---- .../spirv-ll/test/spvasm/op_group_u_max.spvasm | 8 ++++---- .../spirv-ll/test/spvasm/op_group_u_min.spvasm | 8 ++++---- .../test/spvasm/op_group_wrapper_clash.spvasm | 8 ++++---- .../op_memory_barrier_variable_memory_scope.spvasm | 2 +- 18 files changed, 65 insertions(+), 67 deletions(-) diff --git a/modules/compiler/spirv-ll/test/spvasm/linkonce_odr.spvasm b/modules/compiler/spirv-ll/test/spvasm/linkonce_odr.spvasm index cae318668..fe17e0470 100644 --- a/modules/compiler/spirv-ll/test/spvasm/linkonce_odr.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/linkonce_odr.spvasm @@ -24,15 +24,16 @@ %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical64 OpenCL OpSource OpenCL_C 102000 - OpDecorate %gv LinkageAttributes "gv" LinkOnceODR - OpDecorate %foo LinkageAttributes "foo" Import - OpDecorate %bar LinkageAttributes "bar" LinkOnceODR OpName %gv "gv" OpName %foo "foo" OpName %bar "bar" OpName %y "y" + OpDecorate %gv LinkageAttributes "gv" LinkOnceODR + OpDecorate %foo LinkageAttributes "foo" Import + OpDecorate %bar LinkageAttributes "bar" LinkOnceODR + %void = OpTypeVoid %uint = OpTypeInt 32 0 diff --git a/modules/compiler/spirv-ll/test/spvasm/op_control_barrier_variable_execution_scope.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_control_barrier_variable_execution_scope.spvasm index 90f899025..52866ed7c 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_control_barrier_variable_execution_scope.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_control_barrier_variable_execution_scope.spvasm @@ -22,6 +22,7 @@ OpMemoryModel Physical64 OpenCL OpEntryPoint Kernel %main "main" OpName %main "main" + OpName %execution_scope "execution_scope" %void_ty = OpTypeVoid %uint_ty = OpTypeInt 32 0 @@ -30,8 +31,6 @@ %semantics = OpConstant %uint_ty 264 %memory_scope = OpConstant %uint_ty 2 - OpName %execution_scope "execution_scope" - %main = OpFunction %void_ty DontInline %fcn_ty %execution_scope = OpFunctionParameter %uint_ty %bb = OpLabel diff --git a/modules/compiler/spirv-ll/test/spvasm/op_control_barrier_variable_memory_scope.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_control_barrier_variable_memory_scope.spvasm index c5b5fa79b..fb6ab7ef2 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_control_barrier_variable_memory_scope.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_control_barrier_variable_memory_scope.spvasm @@ -22,6 +22,7 @@ OpMemoryModel Physical64 OpenCL OpEntryPoint Kernel %main "main" OpName %main "main" + OpName %memory_scope "memory_scope" %void_ty = OpTypeVoid %uint_ty = OpTypeInt 32 0 @@ -30,8 +31,6 @@ %semantics = OpConstant %uint_ty 264 %execution_scope = OpConstant %uint_ty 2 - OpName %memory_scope "memory_scope" - %main = OpFunction %void_ty DontInline %fcn_ty %memory_scope = OpFunctionParameter %uint_ty %bb = OpLabel diff --git a/modules/compiler/spirv-ll/test/spvasm/op_group_all.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_group_all.spvasm index 1efccd852..4f8f3650b 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_group_all.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_group_all.spvasm @@ -28,6 +28,10 @@ OpEntryPoint Kernel %work_group_all_fcn "work_group_all" OpEntryPoint Kernel %variable_scope_all_fcn "variable_scope_all" + OpName %sub_group_all_in "a" + OpName %work_group_all_in "a" + OpName %variable_scope_all_in "a" + %uint_ty = OpTypeInt 32 0 %bool_ty = OpTypeBool %ptr_CrossWorkgroup_bool_ty = OpTypePointer CrossWorkgroup %bool_ty @@ -38,9 +42,6 @@ %work_group_scope = OpConstant %uint_ty 2 %sub_group_scope = OpConstant %uint_ty 3 - OpName %sub_group_all_in "a" - OpName %work_group_all_in "a" - OpName %variable_scope_all_in "a" ; CHECK: define spir_kernel void @sub_group_all(ptr addrspace(1) [[IN:%[a-zA-Z0-9_]+]]) %sub_group_all_fcn = OpFunction %void_ty None %fcn_ty diff --git a/modules/compiler/spirv-ll/test/spvasm/op_group_any.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_group_any.spvasm index 162d3a459..90325c776 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_group_any.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_group_any.spvasm @@ -28,6 +28,10 @@ OpEntryPoint Kernel %work_group_any_fcn "work_group_any" OpEntryPoint Kernel %variable_scope_any_fcn "variable_scope_any" + OpName %sub_group_any_in "a" + OpName %work_group_any_in "a" + OpName %variable_scope_any_in "a" + %uint_ty = OpTypeInt 32 0 %bool_ty = OpTypeBool %ptr_CrossWorkgroup_bool_ty = OpTypePointer CrossWorkgroup %bool_ty @@ -38,10 +42,6 @@ %work_group_scope = OpConstant %uint_ty 2 %sub_group_scope = OpConstant %uint_ty 3 - OpName %sub_group_any_in "a" - OpName %work_group_any_in "a" - OpName %variable_scope_any_in "a" - ; CHECK: define spir_kernel void @sub_group_any(ptr addrspace(1) [[IN:%[a-zA-Z0-9_]+]]) %sub_group_any_fcn = OpFunction %void_ty None %fcn_ty %sub_group_any_in = OpFunctionParameter %ptr_CrossWorkgroup_bool_ty diff --git a/modules/compiler/spirv-ll/test/spvasm/op_group_broadcast.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_group_broadcast.spvasm index 888e35593..4b6460c38 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_group_broadcast.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_group_broadcast.spvasm @@ -31,6 +31,12 @@ OpEntryPoint Kernel %float_broadcast_fcn "float_broadcast" OpEntryPoint Kernel %bool_broadcast_fcn "bool_broadcast" + OpName %sub_group_uint_broadcast_in "a" + OpName %work_group_uint_broadcast_in "a" + OpName %int_broadcast_in "a" + OpName %float_broadcast_in "a" + OpName %bool_broadcast_in "a" + %uint_ty = OpTypeInt 32 0 %float_ty = OpTypeFloat 32 %bool_ty = OpTypeBool @@ -48,12 +54,6 @@ %work_group_scope = OpConstant %uint_ty 2 %zero = OpConstant %uint_ty 0 - OpName %sub_group_uint_broadcast_in "a" - OpName %work_group_uint_broadcast_in "a" - OpName %int_broadcast_in "a" - OpName %float_broadcast_in "a" - OpName %bool_broadcast_in "a" - ; CHCK-LABEL: sub_group_uint_broadcast ; CHECK: define spir_kernel void @sub_group_uint_broadcast(ptr addrspace(1) [[IN:%[a-zA-Z0-9_]+]]) %sub_group_uint_broadcast_fcn = OpFunction %void_ty None %uint_fcn_ty diff --git a/modules/compiler/spirv-ll/test/spvasm/op_group_broadcast_2D.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_group_broadcast_2D.spvasm index abf078e21..7f761f5f6 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_group_broadcast_2D.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_group_broadcast_2D.spvasm @@ -24,16 +24,15 @@ OpMemoryModel Physical64 OpenCL + OpName %broadcast_val "val" + OpName %broadcast_fcn "broadcast" + OpName %xy "xy" %uint_ty = OpTypeInt 32 0 %uint2_ty = OpTypeVector %uint_ty 2 %fcn_ty = OpTypeFunction %uint_ty %uint_ty %uint2_ty %work_group_scope = OpConstant %uint_ty 2 - OpName %broadcast_val "val" - OpName %broadcast_fcn "broadcast" - OpName %xy "xy" - ; CHECK: define private spir_func i32 @broadcast(i32 [[VAL:%.*]], <2 x i32> [[XY:%.*]]) ; CHECK: [[X:%.*]] = extractelement <2 x i32> [[XY]], i64 0 ; CHECK: [[Y:%.*]] = extractelement <2 x i32> [[XY]], i64 1 diff --git a/modules/compiler/spirv-ll/test/spvasm/op_group_broadcast_3D.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_group_broadcast_3D.spvasm index 4e4a55c2e..8c58088f7 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_group_broadcast_3D.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_group_broadcast_3D.spvasm @@ -24,16 +24,15 @@ OpMemoryModel Physical64 OpenCL + OpName %broadcast_val "val" + OpName %broadcast_fcn "broadcast" + OpName %xyz "xyz" %uint_ty = OpTypeInt 32 0 %uint3_ty = OpTypeVector %uint_ty 3 %fcn_ty = OpTypeFunction %uint_ty %uint_ty %uint3_ty %work_group_scope = OpConstant %uint_ty 2 - OpName %broadcast_val "val" - OpName %broadcast_fcn "broadcast" - OpName %xyz "xyz" - ; CHECK: define private spir_func i32 @broadcast(i32 [[VAL:%.*]], <3 x i32> [[XYZ:%.*]]) ; CHECK: [[X:%.*]] = extractelement <3 x i32> [[XYZ]], i64 0 ; CHECK: [[Y:%.*]] = extractelement <3 x i32> [[XYZ]], i64 1 diff --git a/modules/compiler/spirv-ll/test/spvasm/op_group_f_add.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_group_f_add.spvasm index 2dd00f0c5..41acf4b0e 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_group_f_add.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_group_f_add.spvasm @@ -28,6 +28,10 @@ OpEntryPoint Kernel %sub_group_scan_inc_fcn "sub_group_scan_inclusive" OpEntryPoint Kernel %sub_group_scan_exc_fcn "sub_group_scan_exclusive" + OpName %sub_group_reduction_in "a" + OpName %sub_group_scan_inc_in "a" + OpName %sub_group_scan_exc_in "a" + %float_ty = OpTypeFloat 32 %uint_ty = OpTypeInt 32 0 %ptr_CrossWorkgroup_float_ty = OpTypePointer CrossWorkgroup %float_ty @@ -36,10 +40,6 @@ %sub_group_scope = OpConstant %uint_ty 3 - OpName %sub_group_reduction_in "a" - OpName %sub_group_scan_inc_in "a" - OpName %sub_group_scan_exc_in "a" - ; CHECK: define spir_kernel void @sub_group_reduction(ptr addrspace(1) [[IN:%[a-zA-Z0-9_]+]]) %sub_group_reduction_fcn = OpFunction %void_ty None %fcn_ty %sub_group_reduction_in = OpFunctionParameter %ptr_CrossWorkgroup_float_ty diff --git a/modules/compiler/spirv-ll/test/spvasm/op_group_f_max.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_group_f_max.spvasm index 14582db7e..97ba226fd 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_group_f_max.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_group_f_max.spvasm @@ -28,6 +28,10 @@ OpEntryPoint Kernel %sub_group_scan_inc_fcn "sub_group_scan_inclusive" OpEntryPoint Kernel %sub_group_scan_exc_fcn "sub_group_scan_exclusive" + OpName %sub_group_reduction_in "a" + OpName %sub_group_scan_inc_in "a" + OpName %sub_group_scan_exc_in "a" + %float_ty = OpTypeFloat 32 %uint_ty = OpTypeInt 32 0 %ptr_CrossWorkgroup_float_ty = OpTypePointer CrossWorkgroup %float_ty @@ -36,10 +40,6 @@ %sub_group_scope = OpConstant %uint_ty 3 - OpName %sub_group_reduction_in "a" - OpName %sub_group_scan_inc_in "a" - OpName %sub_group_scan_exc_in "a" - ; CHECK: define spir_kernel void @sub_group_reduction(ptr addrspace(1) [[IN:%[a-zA-Z0-9_]+]]) %sub_group_reduction_fcn = OpFunction %void_ty None %fcn_ty %sub_group_reduction_in = OpFunctionParameter %ptr_CrossWorkgroup_float_ty diff --git a/modules/compiler/spirv-ll/test/spvasm/op_group_f_min.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_group_f_min.spvasm index 1324f8b6c..0bfe6f610 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_group_f_min.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_group_f_min.spvasm @@ -28,6 +28,10 @@ OpEntryPoint Kernel %sub_group_scan_inc_fcn "sub_group_scan_inclusive" OpEntryPoint Kernel %sub_group_scan_exc_fcn "sub_group_scan_exclusive" + OpName %sub_group_reduction_in "a" + OpName %sub_group_scan_inc_in "a" + OpName %sub_group_scan_exc_in "a" + %float_ty = OpTypeFloat 32 %uint_ty = OpTypeInt 32 0 %ptr_CrossWorkgroup_float_ty = OpTypePointer CrossWorkgroup %float_ty @@ -36,10 +40,6 @@ %sub_group_scope = OpConstant %uint_ty 3 - OpName %sub_group_reduction_in "a" - OpName %sub_group_scan_inc_in "a" - OpName %sub_group_scan_exc_in "a" - ; CHECK: define spir_kernel void @sub_group_reduction(ptr addrspace(1) [[IN:%[a-zA-Z0-9_]+]]) %sub_group_reduction_fcn = OpFunction %void_ty None %fcn_ty %sub_group_reduction_in = OpFunctionParameter %ptr_CrossWorkgroup_float_ty diff --git a/modules/compiler/spirv-ll/test/spvasm/op_group_i_add.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_group_i_add.spvasm index 77355c6dc..a8351029f 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_group_i_add.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_group_i_add.spvasm @@ -30,6 +30,12 @@ OpEntryPoint Kernel %uint_sub_group_scan_inc_fcn "uint_sub_group_scan_inclusive" OpEntryPoint Kernel %uint_sub_group_scan_exc_fcn "uint_sub_group_scan_exclusive" + OpName %uint_sub_group_reduction_in "a" + OpName %uint_work_group_reduction_in "a" + OpName %uint_variable_scope_reduction_in "a" + OpName %uint_sub_group_scan_inc_in "a" + OpName %uint_sub_group_scan_exc_in "a" + %uint_ty = OpTypeInt 32 0 %ptr_CrossWorkgroup_uint_ty = OpTypePointer CrossWorkgroup %uint_ty %void_ty = OpTypeVoid @@ -39,12 +45,6 @@ %sub_group_scope = OpConstant %uint_ty 3 %work_group_scope = OpConstant %uint_ty 2 - OpName %uint_sub_group_reduction_in "a" - OpName %uint_work_group_reduction_in "a" - OpName %uint_variable_scope_reduction_in "a" - OpName %uint_sub_group_scan_inc_in "a" - OpName %uint_sub_group_scan_exc_in "a" - ; CHCK-LABEL: uint_sub_group_reduction ; CHECK: define spir_kernel void @uint_sub_group_reduction(ptr addrspace(1) [[IN:%[a-zA-Z0-9_]+]]) %uint_sub_group_reduction_fcn = OpFunction %void_ty None %uint_fcn_ty diff --git a/modules/compiler/spirv-ll/test/spvasm/op_group_s_max.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_group_s_max.spvasm index ad730e0e0..3ad82d58c 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_group_s_max.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_group_s_max.spvasm @@ -28,6 +28,10 @@ OpEntryPoint Kernel %sub_group_scan_inc_fcn "sub_group_scan_inclusive" OpEntryPoint Kernel %sub_group_scan_exc_fcn "sub_group_scan_exclusive" + OpName %sub_group_reduction_in "a" + OpName %sub_group_scan_inc_in "a" + OpName %sub_group_scan_exc_in "a" + %uint_ty = OpTypeInt 32 0 %ptr_CrossWorkgroup_int_ty = OpTypePointer CrossWorkgroup %uint_ty %void_ty = OpTypeVoid @@ -35,10 +39,6 @@ %sub_group_scope = OpConstant %uint_ty 3 - OpName %sub_group_reduction_in "a" - OpName %sub_group_scan_inc_in "a" - OpName %sub_group_scan_exc_in "a" - ; CHECK: define spir_kernel void @sub_group_reduction(ptr addrspace(1) [[IN:%[a-zA-Z0-9_]+]]) %sub_group_reduction_fcn = OpFunction %void_ty None %fcn_ty %sub_group_reduction_in = OpFunctionParameter %ptr_CrossWorkgroup_int_ty diff --git a/modules/compiler/spirv-ll/test/spvasm/op_group_s_min.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_group_s_min.spvasm index 440b4c613..5d0525fd6 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_group_s_min.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_group_s_min.spvasm @@ -29,6 +29,10 @@ OpEntryPoint Kernel %sub_group_scan_exc_fcn "sub_group_scan_exclusive" OpEntryPoint Kernel %sub_group_scan_inc_fcn "sub_group_scan_inclusive" + OpName %sub_group_reduction_in "a" + OpName %sub_group_scan_inc_in "a" + OpName %sub_group_scan_exc_in "a" + %uint_ty = OpTypeInt 32 0 %ptr_CrossWorkgroup_int_ty = OpTypePointer CrossWorkgroup %uint_ty %void_ty = OpTypeVoid @@ -36,10 +40,6 @@ %sub_group_scope = OpConstant %uint_ty 3 - OpName %sub_group_reduction_in "a" - OpName %sub_group_scan_inc_in "a" - OpName %sub_group_scan_exc_in "a" - ; CHECK: define spir_kernel void @sub_group_reduction(ptr addrspace(1) [[IN:%[a-zA-Z0-9_]+]]) %sub_group_reduction_fcn = OpFunction %void_ty None %fcn_ty %sub_group_reduction_in = OpFunctionParameter %ptr_CrossWorkgroup_int_ty diff --git a/modules/compiler/spirv-ll/test/spvasm/op_group_u_max.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_group_u_max.spvasm index 5a6e50c4c..a2dc05c8e 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_group_u_max.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_group_u_max.spvasm @@ -28,6 +28,10 @@ OpEntryPoint Kernel %sub_group_scan_inc_fcn "sub_group_scan_inc" OpEntryPoint Kernel %sub_group_scan_exc_fcn "sub_group_scan_exc" + OpName %sub_group_reduction_in "a" + OpName %sub_group_scan_inc_in "a" + OpName %sub_group_scan_exc_in "a" + %uint_ty = OpTypeInt 32 0 %ptr_CrossWorkgroup_uint_ty = OpTypePointer CrossWorkgroup %uint_ty %void_ty = OpTypeVoid @@ -35,10 +39,6 @@ %sub_group_scope = OpConstant %uint_ty 3 - OpName %sub_group_reduction_in "a" - OpName %sub_group_scan_inc_in "a" - OpName %sub_group_scan_exc_in "a" - ; CHECK: define spir_kernel void @sub_group_reduction(ptr addrspace(1) [[IN:%[a-zA-Z0-9_]+]]) %sub_group_reduction_fcn = OpFunction %void_ty None %fcn_ty %sub_group_reduction_in = OpFunctionParameter %ptr_CrossWorkgroup_uint_ty diff --git a/modules/compiler/spirv-ll/test/spvasm/op_group_u_min.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_group_u_min.spvasm index bcfedb9d3..0a1f19321 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_group_u_min.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_group_u_min.spvasm @@ -28,6 +28,10 @@ OpEntryPoint Kernel %sub_group_scan_inc_fcn "sub_group_scan_inclusive" OpEntryPoint Kernel %sub_group_scan_exc_fcn "sub_group_scan_exclusive" + OpName %sub_group_reduction_in "a" + OpName %sub_group_scan_inc_in "a" + OpName %sub_group_scan_exc_in "a" + %uint_ty = OpTypeInt 32 0 %ptr_CrossWorkgroup_uint_ty = OpTypePointer CrossWorkgroup %uint_ty %void_ty = OpTypeVoid @@ -35,10 +39,6 @@ %sub_group_scope = OpConstant %uint_ty 3 - OpName %sub_group_reduction_in "a" - OpName %sub_group_scan_inc_in "a" - OpName %sub_group_scan_exc_in "a" - ; CHECK: define spir_kernel void @sub_group_reduction(ptr addrspace(1) [[IN:%[a-zA-Z0-9_]+]]) %sub_group_reduction_fcn = OpFunction %void_ty None %fcn_ty %sub_group_reduction_in = OpFunctionParameter %ptr_CrossWorkgroup_uint_ty diff --git a/modules/compiler/spirv-ll/test/spvasm/op_group_wrapper_clash.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_group_wrapper_clash.spvasm index a87083748..79d105aef 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_group_wrapper_clash.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_group_wrapper_clash.spvasm @@ -26,6 +26,10 @@ OpEntryPoint Kernel %sub_group_reduction_fcn "sub_group_reduction_fn" + OpName %a "a" + OpName %b "b" + OpName %c "c" + %void_ty = OpTypeVoid %uint_ty = OpTypeInt 32 0 %fp32_ty = OpTypeFloat 32 @@ -35,10 +39,6 @@ %sub_group_scope = OpConstant %uint_ty 3 - OpName %a "a" - OpName %b "b" - OpName %c "c" - ; CHECK: define spir_kernel void @sub_group_reduction_fn(ptr addrspace(1) %a, ptr addrspace(1) %b, ptr addrspace(1) %c) %sub_group_reduction_fcn = OpFunction %void_ty None %fcn_ty %a = OpFunctionParameter %ptr_CrossWorkgroup_uint_ty diff --git a/modules/compiler/spirv-ll/test/spvasm/op_memory_barrier_variable_memory_scope.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_memory_barrier_variable_memory_scope.spvasm index 7f330d72b..415a2a2aa 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_memory_barrier_variable_memory_scope.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_memory_barrier_variable_memory_scope.spvasm @@ -22,6 +22,7 @@ OpMemoryModel Physical64 OpenCL OpEntryPoint Kernel %main "main" OpName %main "main" + OpName %memory_scope "memory_scope" %void_ty = OpTypeVoid %uint_ty = OpTypeInt 32 0 @@ -29,7 +30,6 @@ %semantics = OpConstant %uint_ty 264 - OpName %memory_scope "memory_scope" %main = OpFunction %void_ty DontInline %fcn_ty %memory_scope = OpFunctionParameter %uint_ty From 7eace2f46f8fbab6e7c1713d74ce41dbe92abc61 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 9 Nov 2023 14:53:53 +0000 Subject: [PATCH 06/35] [spirv-ll] Fix test using OpExtension in wrong layout section --- .../test/spvasm/opencl_usm_generic_address_space.spvasm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/compiler/spirv-ll/test/spvasm/opencl_usm_generic_address_space.spvasm b/modules/compiler/spirv-ll/test/spvasm/opencl_usm_generic_address_space.spvasm index d8ddb9c19..7655cc3f5 100644 --- a/modules/compiler/spirv-ll/test/spvasm/opencl_usm_generic_address_space.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/opencl_usm_generic_address_space.spvasm @@ -20,10 +20,10 @@ OpCapability Linkage OpCapability Kernel OpCapability Int64 + OpExtension "SPV_codeplay_usm_generic_storage_class" %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical64 OpenCL OpEntryPoint Kernel %11 "test" %__spirv_BuiltInLocalInvocationId %__spirv_BuiltInGlobalInvocationId - OpExtension "SPV_codeplay_usm_generic_storage_class" OpSource OpenCL_C 102000 OpDecorate %54 Constant %54 = OpDecorationGroup From 9e85a925ed498008a378204108d71ce0b2c7b401 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 9 Nov 2023 14:55:16 +0000 Subject: [PATCH 07/35] [spirv-ll] Fix test using duplicate non-aggregate type definition --- .../spirv-ll/test/spvasm/op_copy_memory_sized_uint.spvasm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/compiler/spirv-ll/test/spvasm/op_copy_memory_sized_uint.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_copy_memory_sized_uint.spvasm index b74c578a0..3ac1b52df 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_copy_memory_sized_uint.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_copy_memory_sized_uint.spvasm @@ -32,11 +32,10 @@ OpName %b "b" %void = OpTypeVoid %3 = OpTypeFunction %void - %size_t = OpTypeInt 32 0 %uint = OpTypeInt 32 0 %ptr_uint = OpTypePointer Function %uint %14 = OpConstant %uint 42 - %15 = OpConstant %size_t 4 + %15 = OpConstant %uint 4 %main = OpFunction %void None %3 ; CHECK: define spir_kernel void @main() %5 = OpLabel From a4d318d641ed9d5d3ee8e46d121aa6a195f40757 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 9 Nov 2023 15:02:48 +0000 Subject: [PATCH 08/35] [spirv-ll] Fix tests using 'Block' without 'Offset' member decoration --- .../spirv-ll/test/spvasm/op_atomic_and_global_signed.spvasm | 1 + .../spirv-ll/test/spvasm/op_atomic_double_add_global.spvasm | 1 + .../spirv-ll/test/spvasm/op_atomic_double_max_global.spvasm | 1 + .../spirv-ll/test/spvasm/op_atomic_double_min_global.spvasm | 1 + .../spirv-ll/test/spvasm/op_atomic_exchange_global_signed.spvasm | 1 + .../spirv-ll/test/spvasm/op_atomic_float_add_global.spvasm | 1 + .../spirv-ll/test/spvasm/op_atomic_float_max_global.spvasm | 1 + .../spirv-ll/test/spvasm/op_atomic_float_min_global.spvasm | 1 + .../spirv-ll/test/spvasm/op_atomic_i_add_global_signed.spvasm | 1 + .../spirv-ll/test/spvasm/op_atomic_i_sub_global_signed.spvasm | 1 + .../spirv-ll/test/spvasm/op_atomic_or_global_signed.spvasm | 1 + .../compiler/spirv-ll/test/spvasm/op_atomic_s_max_global.spvasm | 1 + .../compiler/spirv-ll/test/spvasm/op_atomic_s_min_global.spvasm | 1 + .../spirv-ll/test/spvasm/op_atomic_xor_global_signed.spvasm | 1 + 14 files changed, 14 insertions(+) diff --git a/modules/compiler/spirv-ll/test/spvasm/op_atomic_and_global_signed.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_atomic_and_global_signed.spvasm index 718b049ad..2a596a3fe 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_atomic_and_global_signed.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_atomic_and_global_signed.spvasm @@ -24,6 +24,7 @@ OpName %atomic "atomic" OpName %a "a" OpDecorate %block_t Block + OpMemberDecorate %block_t 0 Offset 0 OpDecorate %block_var DescriptorSet 0 OpDecorate %block_var Binding 0 %void = OpTypeVoid diff --git a/modules/compiler/spirv-ll/test/spvasm/op_atomic_double_add_global.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_atomic_double_add_global.spvasm index 1cc63eb31..c9887dd2e 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_atomic_double_add_global.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_atomic_double_add_global.spvasm @@ -27,6 +27,7 @@ OpName %atomic "atomic" OpName %a "a" OpDecorate %block_t Block + OpMemberDecorate %block_t 0 Offset 0 OpDecorate %block_var DescriptorSet 0 OpDecorate %block_var Binding 0 %void = OpTypeVoid diff --git a/modules/compiler/spirv-ll/test/spvasm/op_atomic_double_max_global.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_atomic_double_max_global.spvasm index b11e2f50a..46ea3bf07 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_atomic_double_max_global.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_atomic_double_max_global.spvasm @@ -27,6 +27,7 @@ OpName %atomic "atomic" OpName %a "a" OpDecorate %block_t Block + OpMemberDecorate %block_t 0 Offset 0 OpDecorate %block_var DescriptorSet 0 OpDecorate %block_var Binding 0 %void = OpTypeVoid diff --git a/modules/compiler/spirv-ll/test/spvasm/op_atomic_double_min_global.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_atomic_double_min_global.spvasm index 2fe9116d7..ea3140c69 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_atomic_double_min_global.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_atomic_double_min_global.spvasm @@ -27,6 +27,7 @@ OpName %atomic "atomic" OpName %a "a" OpDecorate %block_t Block + OpMemberDecorate %block_t 0 Offset 0 OpDecorate %block_var DescriptorSet 0 OpDecorate %block_var Binding 0 %void = OpTypeVoid diff --git a/modules/compiler/spirv-ll/test/spvasm/op_atomic_exchange_global_signed.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_atomic_exchange_global_signed.spvasm index cf6927a5d..b46806138 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_atomic_exchange_global_signed.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_atomic_exchange_global_signed.spvasm @@ -24,6 +24,7 @@ OpName %atomic "atomic" OpName %a "a" OpDecorate %block_t Block + OpMemberDecorate %block_t 0 Offset 0 OpDecorate %block_var DescriptorSet 0 OpDecorate %block_var Binding 0 %void = OpTypeVoid diff --git a/modules/compiler/spirv-ll/test/spvasm/op_atomic_float_add_global.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_atomic_float_add_global.spvasm index dd4b9549d..886555162 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_atomic_float_add_global.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_atomic_float_add_global.spvasm @@ -26,6 +26,7 @@ OpName %atomic "atomic" OpName %a "a" OpDecorate %block_t Block + OpMemberDecorate %block_t 0 Offset 0 OpDecorate %block_var DescriptorSet 0 OpDecorate %block_var Binding 0 %void = OpTypeVoid diff --git a/modules/compiler/spirv-ll/test/spvasm/op_atomic_float_max_global.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_atomic_float_max_global.spvasm index 7324dea52..4a7090733 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_atomic_float_max_global.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_atomic_float_max_global.spvasm @@ -26,6 +26,7 @@ OpName %atomic "atomic" OpName %a "a" OpDecorate %block_t Block + OpMemberDecorate %block_t 0 Offset 0 OpDecorate %block_var DescriptorSet 0 OpDecorate %block_var Binding 0 %void = OpTypeVoid diff --git a/modules/compiler/spirv-ll/test/spvasm/op_atomic_float_min_global.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_atomic_float_min_global.spvasm index fd976d8fd..8b12bc048 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_atomic_float_min_global.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_atomic_float_min_global.spvasm @@ -26,6 +26,7 @@ OpName %atomic "atomic" OpName %a "a" OpDecorate %block_t Block + OpMemberDecorate %block_t 0 Offset 0 OpDecorate %block_var DescriptorSet 0 OpDecorate %block_var Binding 0 %void = OpTypeVoid diff --git a/modules/compiler/spirv-ll/test/spvasm/op_atomic_i_add_global_signed.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_atomic_i_add_global_signed.spvasm index fb467be6a..f360999e1 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_atomic_i_add_global_signed.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_atomic_i_add_global_signed.spvasm @@ -24,6 +24,7 @@ OpName %atomic "atomic" OpName %a "a" OpDecorate %block_t Block + OpMemberDecorate %block_t 0 Offset 0 OpDecorate %block_var DescriptorSet 0 OpDecorate %block_var Binding 0 %void = OpTypeVoid diff --git a/modules/compiler/spirv-ll/test/spvasm/op_atomic_i_sub_global_signed.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_atomic_i_sub_global_signed.spvasm index 9072de004..4c78a31af 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_atomic_i_sub_global_signed.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_atomic_i_sub_global_signed.spvasm @@ -24,6 +24,7 @@ OpName %atomic "atomic" OpName %a "a" OpDecorate %block_t Block + OpMemberDecorate %block_t 0 Offset 0 OpDecorate %block_var DescriptorSet 0 OpDecorate %block_var Binding 0 %void = OpTypeVoid diff --git a/modules/compiler/spirv-ll/test/spvasm/op_atomic_or_global_signed.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_atomic_or_global_signed.spvasm index 2c5f0350e..a2307299f 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_atomic_or_global_signed.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_atomic_or_global_signed.spvasm @@ -24,6 +24,7 @@ OpName %atomic "atomic" OpName %a "a" OpDecorate %block_t Block + OpMemberDecorate %block_t 0 Offset 0 OpDecorate %block_var DescriptorSet 0 OpDecorate %block_var Binding 0 %void = OpTypeVoid diff --git a/modules/compiler/spirv-ll/test/spvasm/op_atomic_s_max_global.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_atomic_s_max_global.spvasm index 1d053297d..04fe8f434 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_atomic_s_max_global.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_atomic_s_max_global.spvasm @@ -24,6 +24,7 @@ OpName %atomic "atomic" OpName %a "a" OpDecorate %block_t Block + OpMemberDecorate %block_t 0 Offset 0 OpDecorate %block_var DescriptorSet 0 OpDecorate %block_var Binding 0 %void = OpTypeVoid diff --git a/modules/compiler/spirv-ll/test/spvasm/op_atomic_s_min_global.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_atomic_s_min_global.spvasm index 06d881159..5a9facb85 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_atomic_s_min_global.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_atomic_s_min_global.spvasm @@ -24,6 +24,7 @@ OpName %atomic "atomic" OpName %a "a" OpDecorate %block_t Block + OpMemberDecorate %block_t 0 Offset 0 OpDecorate %block_var DescriptorSet 0 OpDecorate %block_var Binding 0 %void = OpTypeVoid diff --git a/modules/compiler/spirv-ll/test/spvasm/op_atomic_xor_global_signed.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_atomic_xor_global_signed.spvasm index 4629e32f9..db8424e54 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_atomic_xor_global_signed.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_atomic_xor_global_signed.spvasm @@ -24,6 +24,7 @@ OpName %atomic "atomic" OpName %a "a" OpDecorate %block_t Block + OpMemberDecorate %block_t 0 Offset 0 OpDecorate %block_var DescriptorSet 0 OpDecorate %block_var Binding 0 %void = OpTypeVoid From 2de22f746c560cd5c0699abd5f6c0631e27f126a Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 9 Nov 2023 15:09:47 +0000 Subject: [PATCH 09/35] [spirv-ll] Fix tests missing OpMemoryModel opcodes --- .../spirv-ll/test/spvasm/op_copy_object_constant.spvasm | 4 +++- .../spirv-ll/test/spvasm/op_copy_object_variable.spvasm | 4 +++- .../spirv-ll/test/spvasm/op_type_forward_pointer.spvasm | 5 ++++- .../spirv-ll/test/spvasm/unsupported_capability.spvasm | 3 +++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/modules/compiler/spirv-ll/test/spvasm/op_copy_object_constant.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_copy_object_constant.spvasm index a998bc9ca..dc9c8d76f 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_copy_object_constant.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_copy_object_constant.spvasm @@ -15,9 +15,11 @@ ; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} -; RUN: spirv-ll-tool -a OpenCL %spv_file_s | FileCheck %s +; RUN: spirv-ll-tool -a OpenCL -b 64 %spv_file_s | FileCheck %s ; This is a smoke test to check that OpCopyObject propagates values correctly OpCapability Kernel + OpCapability Addresses + OpMemoryModel Physical64 OpenCL OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" diff --git a/modules/compiler/spirv-ll/test/spvasm/op_copy_object_variable.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_copy_object_variable.spvasm index 189c64212..a9a743b74 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_copy_object_variable.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_copy_object_variable.spvasm @@ -15,11 +15,13 @@ ; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} -; RUN: spirv-ll-tool -a OpenCL %spv_file_s | FileCheck %s +; RUN: spirv-ll-tool -a OpenCL -b 64 %spv_file_s | FileCheck %s ; This tests for a potential bug where copying a pointer object simply makes ; the same pointer available through a new ID, which would make storing to it ; overwrite the original. OpCapability Kernel + OpCapability Addresses + OpMemoryModel Physical64 OpenCL OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" diff --git a/modules/compiler/spirv-ll/test/spvasm/op_type_forward_pointer.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_type_forward_pointer.spvasm index 2edd5a313..578e5fe7f 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_type_forward_pointer.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_type_forward_pointer.spvasm @@ -17,7 +17,10 @@ ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} ; RUN: spirv-ll-tool -a OpenCL -b 64 %spv_file_s | FileCheck %s -OpTypeForwardPointer %a Function + OpCapability Kernel + OpCapability Addresses + OpMemoryModel Physical64 OpenCL + OpTypeForwardPointer %a Function %b = OpTypeVoid %c = OpTypePointer Function %a %a = OpTypePointer Function %b diff --git a/modules/compiler/spirv-ll/test/spvasm/unsupported_capability.spvasm b/modules/compiler/spirv-ll/test/spvasm/unsupported_capability.spvasm index ab96e2df6..ef2317159 100644 --- a/modules/compiler/spirv-ll/test/spvasm/unsupported_capability.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/unsupported_capability.spvasm @@ -19,6 +19,9 @@ ; quite easily. ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} ; RUN: not spirv-ll-tool -a OpenCL -b 64 %spv_file_s 2>&1 | FileCheck %s + OpCapability Kernel + OpCapability Addresses + OpMemoryModel Physical64 OpenCL OpCapability MultiViewport ; CHECK: OpCapability MultiViewport (#57) not supported by device From 2656e492a1251d80419f237ae978b5cd21c524bc Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 9 Nov 2023 15:12:24 +0000 Subject: [PATCH 10/35] [spirv-ll] Fix tests multiply-defining IDs --- .../spirv-ll/test/spvasm/op_function_call_regression.spvasm | 4 ++-- .../compiler/spirv-ll/test/spvasm/op_image_write_1d.spvasm | 5 ++--- .../compiler/spirv-ll/test/spvasm/op_ptr_access_chain.spvasm | 2 -- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/modules/compiler/spirv-ll/test/spvasm/op_function_call_regression.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_function_call_regression.spvasm index ca3a83645..991d765bf 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_function_call_regression.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_function_call_regression.spvasm @@ -70,7 +70,7 @@ %bar = OpFunction %ulong None %bar_fn_ty - %1 = OpFunctionParameter %ulong + %2 = OpFunctionParameter %ulong %entry_5 = OpLabel - OpReturnValue %1 + OpReturnValue %2 OpFunctionEnd diff --git a/modules/compiler/spirv-ll/test/spvasm/op_image_write_1d.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_image_write_1d.spvasm index 13fea4a42..91d0cf375 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_image_write_1d.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_image_write_1d.spvasm @@ -32,9 +32,8 @@ %float_t = OpTypeFloat 32 %float4_t = OpTypeVector %float_t 4 %uint4_t = OpTypeVector %uint_t 4 - %int4_t = OpTypeVector %uint_t 4 %image1d_t = OpTypeImage %void_t 1D 0 0 0 0 Unknown WriteOnly - %test = OpTypeFunction %void_t %image1d_t + %testfnty = OpTypeFunction %void_t %image1d_t %float_1 = OpConstant %float_t 1 %uint_1 = OpConstant %uint_t 1 %int_1 = OpConstant %uint_t 1 @@ -43,7 +42,7 @@ %uint4_color = OpConstantComposite %uint4_t %uint_1 %uint_1 %uint_1 %uint_1 ; All functions - %test = OpFunction %void_t None %test + %test = OpFunction %void_t None %testfnty %image = OpFunctionParameter %image1d_t ; CHECK-GE17: define spir_kernel void @test([[TY:target\("spirv.Image", void, 0, 0, 0, 0, 0, 0, 0\)]] %image) ; CHECK-LT17: define spir_kernel void @test([[TY:ptr addrspace\(1\)]] %image) diff --git a/modules/compiler/spirv-ll/test/spvasm/op_ptr_access_chain.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_ptr_access_chain.spvasm index e87ba12d6..f24dcd00e 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_ptr_access_chain.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_ptr_access_chain.spvasm @@ -25,7 +25,6 @@ %void = OpTypeVoid %ulong = OpTypeInt 64 0 - %_ptr_Generic_ulong = OpTypePointer Generic %ulong %ulong_0 = OpConstant %ulong 0 %ulong_3 = OpConstant %ulong 3 @@ -33,7 +32,6 @@ %uchar = OpTypeInt 8 0 %uint = OpTypeInt 32 0 %_ptr_uint = OpTypePointer CrossWorkgroup %uint - %ulong_3 = OpConstant %ulong 3 %struct_user_struct = OpTypeStruct %float %uint %uchar %_ptr_uint %_ptr_CrossWorkgroup_struct_user_struct = OpTypePointer CrossWorkgroup %struct_user_struct From ac3d50f76d02cc4a6c54026517b48be33edd0568 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 9 Nov 2023 15:26:17 +0000 Subject: [PATCH 11/35] [spirv-ll] Fix tests not defining forward references --- .../test/spvasm/invalid_storage_class.spvasm | 1 - .../test/spvasm/op_group_broadcast.spvasm | 20 ------------------- .../test/spvasm/op_group_i_add.spvasm | 2 -- .../test/spvasm/op_group_s_min.spvasm | 1 - ..._opencl_get_enqueued_num_sub_groups.spvasm | 2 +- .../op_opencl_get_max_sub_group_size.spvasm | 2 +- .../op_opencl_get_num_sub_groups.spvasm | 2 +- .../spvasm/op_opencl_ldexp_v2float.spvasm | 1 - .../op_opencl_lgamma_r_global_float.spvasm | 2 -- .../test/spvasm/op_opencl_memset.spvasm | 2 -- .../spvasm/op_opencl_memset_gotcha.spvasm | 2 -- .../op_opencl_remquo_global_float.spvasm | 2 -- .../test/spvasm/op_opencl_rootn_float.spvasm | 1 - .../op_opencl_vloada_halfn_32bit.spvasm | 2 -- .../op_opencl_vloada_halfn_64bit.spvasm | 2 -- ...pec_constant_op_fmod_multi_function.spvasm | 1 - 16 files changed, 3 insertions(+), 42 deletions(-) diff --git a/modules/compiler/spirv-ll/test/spvasm/invalid_storage_class.spvasm b/modules/compiler/spirv-ll/test/spvasm/invalid_storage_class.spvasm index 1a2fe4cc5..ce9d1c8af 100644 --- a/modules/compiler/spirv-ll/test/spvasm/invalid_storage_class.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/invalid_storage_class.spvasm @@ -29,7 +29,6 @@ OpCapability Int8 %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical64 OpenCL - OpEntryPoint Kernel %54 "_ZTSZN24kernel_bundle_spec_constL22CATCH2_INTERNAL_TEST_4EvE13simple_kernel" OpSource OpenCL_CPP 100000 %uint = OpTypeInt 32 0 %_ptr_Function_uint = OpTypePointer Function %uint diff --git a/modules/compiler/spirv-ll/test/spvasm/op_group_broadcast.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_group_broadcast.spvasm index 4b6460c38..e0506737f 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_group_broadcast.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_group_broadcast.spvasm @@ -27,13 +27,9 @@ OpEntryPoint Kernel %sub_group_uint_broadcast_fcn "sub_group_uint_broadcast" OpEntryPoint Kernel %work_group_uint_broadcast_fcn "work_group_uint_broadcast" OpEntryPoint Kernel %variable_scope_uint_broadcast_fcn "variable_scope_uint_broadcast" - OpEntryPoint Kernel %int_broadcast_fcn "int_broadcast" OpEntryPoint Kernel %float_broadcast_fcn "float_broadcast" OpEntryPoint Kernel %bool_broadcast_fcn "bool_broadcast" - OpName %sub_group_uint_broadcast_in "a" - OpName %work_group_uint_broadcast_in "a" - OpName %int_broadcast_in "a" OpName %float_broadcast_in "a" OpName %bool_broadcast_in "a" @@ -46,7 +42,6 @@ %void_ty = OpTypeVoid %uint_fcn_ty = OpTypeFunction %void_ty %ptr_CrossWorkgroup_uint_ty %uint_uint_fcn_ty = OpTypeFunction %void_ty %ptr_CrossWorkgroup_uint_ty %uint_ty - %int_fcn_ty = OpTypeFunction %void_ty %ptr_CrossWorkgroup_uint_ty %float_fcn_ty = OpTypeFunction %void_ty %ptr_CrossWorkgroup_float_ty %bool_fcn_ty = OpTypeFunction %void_ty %ptr_CrossWorkgroup_bool_ty @@ -100,21 +95,6 @@ OpReturn OpFunctionEnd -; CHCK-LABEL: int_broadcast -; CHECK: define spir_kernel void @int_broadcast(ptr addrspace(1) [[IN:%[a-zA-Z0-9_]+]]) - %int_broadcast_fcn = OpFunction %void_ty None %int_fcn_ty - %int_broadcast_in = OpFunctionParameter %ptr_CrossWorkgroup_uint_ty - %int_broadcast_bb = OpLabel -; CHECK: [[VAL:%[a-zA-Z0-9_]+]] = load i32, ptr addrspace(1) [[IN]], align 4 - %int_broadcast_val = OpLoad %uint_ty %int_broadcast_in Aligned 4 -; CHECK: [[RES:%[a-zA-Z0-9]+]] = call spir_func i32 @_Z19sub_group_broadcastjj(i32 [[VAL]], i32 0) - %int_broadcast_res = OpGroupBroadcast %uint_ty %sub_group_scope %int_broadcast_val %zero -; CHECK: store i32 [[RES]], ptr addrspace(1) [[IN]] - OpStore %int_broadcast_in %int_broadcast_res Aligned 4 -; CHECK: ret void - OpReturn - OpFunctionEnd - ; CHCK-LABEL: float_broadcast ; CHECK: define spir_kernel void @float_broadcast(ptr addrspace(1) [[IN:%[a-zA-Z0-9_]+]]) %float_broadcast_fcn = OpFunction %void_ty None %float_fcn_ty diff --git a/modules/compiler/spirv-ll/test/spvasm/op_group_i_add.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_group_i_add.spvasm index a8351029f..072bd9bf8 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_group_i_add.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_group_i_add.spvasm @@ -28,13 +28,11 @@ OpEntryPoint Kernel %uint_work_group_reduction_fcn "uint_work_group_reduction" OpEntryPoint Kernel %uint_variable_scope_reduction_fcn "uint_variable_scope_reduction" OpEntryPoint Kernel %uint_sub_group_scan_inc_fcn "uint_sub_group_scan_inclusive" - OpEntryPoint Kernel %uint_sub_group_scan_exc_fcn "uint_sub_group_scan_exclusive" OpName %uint_sub_group_reduction_in "a" OpName %uint_work_group_reduction_in "a" OpName %uint_variable_scope_reduction_in "a" OpName %uint_sub_group_scan_inc_in "a" - OpName %uint_sub_group_scan_exc_in "a" %uint_ty = OpTypeInt 32 0 %ptr_CrossWorkgroup_uint_ty = OpTypePointer CrossWorkgroup %uint_ty diff --git a/modules/compiler/spirv-ll/test/spvasm/op_group_s_min.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_group_s_min.spvasm index 5d0525fd6..e6db103e5 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_group_s_min.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_group_s_min.spvasm @@ -24,7 +24,6 @@ OpMemoryModel Physical64 OpenCL - OpEntryPoint Kernel %sub_group_reduction_fcn "sub_group_reduction" OpEntryPoint Kernel %sub_group_reduction_fcn "sub_group_reduction" OpEntryPoint Kernel %sub_group_scan_exc_fcn "sub_group_scan_exclusive" OpEntryPoint Kernel %sub_group_scan_inc_fcn "sub_group_scan_inclusive" diff --git a/modules/compiler/spirv-ll/test/spvasm/op_opencl_get_enqueued_num_sub_groups.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_opencl_get_enqueued_num_sub_groups.spvasm index a7d70067d..97302a067 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_opencl_get_enqueued_num_sub_groups.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_opencl_get_enqueued_num_sub_groups.spvasm @@ -21,7 +21,7 @@ OpCapability Int64 %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical64 OpenCL - OpEntryPoint Kernel %get_enqueued_num_sub_groups_fn "get_enqueued_num_sub_groups_fn" %__spirv_BuiltInSubgroupID + OpEntryPoint Kernel %get_enqueued_num_sub_groups_fn "get_enqueued_num_sub_groups_fn" %__spirv_BuiltInBuiltInNumEnqueuedSubgroups OpDecorate %__spirv_BuiltInBuiltInNumEnqueuedSubgroups BuiltIn NumEnqueuedSubgroups %size_t = OpTypeInt 64 0 %size_ptr_t = OpTypePointer Input %size_t diff --git a/modules/compiler/spirv-ll/test/spvasm/op_opencl_get_max_sub_group_size.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_opencl_get_max_sub_group_size.spvasm index cc73f1378..2e50ea97b 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_opencl_get_max_sub_group_size.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_opencl_get_max_sub_group_size.spvasm @@ -21,7 +21,7 @@ OpCapability Int64 %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical64 OpenCL - OpEntryPoint Kernel %get_max_sub_group_size_fn "get_max_sub_group_size_fn" %__spirv_BuiltInSubgroupID + OpEntryPoint Kernel %get_max_sub_group_size_fn "get_max_sub_group_size_fn" %__spirv_BuiltInSubgroupMaxSize OpDecorate %__spirv_BuiltInSubgroupMaxSize BuiltIn SubgroupMaxSize %size_t = OpTypeInt 64 0 %size_ptr_t = OpTypePointer Input %size_t diff --git a/modules/compiler/spirv-ll/test/spvasm/op_opencl_get_num_sub_groups.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_opencl_get_num_sub_groups.spvasm index 29d35c555..fdbff5476 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_opencl_get_num_sub_groups.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_opencl_get_num_sub_groups.spvasm @@ -21,7 +21,7 @@ OpCapability Int64 %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical64 OpenCL - OpEntryPoint Kernel %get_num_sub_groups_fn "get_num_sub_groups_fn" %__spirv_BuiltInSubgroupID + OpEntryPoint Kernel %get_num_sub_groups_fn "get_num_sub_groups_fn" %__spirv_BuiltInNumSubgroups OpDecorate %__spirv_BuiltInNumSubgroups BuiltIn NumSubgroups %size_t = OpTypeInt 64 0 %size_ptr_t = OpTypePointer Input %size_t diff --git a/modules/compiler/spirv-ll/test/spvasm/op_opencl_ldexp_v2float.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_opencl_ldexp_v2float.spvasm index be4c97d5c..3d2ba823f 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_opencl_ldexp_v2float.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_opencl_ldexp_v2float.spvasm @@ -20,7 +20,6 @@ OpCapability Addresses %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical64 OpenCL - OpEntryPoint Kernel %ldexp_v2float "ldexp_v2float" OpEntryPoint Kernel %ldexp_v2float_uint "ldexp_v2float_uint" OpSource OpenCL_C 102000 diff --git a/modules/compiler/spirv-ll/test/spvasm/op_opencl_lgamma_r_global_float.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_opencl_lgamma_r_global_float.spvasm index 9bdddd38d..a7d27d402 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_opencl_lgamma_r_global_float.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_opencl_lgamma_r_global_float.spvasm @@ -20,10 +20,8 @@ OpCapability Addresses %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical64 OpenCL - OpEntryPoint Kernel %lgamma_r_float "lgamma_r_float" OpEntryPoint Kernel %lgamma_r_float_uint "lgamma_r_float_uint" OpSource OpenCL_C 102000 - OpName %in_signp "in_signp" OpName %in_signp_uint "in_signp" ; All types, variables and constants diff --git a/modules/compiler/spirv-ll/test/spvasm/op_opencl_memset.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_opencl_memset.spvasm index 1d9c896ad..235bd8e39 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_opencl_memset.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_opencl_memset.spvasm @@ -27,8 +27,6 @@ OpName %out "out" OpName %entry "entry" OpDecorate %24 Constant - OpDecorate %size_addr Alignment 4 - OpDecorate %out_addr Alignment 8 %uint = OpTypeInt 32 0 %ulong = OpTypeInt 64 0 %uchar = OpTypeInt 8 0 diff --git a/modules/compiler/spirv-ll/test/spvasm/op_opencl_memset_gotcha.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_opencl_memset_gotcha.spvasm index a0f7e5a6f..4760a134a 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_opencl_memset_gotcha.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_opencl_memset_gotcha.spvasm @@ -31,8 +31,6 @@ OpName %out "out" OpName %entry "entry" OpDecorate %24 Constant - OpDecorate %size_addr Alignment 4 - OpDecorate %out_addr Alignment 8 %uint = OpTypeInt 32 0 %ulong = OpTypeInt 64 0 %uchar = OpTypeInt 8 0 diff --git a/modules/compiler/spirv-ll/test/spvasm/op_opencl_remquo_global_float.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_opencl_remquo_global_float.spvasm index 09aca0458..c76b04218 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_opencl_remquo_global_float.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_opencl_remquo_global_float.spvasm @@ -20,10 +20,8 @@ OpCapability Addresses %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical64 OpenCL - OpEntryPoint Kernel %remquo_float "remquo_float" OpEntryPoint Kernel %remquo_float_uint "remquo_float_uint" OpSource OpenCL_C 102000 - OpName %in_quo "in_quo" OpName %in_quo_uint "in_quo" ; All types, variables and constants diff --git a/modules/compiler/spirv-ll/test/spvasm/op_opencl_rootn_float.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_opencl_rootn_float.spvasm index a1771e686..7a37a9420 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_opencl_rootn_float.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_opencl_rootn_float.spvasm @@ -20,7 +20,6 @@ OpCapability Addresses %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical64 OpenCL - OpEntryPoint Kernel %rootn_float "rootn_float" OpEntryPoint Kernel %rootn_float_uint "rootn_float_uint" OpSource OpenCL_C 102000 diff --git a/modules/compiler/spirv-ll/test/spvasm/op_opencl_vloada_halfn_32bit.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_opencl_vloada_halfn_32bit.spvasm index fd1108037..3055b09da 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_opencl_vloada_halfn_32bit.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_opencl_vloada_halfn_32bit.spvasm @@ -27,13 +27,11 @@ OpName %out "out" OpName %loc "loc" OpName %entry "entry" - 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" diff --git a/modules/compiler/spirv-ll/test/spvasm/op_opencl_vloada_halfn_64bit.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_opencl_vloada_halfn_64bit.spvasm index 088fda01a..d5791294e 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_opencl_vloada_halfn_64bit.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_opencl_vloada_halfn_64bit.spvasm @@ -28,13 +28,11 @@ OpName %out "out" OpName %loc "loc" OpName %entry "entry" - 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" diff --git a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fmod_multi_function.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fmod_multi_function.spvasm index 86e5fd40c..41cf87f05 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fmod_multi_function.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_op_fmod_multi_function.spvasm @@ -24,7 +24,6 @@ OpEntryPoint Kernel %testfn "testfn" OpSource OpenCL_C 102000 OpName %add "add" - OpName %main "main" OpName %res "res" OpName %test "test" OpName %const "const" From c45d4512e3c7b28e585651e75b5ab7562b4e3ccd Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 9 Nov 2023 15:30:37 +0000 Subject: [PATCH 12/35] [spirv-ll] Fix tests not defining entry points --- .../test/spvasm/op_group_broadcast_2D.spvasm | 13 ++++++++----- .../test/spvasm/op_group_broadcast_3D.spvasm | 13 ++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/modules/compiler/spirv-ll/test/spvasm/op_group_broadcast_2D.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_group_broadcast_2D.spvasm index 7f761f5f6..9cacb5c40 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_group_broadcast_2D.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_group_broadcast_2D.spvasm @@ -24,26 +24,29 @@ OpMemoryModel Physical64 OpenCL + OpEntryPoint Kernel %broadcast_fcn "broadcast" + OpName %broadcast_val "val" OpName %broadcast_fcn "broadcast" OpName %xy "xy" + %void_ty = OpTypeVoid %uint_ty = OpTypeInt 32 0 %uint2_ty = OpTypeVector %uint_ty 2 - %fcn_ty = OpTypeFunction %uint_ty %uint_ty %uint2_ty + %fcn_ty = OpTypeFunction %void_ty %uint_ty %uint2_ty %work_group_scope = OpConstant %uint_ty 2 -; CHECK: define private spir_func i32 @broadcast(i32 [[VAL:%.*]], <2 x i32> [[XY:%.*]]) +; CHECK: define spir_kernel void @broadcast(i32 [[VAL:%.*]], <2 x i32> [[XY:%.*]]) ; CHECK: [[X:%.*]] = extractelement <2 x i32> [[XY]], i64 0 ; CHECK: [[Y:%.*]] = extractelement <2 x i32> [[XY]], i64 1 ; CHECK: [[Xi64:%.*]] = zext i32 [[X]] to i64 ; CHECK: [[Yi64:%.*]] = zext i32 [[Y]] to i64 ; CHECK: [[RES:%.*]] = call spir_func i32 @_Z20work_group_broadcastjmm(i32 [[VAL]], i64 [[Xi64]], i64 [[Yi64]]) -; CHECK: ret i32 [[RES]] -%broadcast_fcn = OpFunction %uint_ty None %fcn_ty +; CHECK: ret void +%broadcast_fcn = OpFunction %void_ty None %fcn_ty %broadcast_val = OpFunctionParameter %uint_ty %xy = OpFunctionParameter %uint2_ty %broadcast_bb = OpLabel %broadcast_res = OpGroupBroadcast %uint_ty %work_group_scope %broadcast_val %xy - OpReturnValue %broadcast_res + OpReturn OpFunctionEnd diff --git a/modules/compiler/spirv-ll/test/spvasm/op_group_broadcast_3D.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_group_broadcast_3D.spvasm index 8c58088f7..ddfea0943 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_group_broadcast_3D.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_group_broadcast_3D.spvasm @@ -24,16 +24,19 @@ OpMemoryModel Physical64 OpenCL + OpEntryPoint Kernel %broadcast_fcn "broadcast" + OpName %broadcast_val "val" OpName %broadcast_fcn "broadcast" OpName %xyz "xyz" + %void_ty = OpTypeVoid %uint_ty = OpTypeInt 32 0 %uint3_ty = OpTypeVector %uint_ty 3 - %fcn_ty = OpTypeFunction %uint_ty %uint_ty %uint3_ty + %fcn_ty = OpTypeFunction %void_ty %uint_ty %uint3_ty %work_group_scope = OpConstant %uint_ty 2 -; CHECK: define private spir_func i32 @broadcast(i32 [[VAL:%.*]], <3 x i32> [[XYZ:%.*]]) +; CHECK: define spir_kernel void @broadcast(i32 [[VAL:%.*]], <3 x i32> [[XYZ:%.*]]) ; CHECK: [[X:%.*]] = extractelement <3 x i32> [[XYZ]], i64 0 ; CHECK: [[Y:%.*]] = extractelement <3 x i32> [[XYZ]], i64 1 ; CHECK: [[Z:%.*]] = extractelement <3 x i32> [[XYZ]], i64 2 @@ -41,11 +44,11 @@ ; CHECK: [[Yi64:%.*]] = zext i32 [[Y]] to i64 ; CHECK: [[Zi64:%.*]] = zext i32 [[Z]] to i64 ; CHECK: [[RES:%.*]] = call spir_func i32 @_Z20work_group_broadcastjmmm(i32 [[VAL]], i64 [[Xi64]], i64 [[Yi64]], i64 [[Zi64]]) -; CHECK: ret i32 [[RES]] -%broadcast_fcn = OpFunction %uint_ty None %fcn_ty +; CHECK: ret void +%broadcast_fcn = OpFunction %void_ty None %fcn_ty %broadcast_val = OpFunctionParameter %uint_ty %xyz = OpFunctionParameter %uint3_ty %broadcast_bb = OpLabel %broadcast_res = OpGroupBroadcast %uint_ty %work_group_scope %broadcast_val %xyz - OpReturnValue %broadcast_res + OpReturn OpFunctionEnd From 6d60603fbc8b06052842d6513e813e3fd06aa648 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 9 Nov 2023 15:43:54 +0000 Subject: [PATCH 13/35] [spirv-ll] Fix tests using wrong target of BufferBlock decoration --- .../spirv-ll/test/spvasm/op_glsl_Frexp_double_intPtr.spvasm | 4 ++-- .../spirv-ll/test/spvasm/op_glsl_Frexp_dvec2_ivec2Ptr.spvasm | 4 ++-- .../spirv-ll/test/spvasm/op_glsl_Frexp_dvec3_ivec3Ptr.spvasm | 4 ++-- .../spirv-ll/test/spvasm/op_glsl_Frexp_dvec4_ivec4Ptr.spvasm | 4 ++-- .../spirv-ll/test/spvasm/op_glsl_Frexp_float_intPtr.spvasm | 4 ++-- .../spirv-ll/test/spvasm/op_glsl_Frexp_vec2_ivec2Ptr.spvasm | 4 ++-- .../spirv-ll/test/spvasm/op_glsl_Frexp_vec3_ivec3Ptr.spvasm | 4 ++-- .../spirv-ll/test/spvasm/op_glsl_Frexp_vec4_ivec4Ptr.spvasm | 4 ++-- .../spirv-ll/test/spvasm/op_glsl_Modf_double_doublePtr.spvasm | 4 ++-- .../spirv-ll/test/spvasm/op_glsl_Modf_dvec2_dvec2Ptr.spvasm | 4 ++-- .../spirv-ll/test/spvasm/op_glsl_Modf_dvec3_dvec3Ptr.spvasm | 4 ++-- .../spirv-ll/test/spvasm/op_glsl_Modf_dvec4_dvec4Ptr.spvasm | 4 ++-- .../spirv-ll/test/spvasm/op_glsl_Modf_float_floatPtr.spvasm | 4 ++-- .../spirv-ll/test/spvasm/op_glsl_Modf_vec2_vec2Ptr.spvasm | 4 ++-- .../spirv-ll/test/spvasm/op_glsl_Modf_vec3_vec3Ptr.spvasm | 4 ++-- .../spirv-ll/test/spvasm/op_glsl_Modf_vec4_vec4Ptr.spvasm | 4 ++-- 16 files changed, 32 insertions(+), 32 deletions(-) diff --git a/modules/compiler/spirv-ll/test/spvasm/op_glsl_Frexp_double_intPtr.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_glsl_Frexp_double_intPtr.spvasm index 569e16450..8c5120782 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_glsl_Frexp_double_intPtr.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_glsl_Frexp_double_intPtr.spvasm @@ -33,11 +33,11 @@ OpMemberName %outBuff_t 1 "exponent" OpMemberDecorate %outBuff_t 0 Offset 0 OpMemberDecorate %outBuff_t 1 Offset 8 - OpDecorate %outBuff BufferBlock + OpDecorate %outBuff_t BufferBlock OpDecorate %outBuff DescriptorSet 0 OpDecorate %outBuff Binding 1 OpMemberDecorate %inBuff_t 0 Offset 0 - OpDecorate %inBuff BufferBlock + OpDecorate %inBuff_t BufferBlock OpDecorate %inBuff DescriptorSet 0 OpDecorate %inBuff Binding 0 %void_t = OpTypeVoid diff --git a/modules/compiler/spirv-ll/test/spvasm/op_glsl_Frexp_dvec2_ivec2Ptr.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_glsl_Frexp_dvec2_ivec2Ptr.spvasm index 383227aa6..2f90c9e33 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_glsl_Frexp_dvec2_ivec2Ptr.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_glsl_Frexp_dvec2_ivec2Ptr.spvasm @@ -33,11 +33,11 @@ OpMemberName %outBuff_t 1 "exponent" OpMemberDecorate %outBuff_t 0 Offset 0 OpMemberDecorate %outBuff_t 1 Offset 16 - OpDecorate %outBuff BufferBlock + OpDecorate %outBuff_t BufferBlock OpDecorate %outBuff DescriptorSet 0 OpDecorate %outBuff Binding 1 OpMemberDecorate %inBuff_t 0 Offset 0 - OpDecorate %inBuff BufferBlock + OpDecorate %inBuff_t BufferBlock OpDecorate %inBuff DescriptorSet 0 OpDecorate %inBuff Binding 0 %void_t = OpTypeVoid diff --git a/modules/compiler/spirv-ll/test/spvasm/op_glsl_Frexp_dvec3_ivec3Ptr.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_glsl_Frexp_dvec3_ivec3Ptr.spvasm index 9f25bad38..ec77f6087 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_glsl_Frexp_dvec3_ivec3Ptr.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_glsl_Frexp_dvec3_ivec3Ptr.spvasm @@ -33,11 +33,11 @@ OpMemberName %outBuff_t 1 "exponent" OpMemberDecorate %outBuff_t 0 Offset 0 OpMemberDecorate %outBuff_t 1 Offset 32 - OpDecorate %outBuff BufferBlock + OpDecorate %outBuff_t BufferBlock OpDecorate %outBuff DescriptorSet 0 OpDecorate %outBuff Binding 1 OpMemberDecorate %inBuff_t 0 Offset 0 - OpDecorate %inBuff BufferBlock + OpDecorate %inBuff_t BufferBlock OpDecorate %inBuff DescriptorSet 0 OpDecorate %inBuff Binding 0 %void_t = OpTypeVoid diff --git a/modules/compiler/spirv-ll/test/spvasm/op_glsl_Frexp_dvec4_ivec4Ptr.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_glsl_Frexp_dvec4_ivec4Ptr.spvasm index 7789d8a22..9f5266356 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_glsl_Frexp_dvec4_ivec4Ptr.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_glsl_Frexp_dvec4_ivec4Ptr.spvasm @@ -33,11 +33,11 @@ OpMemberName %outBuff_t 1 "exponent" OpMemberDecorate %outBuff_t 0 Offset 0 OpMemberDecorate %outBuff_t 1 Offset 32 - OpDecorate %outBuff BufferBlock + OpDecorate %outBuff_t BufferBlock OpDecorate %outBuff DescriptorSet 0 OpDecorate %outBuff Binding 1 OpMemberDecorate %inBuff_t 0 Offset 0 - OpDecorate %inBuff BufferBlock + OpDecorate %inBuff_t BufferBlock OpDecorate %inBuff DescriptorSet 0 OpDecorate %inBuff Binding 0 %void_t = OpTypeVoid diff --git a/modules/compiler/spirv-ll/test/spvasm/op_glsl_Frexp_float_intPtr.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_glsl_Frexp_float_intPtr.spvasm index fa83d22b6..1ae5ec622 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_glsl_Frexp_float_intPtr.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_glsl_Frexp_float_intPtr.spvasm @@ -33,11 +33,11 @@ OpMemberName %outBuff_t 1 "exponent" OpMemberDecorate %outBuff_t 0 Offset 0 OpMemberDecorate %outBuff_t 1 Offset 4 - OpDecorate %outBuff BufferBlock + OpDecorate %outBuff_t BufferBlock OpDecorate %outBuff DescriptorSet 0 OpDecorate %outBuff Binding 1 OpMemberDecorate %inBuff_t 0 Offset 0 - OpDecorate %inBuff BufferBlock + OpDecorate %inBuff_t BufferBlock OpDecorate %inBuff DescriptorSet 0 OpDecorate %inBuff Binding 0 %void_t = OpTypeVoid diff --git a/modules/compiler/spirv-ll/test/spvasm/op_glsl_Frexp_vec2_ivec2Ptr.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_glsl_Frexp_vec2_ivec2Ptr.spvasm index d1b4b356e..17f8a2c4b 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_glsl_Frexp_vec2_ivec2Ptr.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_glsl_Frexp_vec2_ivec2Ptr.spvasm @@ -33,11 +33,11 @@ OpMemberName %outBuff_t 1 "exponent" OpMemberDecorate %outBuff_t 0 Offset 0 OpMemberDecorate %outBuff_t 1 Offset 8 - OpDecorate %outBuff BufferBlock + OpDecorate %outBuff_t BufferBlock OpDecorate %outBuff DescriptorSet 0 OpDecorate %outBuff Binding 1 OpMemberDecorate %inBuff_t 0 Offset 0 - OpDecorate %inBuff BufferBlock + OpDecorate %inBuff_t BufferBlock OpDecorate %inBuff DescriptorSet 0 OpDecorate %inBuff Binding 0 %void_t = OpTypeVoid diff --git a/modules/compiler/spirv-ll/test/spvasm/op_glsl_Frexp_vec3_ivec3Ptr.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_glsl_Frexp_vec3_ivec3Ptr.spvasm index 102306d8c..95d372b33 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_glsl_Frexp_vec3_ivec3Ptr.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_glsl_Frexp_vec3_ivec3Ptr.spvasm @@ -33,11 +33,11 @@ OpMemberName %outBuff_t 1 "exponent" OpMemberDecorate %outBuff_t 0 Offset 0 OpMemberDecorate %outBuff_t 1 Offset 16 - OpDecorate %outBuff BufferBlock + OpDecorate %outBuff_t BufferBlock OpDecorate %outBuff DescriptorSet 0 OpDecorate %outBuff Binding 1 OpMemberDecorate %inBuff_t 0 Offset 0 - OpDecorate %inBuff BufferBlock + OpDecorate %inBuff_t BufferBlock OpDecorate %inBuff DescriptorSet 0 OpDecorate %inBuff Binding 0 %void_t = OpTypeVoid diff --git a/modules/compiler/spirv-ll/test/spvasm/op_glsl_Frexp_vec4_ivec4Ptr.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_glsl_Frexp_vec4_ivec4Ptr.spvasm index dd6b3bdcb..4ec102281 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_glsl_Frexp_vec4_ivec4Ptr.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_glsl_Frexp_vec4_ivec4Ptr.spvasm @@ -33,11 +33,11 @@ OpMemberName %outBuff_t 1 "exponent" OpMemberDecorate %outBuff_t 0 Offset 0 OpMemberDecorate %outBuff_t 1 Offset 16 - OpDecorate %outBuff BufferBlock + OpDecorate %outBuff_t BufferBlock OpDecorate %outBuff DescriptorSet 0 OpDecorate %outBuff Binding 1 OpMemberDecorate %inBuff_t 0 Offset 0 - OpDecorate %inBuff BufferBlock + OpDecorate %inBuff_t BufferBlock OpDecorate %inBuff DescriptorSet 0 OpDecorate %inBuff Binding 0 %void_t = OpTypeVoid diff --git a/modules/compiler/spirv-ll/test/spvasm/op_glsl_Modf_double_doublePtr.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_glsl_Modf_double_doublePtr.spvasm index 4c1d478d1..cd8ba704b 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_glsl_Modf_double_doublePtr.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_glsl_Modf_double_doublePtr.spvasm @@ -33,11 +33,11 @@ OpMemberName %outBuff_t 1 "whole" OpMemberDecorate %outBuff_t 0 Offset 0 OpMemberDecorate %outBuff_t 1 Offset 8 - OpDecorate %outBuff BufferBlock + OpDecorate %outBuff_t BufferBlock OpDecorate %outBuff DescriptorSet 0 OpDecorate %outBuff Binding 1 OpMemberDecorate %inBuff_t 0 Offset 0 - OpDecorate %inBuff BufferBlock + OpDecorate %inBuff_t BufferBlock OpDecorate %inBuff DescriptorSet 0 OpDecorate %inBuff Binding 0 %void_t = OpTypeVoid diff --git a/modules/compiler/spirv-ll/test/spvasm/op_glsl_Modf_dvec2_dvec2Ptr.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_glsl_Modf_dvec2_dvec2Ptr.spvasm index 9a184f281..fb07c7817 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_glsl_Modf_dvec2_dvec2Ptr.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_glsl_Modf_dvec2_dvec2Ptr.spvasm @@ -33,11 +33,11 @@ OpMemberName %outBuff_t 1 "whole" OpMemberDecorate %outBuff_t 0 Offset 0 OpMemberDecorate %outBuff_t 1 Offset 16 - OpDecorate %outBuff BufferBlock + OpDecorate %outBuff_t BufferBlock OpDecorate %outBuff DescriptorSet 0 OpDecorate %outBuff Binding 1 OpMemberDecorate %inBuff_t 0 Offset 0 - OpDecorate %inBuff BufferBlock + OpDecorate %inBuff_t BufferBlock OpDecorate %inBuff DescriptorSet 0 OpDecorate %inBuff Binding 0 %void_t = OpTypeVoid diff --git a/modules/compiler/spirv-ll/test/spvasm/op_glsl_Modf_dvec3_dvec3Ptr.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_glsl_Modf_dvec3_dvec3Ptr.spvasm index 4fa61629f..73bf2e913 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_glsl_Modf_dvec3_dvec3Ptr.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_glsl_Modf_dvec3_dvec3Ptr.spvasm @@ -33,11 +33,11 @@ OpMemberName %outBuff_t 1 "whole" OpMemberDecorate %outBuff_t 0 Offset 0 OpMemberDecorate %outBuff_t 1 Offset 32 - OpDecorate %outBuff BufferBlock + OpDecorate %outBuff_t BufferBlock OpDecorate %outBuff DescriptorSet 0 OpDecorate %outBuff Binding 1 OpMemberDecorate %inBuff_t 0 Offset 0 - OpDecorate %inBuff BufferBlock + OpDecorate %inBuff_t BufferBlock OpDecorate %inBuff DescriptorSet 0 OpDecorate %inBuff Binding 0 %void_t = OpTypeVoid diff --git a/modules/compiler/spirv-ll/test/spvasm/op_glsl_Modf_dvec4_dvec4Ptr.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_glsl_Modf_dvec4_dvec4Ptr.spvasm index e577746ce..c2c351af4 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_glsl_Modf_dvec4_dvec4Ptr.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_glsl_Modf_dvec4_dvec4Ptr.spvasm @@ -33,11 +33,11 @@ OpMemberName %outBuff_t 1 "whole" OpMemberDecorate %outBuff_t 0 Offset 0 OpMemberDecorate %outBuff_t 1 Offset 32 - OpDecorate %outBuff BufferBlock + OpDecorate %outBuff_t BufferBlock OpDecorate %outBuff DescriptorSet 0 OpDecorate %outBuff Binding 1 OpMemberDecorate %inBuff_t 0 Offset 0 - OpDecorate %inBuff BufferBlock + OpDecorate %inBuff_t BufferBlock OpDecorate %inBuff DescriptorSet 0 OpDecorate %inBuff Binding 0 %void_t = OpTypeVoid diff --git a/modules/compiler/spirv-ll/test/spvasm/op_glsl_Modf_float_floatPtr.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_glsl_Modf_float_floatPtr.spvasm index daa19adfc..d8dc655e9 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_glsl_Modf_float_floatPtr.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_glsl_Modf_float_floatPtr.spvasm @@ -33,11 +33,11 @@ OpMemberName %outBuff_t 1 "whole" OpMemberDecorate %outBuff_t 0 Offset 0 OpMemberDecorate %outBuff_t 1 Offset 4 - OpDecorate %outBuff BufferBlock + OpDecorate %outBuff_t BufferBlock OpDecorate %outBuff DescriptorSet 0 OpDecorate %outBuff Binding 1 OpMemberDecorate %inBuff_t 0 Offset 0 - OpDecorate %inBuff BufferBlock + OpDecorate %inBuff_t BufferBlock OpDecorate %inBuff DescriptorSet 0 OpDecorate %inBuff Binding 0 %void_t = OpTypeVoid diff --git a/modules/compiler/spirv-ll/test/spvasm/op_glsl_Modf_vec2_vec2Ptr.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_glsl_Modf_vec2_vec2Ptr.spvasm index 517ee42e8..3f53f5315 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_glsl_Modf_vec2_vec2Ptr.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_glsl_Modf_vec2_vec2Ptr.spvasm @@ -33,11 +33,11 @@ OpMemberName %outBuff_t 1 "whole" OpMemberDecorate %outBuff_t 0 Offset 0 OpMemberDecorate %outBuff_t 1 Offset 8 - OpDecorate %outBuff BufferBlock + OpDecorate %outBuff_t BufferBlock OpDecorate %outBuff DescriptorSet 0 OpDecorate %outBuff Binding 1 OpMemberDecorate %inBuff_t 0 Offset 0 - OpDecorate %inBuff BufferBlock + OpDecorate %inBuff_t BufferBlock OpDecorate %inBuff DescriptorSet 0 OpDecorate %inBuff Binding 0 %void_t = OpTypeVoid diff --git a/modules/compiler/spirv-ll/test/spvasm/op_glsl_Modf_vec3_vec3Ptr.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_glsl_Modf_vec3_vec3Ptr.spvasm index 5d1468319..34909175f 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_glsl_Modf_vec3_vec3Ptr.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_glsl_Modf_vec3_vec3Ptr.spvasm @@ -33,11 +33,11 @@ OpMemberName %outBuff_t 1 "whole" OpMemberDecorate %outBuff_t 0 Offset 0 OpMemberDecorate %outBuff_t 1 Offset 16 - OpDecorate %outBuff BufferBlock + OpDecorate %outBuff_t BufferBlock OpDecorate %outBuff DescriptorSet 0 OpDecorate %outBuff Binding 1 OpMemberDecorate %inBuff_t 0 Offset 0 - OpDecorate %inBuff BufferBlock + OpDecorate %inBuff_t BufferBlock OpDecorate %inBuff DescriptorSet 0 OpDecorate %inBuff Binding 0 %void_t = OpTypeVoid diff --git a/modules/compiler/spirv-ll/test/spvasm/op_glsl_Modf_vec4_vec4Ptr.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_glsl_Modf_vec4_vec4Ptr.spvasm index c26ba242c..230889fda 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_glsl_Modf_vec4_vec4Ptr.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_glsl_Modf_vec4_vec4Ptr.spvasm @@ -33,11 +33,11 @@ OpMemberName %outBuff_t 1 "whole" OpMemberDecorate %outBuff_t 0 Offset 0 OpMemberDecorate %outBuff_t 1 Offset 16 - OpDecorate %outBuff BufferBlock + OpDecorate %outBuff_t BufferBlock OpDecorate %outBuff DescriptorSet 0 OpDecorate %outBuff Binding 1 OpMemberDecorate %inBuff_t 0 Offset 0 - OpDecorate %inBuff BufferBlock + OpDecorate %inBuff_t BufferBlock OpDecorate %inBuff DescriptorSet 0 OpDecorate %inBuff Binding 0 %void_t = OpTypeVoid From b1b0e10c9045b670281a89f0839fc2ebf2aa891b Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 9 Nov 2023 15:52:53 +0000 Subject: [PATCH 14/35] [spirv-ll] Fix up a few more capability issues The op_ptr_access_chain test showed a few more issues, like the fact that the store wasn't to the right variable type. To combat this, I've added an extra dereference to the address of the struct's i32 member. --- .../spvasm/op_function_call_regression.spvasm | 13 ++++--- .../test/spvasm/op_ptr_access_chain.spvasm | 38 +++++++++++-------- .../opencl_usm_generic_address_space.spvasm | 3 +- .../test/spvasm/unsupported_capability.spvasm | 2 +- 4 files changed, 33 insertions(+), 23 deletions(-) diff --git a/modules/compiler/spirv-ll/test/spvasm/op_function_call_regression.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_function_call_regression.spvasm index 991d765bf..e5be99477 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_function_call_regression.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_function_call_regression.spvasm @@ -19,20 +19,23 @@ ; references was leaving behind invalid instructions. ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} -; RUN: spirv-ll-tool -a OpenCL -b 64 %spv_file_s | FileCheck %s +; RUN: spirv-ll-tool -a OpenCL -b 64 -c Addresses %spv_file_s | FileCheck %s OpCapability Kernel + OpCapability Addresses + OpCapability Int64 + OpCapability Linkage %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical64 OpenCL OpSource OpenCL_CPP 100000 - OpDecorate %ptr FuncParamAttr ByVal - OpName %bar "bar" OpName %main "main" OpName %foo "foo" OpName %a "a" + OpDecorate %ptr FuncParamAttr ByVal + %void = OpTypeVoid %ulong = OpTypeInt 64 0 @@ -47,10 +50,10 @@ %main = OpFunction %void None %main_fn_ty %entry_4 = OpLabel -; CHECK: [[TMP:%.*]] = call spir_func i64 @bar(i64 0) - %call0 = OpFunctionCall %ulong %bar %ulong_0 ; CHECK: %a = alloca i64, align 8 %a = OpVariable %ptr_ty Function +; CHECK: [[TMP:%.*]] = call spir_func i64 @bar(i64 0) + %call0 = OpFunctionCall %ulong %bar %ulong_0 ; CHECK: store i64 1, {{(ptr|i64\*)}} %a OpStore %a %ulong_1 Aligned 8 ; Check we also apply call-site attributes to this function diff --git a/modules/compiler/spirv-ll/test/spvasm/op_ptr_access_chain.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_ptr_access_chain.spvasm index f24dcd00e..2ec6b6b83 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_ptr_access_chain.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_ptr_access_chain.spvasm @@ -19,47 +19,53 @@ OpCapability Addresses OpCapability Kernel - OpCapability Int64 + OpCapability Int8 OpMemoryModel Physical64 OpenCL OpEntryPoint Kernel %20 "entry_pt" %void = OpTypeVoid - %ulong = OpTypeInt 64 0 - %ulong_0 = OpConstant %ulong 0 - %ulong_3 = OpConstant %ulong 3 %float = OpTypeFloat 32 %uchar = OpTypeInt 8 0 %uint = OpTypeInt 32 0 + + %_ptr_uint = OpTypePointer CrossWorkgroup %uint %struct_user_struct = OpTypeStruct %float %uint %uchar %_ptr_uint %_ptr_CrossWorkgroup_struct_user_struct = OpTypePointer CrossWorkgroup %struct_user_struct - %19 = OpTypeFunction %void %_ptr_CrossWorkgroup_struct_user_struct %ulong %ulong + %19 = OpTypeFunction %void %_ptr_CrossWorkgroup_struct_user_struct %uint %uint + + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_3 = OpConstant %uint 3 + %20 = OpFunction %void None %19 %_arg_user_struct = OpFunctionParameter %_ptr_CrossWorkgroup_struct_user_struct - %_ulong_input = OpFunctionParameter %ulong - %_ulong_input2 = OpFunctionParameter %ulong + %_uint_input = OpFunctionParameter %uint + %_uint_input2 = OpFunctionParameter %uint -; CHECK: define spir_kernel void @entry_pt(ptr addrspace(1) [[PTR:%.*]], i64 {{%[a-zA-Z0-9]+}}, i64 {{%[a-zA-Z0-9]+}} +; CHECK: define spir_kernel void @entry_pt(ptr addrspace(1) [[PTR:%.*]], i32 {{%.*}}, i32 {{%.*}} %entry = OpLabel ; some maths for the gep input (multiple and an add) - %mul = OpIMul %ulong %ulong_3 %_ulong_input -; CHECK: [[MUL_RES:%[a-zA-Z0-9_]+]] = mul - %add = OpIAdd %uint %ulong_0 %_ulong_input2 -; CHECK: [[ADD_RES:%[a-zA-Z0-9_]+]] = add + %mul = OpIMul %uint %uint_3 %_uint_input +; CHECK: [[MUL_RES:%.*]] = mul + %add = OpIAdd %uint %uint_0 %_uint_input2 +; CHECK: [[ADD_RES:%.*]] = add ; use two OpPtrAccessChain values to get to the correct index of the user struct array ; we don't gep into the struct %mul_user_struct_ptr = OpPtrAccessChain %_ptr_CrossWorkgroup_struct_user_struct %_arg_user_struct %mul %add_user_struct_ptr = OpPtrAccessChain %_ptr_CrossWorkgroup_struct_user_struct %mul_user_struct_ptr %add + %var_ptr = OpPtrAccessChain %_ptr_uint %add_user_struct_ptr %uint_0 %uint_1 -; CHECK: [[GEP_MUL:%[a-zA-Z0-9_]+]] = getelementptr %0, ptr addrspace(1) [[PTR]], i64 [[MUL_RES]] -; CHECK: [[GEP_ADD:%[a-zA-Z0-9_]+]] = getelementptr %0, ptr addrspace(1) [[GEP_MUL]], i64 [[ADD_RES]] -; CHECK: store i64 [[ADD_RES]], ptr addrspace(1) [[GEP_ADD]], align 4 +; CHECK: [[GEP_MUL:%.*]] = getelementptr %0, ptr addrspace(1) [[PTR]], i32 [[MUL_RES]] +; CHECK: [[GEP_ADD:%.*]] = getelementptr %0, ptr addrspace(1) [[GEP_MUL]], i32 [[ADD_RES]] +; CHECK: [[VAR_PTR:%.*]] = getelementptr %0, ptr addrspace(1) [[GEP_ADD]], i32 0, i32 1 +; CHECK: store i32 [[ADD_RES]], ptr addrspace(1) [[VAR_PTR]], align 4 - OpStore %add_user_struct_ptr %add Aligned 4 + OpStore %var_ptr %add Aligned 4 OpReturn OpFunctionEnd diff --git a/modules/compiler/spirv-ll/test/spvasm/opencl_usm_generic_address_space.spvasm b/modules/compiler/spirv-ll/test/spvasm/opencl_usm_generic_address_space.spvasm index 7655cc3f5..90b6b1fae 100644 --- a/modules/compiler/spirv-ll/test/spvasm/opencl_usm_generic_address_space.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/opencl_usm_generic_address_space.spvasm @@ -15,11 +15,12 @@ ; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} -; RUN: spirv-ll-tool -a OpenCL -e SPV_codeplay_usm_generic_storage_class -b 64 %spv_file_s | FileCheck %s +; RUN: spirv-ll-tool -a OpenCL -e SPV_codeplay_usm_generic_storage_class -b 64 -c GenericPointer %spv_file_s | FileCheck %s OpCapability Addresses OpCapability Linkage OpCapability Kernel OpCapability Int64 + OpCapability GenericPointer OpExtension "SPV_codeplay_usm_generic_storage_class" %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical64 OpenCL diff --git a/modules/compiler/spirv-ll/test/spvasm/unsupported_capability.spvasm b/modules/compiler/spirv-ll/test/spvasm/unsupported_capability.spvasm index ef2317159..18267315d 100644 --- a/modules/compiler/spirv-ll/test/spvasm/unsupported_capability.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/unsupported_capability.spvasm @@ -21,7 +21,7 @@ ; RUN: not spirv-ll-tool -a OpenCL -b 64 %spv_file_s 2>&1 | FileCheck %s OpCapability Kernel OpCapability Addresses - OpMemoryModel Physical64 OpenCL OpCapability MultiViewport + OpMemoryModel Physical64 OpenCL ; CHECK: OpCapability MultiViewport (#57) not supported by device From 6fa31b551110bb04e8943ba9f84695766a6f0353 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 9 Nov 2023 16:10:37 +0000 Subject: [PATCH 15/35] [spirv-ll] Fix tests not using OpTypeForwardPointer on struct types --- .../test/spvasm/op_forward_pointer_double.spvasm | 4 ++-- .../test/spvasm/op_forward_pointer_float.spvasm | 4 ++-- .../spirv-ll/test/spvasm/op_forward_pointer_int.spvasm | 4 ++-- .../test/spvasm/op_forward_pointer_long.spvasm | 4 ++-- .../test/spvasm/op_forward_pointer_uint.spvasm | 4 ++-- .../test/spvasm/op_type_forward_pointer.spvasm | 10 ++++++---- 6 files changed, 16 insertions(+), 14 deletions(-) diff --git a/modules/compiler/spirv-ll/test/spvasm/op_forward_pointer_double.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_forward_pointer_double.spvasm index e8e582f60..960a7a7c5 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_forward_pointer_double.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_forward_pointer_double.spvasm @@ -39,9 +39,9 @@ %double = OpTypeFloat 64 ; this should be blank if type is Foo %9 = OpConstant %struct_float 42.42 %struct_int = OpTypeInt 32 0 - OpTypeForwardPointer %ptr_double Function + OpTypeForwardPointer %ptr_Foo Function + %ptr_double = OpTypePointer Function %double %Foo = OpTypeStruct %struct_int %struct_float %ptr_double -%ptr_double = OpTypePointer Function %double ; this should be blank if type is Foo %ptr_Foo = OpTypePointer Function %Foo %14 = OpConstant %struct_int 1 %main = OpFunction %void None %3 diff --git a/modules/compiler/spirv-ll/test/spvasm/op_forward_pointer_float.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_forward_pointer_float.spvasm index 2b89c5a65..7e372f15e 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_forward_pointer_float.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_forward_pointer_float.spvasm @@ -38,9 +38,9 @@ %_ptr_Function_float = OpTypePointer Function %float %9 = OpConstant %float 42.42 %struct_int = OpTypeInt 32 0 - OpTypeForwardPointer %ptr_float Function + OpTypeForwardPointer %ptr_Foo Function + %ptr_float = OpTypePointer Function %float %Foo = OpTypeStruct %struct_int %float %ptr_float -%ptr_float = OpTypePointer Function %float ; this should be blank if type is Foo %ptr_Foo = OpTypePointer Function %Foo %14 = OpConstant %struct_int 1 %main = OpFunction %void None %3 diff --git a/modules/compiler/spirv-ll/test/spvasm/op_forward_pointer_int.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_forward_pointer_int.spvasm index 623a93967..07649055f 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_forward_pointer_int.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_forward_pointer_int.spvasm @@ -39,9 +39,9 @@ %int = OpTypeInt 32 1 ; this should be blank if type is Foo %9 = OpConstant %struct_float 42.42 %struct_int = OpTypeInt 32 0 - OpTypeForwardPointer %ptr_int Function + OpTypeForwardPointer %ptr_Foo Function + %ptr_int = OpTypePointer Function %int %Foo = OpTypeStruct %struct_int %struct_float %ptr_int -%ptr_int = OpTypePointer Function %int ; this should be blank if type is Foo %ptr_Foo = OpTypePointer Function %Foo %14 = OpConstant %struct_int 1 %main = OpFunction %void None %3 diff --git a/modules/compiler/spirv-ll/test/spvasm/op_forward_pointer_long.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_forward_pointer_long.spvasm index 1aa8b8303..951a9c403 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_forward_pointer_long.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_forward_pointer_long.spvasm @@ -39,9 +39,9 @@ %long = OpTypeInt 64 1 ; this should be blank if type is Foo %9 = OpConstant %struct_float 42.42 %struct_int = OpTypeInt 32 0 - OpTypeForwardPointer %ptr_long Function + OpTypeForwardPointer %ptr_Foo Function + %ptr_long = OpTypePointer Function %long %Foo = OpTypeStruct %struct_int %struct_float %ptr_long -%ptr_long = OpTypePointer Function %long ; this should be blank if type is Foo %ptr_Foo = OpTypePointer Function %Foo %14 = OpConstant %struct_int 1 %main = OpFunction %void None %3 diff --git a/modules/compiler/spirv-ll/test/spvasm/op_forward_pointer_uint.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_forward_pointer_uint.spvasm index 03decb624..8bbddd036 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_forward_pointer_uint.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_forward_pointer_uint.spvasm @@ -39,10 +39,10 @@ %_ptr_Function_float = OpTypePointer Function %float %uint = OpTypeInt 32 0 ; this should be blank if type is Foo %9 = OpConstant %float 42.42 - OpTypeForwardPointer %ptr_uint Function + OpTypeForwardPointer %ptr_Foo Function + %ptr_uint = OpTypePointer Function %uint %Foo = OpTypeStruct %uint %float %ptr_uint ; CHECK: [[Foo:%[a-zA-Z0-9_]+]] = type { i32, float, ptr } - %ptr_uint = OpTypePointer Function %uint ; this should be blank if type is Foo %ptr_Foo = OpTypePointer Function %Foo %14 = OpConstant %uint 1 %main = OpFunction %void None %3 diff --git a/modules/compiler/spirv-ll/test/spvasm/op_type_forward_pointer.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_type_forward_pointer.spvasm index 578e5fe7f..846f624ba 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_type_forward_pointer.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_type_forward_pointer.spvasm @@ -19,9 +19,11 @@ OpCapability Kernel OpCapability Addresses + OpCapability Linkage OpMemoryModel Physical64 OpenCL - OpTypeForwardPointer %a Function -%b = OpTypeVoid -%c = OpTypePointer Function %a -%a = OpTypePointer Function %b + OpTypeForwardPointer %ptr_Foo Function + %b = OpTypeVoid + %a = OpTypePointer Function %b + %Foo = OpTypeStruct %a +%ptr_Foo = OpTypePointer Function %Foo ; CHECK: ; ModuleID = '{{.*}}' From 4ccb1def9ce4dffe6edf55631fcb181a18a10bc7 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 9 Nov 2023 16:16:53 +0000 Subject: [PATCH 16/35] [spirv-ll] Fix tests missing ArrayStride decorations --- .../test/spvasm/op_spec_constant_composite_double_array.spvasm | 1 + .../test/spvasm/op_spec_constant_composite_float_array.spvasm | 1 + .../test/spvasm/op_spec_constant_composite_int_array.spvasm | 1 + .../test/spvasm/op_spec_constant_composite_long_array.spvasm | 1 + .../test/spvasm/op_spec_constant_composite_uint_array.spvasm | 1 + 5 files changed, 5 insertions(+) diff --git a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_composite_double_array.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_composite_double_array.spvasm index 092296cd1..d38fb9aad 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_composite_double_array.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_composite_double_array.spvasm @@ -33,6 +33,7 @@ OpDecorate %_ DescriptorSet 0 OpDecorate %_ Binding 0 OpDecorate %14 SpecId 0 + OpDecorate %arr_double ArrayStride 8 %void = OpTypeVoid %3 = OpTypeFunction %void %double = OpTypeFloat 64 diff --git a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_composite_float_array.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_composite_float_array.spvasm index 36440f3e4..581b352d6 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_composite_float_array.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_composite_float_array.spvasm @@ -33,6 +33,7 @@ OpDecorate %_ DescriptorSet 0 OpDecorate %_ Binding 0 OpDecorate %14 SpecId 0 + OpDecorate %arr_float ArrayStride 4 %void = OpTypeVoid %3 = OpTypeFunction %void %float = OpTypeFloat 32 diff --git a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_composite_int_array.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_composite_int_array.spvasm index ec945b963..6a231bb14 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_composite_int_array.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_composite_int_array.spvasm @@ -33,6 +33,7 @@ OpDecorate %_ DescriptorSet 0 OpDecorate %_ Binding 0 OpDecorate %14 SpecId 0 + OpDecorate %arr_int ArrayStride 4 %void = OpTypeVoid %3 = OpTypeFunction %void %int = OpTypeInt 32 1 diff --git a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_composite_long_array.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_composite_long_array.spvasm index be6572b8b..1593b22ef 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_composite_long_array.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_composite_long_array.spvasm @@ -34,6 +34,7 @@ OpDecorate %_ DescriptorSet 0 OpDecorate %_ Binding 0 OpDecorate %14 SpecId 0 + OpDecorate %arr_long ArrayStride 8 %void = OpTypeVoid %3 = OpTypeFunction %void %long = OpTypeInt 64 1 diff --git a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_composite_uint_array.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_composite_uint_array.spvasm index b2be6c1ba..c467f46b7 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_composite_uint_array.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_composite_uint_array.spvasm @@ -33,6 +33,7 @@ OpDecorate %_ DescriptorSet 0 OpDecorate %_ Binding 0 OpDecorate %14 SpecId 0 + OpDecorate %arr_uint ArrayStride 4 %void = OpTypeVoid %3 = OpTypeFunction %void %uint = OpTypeInt 32 0 From 30a4fbfc492a693248511dd4051380cccb23bc81 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 9 Nov 2023 16:24:13 +0000 Subject: [PATCH 17/35] [spirv-ll] Fix tests using invalid scalar vstorea_halfn* opcodes --- .../spvasm/op_opencl_vstorea_halfn_32bit.spvasm | 4 ---- .../spvasm/op_opencl_vstorea_halfn_64bit.spvasm | 4 ---- .../op_opencl_vstorea_halfn_r_32bit.spvasm | 16 ---------------- .../op_opencl_vstorea_halfn_r_64bit.spvasm | 16 ---------------- 4 files changed, 40 deletions(-) diff --git a/modules/compiler/spirv-ll/test/spvasm/op_opencl_vstorea_halfn_32bit.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_opencl_vstorea_halfn_32bit.spvasm index 78abf9e92..fa47ec054 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_opencl_vstorea_halfn_32bit.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_opencl_vstorea_halfn_32bit.spvasm @@ -55,8 +55,6 @@ %out = OpFunctionParameter %_ptr_CrossWorkgroup_half %loc = OpFunctionParameter %_ptr_Workgroup_half %entry = OpLabel - %15 = OpExtInst %void %1 vstorea_halfn %float_1 %uint_0 %out -; CHECK: call spir_func void @_Z12vstorea_halffjPU3AS1Dh(float 1.000000e+00, i32 0, ptr addrspace(1) %out) %19 = OpExtInst %void %1 vstorea_halfn %18 %uint_0 %out ; CHECK: call spir_func void @_Z13vstorea_half2Dv2_fjPU3AS1Dh(<2 x float> , i32 0, ptr addrspace(1) %out) %23 = OpExtInst %void %1 vstorea_halfn %22 %uint_0 %out @@ -67,8 +65,6 @@ ; CHECK: call spir_func void @_Z13vstorea_half8Dv8_fjPU3AS1Dh(<8 x float> , i32 0, ptr addrspace(1) %out) %35 = OpExtInst %void %1 vstorea_halfn %34 %uint_0 %out ; CHECK: call spir_func void @_Z14vstorea_half16Dv16_fjPU3AS1Dh(<16 x float> , i32 0, ptr addrspace(1) %out) - %36 = OpExtInst %void %1 vstorea_halfn %float_1 %uint_0 %loc -; CHECK: call spir_func void @_Z12vstorea_halffjPU3AS3Dh(float 1.000000e+00, i32 0, ptr addrspace(3) %loc) %37 = OpExtInst %void %1 vstorea_halfn %18 %uint_0 %loc ; CHECK: call spir_func void @_Z13vstorea_half2Dv2_fjPU3AS3Dh(<2 x float> , i32 0, ptr addrspace(3) %loc) %38 = OpExtInst %void %1 vstorea_halfn %22 %uint_0 %loc diff --git a/modules/compiler/spirv-ll/test/spvasm/op_opencl_vstorea_halfn_64bit.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_opencl_vstorea_halfn_64bit.spvasm index f60086b69..b4f89eed6 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_opencl_vstorea_halfn_64bit.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_opencl_vstorea_halfn_64bit.spvasm @@ -56,8 +56,6 @@ %out = OpFunctionParameter %_ptr_CrossWorkgroup_half %loc = OpFunctionParameter %_ptr_Workgroup_half %entry = OpLabel - %15 = OpExtInst %void %1 vstorea_halfn %float_1 %ulong_0 %out -; CHECK: call spir_func void @_Z12vstorea_halffmPU3AS1Dh(float 1.000000e+00, i64 0, ptr addrspace(1) %out) %19 = OpExtInst %void %1 vstorea_halfn %18 %ulong_0 %out ; CHECK: call spir_func void @_Z13vstorea_half2Dv2_fmPU3AS1Dh(<2 x float> , i64 0, ptr addrspace(1) %out) %23 = OpExtInst %void %1 vstorea_halfn %22 %ulong_0 %out @@ -68,8 +66,6 @@ ; CHECK: call spir_func void @_Z13vstorea_half8Dv8_fmPU3AS1Dh(<8 x float> , i64 0, ptr addrspace(1) %out) %35 = OpExtInst %void %1 vstorea_halfn %34 %ulong_0 %out ; CHECK: call spir_func void @_Z14vstorea_half16Dv16_fmPU3AS1Dh(<16 x float> , i64 0, ptr addrspace(1) %out) - %36 = OpExtInst %void %1 vstorea_halfn %float_1 %ulong_0 %loc -; CHECK: call spir_func void @_Z12vstorea_halffmPU3AS3Dh(float 1.000000e+00, i64 0, ptr addrspace(3) %loc) %37 = OpExtInst %void %1 vstorea_halfn %18 %ulong_0 %loc ; CHECK: call spir_func void @_Z13vstorea_half2Dv2_fmPU3AS3Dh(<2 x float> , i64 0, ptr addrspace(3) %loc) %38 = OpExtInst %void %1 vstorea_halfn %22 %ulong_0 %loc diff --git a/modules/compiler/spirv-ll/test/spvasm/op_opencl_vstorea_halfn_r_32bit.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_opencl_vstorea_halfn_r_32bit.spvasm index ee28ccd48..fb56bde13 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_opencl_vstorea_halfn_r_32bit.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_opencl_vstorea_halfn_r_32bit.spvasm @@ -55,8 +55,6 @@ %out = OpFunctionParameter %_ptr_CrossWorkgroup_half %loc = OpFunctionParameter %_ptr_Workgroup_half %entry = OpLabel - %15 = OpExtInst %void %1 vstorea_halfn_r %float_1 %uint_0 %out RTE -; CHECK: call spir_func void @_Z16vstorea_half_rtefjPU3AS1Dh(float 1.000000e+00, i32 0, ptr addrspace(1) %out) %19 = OpExtInst %void %1 vstorea_halfn_r %18 %uint_0 %out RTE ; CHECK: call spir_func void @_Z17vstorea_half2_rteDv2_fjPU3AS1Dh(<2 x float> , i32 0, ptr addrspace(1) %out) %23 = OpExtInst %void %1 vstorea_halfn_r %22 %uint_0 %out RTE @@ -67,8 +65,6 @@ ; CHECK: call spir_func void @_Z17vstorea_half8_rteDv8_fjPU3AS1Dh(<8 x float> , i32 0, ptr addrspace(1) %out) %35 = OpExtInst %void %1 vstorea_halfn_r %34 %uint_0 %out RTE ; CHECK: call spir_func void @_Z18vstorea_half16_rteDv16_fjPU3AS1Dh(<16 x float> , i32 0, ptr addrspace(1) %out) - %36 = OpExtInst %void %1 vstorea_halfn_r %float_1 %uint_0 %loc RTE -; CHECK: call spir_func void @_Z16vstorea_half_rtefjPU3AS3Dh(float 1.000000e+00, i32 0, ptr addrspace(3) %loc) %37 = OpExtInst %void %1 vstorea_halfn_r %18 %uint_0 %loc RTE ; CHECK: call spir_func void @_Z17vstorea_half2_rteDv2_fjPU3AS3Dh(<2 x float> , i32 0, ptr addrspace(3) %loc) %38 = OpExtInst %void %1 vstorea_halfn_r %22 %uint_0 %loc RTE @@ -79,8 +75,6 @@ ; CHECK: call spir_func void @_Z17vstorea_half8_rteDv8_fjPU3AS3Dh(<8 x float> , i32 0, ptr addrspace(3) %loc) %41 = OpExtInst %void %1 vstorea_halfn_r %34 %uint_0 %loc RTE ; CHECK: call spir_func void @_Z18vstorea_half16_rteDv16_fjPU3AS3Dh(<16 x float> , i32 0, ptr addrspace(3) %loc) - %42 = OpExtInst %void %1 vstorea_halfn_r %float_1 %uint_0 %out RTZ -; CHECK: call spir_func void @_Z16vstorea_half_rtzfjPU3AS1Dh(float 1.000000e+00, i32 0, ptr addrspace(1) %out) %43 = OpExtInst %void %1 vstorea_halfn_r %18 %uint_0 %out RTZ ; CHECK: call spir_func void @_Z17vstorea_half2_rtzDv2_fjPU3AS1Dh(<2 x float> , i32 0, ptr addrspace(1) %out) %44 = OpExtInst %void %1 vstorea_halfn_r %22 %uint_0 %out RTZ @@ -91,8 +85,6 @@ ; CHECK: call spir_func void @_Z17vstorea_half8_rtzDv8_fjPU3AS1Dh(<8 x float> , i32 0, ptr addrspace(1) %out) %47 = OpExtInst %void %1 vstorea_halfn_r %34 %uint_0 %out RTZ ; CHECK: call spir_func void @_Z18vstorea_half16_rtzDv16_fjPU3AS1Dh(<16 x float> , i32 0, ptr addrspace(1) %out) - %48 = OpExtInst %void %1 vstorea_halfn_r %float_1 %uint_0 %loc RTZ -; CHECK: call spir_func void @_Z16vstorea_half_rtzfjPU3AS3Dh(float 1.000000e+00, i32 0, ptr addrspace(3) %loc) %49 = OpExtInst %void %1 vstorea_halfn_r %18 %uint_0 %loc RTZ ; CHECK: call spir_func void @_Z17vstorea_half2_rtzDv2_fjPU3AS3Dh(<2 x float> , i32 0, ptr addrspace(3) %loc) %50 = OpExtInst %void %1 vstorea_halfn_r %22 %uint_0 %loc RTZ @@ -103,8 +95,6 @@ ; CHECK: call spir_func void @_Z17vstorea_half8_rtzDv8_fjPU3AS3Dh(<8 x float> , i32 0, ptr addrspace(3) %loc) %53 = OpExtInst %void %1 vstorea_halfn_r %34 %uint_0 %loc RTZ ; CHECK: call spir_func void @_Z18vstorea_half16_rtzDv16_fjPU3AS3Dh(<16 x float> , i32 0, ptr addrspace(3) %loc) - %54 = OpExtInst %void %1 vstorea_halfn_r %float_1 %uint_0 %out RTP -; CHECK: call spir_func void @_Z16vstorea_half_rtpfjPU3AS1Dh(float 1.000000e+00, i32 0, ptr addrspace(1) %out) %55 = OpExtInst %void %1 vstorea_halfn_r %18 %uint_0 %out RTP ; CHECK: call spir_func void @_Z17vstorea_half2_rtpDv2_fjPU3AS1Dh(<2 x float> , i32 0, ptr addrspace(1) %out) %56 = OpExtInst %void %1 vstorea_halfn_r %22 %uint_0 %out RTP @@ -115,8 +105,6 @@ ; CHECK: call spir_func void @_Z17vstorea_half8_rtpDv8_fjPU3AS1Dh(<8 x float> , i32 0, ptr addrspace(1) %out) %59 = OpExtInst %void %1 vstorea_halfn_r %34 %uint_0 %out RTP ; CHECK: call spir_func void @_Z18vstorea_half16_rtpDv16_fjPU3AS1Dh(<16 x float> , i32 0, ptr addrspace(1) %out) - %60 = OpExtInst %void %1 vstorea_halfn_r %float_1 %uint_0 %loc RTP -; CHECK: call spir_func void @_Z16vstorea_half_rtpfjPU3AS3Dh(float 1.000000e+00, i32 0, ptr addrspace(3) %loc) %61 = OpExtInst %void %1 vstorea_halfn_r %18 %uint_0 %loc RTP ; CHECK: call spir_func void @_Z17vstorea_half2_rtpDv2_fjPU3AS3Dh(<2 x float> , i32 0, ptr addrspace(3) %loc) %62 = OpExtInst %void %1 vstorea_halfn_r %22 %uint_0 %loc RTP @@ -127,8 +115,6 @@ ; CHECK: call spir_func void @_Z17vstorea_half8_rtpDv8_fjPU3AS3Dh(<8 x float> , i32 0, ptr addrspace(3) %loc) %65 = OpExtInst %void %1 vstorea_halfn_r %34 %uint_0 %loc RTP ; CHECK: call spir_func void @_Z18vstorea_half16_rtpDv16_fjPU3AS3Dh(<16 x float> , i32 0, ptr addrspace(3) %loc) - %66 = OpExtInst %void %1 vstorea_halfn_r %float_1 %uint_0 %out RTN -; CHECK: call spir_func void @_Z16vstorea_half_rtnfjPU3AS1Dh(float 1.000000e+00, i32 0, ptr addrspace(1) %out) %67 = OpExtInst %void %1 vstorea_halfn_r %18 %uint_0 %out RTN ; CHECK: call spir_func void @_Z17vstorea_half2_rtnDv2_fjPU3AS1Dh(<2 x float> , i32 0, ptr addrspace(1) %out) %68 = OpExtInst %void %1 vstorea_halfn_r %22 %uint_0 %out RTN @@ -139,8 +125,6 @@ ; CHECK: call spir_func void @_Z17vstorea_half8_rtnDv8_fjPU3AS1Dh(<8 x float> , i32 0, ptr addrspace(1) %out) %71 = OpExtInst %void %1 vstorea_halfn_r %34 %uint_0 %out RTN ; CHECK: call spir_func void @_Z18vstorea_half16_rtnDv16_fjPU3AS1Dh(<16 x float> , i32 0, ptr addrspace(1) %out) - %72 = OpExtInst %void %1 vstorea_halfn_r %float_1 %uint_0 %loc RTN -; CHECK: call spir_func void @_Z16vstorea_half_rtnfjPU3AS3Dh(float 1.000000e+00, i32 0, ptr addrspace(3) %loc) %73 = OpExtInst %void %1 vstorea_halfn_r %18 %uint_0 %loc RTN ; CHECK: call spir_func void @_Z17vstorea_half2_rtnDv2_fjPU3AS3Dh(<2 x float> , i32 0, ptr addrspace(3) %loc) %74 = OpExtInst %void %1 vstorea_halfn_r %22 %uint_0 %loc RTN diff --git a/modules/compiler/spirv-ll/test/spvasm/op_opencl_vstorea_halfn_r_64bit.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_opencl_vstorea_halfn_r_64bit.spvasm index 46225708d..4a40f07f2 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_opencl_vstorea_halfn_r_64bit.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_opencl_vstorea_halfn_r_64bit.spvasm @@ -56,8 +56,6 @@ %out = OpFunctionParameter %_ptr_CrossWorkgroup_half %loc = OpFunctionParameter %_ptr_Workgroup_half %entry = OpLabel - %15 = OpExtInst %void %1 vstorea_halfn_r %float_1 %ulong_0 %out RTE -; CHECK: call spir_func void @_Z16vstorea_half_rtefmPU3AS1Dh(float 1.000000e+00, i64 0, ptr addrspace(1) %out) %19 = OpExtInst %void %1 vstorea_halfn_r %18 %ulong_0 %out RTE ; CHECK: call spir_func void @_Z17vstorea_half2_rteDv2_fmPU3AS1Dh(<2 x float> , i64 0, ptr addrspace(1) %out) %23 = OpExtInst %void %1 vstorea_halfn_r %22 %ulong_0 %out RTE @@ -68,8 +66,6 @@ ; CHECK: call spir_func void @_Z17vstorea_half8_rteDv8_fmPU3AS1Dh(<8 x float> , i64 0, ptr addrspace(1) %out) %35 = OpExtInst %void %1 vstorea_halfn_r %34 %ulong_0 %out RTE ; CHECK: call spir_func void @_Z18vstorea_half16_rteDv16_fmPU3AS1Dh(<16 x float> , i64 0, ptr addrspace(1) %out) - %36 = OpExtInst %void %1 vstorea_halfn_r %float_1 %ulong_0 %loc RTE -; CHECK: call spir_func void @_Z16vstorea_half_rtefmPU3AS3Dh(float 1.000000e+00, i64 0, ptr addrspace(3) %loc) %37 = OpExtInst %void %1 vstorea_halfn_r %18 %ulong_0 %loc RTE ; CHECK: call spir_func void @_Z17vstorea_half2_rteDv2_fmPU3AS3Dh(<2 x float> , i64 0, ptr addrspace(3) %loc) %38 = OpExtInst %void %1 vstorea_halfn_r %22 %ulong_0 %loc RTE @@ -80,8 +76,6 @@ ; CHECK: call spir_func void @_Z17vstorea_half8_rteDv8_fmPU3AS3Dh(<8 x float> , i64 0, ptr addrspace(3) %loc) %41 = OpExtInst %void %1 vstorea_halfn_r %34 %ulong_0 %loc RTE ; CHECK: call spir_func void @_Z18vstorea_half16_rteDv16_fmPU3AS3Dh(<16 x float> , i64 0, ptr addrspace(3) %loc) - %42 = OpExtInst %void %1 vstorea_halfn_r %float_1 %ulong_0 %out RTZ -; CHECK: call spir_func void @_Z16vstorea_half_rtzfmPU3AS1Dh(float 1.000000e+00, i64 0, ptr addrspace(1) %out) %43 = OpExtInst %void %1 vstorea_halfn_r %18 %ulong_0 %out RTZ ; CHECK: call spir_func void @_Z17vstorea_half2_rtzDv2_fmPU3AS1Dh(<2 x float> , i64 0, ptr addrspace(1) %out) %44 = OpExtInst %void %1 vstorea_halfn_r %22 %ulong_0 %out RTZ @@ -92,8 +86,6 @@ ; CHECK: call spir_func void @_Z17vstorea_half8_rtzDv8_fmPU3AS1Dh(<8 x float> , i64 0, ptr addrspace(1) %out) %47 = OpExtInst %void %1 vstorea_halfn_r %34 %ulong_0 %out RTZ ; CHECK: call spir_func void @_Z18vstorea_half16_rtzDv16_fmPU3AS1Dh(<16 x float> , i64 0, ptr addrspace(1) %out) - %48 = OpExtInst %void %1 vstorea_halfn_r %float_1 %ulong_0 %loc RTZ -; CHECK: call spir_func void @_Z16vstorea_half_rtzfmPU3AS3Dh(float 1.000000e+00, i64 0, ptr addrspace(3) %loc) %49 = OpExtInst %void %1 vstorea_halfn_r %18 %ulong_0 %loc RTZ ; CHECK: call spir_func void @_Z17vstorea_half2_rtzDv2_fmPU3AS3Dh(<2 x float> , i64 0, ptr addrspace(3) %loc) %50 = OpExtInst %void %1 vstorea_halfn_r %22 %ulong_0 %loc RTZ @@ -104,8 +96,6 @@ ; CHECK: call spir_func void @_Z17vstorea_half8_rtzDv8_fmPU3AS3Dh(<8 x float> , i64 0, ptr addrspace(3) %loc) %53 = OpExtInst %void %1 vstorea_halfn_r %34 %ulong_0 %loc RTZ ; CHECK: call spir_func void @_Z18vstorea_half16_rtzDv16_fmPU3AS3Dh(<16 x float> , i64 0, ptr addrspace(3) %loc) - %54 = OpExtInst %void %1 vstorea_halfn_r %float_1 %ulong_0 %out RTP -; CHECK: call spir_func void @_Z16vstorea_half_rtpfmPU3AS1Dh(float 1.000000e+00, i64 0, ptr addrspace(1) %out) %55 = OpExtInst %void %1 vstorea_halfn_r %18 %ulong_0 %out RTP ; CHECK: call spir_func void @_Z17vstorea_half2_rtpDv2_fmPU3AS1Dh(<2 x float> , i64 0, ptr addrspace(1) %out) %56 = OpExtInst %void %1 vstorea_halfn_r %22 %ulong_0 %out RTP @@ -116,8 +106,6 @@ ; CHECK: call spir_func void @_Z17vstorea_half8_rtpDv8_fmPU3AS1Dh(<8 x float> , i64 0, ptr addrspace(1) %out) %59 = OpExtInst %void %1 vstorea_halfn_r %34 %ulong_0 %out RTP ; CHECK: call spir_func void @_Z18vstorea_half16_rtpDv16_fmPU3AS1Dh(<16 x float> , i64 0, ptr addrspace(1) %out) - %60 = OpExtInst %void %1 vstorea_halfn_r %float_1 %ulong_0 %loc RTP -; CHECK: call spir_func void @_Z16vstorea_half_rtpfmPU3AS3Dh(float 1.000000e+00, i64 0, ptr addrspace(3) %loc) %61 = OpExtInst %void %1 vstorea_halfn_r %18 %ulong_0 %loc RTP ; CHECK: call spir_func void @_Z17vstorea_half2_rtpDv2_fmPU3AS3Dh(<2 x float> , i64 0, ptr addrspace(3) %loc) %62 = OpExtInst %void %1 vstorea_halfn_r %22 %ulong_0 %loc RTP @@ -128,8 +116,6 @@ ; CHECK: call spir_func void @_Z17vstorea_half8_rtpDv8_fmPU3AS3Dh(<8 x float> , i64 0, ptr addrspace(3) %loc) %65 = OpExtInst %void %1 vstorea_halfn_r %34 %ulong_0 %loc RTP ; CHECK: call spir_func void @_Z18vstorea_half16_rtpDv16_fmPU3AS3Dh(<16 x float> , i64 0, ptr addrspace(3) %loc) - %66 = OpExtInst %void %1 vstorea_halfn_r %float_1 %ulong_0 %out RTN -; CHECK: call spir_func void @_Z16vstorea_half_rtnfmPU3AS1Dh(float 1.000000e+00, i64 0, ptr addrspace(1) %out) %67 = OpExtInst %void %1 vstorea_halfn_r %18 %ulong_0 %out RTN ; CHECK: call spir_func void @_Z17vstorea_half2_rtnDv2_fmPU3AS1Dh(<2 x float> , i64 0, ptr addrspace(1) %out) %68 = OpExtInst %void %1 vstorea_halfn_r %22 %ulong_0 %out RTN @@ -140,8 +126,6 @@ ; CHECK: call spir_func void @_Z17vstorea_half8_rtnDv8_fmPU3AS1Dh(<8 x float> , i64 0, ptr addrspace(1) %out) %71 = OpExtInst %void %1 vstorea_halfn_r %34 %ulong_0 %out RTN ; CHECK: call spir_func void @_Z18vstorea_half16_rtnDv16_fmPU3AS1Dh(<16 x float> , i64 0, ptr addrspace(1) %out) - %72 = OpExtInst %void %1 vstorea_halfn_r %float_1 %ulong_0 %loc RTN -; CHECK: call spir_func void @_Z16vstorea_half_rtnfmPU3AS3Dh(float 1.000000e+00, i64 0, ptr addrspace(3) %loc) %73 = OpExtInst %void %1 vstorea_halfn_r %18 %ulong_0 %loc RTN ; CHECK: call spir_func void @_Z17vstorea_half2_rtnDv2_fmPU3AS3Dh(<2 x float> , i64 0, ptr addrspace(3) %loc) %74 = OpExtInst %void %1 vstorea_halfn_r %22 %ulong_0 %loc RTN From fb7133a1b3398780158074f170fd51ad96667e49 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 9 Nov 2023 16:29:58 +0000 Subject: [PATCH 18/35] [spirv-ll] Fix tests using invalid OpConstantComposite ops --- .../compiler/spirv-ll/test/spvasm/op_opencl_pown_v8float.spvasm | 2 +- .../spirv-ll/test/spvasm/op_opencl_rootn_v8float.spvasm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/compiler/spirv-ll/test/spvasm/op_opencl_pown_v8float.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_opencl_pown_v8float.spvasm index 919eb966c..07ef8b570 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_opencl_pown_v8float.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_opencl_pown_v8float.spvasm @@ -33,7 +33,7 @@ %pown_fn_t = OpTypeFunction %void_t %int_2 = OpConstant %int_t 2 %float_2 = OpConstant %float_t 2.2 - %v8int_2 = OpConstantComposite %v8float_t %int_2 %int_2 %int_2 %int_2 %int_2 %int_2 %int_2 %int_2 + %v8int_2 = OpConstantComposite %v8int_t %int_2 %int_2 %int_2 %int_2 %int_2 %int_2 %int_2 %int_2 %v8float_2 = OpConstantComposite %v8float_t %float_2 %float_2 %float_2 %float_2 %float_2 %float_2 %float_2 %float_2 ; All functions diff --git a/modules/compiler/spirv-ll/test/spvasm/op_opencl_rootn_v8float.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_opencl_rootn_v8float.spvasm index 11424e75a..86451d483 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_opencl_rootn_v8float.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_opencl_rootn_v8float.spvasm @@ -33,7 +33,7 @@ %rootn_fn_t = OpTypeFunction %void_t %int_2 = OpConstant %int_t 2 %float_2 = OpConstant %float_t 2.0 - %v8int_2 = OpConstantComposite %v8float_t %int_2 %int_2 %int_2 %int_2 %int_2 %int_2 %int_2 %int_2 + %v8int_2 = OpConstantComposite %v8int_t %int_2 %int_2 %int_2 %int_2 %int_2 %int_2 %int_2 %int_2 %v8float_2 = OpConstantComposite %v8float_t %float_2 %float_2 %float_2 %float_2 %float_2 %float_2 %float_2 %float_2 ; All functions From 15ad178d8c8d6b5045a5c8ec80fceeb69f7c7ce7 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 9 Nov 2023 16:31:22 +0000 Subject: [PATCH 19/35] [spirv-ll] Fix tests using undefined types --- modules/compiler/spirv-ll/test/spvasm/op_generic_pointer.spvasm | 1 + .../spirv-ll/test/spvasm/op_spec_constant_generic_pointer.spvasm | 1 + 2 files changed, 2 insertions(+) diff --git a/modules/compiler/spirv-ll/test/spvasm/op_generic_pointer.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_generic_pointer.spvasm index 986d0d2a2..d392bf811 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_generic_pointer.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_generic_pointer.spvasm @@ -26,6 +26,7 @@ OpEntryPoint Kernel %20 "entry_pt" %void = OpTypeVoid + %uint = OpTypeInt 32 0 %ulong = OpTypeInt 64 0 %_ptr_ulong = OpTypePointer CrossWorkgroup %ulong %_ptr_Generic_ulong = OpTypePointer Generic %ulong diff --git a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_generic_pointer.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_generic_pointer.spvasm index 809544d2e..f32d18b66 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_generic_pointer.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_generic_pointer.spvasm @@ -26,6 +26,7 @@ OpEntryPoint Kernel %20 "entry_pt" %void = OpTypeVoid + %uint = OpTypeInt 32 0 %ulong = OpTypeInt 64 0 %_ptr_ulong = OpTypePointer CrossWorkgroup %ulong %_ptr_Generic_ulong = OpTypePointer Generic %ulong From e468a9676bbd4bcc353c83cf2fa81f9c33f7152c Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 9 Nov 2023 16:34:32 +0000 Subject: [PATCH 20/35] [spirv-ll] Fix test using invalid storage classes The storage class of an OpVariable must be the same as that of its result type. --- .../test/spvasm/op_spec_constant_generic_pointer.spvasm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_generic_pointer.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_generic_pointer.spvasm index f32d18b66..c0e59192e 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_generic_pointer.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_generic_pointer.spvasm @@ -31,8 +31,8 @@ %_ptr_ulong = OpTypePointer CrossWorkgroup %ulong %_ptr_Generic_ulong = OpTypePointer Generic %ulong - %_ptr_ptr_ulong = OpTypePointer Workgroup %_ptr_ulong - %_ptr_ptr_Generic_ulong = OpTypePointer Workgroup %_ptr_Generic_ulong + %_ptr_ptr_ulong = OpTypePointer Function %_ptr_ulong + %_ptr_ptr_Generic_ulong = OpTypePointer Function %_ptr_Generic_ulong %ulong_0 = OpConstant %ulong 0 %ulong_1 = OpConstant %ulong 1 @@ -53,7 +53,7 @@ ; CHECK: [[PTRPTR:%.*]] = alloca ptr addrspace(1) %_arg_ptr = OpVariable %_ptr_ptr_ulong Function - %val = OpIAdd %uint %ulong_0 %ulong_1 + %val = OpIAdd %ulong %ulong_0 %ulong_1 ; CHECK: store ptr addrspace(1) addrspacecast (ptr addrspace(4) null to ptr addrspace(1)), ptr [[PTRPTR]] OpStore %_arg_ptr %11 Aligned 4 From 6aff9ac21a67525de09d7ac2e7af43e4121b2a85 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 9 Nov 2023 16:36:43 +0000 Subject: [PATCH 21/35] [spirv-ll] Fix test using mismatched OpIAdd types --- modules/compiler/spirv-ll/test/spvasm/op_generic_pointer.spvasm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/compiler/spirv-ll/test/spvasm/op_generic_pointer.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_generic_pointer.spvasm index d392bf811..e9d54f0d4 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_generic_pointer.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_generic_pointer.spvasm @@ -41,7 +41,7 @@ ; CHECK: define spir_kernel void @entry_pt(ptr addrspace(4) [[PTR:%.*]]) %entry = OpLabel - %x = OpIAdd %uint %ulong_0 %ulong_1 + %x = OpIAdd %ulong %ulong_0 %ulong_1 ; CHECK: store i64 1, ptr addrspace(4) [[PTR]], align 4 OpStore %_arg_ptr %x Aligned 4 From c9edfbe37d5297bd232debfaaceb773ad7af0c4f Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 9 Nov 2023 16:39:33 +0000 Subject: [PATCH 22/35] [spirv-ll] Fix test requiring SPIR-V 1.1 --- modules/compiler/spirv-ll/test/spvasm/CMakeLists.txt | 2 +- .../compiler/spirv-ll/test/spvasm/opencl_max_byte_offset.spvasm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/compiler/spirv-ll/test/spvasm/CMakeLists.txt b/modules/compiler/spirv-ll/test/spvasm/CMakeLists.txt index 4d9a076c9..88b1705d0 100644 --- a/modules/compiler/spirv-ll/test/spvasm/CMakeLists.txt +++ b/modules/compiler/spirv-ll/test/spvasm/CMakeLists.txt @@ -2137,7 +2137,6 @@ set(SPVASM_FILES op_opencl_get_local_linear_id.spvasm op_opencl_get_enqueued_local_size.spvasm op_opencl_call_byval_arg.spvasm - opencl_max_byte_offset.spvasm op_expect_assume.spvasm op_generic_pointer.spvasm op_generic_pointer_builtin.spvasm @@ -2183,6 +2182,7 @@ endif() # TODO: It might be more convenient to support a system like UnitCL where test # files declare their own requirements. set(SPVASM_V1_1_FILES + opencl_max_byte_offset.spvasm op_execution_mode_subgroup_size.spvasm op_execution_mode_subgroups_per_workgroup.spvasm op_get_default_queue.spvasm diff --git a/modules/compiler/spirv-ll/test/spvasm/opencl_max_byte_offset.spvasm b/modules/compiler/spirv-ll/test/spvasm/opencl_max_byte_offset.spvasm index 80c6907a8..44d4f7129 100644 --- a/modules/compiler/spirv-ll/test/spvasm/opencl_max_byte_offset.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/opencl_max_byte_offset.spvasm @@ -13,7 +13,7 @@ ; under the License. ; ; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} +; RUN: %if online-spirv-as %{ spirv-as --target-env spv1.1 -o %spv_file_s %s %} ; RUN: spirv-ll-tool -a OpenCL -b 64 %spv_file_s | FileCheck %s OpCapability Addresses From 7725cd8f1ca6aadbe8fb54b99dba12eed5b65572 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 9 Nov 2023 16:44:06 +0000 Subject: [PATCH 23/35] [spirv-ll] Fix tests using incorrect entry points for capabilities --- .../test/spvasm/op_copy_object_constant.spvasm | 11 ++++------- .../test/spvasm/op_copy_object_variable.spvasm | 15 ++++++--------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/modules/compiler/spirv-ll/test/spvasm/op_copy_object_constant.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_copy_object_constant.spvasm index dc9c8d76f..ec7c1a6bb 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_copy_object_constant.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_copy_object_constant.spvasm @@ -20,11 +20,8 @@ OpCapability Kernel OpCapability Addresses OpMemoryModel Physical64 OpenCL - OpEntryPoint GLCompute %main "main" - OpExecutionMode %main LocalSize 1 1 1 - OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" - OpSourceExtension "GL_GOOGLE_include_directive" - OpName %main "main" + OpEntryPoint Kernel %testfn "testfn" + OpName %testfn "testfn" OpName %x "x" OpName %y "y" OpName %res "res" @@ -35,7 +32,7 @@ %_ptr_Function_float = OpTypePointer Function %float %_ptr_Function_bool = OpTypePointer Function %bool %float_42_42 = OpConstant %float 42.42 - %main = OpFunction %void None %3 + %testfn = OpFunction %void None %3 %5 = OpLabel %res = OpVariable %_ptr_Function_bool Function %x = OpVariable %_ptr_Function_float Function %float_42_42 @@ -46,7 +43,7 @@ OpReturn OpFunctionEnd ; CHECK: ; ModuleID = '{{.*}}' -; CHECK: define spir_kernel void @main() +; CHECK: define spir_kernel void @testfn() ; CHECK: {{[%@][-a-zA-Z$._0-9][-a-zA-Z$._0-9]*}} = alloca i1 ; CHECK: [[X:[%@][-a-zA-Z$._0-9][-a-zA-Z$._0-9]*]] = alloca float ; CHECK: store float {{(-?[0-9]+\.[0-9]+e\+[0-9]+|0x[0-9A-F]+)}}, ptr [[X]] diff --git a/modules/compiler/spirv-ll/test/spvasm/op_copy_object_variable.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_copy_object_variable.spvasm index a9a743b74..acd6f246c 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_copy_object_variable.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_copy_object_variable.spvasm @@ -22,11 +22,8 @@ OpCapability Kernel OpCapability Addresses OpMemoryModel Physical64 OpenCL - OpEntryPoint GLCompute %main "main" - OpExecutionMode %main LocalSize 1 1 1 - OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" - OpSourceExtension "GL_GOOGLE_include_directive" - OpName %main "main" + OpEntryPoint Kernel %testfn "testfn" + OpName %testfn "testfn" OpName %x "x" OpName %y "y" OpName %res "res" @@ -38,11 +35,11 @@ %_ptr_Function_bool = OpTypePointer Function %bool %float_42_42 = OpConstant %float 42.42 %float_24_24 = OpConstant %float 24.24 - %main = OpFunction %void None %3 + %testfn = OpFunction %void None %3 %5 = OpLabel %x = OpVariable %_ptr_Function_float Function - %y = OpCopyObject %_ptr_Function_float %x %res = OpVariable %_ptr_Function_bool Function + %y = OpCopyObject %_ptr_Function_float %x OpStore %x %float_42_42 OpStore %y %float_24_24 %12 = OpLoad %float %x @@ -52,12 +49,12 @@ OpReturn OpFunctionEnd ; CHECK: ; ModuleID = '{{.*}}' -; CHECK: define spir_kernel void @main() +; CHECK: define spir_kernel void @testfn() ; CHECK: [[X:[%@][-a-zA-Z$._0-9][-a-zA-Z$._0-9]*]] = alloca float +; CHECK: {{[%@][-a-zA-Z$._0-9][-a-zA-Z$._0-9]*}} = alloca i1 ; CHECK: [[Y:[%@][-a-zA-Z$._0-9][-a-zA-Z$._0-9]*]] = alloca float ; CHECK: {{[%@][-a-zA-Z$._0-9][-a-zA-Z$._0-9]*}} = load float, ptr [[X]] ; CHECK: store float {{[%@][-a-zA-Z$._0-9][-a-zA-Z$._0-9]*}}, ptr [[Y]] -; CHECK: {{[%@][-a-zA-Z$._0-9][-a-zA-Z$._0-9]*}} = alloca i1 ; CHECK: store float {{(-?[0-9]+\.[0-9]+e\+[0-9]+|0x[0-9A-F]+)}}, ptr [[X]] ; CHECK: store float {{(-?[0-9]+\.[0-9]+e\+[0-9]+|0x[0-9A-F]+)}}, ptr [[Y]] ; CHECK: {{[%@][-a-zA-Z$._0-9][-a-zA-Z$._0-9]*}} = load float, ptr [[X]] From 91db3b02e7d33481934265b27149a21340a5fb10 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 9 Nov 2023 16:51:17 +0000 Subject: [PATCH 24/35] [spirv-ll] Fix up test using incorrect entry point interfaces --- .../spvasm/subgroup_shuffle_xor_intel.spvasm | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/compiler/spirv-ll/test/spvasm/subgroup_shuffle_xor_intel.spvasm b/modules/compiler/spirv-ll/test/spvasm/subgroup_shuffle_xor_intel.spvasm index 582361fae..7fe93955d 100644 --- a/modules/compiler/spirv-ll/test/spvasm/subgroup_shuffle_xor_intel.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/subgroup_shuffle_xor_intel.spvasm @@ -30,7 +30,7 @@ OpExtension "SPV_INTEL_subgroups" %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical64 OpenCL - OpEntryPoint Kernel %31 "permute_sub_group_kernel" %permute_sub_group_kernel %__spirv_BuiltInSubgroupSize %__spirv_BuiltInLocalInvocationId %__spirv_BuiltInWorkgroupSize + OpEntryPoint Kernel %31 "permute_sub_group_kernel" %permute_sub_group_kernel %__spirv_BuiltInSubgroupSize %__spirv_BuiltInLocalInvocationId %__spirv_BuiltInWorkgroupSize %__spirv_BuiltInGlobalInvocationId OpSource OpenCL_CPP 100000 OpName %entry "entry" OpName %for_cond_i "for.cond.i" @@ -66,12 +66,12 @@ %uint_2 = OpConstant %uint 2 %ulong_3 = OpConstant %ulong 3 %ulong_2 = OpConstant %ulong 2 -%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint %v3ulong = OpTypeVector %ulong 3 + %_ptr_Input_uint = OpTypePointer Input %uint + %_ptr_Input_ulong = OpTypePointer Input %ulong %_ptr_Input_v3ulong = OpTypePointer Input %v3ulong %_ptr_CrossWorkgroup_v3ulong = OpTypePointer CrossWorkgroup %v3ulong %_arr_uchar_ulong_129 = OpTypeArray %uchar %ulong_129 -%_ptr_CrossWorkgroup_ulong = OpTypePointer CrossWorkgroup %ulong %void = OpTypeVoid %_ptr_CrossWorkgroup_uchar = OpTypePointer CrossWorkgroup %uchar %30 = OpTypeFunction %void %_ptr_CrossWorkgroup_uchar @@ -85,10 +85,10 @@ %_ptr_Function_uchar = OpTypePointer Function %uchar %203 = OpTypeFunction %void %_ptr_Generic__arr_ulong_ulong_3 %ulong %uint %228 = OpTypeFunction %void %_ptr_Generic__arr_ulong_ulong_3 %ulong -%permute_sub_group_kernel = OpVariable %_ptr_CrossWorkgroup_uint CrossWorkgroup -%__spirv_BuiltInSubgroupSize = OpVariable %_ptr_CrossWorkgroup_uint CrossWorkgroup -%__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_CrossWorkgroup_v3ulong CrossWorkgroup -%__spirv_BuiltInWorkgroupSize = OpVariable %_ptr_CrossWorkgroup_v3ulong CrossWorkgroup +%permute_sub_group_kernel = OpVariable %_ptr_Input_uint Input +%__spirv_BuiltInSubgroupSize = OpVariable %_ptr_Input_uint Input +%__spirv_BuiltInLocalInvocationId = OpVariable %_ptr_Input_v3ulong Input +%__spirv_BuiltInWorkgroupSize = OpVariable %_ptr_Input_v3ulong Input %__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3ulong Input %true = OpConstantTrue %bool @@ -97,11 +97,11 @@ %entry = OpLabel %26 = OpLoad %v3ulong %__spirv_BuiltInGlobalInvocationId %43 = OpCompositeExtract %ulong %26 0 - %45 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_ulong %__spirv_BuiltInWorkgroupSize %uint_0 %uint_0 + %45 = OpInBoundsPtrAccessChain %_ptr_Input_ulong %__spirv_BuiltInWorkgroupSize %uint_0 %uint_0 %46 = OpLoad %ulong %45 Aligned 32 - %48 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_ulong %__spirv_BuiltInLocalInvocationId %uint_0 %uint_1 + %48 = OpInBoundsPtrAccessChain %_ptr_Input_ulong %__spirv_BuiltInLocalInvocationId %uint_0 %uint_1 %49 = OpLoad %ulong %48 Aligned 8 - %50 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_ulong %__spirv_BuiltInLocalInvocationId %uint_0 %uint_0 + %50 = OpInBoundsPtrAccessChain %_ptr_Input_ulong %__spirv_BuiltInLocalInvocationId %uint_0 %uint_0 %51 = OpLoad %ulong %50 Aligned 32 %52 = OpLoad %uint %permute_sub_group_kernel Aligned 4 %add_i = OpIAdd %uint %52 %uint_1 From 6f3ae34631de332ded4a97da0afc3e4c17459454 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 9 Nov 2023 16:52:49 +0000 Subject: [PATCH 25/35] [spirv-ll] Add Linkage capability to test without an OpEntryPoint --- .../compiler/spirv-ll/test/spvasm/unsupported_capability.spvasm | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/compiler/spirv-ll/test/spvasm/unsupported_capability.spvasm b/modules/compiler/spirv-ll/test/spvasm/unsupported_capability.spvasm index 18267315d..4ba65e459 100644 --- a/modules/compiler/spirv-ll/test/spvasm/unsupported_capability.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/unsupported_capability.spvasm @@ -21,6 +21,7 @@ ; RUN: not spirv-ll-tool -a OpenCL -b 64 %spv_file_s 2>&1 | FileCheck %s OpCapability Kernel OpCapability Addresses + OpCapability Linkage OpCapability MultiViewport OpMemoryModel Physical64 OpenCL From a2cc783deacaa731e347eac4578f2d7b34491243 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 9 Nov 2023 16:54:00 +0000 Subject: [PATCH 26/35] [spirv-ll] Remove invalid entry point interface from test It doesn't need to be an interface --- .../compiler/spirv-ll/test/spvasm/op_opencl_memset_zero.spvasm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/compiler/spirv-ll/test/spvasm/op_opencl_memset_zero.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_opencl_memset_zero.spvasm index 327d5c80c..72110df7a 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_opencl_memset_zero.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_opencl_memset_zero.spvasm @@ -22,7 +22,7 @@ OpCapability Int8 %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical64 OpenCL - OpEntryPoint Kernel %6 "memset_zero" %24 + OpEntryPoint Kernel %6 "memset_zero" OpSource OpenCL_C 102000 OpName %out "out" OpName %entry "entry" From 39a3ae0348434f78a3154b71bce5f3667aacaf31 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 9 Nov 2023 17:01:30 +0000 Subject: [PATCH 27/35] [spirv-ll] Fix Shader tests using non-constant barrier operands Switch them to Kernels instead. --- ..._control_barrier_variable_semantics.spvasm | 18 ++++++------ ...p_memory_barrier_variable_semantics.spvasm | 28 ++++++++----------- 2 files changed, 19 insertions(+), 27 deletions(-) diff --git a/modules/compiler/spirv-ll/test/spvasm/op_control_barrier_variable_semantics.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_control_barrier_variable_semantics.spvasm index bb3c2fd77..bf28afedb 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_control_barrier_variable_semantics.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_control_barrier_variable_semantics.spvasm @@ -15,21 +15,19 @@ ; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} -; RUN: spirv-ll-tool -a Vulkan %spv_file_s | FileCheck %s - OpCapability Shader - %1 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint GLCompute %main "main" - OpExecutionMode %main LocalSize 1 1 1 - OpSource GLSL 450 - OpName %main "main" +; RUN: spirv-ll-tool -a OpenCL -b 64 %spv_file_s | FileCheck %s + OpCapability Kernel + OpCapability Addresses + OpMemoryModel Physical64 OpenCL + OpEntryPoint Kernel %testfn "testfn" + OpName %testfn "testfn" %void = OpTypeVoid %4 = OpTypeFunction %void %uint = OpTypeInt 32 0 %_ptr_Function_uint = OpTypePointer Function %uint %uint_2 = OpConstant %uint 2 %uint_272 = OpConstant %uint 272 - %main = OpFunction %void None %4 + %testfn = OpFunction %void None %4 %9 = OpLabel %10 = OpVariable %_ptr_Function_uint Function OpStore %10 %uint_272 @@ -38,7 +36,7 @@ OpReturn OpFunctionEnd ; CHECK: ; ModuleID = '{{.*}}' -; CHECK: define spir_kernel void @main() +; CHECK: define spir_kernel void @testfn() ; CHECK: [[SEMANTICS_VAR:%[a-zA-Z0-9_]+]] = alloca i32 ; CHECK: store i32 272, {{(ptr|i32\*)}} [[SEMANTICS_VAR]] ; CHECK: [[SEMANTICS:%[a-zA-Z0-9_]+]] = load i32, {{(ptr|i32\*)}} [[SEMANTICS_VAR]] diff --git a/modules/compiler/spirv-ll/test/spvasm/op_memory_barrier_variable_semantics.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_memory_barrier_variable_semantics.spvasm index 67e6c5690..950f0ec28 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_memory_barrier_variable_semantics.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_memory_barrier_variable_semantics.spvasm @@ -15,27 +15,21 @@ ; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} -; RUN: spirv-ll-tool -a Vulkan %spv_file_s | FileCheck %s - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint GLCompute %main "main" - OpExecutionMode %main LocalSize 1 1 1 - OpSource GLSL 450 - OpName %main "main" - OpDecorate %uniform_semantics DescriptorSet 0 - OpDecorate %uniform_semantics Binding 0 +; RUN: spirv-ll-tool -a OpenCL -b 64 %spv_file_s | FileCheck %s + OpCapability Kernel + OpCapability Addresses + OpMemoryModel Physical64 OpenCL + OpEntryPoint Kernel %testfn "testfn" + OpName %testfn "testfn" %void = OpTypeVoid - %4 = OpTypeFunction %void %uint = OpTypeInt 32 0 -%ptr_uniform_uint = OpTypePointer Uniform %uint + %4 = OpTypeFunction %void %uint %uint_2 = OpConstant %uint 2 -%uniform_semantics = OpVariable %ptr_uniform_uint Uniform - %main = OpFunction %void None %4 + %testfn = OpFunction %void None %4 +%input_semantics = OpFunctionParameter %uint %8 = OpLabel - %9 = OpLoad %uint %uniform_semantics - OpMemoryBarrier %uint_2 %9 + OpMemoryBarrier %uint_2 %input_semantics OpReturn OpFunctionEnd -; CHECK: define spir_kernel void @main(ptr addrspace(1){{( %0)?}}, ptr addrspace(1){{( %1)?}}) -; CHECK: [[SEMANTICS:%[a-zA-Z0-9]+]] = load i32, ptr addrspace(1) {{%[a-zA-Z0-9_]+}} +; CHECK: define spir_kernel void @testfn(i32 [[SEMANTICS:%.*]]) ; CHECK: call spir_func void @__mux_mem_barrier(i32 2, i32 [[SEMANTICS]]) From 50a4a49d140a44379552c8195f2d7f32a54bad1a Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 9 Nov 2023 17:07:24 +0000 Subject: [PATCH 28/35] [spirv-ll] Fix test using OpConvertUToPtr without physical addressing --- .../test/spvasm/ptr_int_conversions.spvasm | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/modules/compiler/spirv-ll/test/spvasm/ptr_int_conversions.spvasm b/modules/compiler/spirv-ll/test/spvasm/ptr_int_conversions.spvasm index b6437c070..dc91be220 100644 --- a/modules/compiler/spirv-ll/test/spvasm/ptr_int_conversions.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/ptr_int_conversions.spvasm @@ -15,17 +15,14 @@ ; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} -; RUN: spirv-ll-tool -a Vulkan -c Addresses -c Float64 -c Int64 %spv_file_s | FileCheck %s - OpCapability Shader +; RUN: spirv-ll-tool -a OpenCL -b 64 -c Addresses -c Float64 -c Int64 %spv_file_s | FileCheck %s + OpCapability Kernel OpCapability Addresses OpCapability Float64 OpCapability Int64 - %1 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint GLCompute %main "main" - OpExecutionMode %main LocalSize 1 1 1 - OpSource GLSL 450 - OpName %main "main" + OpMemoryModel Physical64 OpenCL + OpEntryPoint Kernel %testfn "testfn" + OpName %testfn "testfn" OpName %ptr "ptr" OpName %a "a" %void = OpTypeVoid @@ -38,7 +35,7 @@ %12 = OpConstantComposite %_arr_uint_7 %11 %11 %_ptr_Function_uint = OpTypePointer Function %uint %16 = OpConstant %uint 1 - %main = OpFunction %void None %3 + %testfn = OpFunction %void None %3 %5 = OpLabel %ptr = OpVariable %_ptr_Function__arr_uint_7 Function %a = OpVariable %_ptr_Function_uint Function @@ -51,7 +48,7 @@ OpReturn OpFunctionEnd ; CHECK: ; ModuleID = '{{.*}}' -; CHECK: define spir_kernel void @main() +; CHECK: define spir_kernel void @testfn() ; CHECK: {{[%@][-a-zA-Z$._0-9][-a-zA-Z$._0-9]*}} = alloca [2 x i32] ; CHECK: {{[%@][-a-zA-Z$._0-9][-a-zA-Z$._0-9]*}} = alloca i32 ; CHECK: store [2 x i32] [i32 42, i32 42], ptr {{[%@][-a-zA-Z$._0-9][-a-zA-Z$._0-9]*}} From 6c83495a3a592da93f3994d2f1c9206afdacaf35 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Mon, 13 Nov 2023 11:13:50 +0000 Subject: [PATCH 29/35] [spirv-ll] Move some tests with invalid SPIR-V into a subdirectory --- modules/compiler/spirv-ll/test/spvasm/CMakeLists.txt | 9 ++++++--- .../spirv-ll/test/spvasm/invalid-spir-v/README.md | 6 ++++++ .../ext_variable_pointers_op_variable.spvasm | 0 .../{ => invalid-spir-v}/invalid_storage_class.spvasm | 0 4 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 modules/compiler/spirv-ll/test/spvasm/invalid-spir-v/README.md rename modules/compiler/spirv-ll/test/spvasm/{ => invalid-spir-v}/ext_variable_pointers_op_variable.spvasm (100%) rename modules/compiler/spirv-ll/test/spvasm/{ => invalid-spir-v}/invalid_storage_class.spvasm (100%) diff --git a/modules/compiler/spirv-ll/test/spvasm/CMakeLists.txt b/modules/compiler/spirv-ll/test/spvasm/CMakeLists.txt index 88b1705d0..3589cb191 100644 --- a/modules/compiler/spirv-ll/test/spvasm/CMakeLists.txt +++ b/modules/compiler/spirv-ll/test/spvasm/CMakeLists.txt @@ -22,7 +22,6 @@ endif() set(SPVASM_FILES debug_info.spvasm - ext_variable_pointers_op_variable.spvasm ext_variable_pointers_function_call.spvasm op_atomic_and_function.spvasm op_atomic_and_generic.spvasm @@ -2150,7 +2149,10 @@ set(SPVASM_FILES op_opencl_arg_md.spvasm unsupported_capability.spvasm op_get_kernel_preferred_work_group_size_multiple.spvasm - invalid_storage_class.spvasm + + # Tests that check behaviour on invalid SPIR-V + invalid-spir-v/invalid_storage_class.spvasm + invalid-spir-v/ext_variable_pointers_op_variable.spvasm ) if(SpirvAsVersion VERSION_GREATER_EQUAL "2020.0") @@ -2217,10 +2219,11 @@ function(ca_assemble_spirv_ll_lit_test) set(spvasm "${args_UNPARSED_ARGUMENTS}") get_filename_component(name ${spvasm} NAME_WE) + get_filename_component(dir ${spvasm} DIRECTORY) set(test ${CMAKE_CURRENT_BINARY_DIR}/${spvasm}) set(spvasm ${CMAKE_CURRENT_SOURCE_DIR}/${spvasm}) - set(spv ${CMAKE_CURRENT_BINARY_DIR}/${name}.spv) + set(spv ${CMAKE_CURRENT_BINARY_DIR}/${dir}/${name}.spv) if(NOT EXISTS ${spvasm}) message(FATAL_ERROR "spirv-ll input spvasm does not exist: ${spvasm}") endif() diff --git a/modules/compiler/spirv-ll/test/spvasm/invalid-spir-v/README.md b/modules/compiler/spirv-ll/test/spvasm/invalid-spir-v/README.md new file mode 100644 index 000000000..589ea4026 --- /dev/null +++ b/modules/compiler/spirv-ll/test/spvasm/invalid-spir-v/README.md @@ -0,0 +1,6 @@ +This directory contains tests which are invalid SPIR-V as per the +specification, but which we want to test. For example: + +* Testing that we correctly identify invalid behaviour. +* Testing that we are flexible and accept invalid SPIR-V and generate something + sensible for it. diff --git a/modules/compiler/spirv-ll/test/spvasm/ext_variable_pointers_op_variable.spvasm b/modules/compiler/spirv-ll/test/spvasm/invalid-spir-v/ext_variable_pointers_op_variable.spvasm similarity index 100% rename from modules/compiler/spirv-ll/test/spvasm/ext_variable_pointers_op_variable.spvasm rename to modules/compiler/spirv-ll/test/spvasm/invalid-spir-v/ext_variable_pointers_op_variable.spvasm diff --git a/modules/compiler/spirv-ll/test/spvasm/invalid_storage_class.spvasm b/modules/compiler/spirv-ll/test/spvasm/invalid-spir-v/invalid_storage_class.spvasm similarity index 100% rename from modules/compiler/spirv-ll/test/spvasm/invalid_storage_class.spvasm rename to modules/compiler/spirv-ll/test/spvasm/invalid-spir-v/invalid_storage_class.spvasm From 7991e05f76fefe1353858983787d3ea1079640f7 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Mon, 13 Nov 2023 11:17:16 +0000 Subject: [PATCH 30/35] [spirv-ll] Fix a test allocating a pointer with logical addressing --- .../test/spvasm/op_constant_null_ptr.spvasm | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/modules/compiler/spirv-ll/test/spvasm/op_constant_null_ptr.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_constant_null_ptr.spvasm index bda8982d4..99b97130d 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_constant_null_ptr.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_constant_null_ptr.spvasm @@ -15,16 +15,12 @@ ; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} -; RUN: spirv-ll-tool -a Vulkan -c Float64 -c Int64 %spv_file_s | FileCheck %s - OpCapability Shader - OpCapability Float64 - OpCapability Int64 - %1 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint GLCompute %main "main" - OpExecutionMode %main LocalSize 1 1 1 - OpSource GLSL 450 - OpName %main "main" +; RUN: spirv-ll-tool -a OpenCL -b 64 %spv_file_s | FileCheck %s + OpCapability Kernel + OpCapability Addresses + OpMemoryModel Physical64 OpenCL + OpEntryPoint Kernel %testfn "testfn" + OpName %testfn "testfn" OpName %a "a" %void = OpTypeVoid %5 = OpTypeFunction %void @@ -32,14 +28,14 @@ %ptr = OpTypePointer Function %int %ptr_ptr = OpTypePointer Function %ptr %8 = OpConstantNull %ptr - %main = OpFunction %void None %5 + %testfn = OpFunction %void None %5 %9 = OpLabel %a = OpVariable %ptr_ptr Function OpStore %a %8 OpReturn OpFunctionEnd ; CHECK: ; ModuleID = '{{.*}}' -; CHECK: define spir_kernel void @main() +; CHECK: define spir_kernel void @testfn() ; CHECK: {{[%@][-a-zA-Z$._0-9][-a-zA-Z$._0-9]*}} = alloca ptr ; CHECK: store ptr null, ptr {{[%@][-a-zA-Z$._0-9][-a-zA-Z$._0-9]*}} ; CHECK: ret void From 42fbfb2eac9e8359809db40e3bbcf47bc00d2737 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Mon, 13 Nov 2023 11:23:02 +0000 Subject: [PATCH 31/35] [spirv-ll] Fix a test breaking the storage layout rules --- modules/compiler/spirv-ll/test/spvasm/op_group_decorate.spvasm | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/compiler/spirv-ll/test/spvasm/op_group_decorate.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_group_decorate.spvasm index 4b7949f07..153376259 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_group_decorate.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_group_decorate.spvasm @@ -53,6 +53,7 @@ OpGroupMemberDecorate %offsetGroup %ablock 0 %bblock 0 %cblock 0 %dblock 0 OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId OpDecorate %dblock BufferBlock + OpDecorate %_runtimearr_int ArrayStride 4 OpDecorate %__0 Binding 0 OpDecorate %__1 Binding 1 OpDecorate %__2 Binding 2 From 9f9160478156520b1f056d4d261f42856458b5fd Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Mon, 13 Nov 2023 11:27:44 +0000 Subject: [PATCH 32/35] [spirv-ll] Fix test using mismatched types --- ...omic_compare_exchange_global_signed.spvasm | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/modules/compiler/spirv-ll/test/spvasm/op_atomic_compare_exchange_global_signed.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_atomic_compare_exchange_global_signed.spvasm index 3b423aa75..57e0bc8f1 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_atomic_compare_exchange_global_signed.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_atomic_compare_exchange_global_signed.spvasm @@ -26,26 +26,26 @@ OpDecorate %block_t Block OpDecorate %block_var DescriptorSet 0 OpDecorate %block_var Binding 0 - %void = OpTypeVoid - %uint = OpTypeInt 32 0 - %int = OpTypeInt 32 1 - %block_t = OpTypeStruct %int + OpMemberDecorate %block_t 0 Offset 0 + %void = OpTypeVoid + %int = OpTypeInt 32 1 + %block_t = OpTypeStruct %int %ptr_Uniform_block_t = OpTypePointer Uniform %block_t -%ptr_Uniform_int = OpTypePointer Uniform %int - %3 = OpTypeFunction %void - %9 = OpConstant %int 424 - %uint_1 = OpConstant %uint 1 - %uint_0 = OpConstant %uint 0 -%block_var = OpVariable %ptr_Uniform_block_t Uniform - %atomic = OpFunction %void None %3 - %5 = OpLabel - %a = OpAccessChain %ptr_Uniform_int %block_var %uint_0 -%original = OpAtomicCompareExchange %int %a %uint_1 %uint_0 %uint_0 %9 %uint_0 - OpReturn - OpFunctionEnd + %ptr_Uniform_int = OpTypePointer Uniform %int + %3 = OpTypeFunction %void + %9 = OpConstant %int 424 + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 + %block_var = OpVariable %ptr_Uniform_block_t Uniform + %atomic = OpFunction %void None %3 + %5 = OpLabel + %a = OpAccessChain %ptr_Uniform_int %block_var %int_0 + %original = OpAtomicCompareExchange %int %a %int_1 %int_0 %int_0 %9 %int_0 + OpReturn + OpFunctionEnd ; CHECK: ; ModuleID = '{{.*}}' ; CHECK: define spir_kernel void @atomic(ptr addrspace(1){{( %0)?}}, ptr addrspace(1){{( %1)?}}) ; CHECK: [[PTR:%[a-zA-Z0-9_]+]] = getelementptr [[BLOCK:%.*]], ptr addrspace(1) [[BLOCK]], i32 0, i32 0 -; CHECK: {{%[a-zA-Z0-9_]+}} = call spir_func i32 @_Z14atomic_cmpxchgPU3AS1Viji(ptr addrspace(1) [[PTR]], i32 0, i32 424) +; CHECK: {{%[a-zA-Z0-9_]+}} = call spir_func i32 @_Z14atomic_cmpxchgPU3AS1Viii(ptr addrspace(1) [[PTR]], i32 0, i32 424) ; CHECK: ret void -; CHECK: declare spir_func i32 @_Z14atomic_cmpxchgPU3AS1Viji(ptr addrspace(1), i32, i32) +; CHECK: declare spir_func i32 @_Z14atomic_cmpxchgPU3AS1Viii(ptr addrspace(1), i32, i32) From 293d632a92c6be549bc6dc92f4f185a123dd1b88 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Mon, 13 Nov 2023 11:35:58 +0000 Subject: [PATCH 33/35] [spirv-ll] Move some tests testing codeplay extensions into a subdirectory --- modules/compiler/spirv-ll/test/spvasm/CMakeLists.txt | 10 +++++++--- .../{ => codeplay}/opencl_group_async_copy_2d2d.spvasm | 0 .../{ => codeplay}/opencl_group_async_copy_3d3d.spvasm | 0 .../opencl_usm_generic_address_space.spvasm | 0 4 files changed, 7 insertions(+), 3 deletions(-) rename modules/compiler/spirv-ll/test/spvasm/{ => codeplay}/opencl_group_async_copy_2d2d.spvasm (100%) rename modules/compiler/spirv-ll/test/spvasm/{ => codeplay}/opencl_group_async_copy_3d3d.spvasm (100%) rename modules/compiler/spirv-ll/test/spvasm/{ => codeplay}/opencl_usm_generic_address_space.spvasm (100%) diff --git a/modules/compiler/spirv-ll/test/spvasm/CMakeLists.txt b/modules/compiler/spirv-ll/test/spvasm/CMakeLists.txt index 3589cb191..dde645f6f 100644 --- a/modules/compiler/spirv-ll/test/spvasm/CMakeLists.txt +++ b/modules/compiler/spirv-ll/test/spvasm/CMakeLists.txt @@ -2105,7 +2105,6 @@ set(SPVASM_FILES op_vector_swizzle_int.spvasm op_vector_swizzle_long.spvasm op_vector_swizzle_uint.spvasm - opencl_usm_generic_address_space.spvasm ptr_int_conversions.spvasm vec_type_hint_length_1.spvasm op_opencl_u_ctz_i16.spvasm @@ -2153,13 +2152,18 @@ set(SPVASM_FILES # Tests that check behaviour on invalid SPIR-V invalid-spir-v/invalid_storage_class.spvasm invalid-spir-v/ext_variable_pointers_op_variable.spvasm + + # Tests that check non-standard Codeplay extensions + codeplay/opencl_usm_generic_address_space.spvasm ) if(SpirvAsVersion VERSION_GREATER_EQUAL "2020.0") list(APPEND SPVASM_FILES op_execution_mode_max_work_dim.spvasm - opencl_group_async_copy_2d2d.spvasm - opencl_group_async_copy_3d3d.spvasm) + # Tests that check non-standard Codeplay extensions + codeplay/opencl_group_async_copy_2d2d.spvasm + codeplay/opencl_group_async_copy_3d3d.spvasm + ) endif() if (SpirvAsVersion VERSION_GREATER_EQUAL "2021.3") diff --git a/modules/compiler/spirv-ll/test/spvasm/opencl_group_async_copy_2d2d.spvasm b/modules/compiler/spirv-ll/test/spvasm/codeplay/opencl_group_async_copy_2d2d.spvasm similarity index 100% rename from modules/compiler/spirv-ll/test/spvasm/opencl_group_async_copy_2d2d.spvasm rename to modules/compiler/spirv-ll/test/spvasm/codeplay/opencl_group_async_copy_2d2d.spvasm diff --git a/modules/compiler/spirv-ll/test/spvasm/opencl_group_async_copy_3d3d.spvasm b/modules/compiler/spirv-ll/test/spvasm/codeplay/opencl_group_async_copy_3d3d.spvasm similarity index 100% rename from modules/compiler/spirv-ll/test/spvasm/opencl_group_async_copy_3d3d.spvasm rename to modules/compiler/spirv-ll/test/spvasm/codeplay/opencl_group_async_copy_3d3d.spvasm diff --git a/modules/compiler/spirv-ll/test/spvasm/opencl_usm_generic_address_space.spvasm b/modules/compiler/spirv-ll/test/spvasm/codeplay/opencl_usm_generic_address_space.spvasm similarity index 100% rename from modules/compiler/spirv-ll/test/spvasm/opencl_usm_generic_address_space.spvasm rename to modules/compiler/spirv-ll/test/spvasm/codeplay/opencl_usm_generic_address_space.spvasm From f6443dafa3162d9d483b4fb359cc2044d2ccbcfb Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Mon, 13 Nov 2023 11:45:27 +0000 Subject: [PATCH 34/35] [spirv-ll] Fix test so that it's not invalid The intention was really to use the 'VariablePointers' capability, which I'd missed earlier. I thought we were being flexible. --- modules/compiler/spirv-ll/test/spvasm/CMakeLists.txt | 2 +- .../ext_variable_pointers_op_variable.spvasm | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) rename modules/compiler/spirv-ll/test/spvasm/{invalid-spir-v => }/ext_variable_pointers_op_variable.spvasm (90%) diff --git a/modules/compiler/spirv-ll/test/spvasm/CMakeLists.txt b/modules/compiler/spirv-ll/test/spvasm/CMakeLists.txt index dde645f6f..ff3799fe7 100644 --- a/modules/compiler/spirv-ll/test/spvasm/CMakeLists.txt +++ b/modules/compiler/spirv-ll/test/spvasm/CMakeLists.txt @@ -22,6 +22,7 @@ endif() set(SPVASM_FILES debug_info.spvasm + ext_variable_pointers_op_variable.spvasm ext_variable_pointers_function_call.spvasm op_atomic_and_function.spvasm op_atomic_and_generic.spvasm @@ -2151,7 +2152,6 @@ set(SPVASM_FILES # Tests that check behaviour on invalid SPIR-V invalid-spir-v/invalid_storage_class.spvasm - invalid-spir-v/ext_variable_pointers_op_variable.spvasm # Tests that check non-standard Codeplay extensions codeplay/opencl_usm_generic_address_space.spvasm diff --git a/modules/compiler/spirv-ll/test/spvasm/invalid-spir-v/ext_variable_pointers_op_variable.spvasm b/modules/compiler/spirv-ll/test/spvasm/ext_variable_pointers_op_variable.spvasm similarity index 90% rename from modules/compiler/spirv-ll/test/spvasm/invalid-spir-v/ext_variable_pointers_op_variable.spvasm rename to modules/compiler/spirv-ll/test/spvasm/ext_variable_pointers_op_variable.spvasm index 8da0cc96d..4292975b2 100644 --- a/modules/compiler/spirv-ll/test/spvasm/invalid-spir-v/ext_variable_pointers_op_variable.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/ext_variable_pointers_op_variable.spvasm @@ -15,12 +15,14 @@ ; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} -; RUN: spirv-ll-tool -a Vulkan -c Float64 -c Int64 %spv_file_s | FileCheck %s +; RUN: spirv-ll-tool -a Vulkan -c VariablePointers -e SPV_KHR_variable_pointers %spv_file_s | FileCheck %s + ; tests that variable pointers (pointer to pointer type) can be created and that ; they can be produced from an OpConstantNull in accordance with the spec + OpCapability Shader - OpCapability Float64 - OpCapability Int64 + OpCapability VariablePointers + OpExtension "SPV_KHR_variable_pointers" %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" From 3382276f68a5cd534af6f5099f19eb5729cad832 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Mon, 13 Nov 2023 11:58:58 +0000 Subject: [PATCH 35/35] [spirv-ll] Fix two tests using OpTypeBool and OpVariable These can only be used with Workgroup, CrossWorkgroup, Private and Function storage classes. --- .../spvasm/op_spec_constant_false_bool.spvasm | 23 ++++++++----------- .../spvasm/op_spec_constant_true_bool.spvasm | 23 ++++++++----------- 2 files changed, 18 insertions(+), 28 deletions(-) diff --git a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_false_bool.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_false_bool.spvasm index 582fc32a3..225e72645 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_false_bool.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_false_bool.spvasm @@ -15,10 +15,8 @@ ; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} -; RUN: spirv-ll-tool -a Vulkan -c Float64 -c Int64 %spv_file_s | FileCheck %s +; RUN: spirv-ll-tool -a Vulkan %spv_file_s | FileCheck %s OpCapability Shader - OpCapability Float64 - OpCapability Int64 %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" @@ -29,29 +27,26 @@ OpMemberName %a_block 0 "test_out" OpName %_ "" OpMemberDecorate %a_block 0 Offset 0 - OpDecorate %a_block BufferBlock - OpDecorate %_ DescriptorSet 0 - OpDecorate %_ Binding 0 OpDecorate %11 SpecId 0 %void = OpTypeVoid %3 = OpTypeFunction %void %bool = OpTypeBool %idx_type = OpTypeInt 32 0 %a_block = OpTypeStruct %bool -%ptr_Uniform_block = OpTypePointer Uniform %a_block - %_ = OpVariable %ptr_Uniform_block Uniform +%ptr_Uniform_block = OpTypePointer Workgroup %a_block + %_ = OpVariable %ptr_Uniform_block Workgroup %10 = OpConstant %idx_type 0 %11 = OpSpecConstantFalse %bool ; testing this -%ptr_Uniform_bool = OpTypePointer Uniform %bool +%ptr_Uniform_bool = OpTypePointer Workgroup %bool %main = OpFunction %void None %3 %5 = OpLabel %13 = OpAccessChain %ptr_Uniform_bool %_ %10 OpStore %13 %11 OpReturn OpFunctionEnd -; CHECK: ; ModuleID = '{{.*}}' -; CHECK: [[a_block:%[a-zA-Z0-9_]+]] = type { i1 } -; CHECK: define spir_kernel void @main(ptr addrspace(1){{( %0)?}}, ptr addrspace(1){{( %1)?}}) -; CHECK: [[anon:%[a-zA-Z0-9]+]] = getelementptr [[a_block]], ptr addrspace(1) {{%[a-zA-Z0-9]+}}, i32 0, i32 0 -; CHECK: store i1 false, ptr addrspace(1) [[anon]] +; CHECK: [[a_block:%.*]] = type { i1 } +; CHECK: [[global:@.*]] = internal addrspace(3) global [[a_block]] undef +; CHECK: define spir_kernel void @main() +; CHECK: [[anon:%.*]] = getelementptr [[a_block]], ptr addrspace(3) [[global]], i32 0, i32 0 +; CHECK: store i1 false, ptr addrspace(3) [[anon]] ; CHECK: ret void diff --git a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_true_bool.spvasm b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_true_bool.spvasm index 0ebef9717..d34754f46 100644 --- a/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_true_bool.spvasm +++ b/modules/compiler/spirv-ll/test/spvasm/op_spec_constant_true_bool.spvasm @@ -15,10 +15,8 @@ ; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %} -; RUN: spirv-ll-tool -a Vulkan -c Float64 -c Int64 %spv_file_s | FileCheck %s +; RUN: spirv-ll-tool -a Vulkan %spv_file_s | FileCheck %s OpCapability Shader - OpCapability Float64 - OpCapability Int64 %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" @@ -29,29 +27,26 @@ OpMemberName %a_block 0 "test_out" OpName %_ "" OpMemberDecorate %a_block 0 Offset 0 - OpDecorate %a_block BufferBlock - OpDecorate %_ DescriptorSet 0 - OpDecorate %_ Binding 0 OpDecorate %11 SpecId 0 %void = OpTypeVoid %3 = OpTypeFunction %void %bool = OpTypeBool %idx_type = OpTypeInt 32 0 %a_block = OpTypeStruct %bool -%ptr_Uniform_block = OpTypePointer Uniform %a_block - %_ = OpVariable %ptr_Uniform_block Uniform +%ptr_Uniform_block = OpTypePointer Workgroup %a_block + %_ = OpVariable %ptr_Uniform_block Workgroup %10 = OpConstant %idx_type 0 %11 = OpSpecConstantTrue %bool ; testing this -%ptr_Uniform_bool = OpTypePointer Uniform %bool +%ptr_Uniform_bool = OpTypePointer Workgroup %bool %main = OpFunction %void None %3 %5 = OpLabel %13 = OpAccessChain %ptr_Uniform_bool %_ %10 OpStore %13 %11 OpReturn OpFunctionEnd -; CHECK: ; ModuleID = '{{.*}}' -; CHECK: [[a_block:%[a-zA-Z0-9_]+]] = type { i1 } -; CHECK: define spir_kernel void @main(ptr addrspace(1){{( %0)?}}, ptr addrspace(1){{( %1)?}}) -; CHECK: [[anon:%[a-zA-Z0-9]+]] = getelementptr [[a_block]], ptr addrspace(1) {{%[a-zA-Z0-9]+}}, i32 0, i32 0 -; CHECK: store i1 true, ptr addrspace({{[0-9]}}) [[anon]] +; CHECK: [[a_block:%.*]] = type { i1 } +; CHECK: [[global:@.*]] = internal addrspace(3) global [[a_block]] undef +; CHECK: define spir_kernel void @main() +; CHECK: [[anon:%.*]] = getelementptr [[a_block]], ptr addrspace(3) [[global]], i32 0, i32 0 +; CHECK: store i1 true, ptr addrspace(3) [[anon]] ; CHECK: ret void