brintos

brintos / llvm-project-archived public Read only

0
0
Text · 809 B · 85805da Raw
22 lines · plain
1// RUN: mlir-opt -test-gpu-rewrite -convert-func-to-llvm %s | FileCheck %s2 3gpu.module @kernels {4    // CHECK-LABEL: @hello5    // CHECK-SAME: %[[ARG0:.*]]: f326    func.func @hello(%arg0 : f32) {7        %tid_x = gpu.thread_id x8        %csti8 = arith.constant 2 : i89        gpu.printf "Hello from %lld, %d, %f\n", %tid_x, %csti8, %arg0  : index, i8, f3210        return11    }12    // CHECK-LABEL: @hello_indirect13    gpu.func @hello_indirect() kernel { 14        %cstf32 = arith.constant 3.0 : f3215        // CHECK: %[[DEVICE_FUNC_ADDR:.*]] = llvm.mlir.addressof @hello : !llvm.ptr16        %func_ref = func.constant @hello : (f32) -> ()17        // CHECK: llvm.call %[[DEVICE_FUNC_ADDR]](%{{.*}}) : !llvm.ptr, (f32) -> ()18        func.call_indirect %func_ref(%cstf32) : (f32) -> ()19        gpu.return20    }21}22