31 lines · plain
1// REQUIRES: host-supports-nvptx2// RUN: mlir-opt %s \3// RUN: | mlir-opt -gpu-lower-to-nvvm-pipeline="cubin-format=isa" \4// RUN: | FileCheck %s5 6// RUN: mlir-opt %s \7// RUN: | mlir-opt -gpu-lower-to-nvvm-pipeline="cubin-format=isa" \8// RUN: --mlir-print-ir-after=convert-gpu-to-nvvm 2>&1 \9// RUN: | FileCheck %s --check-prefixes=CHECK-NVVM10 11// This test checks whether the GPU region is compiled correctly to PTX by 12// pipeline. It doesn't test IR for GPU side, but it can test Host IR and 13// generated PTX.14 15// CHECK-LABEL: llvm.func @test_math(%arg0: f32) {16func.func @test_math(%arg0 : f32) {17 %c2 = arith.constant 2 : index18 %c1 = arith.constant 1 : index19 // CHECK: gpu.launch_func @test_math_kernel::@test_math_kernel20 // CHECK: gpu.binary @test_math_kernel [#gpu.object<#nvvm.target21 gpu.launch 22 blocks(%0, %1, %2) in (%3 = %c1, %4 = %c1, %5 = %c1) 23 threads(%6, %7, %8) in (%9 = %c2, %10 = %c1, %11 = %c1) { 24 // CHECK-NVVM: __nv_expf 25 %s1 = math.exp %arg0 : f3226 gpu.printf "%f", %s1 : f3227 gpu.terminator28 }29 return30}31