From 2ee7f406519574d639e30b4e44bfd7bdab4cb345 Mon Sep 17 00:00:00 2001
From: foreman
Date: Wed, 3 Aug 2016 15:30:13 -0400
Subject: [PATCH] P4 to Git Change 1298635 by lmoriche@lmoriche_opencl_dev on
2016/08/03 15:14:04
SWDEV-94644 - Comment out sections of the rocm virtual device still using the compiler library.
Affected files ...
... //depot/stg/opencl/drivers/opencl/Makefile#55 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/Makefile#6 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/build/Makefile.api#134 edit
... //depot/stg/opencl/drivers/opencl/compiler/Makefile#66 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/build/Makefile.utils#18 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/device.cpp#199 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/program.cpp#79 edit
---
rocclr/runtime/device/device.cpp | 7 +++++++
rocclr/runtime/platform/program.cpp | 12 ++++++++++++
2 files changed, 19 insertions(+)
diff --git a/rocclr/runtime/device/device.cpp b/rocclr/runtime/device/device.cpp
index b34a04e60a..60c1de21bc 100644
--- a/rocclr/runtime/device/device.cpp
+++ b/rocclr/runtime/device/device.cpp
@@ -1163,6 +1163,7 @@ Program::initClBinary(char* binaryIn, size_t size)
int encryptCode = 0;
char* decryptedBin = NULL;
+#if !defined(WITH_LIGHTNING_COMPILER)
bool isSPIRV = isSPIRVMagic(binaryIn, size);
if (isSPIRV || isBcMagic(binaryIn))
{
@@ -1212,6 +1213,7 @@ Program::initClBinary(char* binaryIn, size_t size)
}
}
else
+#endif // defined(WITH_LIGHTNING_COMPILER)
{
size_t decryptedSize;
if (!clBinary()->decryptElf(binaryIn,size,
@@ -1294,6 +1296,10 @@ Program::setBinary(char* binaryIn, size_t size)
bool
Program::createBIFBinary(aclBinary* bin)
{
+#if defined(WITH_LIGHTNING_COMPILER)
+ assert(!"FIXME_Wilkin");
+ return false;
+#else // defined(WITH_LIGHTNING_COMPILER)
acl_error err;
char *binaryIn = NULL;
size_t size;
@@ -1305,6 +1311,7 @@ Program::createBIFBinary(aclBinary* bin)
clBinary()->saveBIFBinary(binaryIn, size);
aclFreeMem(bin, binaryIn);
return true;
+#endif // defined(WITH_LIGHTNING_COMPILER)
}
ClBinary::ClBinary(const amd::Device& dev, BinaryImageFormat bifVer)
diff --git a/rocclr/runtime/platform/program.cpp b/rocclr/runtime/platform/program.cpp
index c667d858de..eac34ffc81 100644
--- a/rocclr/runtime/platform/program.cpp
+++ b/rocclr/runtime/platform/program.cpp
@@ -48,11 +48,15 @@ cl_int
Program::addDeviceProgram(Device& device, const void* image, size_t length,
amd::option::Options* options)
{
+#if defined(WITH_LIGHTNING_COMPILER)
+ assert(!"FIMXE_Wilkins: check the code below");
+#else // !defined(WITH_LIGHTNING_COMPILER)
if (image != NULL &&
!aclValidateBinaryImage(image, length,
isSPIRV_?BINARY_TYPE_SPIRV:BINARY_TYPE_ELF|BINARY_TYPE_LLVM)) {
return CL_INVALID_BINARY;
}
+#endif // !defined(WITH_LIGHTNING_COMPILER)
// Check if the device is already associated with this program
if (deviceList_.find(&device) != deviceList_.end()) {
@@ -71,6 +75,9 @@ Program::addDeviceProgram(Device& device, const void* image, size_t length,
options = &emptyOpts;
emptyOptions = true;
}
+#if defined(WITH_LIGHTNING_COMPILER)
+ assert(!"FIMXE_Wilkins: check the code below");
+#else // !defined(WITH_LIGHTNING_COMPILER)
if (image != NULL && length != 0 && aclValidateBinaryImage(image, length, BINARY_TYPE_ELF)) {
acl_error errorCode;
aclBinary *binary = aclReadFromMem(image, length, &errorCode);
@@ -92,8 +99,11 @@ Program::addDeviceProgram(Device& device, const void* image, size_t length,
return CL_INVALID_COMPILER_OPTIONS;
}
}
+#if !defined(WITH_LIGHTNING_COMPILER)
options->oVariables->Legacy = isAMDILTarget(*aclutGetTargetInfo(binary));
+#endif // !defined(WITH_LIGHTNING_COMPILER)
}
+#endif // !defined(WITH_LIGHTNING_COMPILER)
options->oVariables->BinaryIsSpirv = isSPIRV_;
device::Program* program = rootDev.createProgram(options);
if (program == NULL) {
@@ -296,6 +306,7 @@ Program::link(
// Check the binary's target for the first found device program.
// TODO: Revise these binary's target checks
// and possibly remove them after switching to HSAIL by default.
+#if !defined(WITH_LIGHTNING_COMPILER)
if (!found && binary.first != NULL && binary.second > 0) {
acl_error errorCode = ACL_SUCCESS;
void *mem = const_cast(binary.first);
@@ -310,6 +321,7 @@ Program::link(
parsedOptions.oVariables->Frontend = "edg";
}
}
+#endif // !defined(WITH_LIGHTNING_COMPILER)
found = true;
}
if (inputDevPrograms.size() == 0) {