Files
clang-p2996/mlir/test/Dialect/GPU/module-to-binary-rocdl.mlir
Fabian Mora 43752a2aa3 [mlir][gpu] Add the gpu-module-to-binary pass.
**For an explanation of these patches see D154153.**

Commit message:
This pass converts GPU modules into GPU binaries, serializing all targets present
in a GPU module by invoking the `serializeToObject` target attribute method.

Depends on D154147

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D154149
2023-08-12 00:24:53 +00:00

26 lines
997 B
MLIR

// REQUIRES: host-supports-amdgpu
// RUN: mlir-opt %s --gpu-module-to-binary="format=llvm" | FileCheck %s
// RUN: mlir-opt %s --gpu-module-to-binary="format=isa" | FileCheck %s
module attributes {gpu.container_module} {
// CHECK-LABEL:gpu.binary @kernel_module1
// CHECK:[#gpu.object<#rocdl.target<chip = "gfx90a">, "{{.*}}">]
gpu.module @kernel_module1 [#rocdl.target<chip = "gfx90a">] {
llvm.func @kernel(%arg0: i32, %arg1: !llvm.ptr<f32>,
%arg2: !llvm.ptr<f32>, %arg3: i64, %arg4: i64,
%arg5: i64) attributes {gpu.kernel} {
llvm.return
}
}
// CHECK-LABEL:gpu.binary @kernel_module2
// CHECK:[#gpu.object<#rocdl.target<flags = {fast}>, "{{.*}}">, #gpu.object<#rocdl.target, "{{.*}}">]
gpu.module @kernel_module2 [#rocdl.target<flags = {fast}>, #rocdl.target] {
llvm.func @kernel(%arg0: i32, %arg1: !llvm.ptr<f32>,
%arg2: !llvm.ptr<f32>, %arg3: i64, %arg4: i64,
%arg5: i64) attributes {gpu.kernel} {
llvm.return
}
}
}