P4 to Git Change 1472384 by lmoriche@lmoriche_opencl_dev2 on 2017/10/19 03:29:10
SWDEV-126884 - OCL 2.1 Platform APIs
- Fix OCL/ROCm OpenCL C version
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpucompiler.cpp#157 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#578 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuresource.cpp#240 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.cpp#65 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.cpp#70 edit
... //depot/stg/opencl/drivers/opencl/runtime/runtimedefs#46 edit
[ROCm/clr commit: 46dcd95add]
This commit is contained in:
@@ -138,6 +138,7 @@ bool NullProgram::compileImpl(const std::string& src,
|
|||||||
opts << " -cl-std=CL1.1";
|
opts << " -cl-std=CL1.1";
|
||||||
break;
|
break;
|
||||||
case OpenCL20:
|
case OpenCL20:
|
||||||
|
case OpenCL21:
|
||||||
default:
|
default:
|
||||||
case OpenCL12:
|
case OpenCL12:
|
||||||
opts << " -cl-std=CL1.2";
|
opts << " -cl-std=CL1.2";
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ bool NullDevice::create(CALtarget target) {
|
|||||||
compiler_ = aclCompilerInit(&opts, NULL);
|
compiler_ = aclCompilerInit(&opts, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings().hsail_ || (settings().oclVersion_ == OpenCL20)) {
|
if (settings().hsail_ || (settings().oclVersion_ >= OpenCL20)) {
|
||||||
// Runtime doesn't know what local size could be on the real board
|
// Runtime doesn't know what local size could be on the real board
|
||||||
info_.maxGlobalVariableSize_ = static_cast<size_t>(512 * Mi);
|
info_.maxGlobalVariableSize_ = static_cast<size_t>(512 * Mi);
|
||||||
|
|
||||||
@@ -487,7 +487,7 @@ void NullDevice::fillDeviceInfo(const CALdeviceattribs& calAttr, const gslMemInf
|
|||||||
::snprintf(info_.driverVersion_, sizeof(info_.driverVersion_) - 1, AMD_BUILD_STRING);
|
::snprintf(info_.driverVersion_, sizeof(info_.driverVersion_) - 1, AMD_BUILD_STRING);
|
||||||
|
|
||||||
info_.profile_ = "FULL_PROFILE";
|
info_.profile_ = "FULL_PROFILE";
|
||||||
if (settings().oclVersion_ == OpenCL20) {
|
if (settings().oclVersion_ >= OpenCL20) {
|
||||||
info_.version_ = "OpenCL 2.0 " AMD_PLATFORM_INFO;
|
info_.version_ = "OpenCL 2.0 " AMD_PLATFORM_INFO;
|
||||||
info_.oclcVersion_ = "OpenCL C 2.0 ";
|
info_.oclcVersion_ = "OpenCL C 2.0 ";
|
||||||
info_.spirVersions_ = "1.2";
|
info_.spirVersions_ = "1.2";
|
||||||
@@ -958,7 +958,7 @@ bool Device::create(CALuint ordinal, CALuint numOfDevices) {
|
|||||||
compiler_ = aclCompilerInit(&opts, NULL);
|
compiler_ = aclCompilerInit(&opts, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings().hsail_ || (settings().oclVersion_ == OpenCL20)) {
|
if (settings().hsail_ || (settings().oclVersion_ >= OpenCL20)) {
|
||||||
if (NULL == hsaCompiler_) {
|
if (NULL == hsaCompiler_) {
|
||||||
const char* library = getenv("HSA_COMPILER_LIBRARY");
|
const char* library = getenv("HSA_COMPILER_LIBRARY");
|
||||||
aclCompilerOptions opts = {
|
aclCompilerOptions opts = {
|
||||||
@@ -1068,7 +1068,7 @@ bool Device::initializeHeapResources() {
|
|||||||
if (settings().ciPlus_) {
|
if (settings().ciPlus_) {
|
||||||
const char* CL20extraBlits = NULL;
|
const char* CL20extraBlits = NULL;
|
||||||
const char* ocl20 = NULL;
|
const char* ocl20 = NULL;
|
||||||
if (settings().oclVersion_ == OpenCL20) {
|
if (settings().oclVersion_ >= OpenCL20) {
|
||||||
CL20extraBlits = SchedulerSourceCode;
|
CL20extraBlits = SchedulerSourceCode;
|
||||||
ocl20 = "-cl-std=CL2.0";
|
ocl20 = "-cl-std=CL2.0";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -924,7 +924,7 @@ bool Resource::create(MemoryType memType, CreateParams* params) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((dev().settings().hsail_ || (dev().settings().oclVersion_ == OpenCL20)) && !cal()->buffer_) {
|
if ((dev().settings().hsail_ || (dev().settings().oclVersion_ >= OpenCL20)) && !cal()->buffer_) {
|
||||||
hwSrd_ = dev().srds().allocSrdSlot(reinterpret_cast<address*>(&hwState_));
|
hwSrd_ = dev().srds().allocSrdSlot(reinterpret_cast<address*>(&hwState_));
|
||||||
if (0 == hwSrd_) {
|
if (0 == hwSrd_) {
|
||||||
return false;
|
return false;
|
||||||
@@ -1032,7 +1032,7 @@ void Resource::free() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Free SRD for images
|
// Free SRD for images
|
||||||
if ((dev().settings().hsail_ || (dev().settings().oclVersion_ == OpenCL20)) && !cal()->buffer_) {
|
if ((dev().settings().hsail_ || (dev().settings().oclVersion_ >= OpenCL20)) && !cal()->buffer_) {
|
||||||
dev().srds().freeSrdSlot(hwSrd_);
|
dev().srds().freeSrdSlot(hwSrd_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -439,7 +439,7 @@ void NullDevice::fillDeviceInfo(const Pal::DeviceProperties& palProp,
|
|||||||
);
|
);
|
||||||
|
|
||||||
info_.profile_ = "FULL_PROFILE";
|
info_.profile_ = "FULL_PROFILE";
|
||||||
if (settings().oclVersion_ == OpenCL20) {
|
if (settings().oclVersion_ >= OpenCL20) {
|
||||||
info_.version_ = "OpenCL 2.0 " AMD_PLATFORM_INFO;
|
info_.version_ = "OpenCL 2.0 " AMD_PLATFORM_INFO;
|
||||||
info_.oclcVersion_ = "OpenCL C 2.0 ";
|
info_.oclcVersion_ = "OpenCL C 2.0 ";
|
||||||
info_.spirVersions_ = "1.2";
|
info_.spirVersions_ = "1.2";
|
||||||
@@ -2151,7 +2151,7 @@ bool Device::createBlitProgram() {
|
|||||||
const char* ocl20 = nullptr;
|
const char* ocl20 = nullptr;
|
||||||
#if !defined(WITH_LIGHTNING_COMPILER)
|
#if !defined(WITH_LIGHTNING_COMPILER)
|
||||||
std::string sch = SchedulerSourceCode;
|
std::string sch = SchedulerSourceCode;
|
||||||
if (settings().oclVersion_ == OpenCL20) {
|
if (settings().oclVersion_ >= OpenCL20) {
|
||||||
size_t loc = sch.find("%s");
|
size_t loc = sch.find("%s");
|
||||||
sch.replace(loc, 2, iDev()->GetDispatchKernelSource());
|
sch.replace(loc, 2, iDev()->GetDispatchKernelSource());
|
||||||
scheduler = sch.c_str();
|
scheduler = sch.c_str();
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
#endif // WITHOUT_HSA_BACKEND
|
#endif // WITHOUT_HSA_BACKEND
|
||||||
|
|
||||||
#define OPENCL_VERSION_STR XSTR(OPENCL_MAJOR) "." XSTR(OPENCL_MINOR)
|
#define OPENCL_VERSION_STR XSTR(OPENCL_MAJOR) "." XSTR(OPENCL_MINOR)
|
||||||
|
#define OPENCL_C_VERSION_STR XSTR(OPENCL_C_MAJOR) "." XSTR(OPENCL_C_MINOR)
|
||||||
|
|
||||||
#ifndef WITHOUT_HSA_BACKEND
|
#ifndef WITHOUT_HSA_BACKEND
|
||||||
namespace device {
|
namespace device {
|
||||||
@@ -111,7 +112,7 @@ bool NullDevice::create(const AMDDeviceInfo& deviceInfo) {
|
|||||||
info_.extensions_ = getExtensionString();
|
info_.extensions_ = getExtensionString();
|
||||||
info_.maxWorkGroupSize_ = hsaSettings->maxWorkGroupSize_;
|
info_.maxWorkGroupSize_ = hsaSettings->maxWorkGroupSize_;
|
||||||
::strcpy(info_.vendor_, "Advanced Micro Devices, Inc.");
|
::strcpy(info_.vendor_, "Advanced Micro Devices, Inc.");
|
||||||
info_.oclcVersion_ = "OpenCL C " IF(IS_LIGHTNING, OPENCL_VERSION_STR, "1.2") " ";
|
info_.oclcVersion_ = "OpenCL C " IF(IS_LIGHTNING, OPENCL_C_VERSION_STR, "1.2") " ";
|
||||||
strcpy(info_.driverVersion_, "1.0 Provisional (hsa)");
|
strcpy(info_.driverVersion_, "1.0 Provisional (hsa)");
|
||||||
info_.version_ = "OpenCL " OPENCL_VERSION_STR " ";
|
info_.version_ = "OpenCL " OPENCL_VERSION_STR " ";
|
||||||
return true;
|
return true;
|
||||||
@@ -952,7 +953,7 @@ bool Device::populateOCLDeviceConstants() {
|
|||||||
info_.addressBits_ = LP64_SWITCH(32, 64);
|
info_.addressBits_ = LP64_SWITCH(32, 64);
|
||||||
info_.maxSamplers_ = 16;
|
info_.maxSamplers_ = 16;
|
||||||
info_.bufferFromImageSupport_ = CL_FALSE;
|
info_.bufferFromImageSupport_ = CL_FALSE;
|
||||||
info_.oclcVersion_ = "OpenCL C " IF(IS_LIGHTNING, OPENCL_VERSION_STR, "1.2") " ";
|
info_.oclcVersion_ = "OpenCL C " IF(IS_LIGHTNING, OPENCL_C_VERSION_STR, "1.2") " ";
|
||||||
|
|
||||||
uint16_t major, minor;
|
uint16_t major, minor;
|
||||||
if (hsa_agent_get_info(_bkendDevice, HSA_AGENT_INFO_VERSION_MAJOR, &major) !=
|
if (hsa_agent_get_info(_bkendDevice, HSA_AGENT_INFO_VERSION_MAJOR, &major) !=
|
||||||
|
|||||||
Reference in New Issue
Block a user