From df22dc2a47ce0c6e1790c84e419f4cc637be71c3 Mon Sep 17 00:00:00 2001
From: foreman
Date: Wed, 1 Feb 2017 01:41:59 -0500
Subject: [PATCH] P4 to Git Change 1367875 by smekhano@stas-mwamba-rocm on
2017/02/01 01:33:12
SWDEV-105835 - ROCm OpenCL: add -amdgpu-internalize-symbols to BE
The option -amdgpu-internalize-symbols allows to drop unused symbols from program,
functions and global variables. This saves compile time and object size, a lot in
case of a big program.
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palprogram.cpp#33 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprogram.cpp#55 edit
---
rocclr/runtime/device/pal/palprogram.cpp | 3 +++
rocclr/runtime/device/rocm/rocprogram.cpp | 3 +++
2 files changed, 6 insertions(+)
diff --git a/rocclr/runtime/device/pal/palprogram.cpp b/rocclr/runtime/device/pal/palprogram.cpp
index 871d9cc149..5857a56435 100644
--- a/rocclr/runtime/device/pal/palprogram.cpp
+++ b/rocclr/runtime/device/pal/palprogram.cpp
@@ -1504,6 +1504,9 @@ LightningProgram::linkImpl(amd::option::Options *options)
optLevel << "-O" << options->oVariables->OptLevel;
codegenOptions.append(" ").append(optLevel.str());
+ // Set whole program mode
+ codegenOptions.append(" -mllvm -amdgpu-internalize-symbols");
+
// Tokenize the options string into a vector of strings
std::istringstream strstr(codegenOptions);
std::istream_iterator sit(strstr), end;
diff --git a/rocclr/runtime/device/rocm/rocprogram.cpp b/rocclr/runtime/device/rocm/rocprogram.cpp
index 9dcbba16c1..8e17aea1bc 100644
--- a/rocclr/runtime/device/rocm/rocprogram.cpp
+++ b/rocclr/runtime/device/rocm/rocprogram.cpp
@@ -813,6 +813,9 @@ HSAILProgram::linkImpl_LC(amd::option::Options *options)
optLevel << "-O" << options->oVariables->OptLevel;
codegenOptions.append(" ").append(optLevel.str());
+ // Set whole program mode
+ codegenOptions.append(" -mllvm -amdgpu-internalize-symbols");
+
// Tokenize the options string into a vector of strings
std::istringstream strstr(codegenOptions);
std::istream_iterator sit(strstr), end;