1// REQUIRES: host-supports-nvptx 2// RUN: mlir-opt %s --gpu-module-to-binary="format=llvm" | FileCheck %s 3// RUN: mlir-opt %s --gpu-module-to-binary="format=isa" | FileCheck %s -check-prefix=CHECK-ISA 4// RUN: mlir-opt %s --gpu-module-to-binary="format=llvm section=__fatbin" | FileCheck %s -check-prefix=CHECK-SECTION 5 6module attributes {gpu.container_module} { 7 // CHECK-LABEL:gpu.binary @kernel_module1 8 // CHECK:[#gpu.object<#nvvm.target<chip = "sm_70">, offload = "{{.*}}">] 9 // CHECK-SECTION: #gpu.object<#nvvm.target<chip = "sm_70">, properties = {section = "__fatbin"} 10 gpu.module @kernel_module1 [#nvvm.target<chip = "sm_70">] { 11 llvm.func @kernel(%arg0: i32, %arg1: !llvm.ptr, 12 %arg2: !llvm.ptr, %arg3: i64, %arg4: i64, 13 %arg5: i64) attributes {gpu.kernel} { 14 llvm.return 15 } 16 } 17 18 // CHECK-LABEL:gpu.binary @kernel_module2 19 // CHECK-ISA:[#gpu.object<#nvvm.target<flags = {fast}>, properties = {O = 2 : i32}, assembly = "{{.*}}">, #gpu.object<#nvvm.target, properties = {O = 2 : i32}, assembly = "{{.*}}">] 20 gpu.module @kernel_module2 [#nvvm.target<flags = {fast}>, #nvvm.target] { 21 llvm.func @kernel(%arg0: i32, %arg1: !llvm.ptr, 22 %arg2: !llvm.ptr, %arg3: i64, %arg4: i64, 23 %arg5: i64) attributes {gpu.kernel} { 24 llvm.return 25 } 26 } 27 28 // CHECK-LABEL:gpu.binary @kernel_module3 <#gpu.select_object<1 : i64>> 29 // CHECK:[#gpu.object<#nvvm.target<chip = "sm_70">, offload = "{{.*}}">, #gpu.object<#nvvm.target<chip = "sm_80">, offload = "{{.*}}">] 30 // CHECK-SECTION: [#gpu.object<#nvvm.target<chip = "sm_70">, properties = {section = "__fatbin"},{{.*}} #gpu.object<#nvvm.target<chip = "sm_80">, properties = {section = "__fatbin"} 31 gpu.module @kernel_module3 <#gpu.select_object<1>> [ 32 #nvvm.target<chip = "sm_70">, 33 #nvvm.target<chip = "sm_80">] { 34 llvm.func @kernel(%arg0: i32, %arg1: !llvm.ptr, 35 %arg2: !llvm.ptr, %arg3: i64, %arg4: i64, 36 %arg5: i64) attributes {gpu.kernel} { 37 llvm.return 38 } 39 } 40} 41