brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.7 KiB · 6c5c1e0 Raw
102 lines · plain
1// RUN: mlir-opt %s --gpu-to-llvm -split-input-file | FileCheck %s2 3module attributes {gpu.container_module} {4  // CHECK: gpu.module5  gpu.module @kernel_module [#nvvm.target] {6    llvm.func @kernel(%arg0: i32, %arg1: !llvm.ptr,7        %arg2: !llvm.ptr, %arg3: i64, %arg4: i64,8        %arg5: i64) attributes {gpu.kernel} {9      llvm.return10    }11  }12 13  func.func @foo(%buffer: memref<?xf32>) {14  // CHECK: [[C8:%.*]] = llvm.mlir.constant(8 : index) : i6415  // CHECK: [[C32:%.*]] = llvm.mlir.constant(32 : i32) : i3216  // CHECK: [[C256:%.*]] = llvm.mlir.constant(256 : i32) : i3217    %c8 = arith.constant 8 : index18    %c32 = arith.constant 32 : i3219    %c256 = arith.constant 256 : i3220 21  // CHECK: gpu.launch_func @kernel_module::@kernel22  // CHECK: blocks in ([[C8]], [[C8]], [[C8]]) threads in ([[C8]], [[C8]], [[C8]]) : i6423  // CHECK: dynamic_shared_memory_size [[C256]]24  // CHECK: args([[C32]] : i32, %{{.*}} : !llvm.ptr, %{{.*}} : !llvm.ptr, %{{.*}} : i64, %{{.*}} : i64, %{{.*}} : i64)25    gpu.launch_func @kernel_module::@kernel26        blocks in (%c8, %c8, %c8)27        threads in (%c8, %c8, %c8)28        dynamic_shared_memory_size %c25629        args(%c32 : i32, %buffer : memref<?xf32>)30    return31  }32}33 34 35// -----36 37module attributes {gpu.container_module} {38  // CHECK: gpu.module39  gpu.module @kernel_module [#nvvm.target] {40    llvm.func @kernel(%arg0: i32, %arg1: !llvm.ptr,41        %arg2: !llvm.ptr, %arg3: i64, %arg4: i64,42        %arg5: i64) attributes {gpu.kernel} {43      llvm.return44    }45  }46 47  func.func @foo(%buffer: memref<?xf32>) {48  // CHECK: [[C8:%.*]] = llvm.mlir.constant(8 : index) : i6449  // CHECK: [[C32:%.*]] = llvm.mlir.constant(32 : i32) : i3250  // CHECK: [[C256:%.*]] = llvm.mlir.constant(256 : i32) : i3251  // CHECK: [[C2:%.*]] = llvm.mlir.constant(2 : index) : i6452    %c8 = arith.constant 8 : index    53    %c32 = arith.constant 32 : i3254    %c256 = arith.constant 256 : i3255    %c2 = arith.constant 2 : index56 57  // CHECK: gpu.launch_func @kernel_module::@kernel58  // CHECK: clusters in ([[C2]], [[C2]], [[C2]])59  // CHECK: blocks in ([[C8]], [[C8]], [[C8]]) threads in ([[C8]], [[C8]], [[C8]]) : i6460  // CHECK: dynamic_shared_memory_size [[C256]]61  // CHECK: args([[C32]] : i32, %{{.*}} : !llvm.ptr, %{{.*}} : !llvm.ptr, %{{.*}} : i64, %{{.*}} : i64, %{{.*}} : i64)62    gpu.launch_func @kernel_module::@kernel63        clusters in (%c2, %c2, %c2)64        blocks in (%c8, %c8, %c8)65        threads in (%c8, %c8, %c8)66        dynamic_shared_memory_size %c25667        args(%c32 : i32, %buffer : memref<?xf32>)68    return69  }70}71 72// -----73 74module attributes {gpu.container_module} {75  // CHECK: gpu.binary76  gpu.binary @kernel_module [#gpu.object<#rocdl.target, "blob">]77 78  func.func @foo(%buffer: memref<?xf32>) {79  // CHECK: [[C8:%.*]] = llvm.mlir.constant(8 : index) : i6480  // CHECK: [[C32:%.*]] = llvm.mlir.constant(32 : i32) : i3281  // CHECK: [[C256:%.*]] = llvm.mlir.constant(256 : i32) : i3282  // CHECK: [[C2:%.*]] = llvm.mlir.constant(2 : index) : i6483    %c8 = arith.constant 8 : index    84    %c32 = arith.constant 32 : i3285    %c256 = arith.constant 256 : i3286    %c2 = arith.constant 2 : index87 88  // CHECK: gpu.launch_func @kernel_module::@kernel89  // CHECK: clusters in ([[C2]], [[C2]], [[C2]])90  // CHECK: blocks in ([[C8]], [[C8]], [[C8]]) threads in ([[C8]], [[C8]], [[C8]]) : i6491  // CHECK: dynamic_shared_memory_size [[C256]]92  // CHECK: args([[C32]] : i32, %{{.*}} : !llvm.ptr, %{{.*}} : !llvm.ptr, %{{.*}} : i64, %{{.*}} : i64, %{{.*}} : i64)93    gpu.launch_func @kernel_module::@kernel94        clusters in (%c2, %c2, %c2)95        blocks in (%c8, %c8, %c8)96        threads in (%c8, %c8, %c8)97        dynamic_shared_memory_size %c25698        args(%c32 : i32, %buffer : memref<?xf32>)99    return100  }101}102