From 86bfb5474907575b28a5ac8a4af56b9b343ba755 Mon Sep 17 00:00:00 2001
From: foreman
Date: Wed, 26 Apr 2017 12:23:11 -0400
Subject: [PATCH] P4 to Git Change 1402826 by lmoriche@lmoriche_opencl_dev2 on
2017/04/26 12:05:30
SWDEV-102726 - [OCL-LC-ROCm] Open source OpenCL Runtime
- Cleanups to build with gcc 5.4 and cmake.
Affected files ...
... //depot/stg/opencl/drivers/opencl/compiler/lib/loaders/elf/elf.cpp#37 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/loaders/elf/elf.hpp#25 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/blit.cpp#5 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.cpp#50 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rockernel.cpp#23 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocmemory.cpp#17 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprintf.cpp#8 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprogram.cpp#65 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocvirtual.cpp#36 edit
[ROCm/clr commit: d2ca5e309d5b557a1791130011055973214b83ee]
---
projects/clr/rocclr/compiler/lib/loaders/elf/elf.cpp | 7 ++++++-
projects/clr/rocclr/compiler/lib/loaders/elf/elf.hpp | 7 +++++++
projects/clr/rocclr/runtime/device/blit.cpp | 4 +++-
projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp | 5 -----
projects/clr/rocclr/runtime/device/rocm/rockernel.cpp | 1 -
projects/clr/rocclr/runtime/device/rocm/rocmemory.cpp | 2 +-
projects/clr/rocclr/runtime/device/rocm/rocprintf.cpp | 6 +++---
projects/clr/rocclr/runtime/device/rocm/rocprogram.cpp | 4 ++--
projects/clr/rocclr/runtime/device/rocm/rocvirtual.cpp | 1 -
9 files changed, 22 insertions(+), 15 deletions(-)
diff --git a/projects/clr/rocclr/compiler/lib/loaders/elf/elf.cpp b/projects/clr/rocclr/compiler/lib/loaders/elf/elf.cpp
index c5df0afcf4..4662454039 100644
--- a/projects/clr/rocclr/compiler/lib/loaders/elf/elf.cpp
+++ b/projects/clr/rocclr/compiler/lib/loaders/elf/elf.cpp
@@ -175,9 +175,11 @@ isCALTarget(const char* p, signed char ec)
machine = ((Elf64_Ehdr*)p)->e_machine;
}
+#if !defined(WITH_LIGHTNING_COMPILER)
if ( (machine >= OclElf::CAL_FIRST) && (machine <= OclElf::CAL_LAST) ) {
return true;
}
+#endif // !defined(WITH_LIGHTNING_COMPILER)
return false;
}
@@ -622,10 +624,13 @@ OclElf::getTarget(uint16_t& machine, oclElfPlatform& platform)
platform = CPU_PLATFORM;
machine = mach - CPU_BASE;
}
+#if !defined(WITH_LIGHTNING_COMPILER)
else if ( (mach >= CAL_FIRST) && (mach <= CAL_LAST)) {
platform = CAL_PLATFORM;
machine = mach - CAL_BASE;
- } else if (mach == EM_386
+ }
+#endif // !defined(WITH_LIGHTNING_COMPILER)
+ else if (mach == EM_386
|| mach == EM_HSAIL
|| mach == EM_HSAIL_64
|| mach == EM_AMDIL
diff --git a/projects/clr/rocclr/compiler/lib/loaders/elf/elf.hpp b/projects/clr/rocclr/compiler/lib/loaders/elf/elf.hpp
index 162116e739..552ca360f6 100644
--- a/projects/clr/rocclr/compiler/lib/loaders/elf/elf.hpp
+++ b/projects/clr/rocclr/compiler/lib/loaders/elf/elf.hpp
@@ -8,7 +8,9 @@
#include "top.hpp"
#include "elf_utils.hpp"
+#if !defined(WITH_LIGHTNING_COMPILER)
#include "caltarget.h" // using CALtargetEnum
+#endif // !defined(WITH_LIGHTNING_COMPILER)
#include "libelf.h"
#include "gelf.h"
@@ -23,6 +25,9 @@
#ifndef EM_HSAIL
#define EM_HSAIL 0xAF5A
#endif
+#ifndef EM_HSAIL_64
+#define EM_HSAIL_64 0xAF5B
+#endif
#ifndef EM_AMDIL
#define EM_AMDIL 0x4154
#endif
@@ -66,9 +71,11 @@ public:
typedef enum {
// NOTE!!! Never remove an entry or change the order.
+#if !defined(WITH_LIGHTNING_COMPILER)
// All CAL targets are within [CAL_FIRST, CAL_LAST].
CAL_FIRST = CAL_TARGET_600 + CAL_BASE,
CAL_LAST = CAL_TARGET_LAST + CAL_BASE,
+#endif // !defined(WITH_LIGHTNING_COMPILER)
// All CPU targets are within [CPU_FIRST, CPU_LAST]
CPU_FIRST = CPU_FEATURES_FIRST + CPU_BASE,
diff --git a/projects/clr/rocclr/runtime/device/blit.cpp b/projects/clr/rocclr/runtime/device/blit.cpp
index dfb03972dc..9a6ced0a5f 100644
--- a/projects/clr/rocclr/runtime/device/blit.cpp
+++ b/projects/clr/rocclr/runtime/device/blit.cpp
@@ -7,6 +7,8 @@
#include "device/blit.hpp"
#include "utils/debug.hpp"
+#include
+
namespace device {
HostBlitManager::HostBlitManager(VirtualDevice& vDev, Setup setup)
@@ -643,7 +645,7 @@ cl_uint HostBlitManager::sRGBmap(float fc) const {
double c = (double)fc;
#ifdef ATI_OS_LINUX
- if (isnan(c)) c = 0.0;
+ if (std::isnan(c)) c = 0.0;
#else
if (_isnan(c)) c = 0.0;
#endif
diff --git a/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp b/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp
index 61104b461a..04f7ad1cc9 100644
--- a/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp
+++ b/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp
@@ -25,11 +25,6 @@
#endif // !defined(WITH_LIGHTNING_COMPILER)
#include "device/rocm/rocmemory.hpp"
#include "device/rocm/rocglinterop.hpp"
-#include "kv_id.h"
-#include "vi_id.h"
-#include "cz_id.h"
-#include "ci_id.h"
-#include "ai_id.h"
#include
#include
#include
diff --git a/projects/clr/rocclr/runtime/device/rocm/rockernel.cpp b/projects/clr/rocclr/runtime/device/rocm/rockernel.cpp
index 2054e89b2c..cdee812cab 100644
--- a/projects/clr/rocclr/runtime/device/rocm/rockernel.cpp
+++ b/projects/clr/rocclr/runtime/device/rocm/rockernel.cpp
@@ -3,7 +3,6 @@
//
#include "rockernel.hpp"
-#include "SCHSAInterface.h"
#include "amd_hsa_kernel_code.h"
#include
diff --git a/projects/clr/rocclr/runtime/device/rocm/rocmemory.cpp b/projects/clr/rocclr/runtime/device/rocm/rocmemory.cpp
index ae7d45eb02..720ade81c3 100644
--- a/projects/clr/rocclr/runtime/device/rocm/rocmemory.cpp
+++ b/projects/clr/rocclr/runtime/device/rocm/rocmemory.cpp
@@ -19,7 +19,7 @@
#include "thread/monitor.hpp"
#include "platform/memory.hpp"
#include "platform/sampler.hpp"
-#include "api/opencl/amdocl/cl_gl_amd.hpp"
+#include "amdocl/cl_gl_amd.hpp"
namespace roc {
diff --git a/projects/clr/rocclr/runtime/device/rocm/rocprintf.cpp b/projects/clr/rocclr/runtime/device/rocm/rocprintf.cpp
index 9d97d7c934..fcf7dfb2e8 100644
--- a/projects/clr/rocclr/runtime/device/rocm/rocprintf.cpp
+++ b/projects/clr/rocclr/runtime/device/rocm/rocprintf.cpp
@@ -13,7 +13,7 @@
#include "device/rocm/rocprintf.hpp"
#include
#include
-#include
+#include
namespace roc {
@@ -165,13 +165,13 @@ size_t PrintfDbg::outputArgument(const std::string& fmt, bool printFloat, size_t
}
float fArg = *(reinterpret_cast(argument));
float fSign = copysign(1.0, fArg);
- if (isinf(fArg) && !isnan(fArg)) {
+ if (std::isinf(fArg) && !std::isnan(fArg)) {
if (fSign < 0) {
amd::Os::printf(fmtF.data(), "-infinity");
} else {
amd::Os::printf(fmtF.data(), "infinity");
}
- } else if (isnan(fArg)) {
+ } else if (std::isnan(fArg)) {
if (fSign < 0) {
amd::Os::printf(fmtF.data(), "-nan");
} else {
diff --git a/projects/clr/rocclr/runtime/device/rocm/rocprogram.cpp b/projects/clr/rocclr/runtime/device/rocm/rocprogram.cpp
index 74651dbd97..a4e417b163 100644
--- a/projects/clr/rocclr/runtime/device/rocm/rocprogram.cpp
+++ b/projects/clr/rocclr/runtime/device/rocm/rocprogram.cpp
@@ -7,13 +7,13 @@
#include "rocprogram.hpp"
-#include "compiler/lib/utils/options.hpp"
+#include "utils/options.hpp"
#include "rockernel.hpp"
#if defined(WITH_LIGHTNING_COMPILER)
#include "AMDGPUPTNote.h"
-#include "libelf/gelf.h"
#include "driver/AmdCompiler.h"
#include "libraries.amdgcn.inc"
+#include
#else // !defined(WITH_LIGHTNING_COMPILER)
#include "roccompilerlib.hpp"
#include "amd_hsa_code.hpp"
diff --git a/projects/clr/rocclr/runtime/device/rocm/rocvirtual.cpp b/projects/clr/rocclr/runtime/device/rocm/rocvirtual.cpp
index 1710830703..70cc58f6fa 100644
--- a/projects/clr/rocclr/runtime/device/rocm/rocvirtual.cpp
+++ b/projects/clr/rocclr/runtime/device/rocm/rocvirtual.cpp
@@ -14,7 +14,6 @@
#include "platform/sampler.hpp"
#include "utils/debug.hpp"
#include "os/os.hpp"
-#include "SCHSAInterface.h"
#include "amd_hsa_kernel_code.h"
#include