1// RUN: mlir-opt %s --nvvm-attach-target='module=nvvm.* O=3 chip=sm_90' --rocdl-attach-target='module=rocdl.* O=3 chip=gfx90a' | FileCheck %s 2// RUN: mlir-opt %s --nvvm-attach-target='module=options.* O=1 chip=sm_70 fast=true ftz=true' --rocdl-attach-target='module=options.* l=file1.bc,file2.bc wave64=false finite-only=true' | FileCheck %s --check-prefix=CHECK_OPTS 3 4module attributes {gpu.container_module} { 5// Verify the target is appended. 6// CHECK: @nvvm_module_1 [#nvvm.target<O = 3, chip = "sm_90">] { 7gpu.module @nvvm_module_1 { 8} 9// Verify the target is appended. 10// CHECK: @nvvm_module_2 [#nvvm.target<chip = "sm_60">, #nvvm.target<O = 3, chip = "sm_90">] { 11gpu.module @nvvm_module_2 [#nvvm.target<chip = "sm_60">] { 12} 13// Verify the target is not added multiple times. 14// CHECK: @nvvm_module_3 [#nvvm.target<O = 3, chip = "sm_90">] { 15gpu.module @nvvm_module_3 [#nvvm.target<O = 3, chip = "sm_90">] { 16} 17// Verify the NVVM target is not added as it fails to match the regex, but the ROCDL does get appended. 18// CHECK: @rocdl_module [#rocdl.target<O = 3, chip = "gfx90a">] { 19gpu.module @rocdl_module { 20} 21// Check the options were added. 22// CHECK_OPTS: @options_module_1 [#nvvm.target<O = 1, chip = "sm_70", flags = {fast, ftz}>, #rocdl.target<flags = {finite_only, no_wave64}, link = ["file1.bc", "file2.bc"]>] { 23gpu.module @options_module_1 { 24} 25// Check the options were added and that the first target was preserved. 26// CHECK_OPTS: @options_module_2 [#nvvm.target<O = 3, chip = "sm_90">, #nvvm.target<O = 1, chip = "sm_70", flags = {fast, ftz}>, #rocdl.target<flags = {finite_only, no_wave64}, link = ["file1.bc", "file2.bc"]>] { 27gpu.module @options_module_2 [#nvvm.target<O = 3, chip = "sm_90">] { 28} 29} 30