From 9e7caf977bd65d958d29fd6b115dfc31862fb256 Mon Sep 17 00:00:00 2001
From: foreman
Date: Thu, 13 Jul 2017 14:18:44 -0400
Subject: [PATCH] P4 to Git Change 1433795 by lmoriche@lmoriche_opencl_dev2 on
2017/07/13 13:32:24
SWDEV-102733 - Use the embedded compiler library for OCL/ROCm/HSAIL when BUILD_HSA_TARGET != yes
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/roccompilerlib.cpp#7 edit
---
rocclr/runtime/device/rocm/roccompilerlib.cpp | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/rocclr/runtime/device/rocm/roccompilerlib.cpp b/rocclr/runtime/device/rocm/roccompilerlib.cpp
index 9fccfe212e..6afc916f66 100644
--- a/rocclr/runtime/device/rocm/roccompilerlib.cpp
+++ b/rocclr/runtime/device/rocm/roccompilerlib.cpp
@@ -12,6 +12,7 @@ struct CompLibApi g_complibApi;
// g_complibModule is defined in LoadCompLib(). This macro must be used only in LoadCompLib()
// function.
//
+#if defined(BUILD_HSA_TARGET)
#define LOADSYMBOL(api) \
g_complibApi._##api = (pfn_##api)amd::Os::getSymbol(g_complibModule, #api); \
if (g_complibApi._##api == nullptr) { \
@@ -19,8 +20,12 @@ struct CompLibApi g_complibApi;
amd::Os::unloadLibrary(g_complibModule); \
return false; \
}
+#else // !defined(BUILD_HSA_TARGET)
+#define LOADSYMBOL(api) g_complibApi._##api = (pfn_##api)&(api);
+#endif // !defined(BUILD_HSA_TARGET)
bool LoadCompLib(bool offline) {
+#if defined(BUILD_HSA_TARGET)
g_complibModule = amd::Os::loadLibrary("amdhsacl" LP64_SWITCH(LINUX_SWITCH("32", ""), "64"));
if (g_complibModule == nullptr) {
if (!offline) {
@@ -28,6 +33,7 @@ bool LoadCompLib(bool offline) {
}
return false;
}
+#endif // defined(BUILD_HSA_TARGET)
LOADSYMBOL(aclCompilerInit)
LOADSYMBOL(aclGetTargetInfo)