diff --git a/mlir/docs/Dialects/SPIR-V.md b/mlir/docs/Dialects/SPIR-V.md --- a/mlir/docs/Dialects/SPIR-V.md +++ b/mlir/docs/Dialects/SPIR-V.md @@ -178,7 +178,7 @@ * Global variables are defined with the `spv.globalVariable` op. They do not generate SSA values. Instead they have symbols and should be referenced via - symbols. To use global variables in a function block, `spv._address_of` is + symbols. To use global variables in a function block, `spv.mlir.address_of` is needed to turn the symbol into an SSA value. * Specialization constants are defined with the `spv.specConstant` op. Similar to global variables, they do not generate SSA values and have symbols for @@ -968,7 +968,7 @@ * `OpVariable` instructions will be converted to `spv.globalVariable` ops if in module-level; otherwise they will be converted into `spv.Variable` ops. * Every use of a module-level `OpVariable` instruction will materialize a - `spv._address_of` op to turn the symbol of the corresponding + `spv.mlir.address_of` op to turn the symbol of the corresponding `spv.globalVariable` into an SSA value. * Every use of a `OpSpecConstant` instruction will materialize a `spv._reference_of` op to turn the symbol of the corresponding @@ -1054,7 +1054,7 @@ * Creates `spv.globalVariable`s for the arguments, and replaces all uses of the argument with this variable. The SSA value used for replacement is - obtained using the `spv._address_of` operation. + obtained using the `spv.mlir.address_of` operation. * Adds the `spv.EntryPoint` and `spv.ExecutionMode` operations into the `spv.module` for the entry function. @@ -1068,10 +1068,10 @@ #### Creating builtin variables In SPIR-V dialect, builtins are represented using `spv.globalVariable`s, with -`spv._address_of` used to get a handle to the builtin as an SSA value. The +`spv.mlir.address_of` used to get a handle to the builtin as an SSA value. The method `mlir::spirv::getBuiltinVariableValue` creates a `spv.globalVariable` for the builtin in the current `spv.module` if it does not exist already, and -returns an SSA value generated from an `spv._address_of` operation. +returns an SSA value generated from an `spv.mlir.address_of` operation. ### Current conversions to SPIR-V diff --git a/mlir/docs/SPIRVToLLVMDialectConversion.md b/mlir/docs/SPIRVToLLVMDialectConversion.md --- a/mlir/docs/SPIRVToLLVMDialectConversion.md +++ b/mlir/docs/SPIRVToLLVMDialectConversion.md @@ -452,14 +452,14 @@ Otherwise the conversion fails as other cases (`MakePointerAvailable`, `MakePointerVisible`, `NonPrivatePointer`) are not supported yet. -#### `spv.globalVariable` and `spv._address_of` +#### `spv.globalVariable` and `spv.mlir.address_of` `spv.globalVariable` is modelled with `llvm.mlir.global` op. However, there is a difference that has to be pointed out. In SPIR-V dialect, the global variable returns a pointer, whereas in LLVM dialect the global holds an actual value. This difference is handled by -`spv._address_of` and `llvm.mlir.addressof` ops that both return a pointer and +`spv.mlir.address_of` and `llvm.mlir.addressof` ops that both return a pointer and are used to reference the global. ```mlir @@ -467,7 +467,7 @@ spv.module Logical GLSL450 { spv.globalVariable @struct : !spv.ptr>, Private> spv.func @func() -> () "None" { - %0 = spv._address_of @struct : !spv.ptr>, Private> + %0 = spv.mlir.address_of @struct : !spv.ptr>, Private> spv.Return } } diff --git a/mlir/include/mlir/Dialect/SPIRV/SPIRVStructureOps.td b/mlir/include/mlir/Dialect/SPIRV/SPIRVStructureOps.td --- a/mlir/include/mlir/Dialect/SPIRV/SPIRVStructureOps.td +++ b/mlir/include/mlir/Dialect/SPIRV/SPIRVStructureOps.td @@ -22,7 +22,7 @@ // ----- -def SPV_AddressOfOp : SPV_Op<"_address_of", [InFunctionScope, NoSideEffect]> { +def SPV_AddressOfOp : SPV_Op<"mlir.address_of", [InFunctionScope, NoSideEffect]> { let summary = "Get the address of a global variable."; let description = [{ @@ -37,14 +37,14 @@ ``` - spv-address-of-op ::= ssa-id `=` `spv._address_of` symbol-ref-id + spv-address-of-op ::= ssa-id `=` `spv.mlir.address_of` symbol-ref-id `:` spirv-pointer-type ``` #### Example: ```mlir - %0 = spv._address_of @global_var : !spv.ptr + %0 = spv.mlir.address_of @global_var : !spv.ptr ``` }]; diff --git a/mlir/lib/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.cpp b/mlir/lib/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.cpp --- a/mlir/lib/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.cpp +++ b/mlir/lib/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.cpp @@ -712,8 +712,8 @@ /// Converts `spv.globalVariable` to `llvm.mlir.global`. Note that SPIR-V global /// returns a pointer, whereas in LLVM dialect the global holds an actual value. -/// This difference is handled by `spv._address_of` and `llvm.mlir.addressof`ops -/// that both return a pointer. +/// This difference is handled by `spv.mlir.address_of` and +/// `llvm.mlir.addressof`ops that both return a pointer. class GlobalVariablePattern : public SPIRVToLLVMConversion { public: diff --git a/mlir/lib/Dialect/SPIRV/SPIRVOps.cpp b/mlir/lib/Dialect/SPIRV/SPIRVOps.cpp --- a/mlir/lib/Dialect/SPIRV/SPIRVOps.cpp +++ b/mlir/lib/Dialect/SPIRV/SPIRVOps.cpp @@ -1036,7 +1036,7 @@ } //===----------------------------------------------------------------------===// -// spv._address_of +// spv.mlir.address_of //===----------------------------------------------------------------------===// void spirv::AddressOfOp::build(OpBuilder &builder, OperationState &state, diff --git a/mlir/lib/Dialect/SPIRV/Serialization/Deserializer.cpp b/mlir/lib/Dialect/SPIRV/Serialization/Deserializer.cpp --- a/mlir/lib/Dialect/SPIRV/Serialization/Deserializer.cpp +++ b/mlir/lib/Dialect/SPIRV/Serialization/Deserializer.cpp @@ -399,8 +399,9 @@ /// Get the Value associated with a result . /// /// This method materializes normal constants and inserts "casting" ops - /// (`spv._address_of` and `spv._reference_of`) to turn an symbol into a SSA - /// value for handling uses of module scope constants/variables in functions. + /// (`spv.mlir.address_of` and `spv._reference_of`) to turn an symbol into a + /// SSA value for handling uses of module scope constants/variables in + /// functions. Value getValue(uint32_t id); /// Slices the first instruction out of `binary` and returns its opcode and diff --git a/mlir/test/Conversion/GPUToSPIRV/builtins.mlir b/mlir/test/Conversion/GPUToSPIRV/builtins.mlir --- a/mlir/test/Conversion/GPUToSPIRV/builtins.mlir +++ b/mlir/test/Conversion/GPUToSPIRV/builtins.mlir @@ -13,7 +13,7 @@ gpu.module @kernels { gpu.func @builtin_workgroup_id_x() kernel attributes {spv.entry_point_abi = {local_size = dense<[16, 1, 1]>: vector<3xi32>}} { - // CHECK: [[ADDRESS:%.*]] = spv._address_of [[WORKGROUPID]] + // CHECK: [[ADDRESS:%.*]] = spv.mlir.address_of [[WORKGROUPID]] // CHECK-NEXT: [[VEC:%.*]] = spv.Load "Input" [[ADDRESS]] // CHECK-NEXT: {{%.*}} = spv.CompositeExtract [[VEC]]{{\[}}0 : i32{{\]}} %0 = "gpu.block_id"() {dimension = "x"} : () -> index @@ -37,7 +37,7 @@ gpu.module @kernels { gpu.func @builtin_workgroup_id_y() kernel attributes {spv.entry_point_abi = {local_size = dense<[16, 1, 1]>: vector<3xi32>}} { - // CHECK: [[ADDRESS:%.*]] = spv._address_of [[WORKGROUPID]] + // CHECK: [[ADDRESS:%.*]] = spv.mlir.address_of [[WORKGROUPID]] // CHECK-NEXT: [[VEC:%.*]] = spv.Load "Input" [[ADDRESS]] // CHECK-NEXT: {{%.*}} = spv.CompositeExtract [[VEC]]{{\[}}1 : i32{{\]}} %0 = "gpu.block_id"() {dimension = "y"} : () -> index @@ -61,7 +61,7 @@ gpu.module @kernels { gpu.func @builtin_workgroup_id_z() kernel attributes {spv.entry_point_abi = {local_size = dense<[16, 1, 1]>: vector<3xi32>}} { - // CHECK: [[ADDRESS:%.*]] = spv._address_of [[WORKGROUPID]] + // CHECK: [[ADDRESS:%.*]] = spv.mlir.address_of [[WORKGROUPID]] // CHECK-NEXT: [[VEC:%.*]] = spv.Load "Input" [[ADDRESS]] // CHECK-NEXT: {{%.*}} = spv.CompositeExtract [[VEC]]{{\[}}2 : i32{{\]}} %0 = "gpu.block_id"() {dimension = "z"} : () -> index @@ -154,7 +154,7 @@ gpu.module @kernels { gpu.func @builtin_local_id_x() kernel attributes {spv.entry_point_abi = {local_size = dense<[16, 1, 1]>: vector<3xi32>}} { - // CHECK: [[ADDRESS:%.*]] = spv._address_of [[LOCALINVOCATIONID]] + // CHECK: [[ADDRESS:%.*]] = spv.mlir.address_of [[LOCALINVOCATIONID]] // CHECK-NEXT: [[VEC:%.*]] = spv.Load "Input" [[ADDRESS]] // CHECK-NEXT: {{%.*}} = spv.CompositeExtract [[VEC]]{{\[}}0 : i32{{\]}} %0 = "gpu.thread_id"() {dimension = "x"} : () -> index @@ -178,7 +178,7 @@ gpu.module @kernels { gpu.func @builtin_num_workgroups_x() kernel attributes {spv.entry_point_abi = {local_size = dense<[16, 1, 1]>: vector<3xi32>}} { - // CHECK: [[ADDRESS:%.*]] = spv._address_of [[NUMWORKGROUPS]] + // CHECK: [[ADDRESS:%.*]] = spv.mlir.address_of [[NUMWORKGROUPS]] // CHECK-NEXT: [[VEC:%.*]] = spv.Load "Input" [[ADDRESS]] // CHECK-NEXT: {{%.*}} = spv.CompositeExtract [[VEC]]{{\[}}0 : i32{{\]}} %0 = "gpu.grid_dim"() {dimension = "x"} : () -> index @@ -195,7 +195,7 @@ gpu.module @kernels { gpu.func @builtin_subgroup_id() kernel attributes {spv.entry_point_abi = {local_size = dense<[16, 1, 1]>: vector<3xi32>}} { - // CHECK: [[ADDRESS:%.*]] = spv._address_of [[SUBGROUPID]] + // CHECK: [[ADDRESS:%.*]] = spv.mlir.address_of [[SUBGROUPID]] // CHECK-NEXT: {{%.*}} = spv.Load "Input" [[ADDRESS]] %0 = gpu.subgroup_id : index gpu.return @@ -211,7 +211,7 @@ gpu.module @kernels { gpu.func @builtin_num_subgroups() kernel attributes {spv.entry_point_abi = {local_size = dense<[16, 1, 1]>: vector<3xi32>}} { - // CHECK: [[ADDRESS:%.*]] = spv._address_of [[NUMSUBGROUPS]] + // CHECK: [[ADDRESS:%.*]] = spv.mlir.address_of [[NUMSUBGROUPS]] // CHECK-NEXT: {{%.*}} = spv.Load "Input" [[ADDRESS]] %0 = gpu.num_subgroups : index gpu.return @@ -227,7 +227,7 @@ gpu.module @kernels { gpu.func @builtin_subgroup_size() kernel attributes {spv.entry_point_abi = {local_size = dense<[16, 1, 1]>: vector<3xi32>}} { - // CHECK: [[ADDRESS:%.*]] = spv._address_of [[SUBGROUPSIZE]] + // CHECK: [[ADDRESS:%.*]] = spv.mlir.address_of [[SUBGROUPSIZE]] // CHECK-NEXT: {{%.*}} = spv.Load "Input" [[ADDRESS]] %0 = gpu.subgroup_size : index gpu.return diff --git a/mlir/test/Conversion/GPUToSPIRV/load-store.mlir b/mlir/test/Conversion/GPUToSPIRV/load-store.mlir --- a/mlir/test/Conversion/GPUToSPIRV/load-store.mlir +++ b/mlir/test/Conversion/GPUToSPIRV/load-store.mlir @@ -37,10 +37,10 @@ // CHECK-SAME: %[[ARG6:.*]]: i32 {spv.interface_var_abi = #spv.interface_var_abi<(0, 6), StorageBuffer>} gpu.func @load_store_kernel(%arg0: memref<12x4xf32>, %arg1: memref<12x4xf32>, %arg2: memref<12x4xf32>, %arg3: index, %arg4: index, %arg5: index, %arg6: index) kernel attributes {spv.entry_point_abi = {local_size = dense<[16, 1, 1]>: vector<3xi32>}} { - // CHECK: %[[ADDRESSWORKGROUPID:.*]] = spv._address_of @[[$WORKGROUPIDVAR]] + // CHECK: %[[ADDRESSWORKGROUPID:.*]] = spv.mlir.address_of @[[$WORKGROUPIDVAR]] // CHECK: %[[WORKGROUPID:.*]] = spv.Load "Input" %[[ADDRESSWORKGROUPID]] // CHECK: %[[WORKGROUPIDX:.*]] = spv.CompositeExtract %[[WORKGROUPID]]{{\[}}0 : i32{{\]}} - // CHECK: %[[ADDRESSLOCALINVOCATIONID:.*]] = spv._address_of @[[$LOCALINVOCATIONIDVAR]] + // CHECK: %[[ADDRESSLOCALINVOCATIONID:.*]] = spv.mlir.address_of @[[$LOCALINVOCATIONIDVAR]] // CHECK: %[[LOCALINVOCATIONID:.*]] = spv.Load "Input" %[[ADDRESSLOCALINVOCATIONID]] // CHECK: %[[LOCALINVOCATIONIDX:.*]] = spv.CompositeExtract %[[LOCALINVOCATIONID]]{{\[}}0 : i32{{\]}} %0 = "gpu.block_id"() {dimension = "x"} : () -> index diff --git a/mlir/test/Conversion/GPUToVulkan/lower-gpu-launch-vulkan-launch.mlir b/mlir/test/Conversion/GPUToVulkan/lower-gpu-launch-vulkan-launch.mlir --- a/mlir/test/Conversion/GPUToVulkan/lower-gpu-launch-vulkan-launch.mlir +++ b/mlir/test/Conversion/GPUToVulkan/lower-gpu-launch-vulkan-launch.mlir @@ -8,9 +8,9 @@ spv.module Logical GLSL450 requires #spv.vce { spv.globalVariable @kernel_arg_0 bind(0, 0) : !spv.ptr [0])>, StorageBuffer> spv.func @kernel() "None" attributes {workgroup_attributions = 0 : i64} { - %0 = spv._address_of @kernel_arg_0 : !spv.ptr [0])>, StorageBuffer> + %0 = spv.mlir.address_of @kernel_arg_0 : !spv.ptr [0])>, StorageBuffer> %2 = spv.constant 0 : i32 - %3 = spv._address_of @kernel_arg_0 : !spv.ptr [0])>, StorageBuffer> + %3 = spv.mlir.address_of @kernel_arg_0 : !spv.ptr [0])>, StorageBuffer> %4 = spv.AccessChain %0[%2, %2] : !spv.ptr [0])>, StorageBuffer>, i32, i32 %5 = spv.Load "StorageBuffer" %4 : f32 spv.Return diff --git a/mlir/test/Conversion/SPIRVToLLVM/lower-host-to-llvm-calls.mlir b/mlir/test/Conversion/SPIRVToLLVM/lower-host-to-llvm-calls.mlir --- a/mlir/test/Conversion/SPIRVToLLVM/lower-host-to-llvm-calls.mlir +++ b/mlir/test/Conversion/SPIRVToLLVM/lower-host-to-llvm-calls.mlir @@ -24,7 +24,7 @@ spv.module @__spv__foo Logical GLSL450 requires #spv.vce { spv.globalVariable @bar_arg_0 bind(0, 0) : !spv.ptr [0])>, StorageBuffer> spv.func @bar() "None" attributes {workgroup_attributions = 0 : i64} { - %0 = spv._address_of @bar_arg_0 : !spv.ptr [0])>, StorageBuffer> + %0 = spv.mlir.address_of @bar_arg_0 : !spv.ptr [0])>, StorageBuffer> spv.Return } spv.EntryPoint "GLCompute" @bar diff --git a/mlir/test/Conversion/SPIRVToLLVM/memory-ops-to-llvm.mlir b/mlir/test/Conversion/SPIRVToLLVM/memory-ops-to-llvm.mlir --- a/mlir/test/Conversion/SPIRVToLLVM/memory-ops-to-llvm.mlir +++ b/mlir/test/Conversion/SPIRVToLLVM/memory-ops-to-llvm.mlir @@ -26,7 +26,7 @@ } //===----------------------------------------------------------------------===// -// spv.globalVariable and spv._address_of +// spv.globalVariable and spv.mlir.address_of //===----------------------------------------------------------------------===// spv.module Logical GLSL450 { @@ -40,7 +40,7 @@ // CHECK: llvm.mlir.addressof @struct : !llvm.ptr)>> spv.globalVariable @struct : !spv.ptr)>, Private> spv.func @func() "None" { - %0 = spv._address_of @struct : !spv.ptr)>, Private> + %0 = spv.mlir.address_of @struct : !spv.ptr)>, Private> spv.Return } } @@ -51,7 +51,7 @@ // CHECK: llvm.mlir.addressof @bar_descriptor_set0_binding0 : !llvm.ptr spv.globalVariable @bar bind(0, 0) : !spv.ptr spv.func @foo() "None" { - %0 = spv._address_of @bar : !spv.ptr + %0 = spv.mlir.address_of @bar : !spv.ptr spv.Return } } @@ -62,7 +62,7 @@ // CHECK: llvm.mlir.addressof @name_bar_descriptor_set0_binding0 : !llvm.ptr spv.globalVariable @bar bind(0, 0) : !spv.ptr spv.func @foo() "None" { - %0 = spv._address_of @bar : !spv.ptr + %0 = spv.mlir.address_of @bar : !spv.ptr spv.Return } } diff --git a/mlir/test/Conversion/StandardToSPIRV/alloc.mlir b/mlir/test/Conversion/StandardToSPIRV/alloc.mlir --- a/mlir/test/Conversion/StandardToSPIRV/alloc.mlir +++ b/mlir/test/Conversion/StandardToSPIRV/alloc.mlir @@ -20,7 +20,7 @@ // CHECK: spv.globalVariable @[[VAR:.+]] : !spv.ptr)>, Workgroup> // CHECK: func @alloc_dealloc_workgroup_mem // CHECK-NOT: alloc -// CHECK: %[[PTR:.+]] = spv._address_of @[[VAR]] +// CHECK: %[[PTR:.+]] = spv.mlir.address_of @[[VAR]] // CHECK: %[[LOADPTR:.+]] = spv.AccessChain %[[PTR]] // CHECK: %[[VAL:.+]] = spv.Load "Workgroup" %[[LOADPTR]] : f32 // CHECK: %[[STOREPTR:.+]] = spv.AccessChain %[[PTR]] @@ -47,7 +47,7 @@ // CHECK: spv.globalVariable @__workgroup_mem__{{[0-9]+}} // CHECK-SAME: !spv.ptr)>, Workgroup> // CHECK_LABEL: spv.func @alloc_dealloc_workgroup_mem -// CHECK: %[[VAR:.+]] = spv._address_of @__workgroup_mem__0 +// CHECK: %[[VAR:.+]] = spv.mlir.address_of @__workgroup_mem__0 // CHECK: %[[LOC:.+]] = spv.SDiv // CHECK: %[[PTR:.+]] = spv.AccessChain %[[VAR]][%{{.+}}, %[[LOC]]] // CHECK: %{{.+}} = spv.Load "Workgroup" %[[PTR]] : i32 diff --git a/mlir/test/Dialect/SPIRV/Linking/ModuleCombiner/conflict_resolution.mlir b/mlir/test/Dialect/SPIRV/Linking/ModuleCombiner/conflict_resolution.mlir --- a/mlir/test/Dialect/SPIRV/Linking/ModuleCombiner/conflict_resolution.mlir +++ b/mlir/test/Dialect/SPIRV/Linking/ModuleCombiner/conflict_resolution.mlir @@ -264,7 +264,7 @@ // CHECK-NEXT: spv.globalVariable @foo_1 // CHECK-NEXT: spv.func @bar -// CHECK-NEXT: spv._address_of @foo_1 +// CHECK-NEXT: spv.mlir.address_of @foo_1 // CHECK-NEXT: spv.Load // CHECK-NEXT: spv.ReturnValue // CHECK-NEXT: } @@ -281,7 +281,7 @@ spv.globalVariable @foo bind(1, 0) : !spv.ptr spv.func @bar() -> f32 "None" { - %0 = spv._address_of @foo : !spv.ptr + %0 = spv.mlir.address_of @foo : !spv.ptr %1 = spv.Load "Input" %0 : f32 spv.ReturnValue %1 : f32 } @@ -297,7 +297,7 @@ // CHECK-NEXT: spv.module Logical GLSL450 { // CHECK-NEXT: spv.globalVariable @foo_1 // CHECK-NEXT: spv.func @bar -// CHECK-NEXT: spv._address_of @foo_1 +// CHECK-NEXT: spv.mlir.address_of @foo_1 // CHECK-NEXT: spv.Load // CHECK-NEXT: spv.ReturnValue // CHECK-NEXT: } @@ -312,7 +312,7 @@ spv.globalVariable @foo bind(1, 0) : !spv.ptr spv.func @bar() -> f32 "None" { - %0 = spv._address_of @foo : !spv.ptr + %0 = spv.mlir.address_of @foo : !spv.ptr %1 = spv.Load "Input" %0 : f32 spv.ReturnValue %1 : f32 } diff --git a/mlir/test/Dialect/SPIRV/Serialization/function-call.mlir b/mlir/test/Dialect/SPIRV/Serialization/function-call.mlir --- a/mlir/test/Dialect/SPIRV/Serialization/function-call.mlir +++ b/mlir/test/Dialect/SPIRV/Serialization/function-call.mlir @@ -4,7 +4,7 @@ spv.globalVariable @var1 : !spv.ptr, Input> spv.func @fmain() -> i32 "None" { %0 = spv.constant 16 : i32 - %1 = spv._address_of @var1 : !spv.ptr, Input> + %1 = spv.mlir.address_of @var1 : !spv.ptr, Input> // CHECK: {{%.*}} = spv.FunctionCall @f_0({{%.*}}) : (i32) -> i32 %3 = spv.FunctionCall @f_0(%0) : (i32) -> i32 // CHECK: spv.FunctionCall @f_1({{%.*}}, {{%.*}}) : (i32, !spv.ptr, Input>) -> () diff --git a/mlir/test/Dialect/SPIRV/Serialization/global-variable.mlir b/mlir/test/Dialect/SPIRV/Serialization/global-variable.mlir --- a/mlir/test/Dialect/SPIRV/Serialization/global-variable.mlir +++ b/mlir/test/Dialect/SPIRV/Serialization/global-variable.mlir @@ -26,8 +26,8 @@ spv.module Logical GLSL450 requires #spv.vce { spv.globalVariable @globalInvocationID built_in("GlobalInvocationId") : !spv.ptr, Input> spv.func @foo() "None" { - // CHECK: %[[ADDR:.*]] = spv._address_of @globalInvocationID : !spv.ptr, Input> - %0 = spv._address_of @globalInvocationID : !spv.ptr, Input> + // CHECK: %[[ADDR:.*]] = spv.mlir.address_of @globalInvocationID : !spv.ptr, Input> + %0 = spv.mlir.address_of @globalInvocationID : !spv.ptr, Input> %1 = spv.constant 0: i32 // CHECK: spv.AccessChain %[[ADDR]] %2 = spv.AccessChain %0[%1] : !spv.ptr, Input>, i32 diff --git a/mlir/test/Dialect/SPIRV/Serialization/loop.mlir b/mlir/test/Dialect/SPIRV/Serialization/loop.mlir --- a/mlir/test/Dialect/SPIRV/Serialization/loop.mlir +++ b/mlir/test/Dialect/SPIRV/Serialization/loop.mlir @@ -63,10 +63,10 @@ spv.globalVariable @GV1 bind(0, 0) : !spv.ptr [0])>, StorageBuffer> spv.globalVariable @GV2 bind(0, 1) : !spv.ptr [0])>, StorageBuffer> spv.func @loop_kernel() "None" { - %0 = spv._address_of @GV1 : !spv.ptr [0])>, StorageBuffer> + %0 = spv.mlir.address_of @GV1 : !spv.ptr [0])>, StorageBuffer> %1 = spv.constant 0 : i32 %2 = spv.AccessChain %0[%1] : !spv.ptr [0])>, StorageBuffer>, i32 - %3 = spv._address_of @GV2 : !spv.ptr [0])>, StorageBuffer> + %3 = spv.mlir.address_of @GV2 : !spv.ptr [0])>, StorageBuffer> %5 = spv.AccessChain %3[%1] : !spv.ptr [0])>, StorageBuffer>, i32 %6 = spv.constant 4 : i32 %7 = spv.constant 42 : i32 diff --git a/mlir/test/Dialect/SPIRV/Serialization/phi.mlir b/mlir/test/Dialect/SPIRV/Serialization/phi.mlir --- a/mlir/test/Dialect/SPIRV/Serialization/phi.mlir +++ b/mlir/test/Dialect/SPIRV/Serialization/phi.mlir @@ -165,16 +165,16 @@ %3 = spv.constant 12 : i32 %4 = spv.constant 32 : i32 %5 = spv.constant 4 : i32 - %6 = spv._address_of @__builtin_var_WorkgroupId__ : !spv.ptr, Input> + %6 = spv.mlir.address_of @__builtin_var_WorkgroupId__ : !spv.ptr, Input> %7 = spv.Load "Input" %6 : vector<3xi32> %8 = spv.CompositeExtract %7[0 : i32] : vector<3xi32> - %9 = spv._address_of @__builtin_var_WorkgroupId__ : !spv.ptr, Input> + %9 = spv.mlir.address_of @__builtin_var_WorkgroupId__ : !spv.ptr, Input> %10 = spv.Load "Input" %9 : vector<3xi32> %11 = spv.CompositeExtract %10[1 : i32] : vector<3xi32> - %18 = spv._address_of @__builtin_var_NumWorkgroups__ : !spv.ptr, Input> + %18 = spv.mlir.address_of @__builtin_var_NumWorkgroups__ : !spv.ptr, Input> %19 = spv.Load "Input" %18 : vector<3xi32> %20 = spv.CompositeExtract %19[0 : i32] : vector<3xi32> - %21 = spv._address_of @__builtin_var_NumWorkgroups__ : !spv.ptr, Input> + %21 = spv.mlir.address_of @__builtin_var_NumWorkgroups__ : !spv.ptr, Input> %22 = spv.Load "Input" %21 : vector<3xi32> %23 = spv.CompositeExtract %22[1 : i32] : vector<3xi32> %30 = spv.IMul %11, %4 : i32 diff --git a/mlir/test/Dialect/SPIRV/Transforms/abi-interface.mlir b/mlir/test/Dialect/SPIRV/Transforms/abi-interface.mlir --- a/mlir/test/Dialect/SPIRV/Transforms/abi-interface.mlir +++ b/mlir/test/Dialect/SPIRV/Transforms/abi-interface.mlir @@ -16,8 +16,8 @@ %arg1: !spv.ptr)>, StorageBuffer> {spv.interface_var_abi = #spv.interface_var_abi<(0, 1)>}) "None" attributes {spv.entry_point_abi = {local_size = dense<[32, 1, 1]> : vector<3xi32>}} { - // CHECK: [[ARG1:%.*]] = spv._address_of [[VAR1]] - // CHECK: [[ADDRESSARG0:%.*]] = spv._address_of [[VAR0]] + // CHECK: [[ARG1:%.*]] = spv.mlir.address_of [[VAR1]] + // CHECK: [[ADDRESSARG0:%.*]] = spv.mlir.address_of [[VAR0]] // CHECK: [[CONST0:%.*]] = spv.constant 0 : i32 // CHECK: [[ARG0PTR:%.*]] = spv.AccessChain [[ADDRESSARG0]]{{\[}}[[CONST0]] // CHECK: [[ARG0:%.*]] = spv.Load "StorageBuffer" [[ARG0PTR]] diff --git a/mlir/test/Dialect/SPIRV/Transforms/abi-load-store.mlir b/mlir/test/Dialect/SPIRV/Transforms/abi-load-store.mlir --- a/mlir/test/Dialect/SPIRV/Transforms/abi-load-store.mlir +++ b/mlir/test/Dialect/SPIRV/Transforms/abi-load-store.mlir @@ -39,62 +39,62 @@ %arg6: i32 {spv.interface_var_abi = #spv.interface_var_abi<(0, 6), StorageBuffer>}) "None" attributes {spv.entry_point_abi = {local_size = dense<[32, 1, 1]> : vector<3xi32>}} { - // CHECK: [[ADDRESSARG6:%.*]] = spv._address_of [[VAR6]] + // CHECK: [[ADDRESSARG6:%.*]] = spv.mlir.address_of [[VAR6]] // CHECK: [[CONST6:%.*]] = spv.constant 0 : i32 // CHECK: [[ARG6PTR:%.*]] = spv.AccessChain [[ADDRESSARG6]]{{\[}}[[CONST6]] // CHECK: {{%.*}} = spv.Load "StorageBuffer" [[ARG6PTR]] - // CHECK: [[ADDRESSARG5:%.*]] = spv._address_of [[VAR5]] + // CHECK: [[ADDRESSARG5:%.*]] = spv.mlir.address_of [[VAR5]] // CHECK: [[CONST5:%.*]] = spv.constant 0 : i32 // CHECK: [[ARG5PTR:%.*]] = spv.AccessChain [[ADDRESSARG5]]{{\[}}[[CONST5]] // CHECK: {{%.*}} = spv.Load "StorageBuffer" [[ARG5PTR]] - // CHECK: [[ADDRESSARG4:%.*]] = spv._address_of [[VAR4]] + // CHECK: [[ADDRESSARG4:%.*]] = spv.mlir.address_of [[VAR4]] // CHECK: [[CONST4:%.*]] = spv.constant 0 : i32 // CHECK: [[ARG4PTR:%.*]] = spv.AccessChain [[ADDRESSARG4]]{{\[}}[[CONST4]] // CHECK: [[ARG4:%.*]] = spv.Load "StorageBuffer" [[ARG4PTR]] - // CHECK: [[ADDRESSARG3:%.*]] = spv._address_of [[VAR3]] + // CHECK: [[ADDRESSARG3:%.*]] = spv.mlir.address_of [[VAR3]] // CHECK: [[CONST3:%.*]] = spv.constant 0 : i32 // CHECK: [[ARG3PTR:%.*]] = spv.AccessChain [[ADDRESSARG3]]{{\[}}[[CONST3]] // CHECK: [[ARG3:%.*]] = spv.Load "StorageBuffer" [[ARG3PTR]] - // CHECK: [[ADDRESSARG2:%.*]] = spv._address_of [[VAR2]] + // CHECK: [[ADDRESSARG2:%.*]] = spv.mlir.address_of [[VAR2]] // CHECK: [[ARG2:%.*]] = spv.Bitcast [[ADDRESSARG2]] - // CHECK: [[ADDRESSARG1:%.*]] = spv._address_of [[VAR1]] + // CHECK: [[ADDRESSARG1:%.*]] = spv.mlir.address_of [[VAR1]] // CHECK: [[ARG1:%.*]] = spv.Bitcast [[ADDRESSARG1]] - // CHECK: [[ADDRESSARG0:%.*]] = spv._address_of [[VAR0]] + // CHECK: [[ADDRESSARG0:%.*]] = spv.mlir.address_of [[VAR0]] // CHECK: [[ARG0:%.*]] = spv.Bitcast [[ADDRESSARG0]] - %0 = spv._address_of @__builtin_var_WorkgroupId__ : !spv.ptr, Input> + %0 = spv.mlir.address_of @__builtin_var_WorkgroupId__ : !spv.ptr, Input> %1 = spv.Load "Input" %0 : vector<3xi32> %2 = spv.CompositeExtract %1[0 : i32] : vector<3xi32> - %3 = spv._address_of @__builtin_var_WorkgroupId__ : !spv.ptr, Input> + %3 = spv.mlir.address_of @__builtin_var_WorkgroupId__ : !spv.ptr, Input> %4 = spv.Load "Input" %3 : vector<3xi32> %5 = spv.CompositeExtract %4[1 : i32] : vector<3xi32> - %6 = spv._address_of @__builtin_var_WorkgroupId__ : !spv.ptr, Input> + %6 = spv.mlir.address_of @__builtin_var_WorkgroupId__ : !spv.ptr, Input> %7 = spv.Load "Input" %6 : vector<3xi32> %8 = spv.CompositeExtract %7[2 : i32] : vector<3xi32> - %9 = spv._address_of @__builtin_var_LocalInvocationId__ : !spv.ptr, Input> + %9 = spv.mlir.address_of @__builtin_var_LocalInvocationId__ : !spv.ptr, Input> %10 = spv.Load "Input" %9 : vector<3xi32> %11 = spv.CompositeExtract %10[0 : i32] : vector<3xi32> - %12 = spv._address_of @__builtin_var_LocalInvocationId__ : !spv.ptr, Input> + %12 = spv.mlir.address_of @__builtin_var_LocalInvocationId__ : !spv.ptr, Input> %13 = spv.Load "Input" %12 : vector<3xi32> %14 = spv.CompositeExtract %13[1 : i32] : vector<3xi32> - %15 = spv._address_of @__builtin_var_LocalInvocationId__ : !spv.ptr, Input> + %15 = spv.mlir.address_of @__builtin_var_LocalInvocationId__ : !spv.ptr, Input> %16 = spv.Load "Input" %15 : vector<3xi32> %17 = spv.CompositeExtract %16[2 : i32] : vector<3xi32> - %18 = spv._address_of @__builtin_var_NumWorkgroups__ : !spv.ptr, Input> + %18 = spv.mlir.address_of @__builtin_var_NumWorkgroups__ : !spv.ptr, Input> %19 = spv.Load "Input" %18 : vector<3xi32> %20 = spv.CompositeExtract %19[0 : i32] : vector<3xi32> - %21 = spv._address_of @__builtin_var_NumWorkgroups__ : !spv.ptr, Input> + %21 = spv.mlir.address_of @__builtin_var_NumWorkgroups__ : !spv.ptr, Input> %22 = spv.Load "Input" %21 : vector<3xi32> %23 = spv.CompositeExtract %22[1 : i32] : vector<3xi32> - %24 = spv._address_of @__builtin_var_NumWorkgroups__ : !spv.ptr, Input> + %24 = spv.mlir.address_of @__builtin_var_NumWorkgroups__ : !spv.ptr, Input> %25 = spv.Load "Input" %24 : vector<3xi32> %26 = spv.CompositeExtract %25[2 : i32] : vector<3xi32> - %27 = spv._address_of @__builtin_var_WorkgroupSize__ : !spv.ptr, Input> + %27 = spv.mlir.address_of @__builtin_var_WorkgroupSize__ : !spv.ptr, Input> %28 = spv.Load "Input" %27 : vector<3xi32> %29 = spv.CompositeExtract %28[0 : i32] : vector<3xi32> - %30 = spv._address_of @__builtin_var_WorkgroupSize__ : !spv.ptr, Input> + %30 = spv.mlir.address_of @__builtin_var_WorkgroupSize__ : !spv.ptr, Input> %31 = spv.Load "Input" %30 : vector<3xi32> %32 = spv.CompositeExtract %31[1 : i32] : vector<3xi32> - %33 = spv._address_of @__builtin_var_WorkgroupSize__ : !spv.ptr, Input> + %33 = spv.mlir.address_of @__builtin_var_WorkgroupSize__ : !spv.ptr, Input> %34 = spv.Load "Input" %33 : vector<3xi32> %35 = spv.CompositeExtract %34[2 : i32] : vector<3xi32> // CHECK: spv.IAdd [[ARG3]] diff --git a/mlir/test/Dialect/SPIRV/Transforms/inlining.mlir b/mlir/test/Dialect/SPIRV/Transforms/inlining.mlir --- a/mlir/test/Dialect/SPIRV/Transforms/inlining.mlir +++ b/mlir/test/Dialect/SPIRV/Transforms/inlining.mlir @@ -35,7 +35,7 @@ spv.module Logical GLSL450 { spv.globalVariable @data bind(0, 0) : !spv.ptr [0])>, StorageBuffer> spv.func @callee() "None" { - %0 = spv._address_of @data : !spv.ptr [0])>, StorageBuffer> + %0 = spv.mlir.address_of @data : !spv.ptr [0])>, StorageBuffer> %1 = spv.constant 0: i32 %2 = spv.AccessChain %0[%1, %1] : !spv.ptr [0])>, StorageBuffer>, i32, i32 spv.Branch ^next @@ -48,7 +48,7 @@ // CHECK-LABEL: @calling_multi_block_ret_func spv.func @calling_multi_block_ret_func() "None" { - // CHECK-NEXT: spv._address_of + // CHECK-NEXT: spv.mlir.address_of // CHECK-NEXT: spv.constant 0 // CHECK-NEXT: spv.AccessChain // CHECK-NEXT: spv.Branch ^bb1 @@ -190,12 +190,12 @@ // CHECK: @inline_into_selection_region spv.func @inline_into_selection_region() "None" { %1 = spv.constant 0 : i32 - // CHECK-DAG: [[ADDRESS_ARG0:%.*]] = spv._address_of @arg_0 - // CHECK-DAG: [[ADDRESS_ARG1:%.*]] = spv._address_of @arg_1 + // CHECK-DAG: [[ADDRESS_ARG0:%.*]] = spv.mlir.address_of @arg_0 + // CHECK-DAG: [[ADDRESS_ARG1:%.*]] = spv.mlir.address_of @arg_1 // CHECK-DAG: [[LOADPTR:%.*]] = spv.AccessChain [[ADDRESS_ARG0]] // CHECK: [[VAL:%.*]] = spv.Load "StorageBuffer" [[LOADPTR]] - %2 = spv._address_of @arg_0 : !spv.ptr, StorageBuffer> - %3 = spv._address_of @arg_1 : !spv.ptr, StorageBuffer> + %2 = spv.mlir.address_of @arg_0 : !spv.ptr, StorageBuffer> + %3 = spv.mlir.address_of @arg_1 : !spv.ptr, StorageBuffer> %4 = spv.AccessChain %2[%1] : !spv.ptr, StorageBuffer>, i32 %5 = spv.Load "StorageBuffer" %4 : i32 %6 = spv.SGreaterThan %5, %1 : i32 diff --git a/mlir/test/Dialect/SPIRV/Transforms/layout-decoration.mlir b/mlir/test/Dialect/SPIRV/Transforms/layout-decoration.mlir --- a/mlir/test/Dialect/SPIRV/Transforms/layout-decoration.mlir +++ b/mlir/test/Dialect/SPIRV/Transforms/layout-decoration.mlir @@ -21,8 +21,8 @@ spv.func @kernel() -> () "None" { %c0 = spv.constant 0 : i32 - // CHECK: {{%.*}} = spv._address_of @var0 : !spv.ptr [4], f32 [12])>, Uniform> - %0 = spv._address_of @var0 : !spv.ptr, f32)>, Uniform> + // CHECK: {{%.*}} = spv.mlir.address_of @var0 : !spv.ptr [4], f32 [12])>, Uniform> + %0 = spv.mlir.address_of @var0 : !spv.ptr, f32)>, Uniform> // CHECK: {{%.*}} = spv.AccessChain {{%.*}}[{{%.*}}] : !spv.ptr [4], f32 [12])>, Uniform> %1 = spv.AccessChain %0[%c0] : !spv.ptr, f32)>, Uniform>, i32 spv.Return diff --git a/mlir/test/Dialect/SPIRV/ops.mlir b/mlir/test/Dialect/SPIRV/ops.mlir --- a/mlir/test/Dialect/SPIRV/ops.mlir +++ b/mlir/test/Dialect/SPIRV/ops.mlir @@ -735,7 +735,7 @@ // CHECK_LABEL: @simple_load spv.func @simple_load() -> () "None" { // CHECK: spv.Load "Input" {{%.*}} : f32 - %0 = spv._address_of @var0 : !spv.ptr + %0 = spv.mlir.address_of @var0 : !spv.ptr %1 = spv.Load "Input" %0 : f32 spv.Return } @@ -1151,7 +1151,7 @@ spv.module Logical GLSL450 { spv.globalVariable @var0 : !spv.ptr spv.func @simple_store(%arg0 : f32) -> () "None" { - %0 = spv._address_of @var0 : !spv.ptr + %0 = spv.mlir.address_of @var0 : !spv.ptr // CHECK: spv.Store "Input" {{%.*}}, {{%.*}} : f32 spv.Store "Input" %0, %arg0 : f32 spv.Return @@ -1224,7 +1224,7 @@ spv.module Logical GLSL450 { spv.globalVariable @global : !spv.ptr spv.func @variable_init_global_variable() -> () "None" { - %0 = spv._address_of @global : !spv.ptr + %0 = spv.mlir.address_of @global : !spv.ptr // CHECK: spv.Variable init({{.*}}) : !spv.ptr, Function> %1 = spv.Variable init(%0) : !spv.ptr, Function> spv.Return diff --git a/mlir/test/Dialect/SPIRV/structure-ops.mlir b/mlir/test/Dialect/SPIRV/structure-ops.mlir --- a/mlir/test/Dialect/SPIRV/structure-ops.mlir +++ b/mlir/test/Dialect/SPIRV/structure-ops.mlir @@ -1,16 +1,16 @@ // RUN: mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics %s | FileCheck %s //===----------------------------------------------------------------------===// -// spv._address_of +// spv.mlir.address_of //===----------------------------------------------------------------------===// spv.module Logical GLSL450 { spv.globalVariable @var1 : !spv.ptr)>, Input> spv.func @access_chain() -> () "None" { %0 = spv.constant 1: i32 - // CHECK: [[VAR1:%.*]] = spv._address_of @var1 : !spv.ptr)>, Input> + // CHECK: [[VAR1:%.*]] = spv.mlir.address_of @var1 : !spv.ptr)>, Input> // CHECK-NEXT: spv.AccessChain [[VAR1]][{{.*}}, {{.*}}] : !spv.ptr)>, Input> - %1 = spv._address_of @var1 : !spv.ptr)>, Input> + %1 = spv.mlir.address_of @var1 : !spv.ptr)>, Input> %2 = spv.AccessChain %1[%0, %0] : !spv.ptr)>, Input>, i32, i32 spv.Return } @@ -21,8 +21,8 @@ // Allow taking address of global variables in other module-like ops spv.globalVariable @var : !spv.ptr)>, Input> func @address_of() -> () { - // CHECK: spv._address_of @var - %1 = spv._address_of @var : !spv.ptr)>, Input> + // CHECK: spv.mlir.address_of @var + %1 = spv.mlir.address_of @var : !spv.ptr)>, Input> return } @@ -32,7 +32,7 @@ spv.globalVariable @var1 : !spv.ptr)>, Input> spv.func @foo() -> () "None" { // expected-error @+1 {{expected spv.globalVariable symbol}} - %0 = spv._address_of @var2 : !spv.ptr)>, Input> + %0 = spv.mlir.address_of @var2 : !spv.ptr)>, Input> } } @@ -42,7 +42,7 @@ spv.globalVariable @var1 : !spv.ptr)>, Input> spv.func @foo() -> () "None" { // expected-error @+1 {{result type mismatch with the referenced global variable's type}} - %0 = spv._address_of @var1 : !spv.ptr + %0 = spv.mlir.address_of @var1 : !spv.ptr } }