1// RUN: mlir-opt %s -convert-gpu-launch-to-vulkan-launch | FileCheck %s 2 3// CHECK: %[[resource:.*]] = alloc() : memref<12xf32> 4// CHECK: %[[index:.*]] = constant 1 : index 5// CHECK: call @vulkanLaunch(%[[index]], %[[index]], %[[index]], %[[resource]]) {spirv_blob = "{{.*}}", spirv_entry_point = "kernel"} 6 7module attributes {gpu.container_module} { 8 spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], [SPV_KHR_storage_buffer_storage_class]> { 9 spv.globalVariable @kernel_arg_0 bind(0, 0) : !spv.ptr<!spv.struct<(!spv.array<12 x f32, stride=4> [0])>, StorageBuffer> 10 spv.func @kernel() "None" attributes {workgroup_attributions = 0 : i64} { 11 %0 = spv.mlir.addressof @kernel_arg_0 : !spv.ptr<!spv.struct<(!spv.array<12 x f32, stride=4> [0])>, StorageBuffer> 12 %2 = spv.constant 0 : i32 13 %3 = spv.mlir.addressof @kernel_arg_0 : !spv.ptr<!spv.struct<(!spv.array<12 x f32, stride=4> [0])>, StorageBuffer> 14 %4 = spv.AccessChain %0[%2, %2] : !spv.ptr<!spv.struct<(!spv.array<12 x f32, stride=4> [0])>, StorageBuffer>, i32, i32 15 %5 = spv.Load "StorageBuffer" %4 : f32 16 spv.Return 17 } 18 spv.EntryPoint "GLCompute" @kernel 19 spv.ExecutionMode @kernel "LocalSize", 1, 1, 1 20 } 21 gpu.module @kernels { 22 gpu.func @kernel(%arg0: memref<12xf32>) kernel { 23 gpu.return 24 } 25 } 26 func @foo() { 27 %0 = alloc() : memref<12xf32> 28 %c1 = constant 1 : index 29 gpu.launch_func @kernels::@kernel 30 blocks in(%c1, %c1, %c1) 31 threads in(%c1, %c1, %c1) 32 args(%0 : memref<12xf32>) 33 return 34 } 35} 36