[Mlir-commits] [mlir] [mlir][ROCDL] Stop setting amdgpu-implicitarg-num-bytes (PR #78498)

Krzysztof Drewniak llvmlistbot at llvm.org
Wed Jan 17 12:15:01 PST 2024


https://github.com/krzysz00 created https://github.com/llvm/llvm-project/pull/78498

Clang stopped doing this late 2021 back in 33315ef3216b, and no other frontent does this, so stop doing it.

>From 5e499c7f32ecf948db1d8609808389025d21e422 Mon Sep 17 00:00:00 2001
From: Krzysztof Drewniak <Krzysztof.Drewniak at amd.com>
Date: Wed, 17 Jan 2024 20:11:47 +0000
Subject: [PATCH] [mlir][ROCDL] Stop setting amdgpu-implicitarg-num-bytes

Clang stopped doing this late 2021 back in 33315ef3216b, and no other
frontent does this, so stop doing it.
---
 .../Target/LLVMIR/Dialect/ROCDL/ROCDLToLLVMIRTranslation.cpp   | 3 ---
 mlir/test/Target/LLVMIR/rocdl.mlir                             | 2 +-
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/mlir/lib/Target/LLVMIR/Dialect/ROCDL/ROCDLToLLVMIRTranslation.cpp b/mlir/lib/Target/LLVMIR/Dialect/ROCDL/ROCDLToLLVMIRTranslation.cpp
index 55a6285ec87eb4e..cbce23fd580e755 100644
--- a/mlir/lib/Target/LLVMIR/Dialect/ROCDL/ROCDLToLLVMIRTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/Dialect/ROCDL/ROCDLToLLVMIRTranslation.cpp
@@ -93,15 +93,12 @@ class ROCDLDialectLLVMIRTranslationInterface
       // 1. Insert AMDGPU_KERNEL calling convention.
       // 2. Insert amdgpu-flat-work-group-size(1, 256) attribute unless the user
       // has overriden this value - 256 is the default in clang
-      // 3. Insert amdgpu-implicitarg-num-bytes=56 (which must be set on OpenCL
-      // and HIP kernels per Clang)
       llvm::Function *llvmFunc =
           moduleTranslation.lookupFunction(func.getName());
       llvmFunc->setCallingConv(llvm::CallingConv::AMDGPU_KERNEL);
       if (!llvmFunc->hasFnAttribute("amdgpu-flat-work-group-size")) {
         llvmFunc->addFnAttr("amdgpu-flat-work-group-size", "1,256");
       }
-      llvmFunc->addFnAttr("amdgpu-implicitarg-num-bytes", "56");
     }
     // Override flat-work-group-size
     // TODO: update clients to rocdl.flat_work_group_size instead,
diff --git a/mlir/test/Target/LLVMIR/rocdl.mlir b/mlir/test/Target/LLVMIR/rocdl.mlir
index 8b37dfbe3c6e881..3c9c70711ae2304 100644
--- a/mlir/test/Target/LLVMIR/rocdl.mlir
+++ b/mlir/test/Target/LLVMIR/rocdl.mlir
@@ -489,7 +489,7 @@ llvm.func @rocdl_8bit_floats(%source: i32, %stoch: i32) -> i32 {
   llvm.return %source5 : i32
 }
 
-// CHECK-DAG: attributes #[[$KERNEL_ATTRS]] = { "amdgpu-flat-work-group-size"="1,256" "amdgpu-implicitarg-num-bytes"="56" }
+// CHECK-DAG: attributes #[[$KERNEL_ATTRS]] = { "amdgpu-flat-work-group-size"="1,256" }
 // CHECK-DAG: attributes #[[$KERNEL_WORKGROUP_ATTRS]] = { "amdgpu-flat-work-group-size"="1,1024"
 // CHECK-DAG: attributes #[[$KNOWN_BLOCK_SIZE_ATTRS]] = { "amdgpu-flat-work-group-size"="128,128"
 // CHECK-DAG: ![[$RANGE]] = !{i32 0, i32 64}



More information about the Mlir-commits mailing list