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]
Bu işleme şunda yer alıyor:
@@ -138,6 +138,7 @@ bool NullProgram::compileImpl(const std::string& src,
|
||||
opts << " -cl-std=CL1.1";
|
||||
break;
|
||||
case OpenCL20:
|
||||
case OpenCL21:
|
||||
default:
|
||||
case OpenCL12:
|
||||
opts << " -cl-std=CL1.2";
|
||||
|
||||
@@ -216,7 +216,7 @@ bool NullDevice::create(CALtarget target) {
|
||||
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
|
||||
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);
|
||||
|
||||
info_.profile_ = "FULL_PROFILE";
|
||||
if (settings().oclVersion_ == OpenCL20) {
|
||||
if (settings().oclVersion_ >= OpenCL20) {
|
||||
info_.version_ = "OpenCL 2.0 " AMD_PLATFORM_INFO;
|
||||
info_.oclcVersion_ = "OpenCL C 2.0 ";
|
||||
info_.spirVersions_ = "1.2";
|
||||
@@ -958,7 +958,7 @@ bool Device::create(CALuint ordinal, CALuint numOfDevices) {
|
||||
compiler_ = aclCompilerInit(&opts, NULL);
|
||||
}
|
||||
|
||||
if (settings().hsail_ || (settings().oclVersion_ == OpenCL20)) {
|
||||
if (settings().hsail_ || (settings().oclVersion_ >= OpenCL20)) {
|
||||
if (NULL == hsaCompiler_) {
|
||||
const char* library = getenv("HSA_COMPILER_LIBRARY");
|
||||
aclCompilerOptions opts = {
|
||||
@@ -1068,7 +1068,7 @@ bool Device::initializeHeapResources() {
|
||||
if (settings().ciPlus_) {
|
||||
const char* CL20extraBlits = NULL;
|
||||
const char* ocl20 = NULL;
|
||||
if (settings().oclVersion_ == OpenCL20) {
|
||||
if (settings().oclVersion_ >= OpenCL20) {
|
||||
CL20extraBlits = SchedulerSourceCode;
|
||||
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_));
|
||||
if (0 == hwSrd_) {
|
||||
return false;
|
||||
@@ -1032,7 +1032,7 @@ void Resource::free() {
|
||||
}
|
||||
|
||||
// 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_);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -439,7 +439,7 @@ void NullDevice::fillDeviceInfo(const Pal::DeviceProperties& palProp,
|
||||
);
|
||||
|
||||
info_.profile_ = "FULL_PROFILE";
|
||||
if (settings().oclVersion_ == OpenCL20) {
|
||||
if (settings().oclVersion_ >= OpenCL20) {
|
||||
info_.version_ = "OpenCL 2.0 " AMD_PLATFORM_INFO;
|
||||
info_.oclcVersion_ = "OpenCL C 2.0 ";
|
||||
info_.spirVersions_ = "1.2";
|
||||
@@ -2151,7 +2151,7 @@ bool Device::createBlitProgram() {
|
||||
const char* ocl20 = nullptr;
|
||||
#if !defined(WITH_LIGHTNING_COMPILER)
|
||||
std::string sch = SchedulerSourceCode;
|
||||
if (settings().oclVersion_ == OpenCL20) {
|
||||
if (settings().oclVersion_ >= OpenCL20) {
|
||||
size_t loc = sch.find("%s");
|
||||
sch.replace(loc, 2, iDev()->GetDispatchKernelSource());
|
||||
scheduler = sch.c_str();
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#endif // WITHOUT_HSA_BACKEND
|
||||
|
||||
#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
|
||||
namespace device {
|
||||
@@ -111,7 +112,7 @@ bool NullDevice::create(const AMDDeviceInfo& deviceInfo) {
|
||||
info_.extensions_ = getExtensionString();
|
||||
info_.maxWorkGroupSize_ = hsaSettings->maxWorkGroupSize_;
|
||||
::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)");
|
||||
info_.version_ = "OpenCL " OPENCL_VERSION_STR " ";
|
||||
return true;
|
||||
@@ -952,7 +953,7 @@ bool Device::populateOCLDeviceConstants() {
|
||||
info_.addressBits_ = LP64_SWITCH(32, 64);
|
||||
info_.maxSamplers_ = 16;
|
||||
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;
|
||||
if (hsa_agent_get_info(_bkendDevice, HSA_AGENT_INFO_VERSION_MAJOR, &major) !=
|
||||
|
||||
Yeni konuda referans
Bir kullanıcı engelle