From ad1eb8f858b92f5af3ab21e902a795201cfdaaf9 Mon Sep 17 00:00:00 2001 From: foreman Date: Thu, 17 Sep 2015 20:59:45 -0400 Subject: [PATCH] P4 to Git Change 1191906 by yaxunl@yaxunl_stg_win50 on 2015/09/17 20:52:47 ECR #354633 - SPIR-V: Always create HSAIL device program for SPIR-V since AMDIL path does not support it due to LLVM version. Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpudevice.cpp#276 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpudevice.hpp#92 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#254 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#524 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.hpp#149 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa/hsadevice.cpp#94 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa/hsadevice.hpp#50 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsadevice.cpp#39 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsadevice.hpp#17 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/program.cpp#69 edit --- rocclr/runtime/device/cpu/cpudevice.cpp | 2 +- rocclr/runtime/device/cpu/cpudevice.hpp | 2 +- rocclr/runtime/device/device.hpp | 2 +- rocclr/runtime/device/gpu/gpudevice.cpp | 8 ++++---- rocclr/runtime/device/gpu/gpudevice.hpp | 4 ++-- rocclr/runtime/device/hsa/hsadevice.cpp | 4 ++-- rocclr/runtime/device/hsa/hsadevice.hpp | 4 ++-- rocclr/runtime/platform/program.cpp | 5 +++-- 8 files changed, 16 insertions(+), 15 deletions(-) diff --git a/rocclr/runtime/device/cpu/cpudevice.cpp b/rocclr/runtime/device/cpu/cpudevice.cpp index 3e5493b06e..1f4f4b0a61 100644 --- a/rocclr/runtime/device/cpu/cpudevice.cpp +++ b/rocclr/runtime/device/cpu/cpudevice.cpp @@ -1115,7 +1115,7 @@ Device::partitionByAffinityDomainCacheLevel( } device::Program* -Device::createProgram(int oclVer) +Device::createProgram(bool hsail) { Program* cpuProgram = new Program(*this); if (cpuProgram == NULL) { diff --git a/rocclr/runtime/device/cpu/cpudevice.hpp b/rocclr/runtime/device/cpu/cpudevice.hpp index 64a767a87f..4389849e2b 100644 --- a/rocclr/runtime/device/cpu/cpudevice.hpp +++ b/rocclr/runtime/device/cpu/cpudevice.hpp @@ -84,7 +84,7 @@ public: } //! Compile the given source code. - virtual device::Program* createProgram(int oclVer = 120); + virtual device::Program* createProgram(bool hsail = false); //! Just returns NULL as CPU devices use the host memory virtual device::Memory* createMemory(amd::Memory& owner) const diff --git a/rocclr/runtime/device/device.hpp b/rocclr/runtime/device/device.hpp index d2a313b6be..41a4a9a51d 100644 --- a/rocclr/runtime/device/device.hpp +++ b/rocclr/runtime/device/device.hpp @@ -1556,7 +1556,7 @@ public: ) = 0; //! Compile the given source code. - virtual device::Program* createProgram(int oclVer = 120) = 0; + virtual device::Program* createProgram(bool hsail = false) = 0; //! Allocate a chunk of device memory as a cache for a CL memory object virtual device::Memory* createMemory(Memory& owner) const = 0; diff --git a/rocclr/runtime/device/gpu/gpudevice.cpp b/rocclr/runtime/device/gpu/gpudevice.cpp index e8775b6db7..f7181fcee0 100644 --- a/rocclr/runtime/device/gpu/gpudevice.cpp +++ b/rocclr/runtime/device/gpu/gpudevice.cpp @@ -205,10 +205,10 @@ NullDevice::create(CALtarget target) } device::Program* -NullDevice::createProgram(int oclVer) +NullDevice::createProgram(bool hsail) { device::Program* nullProgram; - if (settings().hsail_ || (oclVer == 200)) { + if (settings().hsail_ || hsail) { nullProgram = new HSAILProgram(*this); } else { @@ -1064,10 +1064,10 @@ Device::createVirtualDevice( } device::Program* -Device::createProgram(int oclVer) +Device::createProgram(bool hsail) { device::Program* gpuProgram; - if (settings().hsail_ || (oclVer == 200)) { + if (settings().hsail_ || hsail) { gpuProgram = new HSAILProgram(*this); } else { diff --git a/rocclr/runtime/device/gpu/gpudevice.hpp b/rocclr/runtime/device/gpu/gpudevice.hpp index 045ee2b40c..9a7c43853a 100644 --- a/rocclr/runtime/device/gpu/gpudevice.hpp +++ b/rocclr/runtime/device/gpu/gpudevice.hpp @@ -67,7 +67,7 @@ public: ) { return NULL; } //! Compile the given source code. - virtual device::Program* createProgram(int oclVer = 120); + virtual device::Program* createProgram(bool hsail = false); //! Just returns NULL for the dummy device virtual device::Memory* createMemory(amd::Memory& owner) const { return NULL; } @@ -430,7 +430,7 @@ public: ) const; //! Create the device program. - virtual device::Program* createProgram(int oclVer = 120); + virtual device::Program* createProgram(bool hsail = false); //! Attempt to bind with external graphics API's device/context virtual bool bindExternalDevice( diff --git a/rocclr/runtime/device/hsa/hsadevice.cpp b/rocclr/runtime/device/hsa/hsadevice.cpp index 5525619e1e..20356d3227 100644 --- a/rocclr/runtime/device/hsa/hsadevice.cpp +++ b/rocclr/runtime/device/hsa/hsadevice.cpp @@ -415,12 +415,12 @@ Device::getOclHsaMemory(amd::Memory* mem) const } device::Program* -NullDevice::createProgram(int oclVer) { +NullDevice::createProgram(bool hsail) { return new oclhsa::FSAILProgram(*this); } device::Program* -Device::createProgram(int oclVer) { +Device::createProgram(bool hsail) { return new oclhsa::FSAILProgram(*this); } diff --git a/rocclr/runtime/device/hsa/hsadevice.hpp b/rocclr/runtime/device/hsa/hsadevice.hpp index ce1fe3a230..30cfc9fcf5 100644 --- a/rocclr/runtime/device/hsa/hsadevice.hpp +++ b/rocclr/runtime/device/hsa/hsadevice.hpp @@ -76,7 +76,7 @@ public: aclCompiler *compiler() const { return compilerHandle_; } //! Construct an HSAIL program object from the ELF assuming it is valid - virtual device::Program *createProgram(int oclVer = 120); + virtual device::Program *createProgram(bool hsail = false); const AMDDeviceInfo& deviceInfo() const { return deviceInfo_; @@ -246,7 +246,7 @@ public: amd::CommandQueue* queue = NULL); //! Construct an HSAIL program object from the ELF assuming it is valid - virtual device::Program *createProgram(int oclVer = 120); + virtual device::Program *createProgram(bool hsail = false); virtual device::Memory *createMemory(amd::Memory &owner) const; diff --git a/rocclr/runtime/platform/program.cpp b/rocclr/runtime/platform/program.cpp index 91795b99ae..2e1300a9e4 100644 --- a/rocclr/runtime/platform/program.cpp +++ b/rocclr/runtime/platform/program.cpp @@ -63,7 +63,8 @@ Program::addDeviceProgram(Device& device, const void* image, size_t length, int return CL_SUCCESS; } - device::Program* program = rootDev.createProgram(oclVer); + bool hsail = (oclVer >= 200) || isIL_; + device::Program* program = rootDev.createProgram(hsail); if (program == NULL) { return CL_OUT_OF_HOST_MEMORY; } @@ -92,7 +93,7 @@ Program::addDeviceProgram(Device& device, const void* image, size_t length, int devicePrograms_[&rootDev] = program; - program = rootDev.createProgram(oclVer); + program = rootDev.createProgram(hsail); if (program == NULL) { return CL_OUT_OF_HOST_MEMORY; }