From 25f767027dac29d6fa2b3e9d988024be32aa2800 Mon Sep 17 00:00:00 2001 From: foreman Date: Fri, 28 Oct 2016 02:55:43 -0400 Subject: [PATCH] P4 to Git Change 1333167 by lmoriche@lmoriche_opencl_dev on 2016/10/28 02:41:50 SWDEV-105604 - [OCL-LC-PAL] OpenCL program manager for LC on PAL - Remove cl_khr_depth_images from the extension list for CL2.0 since it is already defined in opencl-c.h Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palcompiler.cpp#7 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palprogram.cpp#18 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palprogram.hpp#12 edit [ROCm/clr commit: 47ec8d3e89d547c4435ba44b131d4b6bc4dbd019] --- .../rocclr/runtime/device/pal/palcompiler.cpp | 4 ++-- .../rocclr/runtime/device/pal/palprogram.cpp | 20 +++++++++++-------- .../rocclr/runtime/device/pal/palprogram.hpp | 2 +- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/projects/clr/rocclr/runtime/device/pal/palcompiler.cpp b/projects/clr/rocclr/runtime/device/pal/palcompiler.cpp index b235bae2e5..fc1ef69007 100644 --- a/projects/clr/rocclr/runtime/device/pal/palcompiler.cpp +++ b/projects/clr/rocclr/runtime/device/pal/palcompiler.cpp @@ -135,7 +135,7 @@ HSAILProgram::compileImpl( #endif // Compile source to IR - compileOptions_.append(hsailOptions()); + compileOptions_.append(hsailOptions(options)); errorCode = aclCompile(dev().compiler(), binaryElf_, compileOptions_.c_str(), ACL_TYPE_OPENCL, ACL_TYPE_LLVMIR_BINARY, nullptr); buildLog_ += aclGetCompilerLog(dev().compiler()); @@ -248,7 +248,7 @@ LightningProgram::compileImpl( driverOptions.append(mCPU.str()); driverOptions.append(options->llvmOptions); - driverOptions.append(hsailOptions()); + driverOptions.append(hsailOptions(options)); //Find the temp folder for the OS std::string tempFolder = amd::Os::getEnvironment("TEMP"); diff --git a/projects/clr/rocclr/runtime/device/pal/palprogram.cpp b/projects/clr/rocclr/runtime/device/pal/palprogram.cpp index 92d7e13770..c146c8e139 100644 --- a/projects/clr/rocclr/runtime/device/pal/palprogram.cpp +++ b/projects/clr/rocclr/runtime/device/pal/palprogram.cpp @@ -598,7 +598,7 @@ HSAILProgram::linkImpl(amd::option::Options* options) // Compilation from ACL_TYPE_HSAIL_TEXT to ACL_TYPE_CG in cases: // 1. if the program is created with binary and contains only hsail text case ACL_TYPE_HSAIL_TEXT: { - std::string curOptions = options->origOptionStr + hsailOptions(); + std::string curOptions = options->origOptionStr + hsailOptions(options); errorCode = aclCompile(dev().compiler(), binaryElf_, curOptions.c_str(), continueCompileFrom, ACL_TYPE_CG, nullptr); buildLog_ += aclGetCompilerLog(dev().compiler()); @@ -618,7 +618,7 @@ HSAILProgram::linkImpl(amd::option::Options* options) return false; } if (finalize) { - std::string fin_options(options->origOptionStr + hsailOptions()); + std::string fin_options(options->origOptionStr + hsailOptions(options)); // Append an option so that we can selectively enable a SCOption on CZ // whenever IOMMUv2 is enabled. if (dev().settings().svmFineGrainSystem_) { @@ -681,7 +681,7 @@ HSAILProgram::linkImpl(amd::option::Options* options) std::string kernelName(*it); std::string openclKernelName = device::Kernel::openclMangledName(kernelName); - HSAILKernel *aKernel = new HSAILKernel(kernelName, this, options->origOptionStr + hsailOptions()); + HSAILKernel *aKernel = new HSAILKernel(kernelName, this, options->origOptionStr + hsailOptions(options)); kernels()[kernelName] = aKernel; amd::hsa::loader::Symbol *sym = executable_->GetSymbol("", openclKernelName.c_str(), agent, 0); @@ -741,7 +741,7 @@ HSAILProgram::releaseClBinary() } std::string -HSAILProgram::hsailOptions() +HSAILProgram::hsailOptions(amd::option::Options* options) { std::string hsailOptions; // Set options for the standard device specific options @@ -767,9 +767,13 @@ HSAILProgram::hsailOptions() iss.str(device().info().extensions_); while (getline(iss, token, ' ')) { if (!token.empty()) { - hsailOptions.append(" -D"); - hsailOptions.append(token); - hsailOptions.append("=1"); +#if defined(WITH_LIGHTNING_COMPILER) + // FIXME_lmoriche: opencl-c.h defines 'cl_khr_depth_images', so + // remove it from the command line. Should we fix opencl-c.h? + if (options->oVariables->CLStd[2] >= '2' + && token == "cl_khr_depth_images") continue; +#endif // defined(WITH_LIGHTHNING_COMPILER) + hsailOptions.append(" -D").append(token).append("=1"); } } return hsailOptions; @@ -1347,7 +1351,7 @@ LightningProgram::setKernels( for (auto &kernelName : kernelNameList) { auto kernel = new LightningKernel( - kernelName, this, options->origOptionStr + hsailOptions()); + kernelName, this, options->origOptionStr + hsailOptions(options)); kernels()[kernelName] = kernel; diff --git a/projects/clr/rocclr/runtime/device/pal/palprogram.hpp b/projects/clr/rocclr/runtime/device/pal/palprogram.hpp index 52464e841b..160b222602 100644 --- a/projects/clr/rocclr/runtime/device/pal/palprogram.hpp +++ b/projects/clr/rocclr/runtime/device/pal/palprogram.hpp @@ -257,7 +257,7 @@ private: protected: //! Returns all the options to be appended while passing to the //compiler library - std::string hsailOptions(); + std::string hsailOptions(amd::option::Options* options); //! Allocate kernel table bool allocKernelTable();