From 87619af17582bae3943d8d8938578fc46526bfbd Mon Sep 17 00:00:00 2001 From: Rakesh Roy Date: Thu, 2 May 2024 14:31:43 +0530 Subject: [PATCH] SWDEV-459556 - Revert "SWDEV-442724 - Remove uses of `-amdgpu-early-inline-all` to enable function calls" This reverts commit a09204388a9b73b0f3b66f2939a1827e21d33dd8. Change-Id: I885b9e5910d90fd871ab48f7ee95796b6cd01297 --- hipamd/hip-config-amd.cmake | 4 ++++ rocclr/device/devprogram.cpp | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/hipamd/hip-config-amd.cmake b/hipamd/hip-config-amd.cmake index 6a00f8f43e..d5e6484b59 100755 --- a/hipamd/hip-config-amd.cmake +++ b/hipamd/hip-config-amd.cmake @@ -129,6 +129,10 @@ endif() get_property(compilePropIsSet TARGET hip::device PROPERTY INTERFACE_COMPILE_OPTIONS SET) +if (NOT compilePropIsSet AND HIP_CXX_COMPILER MATCHES ".*clang\\+\\+") + hip_add_interface_compile_flags(hip::device -mllvm=-amdgpu-early-inline-all=true -mllvm=-amdgpu-function-calls=false) +endif() + if (NOT compilePropIsSet) hip_add_interface_compile_flags(hip::device -x hip) endif() diff --git a/rocclr/device/devprogram.cpp b/rocclr/device/devprogram.cpp index c030e76b0e..7e02ad0600 100644 --- a/rocclr/device/devprogram.cpp +++ b/rocclr/device/devprogram.cpp @@ -53,6 +53,12 @@ #include "hsailctx.hpp" #endif +#ifdef EARLY_INLINE +#define AMDGPU_EARLY_INLINE_ALL_OPTION " -mllvm -amdgpu-early-inline-all" +#else +#define AMDGPU_EARLY_INLINE_ALL_OPTION +#endif + namespace device { // TODO: Can this be unified with the copies in: @@ -657,6 +663,10 @@ bool Program::compileImplLC(const std::string& sourceCode, driverOptions.insert(driverOptions.end(), processedOptions.begin(), processedOptions.end()); // Set whole program mode +#ifdef EARLY_INLINE + driverOptions.push_back("-mllvm"); + driverOptions.push_back("-amdgpu-early-inline-all"); +#endif driverOptions.push_back("-mllvm"); driverOptions.push_back("-amdgpu-prelink"); @@ -1245,6 +1255,10 @@ bool Program::linkImplLC(amd::option::Options* options) { // Set whole program mode codegenOptions.push_back("-mllvm"); codegenOptions.push_back("-amdgpu-internalize-symbols"); +#ifdef EARLY_INLINE + codegenOptions.push_back("-mllvm"); + codegenOptions.push_back("-amdgpu-early-inline-all"); +#endif if (!device().settings().enableWgpMode_) { codegenOptions.push_back("-mcumode");