From bc8b0dbc9ca1157c3ec887f8ef15374c5f6d9f8a Mon Sep 17 00:00:00 2001
From: foreman
Date: Fri, 29 Aug 2014 17:26:08 -0400
Subject: [PATCH] P4 to Git Change 1071796 by xcui@merged_opencl_jxcwin on
2014/08/29 17:10:04
EPR #404341 - disable OPenCL 2.0 for corssfire and multipe devices temporaraly, this is the OPENCL changes.
code review:
http://ocltc.amd.com/reviews/r/5639/
precheckin testing results:
http://ocltc.amd.com:8111/viewModification.html?modId=38513&personal=true&init=1&tab=vcsModificationBuilds
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#458 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.hpp#132 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpusettings.cpp#277 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/include/cal/cal.h#28 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp#98 edit
---
rocclr/runtime/device/gpu/gpudevice.cpp | 21 +++++++++----------
rocclr/runtime/device/gpu/gpudevice.hpp | 3 ++-
rocclr/runtime/device/gpu/gpusettings.cpp | 3 +++
.../device/gpu/gslbe/src/include/cal/cal.h | 1 +
.../device/gpu/gslbe/src/rt/GSLDevice.cpp | 1 +
5 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/rocclr/runtime/device/gpu/gpudevice.cpp b/rocclr/runtime/device/gpu/gpudevice.cpp
index 7d853be7f6..d36305e885 100644
--- a/rocclr/runtime/device/gpu/gpudevice.cpp
+++ b/rocclr/runtime/device/gpu/gpudevice.cpp
@@ -623,13 +623,6 @@ void Device::fillDeviceInfo(
info_.linkerAvailable_ = CL_TRUE;
info_.executionCapabilities_ = CL_EXEC_KERNEL;
- if (settings().oclVersion_ >= OpenCL20) {
- info_.svmCapabilities_ = CL_DEVICE_SVM_COARSE_GRAIN_BUFFER
- | CL_DEVICE_SVM_FINE_GRAIN_BUFFER;
- if (settings().svmAtomics_) {
- info_.svmCapabilities_ |= CL_DEVICE_SVM_ATOMICS;
- }
- }
info_.preferredPlatformAtomicAlignment_ = 0;
info_.preferredGlobalAtomicAlignment_ = 0;
info_.preferredLocalAtomicAlignment_ = 0;
@@ -713,6 +706,11 @@ void Device::fillDeviceInfo(
info_.printfBufferSize_ = PrintfDbg::WorkitemDebugSize * info().maxWorkGroupSize_;
if (settings().oclVersion_ >= OpenCL20) {
+ info_.svmCapabilities_ = CL_DEVICE_SVM_COARSE_GRAIN_BUFFER
+ | CL_DEVICE_SVM_FINE_GRAIN_BUFFER;
+ if (settings().svmAtomics_) {
+ info_.svmCapabilities_ |= CL_DEVICE_SVM_ATOMICS;
+ }
// OpenCL2.0 device info fields
info_.maxWriteImageArgs_ = MaxReadWriteImage; //!< For compatibility
info_.maxReadWriteImageArgs_ = MaxReadWriteImage;
@@ -749,13 +747,14 @@ void Device::fillDeviceInfo(
extern const char* SchedulerSourceCode;
bool
-Device::create(CALuint ordinal)
+Device::create(CALuint ordinal, CALuint numOfDevices)
{
appProfile_.init();
// Open GSL device
+ bool reportOCL12Device = numOfDevices < 2 ? (OPENCL_VERSION < 200) : true;
if (!open(ordinal, appProfile_.enableHighPerformanceState(),
- (appProfile_.reportAsOCL12Device() || (OPENCL_VERSION < 200)))) {
+ appProfile_.reportAsOCL12Device() || reportOCL12Device)) {
return false;
}
@@ -770,7 +769,7 @@ Device::create(CALuint ordinal)
#if cl_amd_open_video
, getVideoAttribs()
#endif // cl_amd_open_video
- , appProfile_.reportAsOCL12Device()
+ , appProfile_.reportAsOCL12Device() || reportOCL12Device
)) {
return false;
}
@@ -1249,7 +1248,7 @@ Device::init()
for (; ordinal < numDevices; ++ordinal) {
// Create the GPU device object
Device *d = new Device();
- result = (NULL != d) && d->create(ordinal);
+ result = (NULL != d) && d->create(ordinal, numDevices);
if (useDeviceList) {
result &= (requestedDevices.find(ordinal) != requestedDevices.end());
}
diff --git a/rocclr/runtime/device/gpu/gpudevice.hpp b/rocclr/runtime/device/gpu/gpudevice.hpp
index a3ca8f92f3..fd9fb46e19 100644
--- a/rocclr/runtime/device/gpu/gpudevice.hpp
+++ b/rocclr/runtime/device/gpu/gpudevice.hpp
@@ -363,7 +363,8 @@ public:
//! Initialise a device (i.e. all parts of the constructor that could
//! potentially fail)
bool create(
- CALuint ordinal //!< GPU device ordinal index. Starts from 0
+ CALuint ordinal, //!< GPU device ordinal index. Starts from 0
+ CALuint numOfDevices //!< number of GPU devices in the system
);
//! Destructor for the physical GPU device
diff --git a/rocclr/runtime/device/gpu/gpusettings.cpp b/rocclr/runtime/device/gpu/gpusettings.cpp
index 2c81e2e42f..b8342877c8 100644
--- a/rocclr/runtime/device/gpu/gpusettings.cpp
+++ b/rocclr/runtime/device/gpu/gpusettings.cpp
@@ -287,6 +287,9 @@ Settings::create(
#if defined(_LP64)
oclVersion_ = reportAsOCL12Device ? OpenCL12 : XCONCAT(OpenCL,XCONCAT(OPENCL_MAJOR,OPENCL_MINOR));
#endif
+ if (calAttr.numOfVpu > 1) {
+ oclVersion_ = OpenCL12;
+ }
if (GPU_FORCE_OCL20_32BIT) {
force32BitOcl20_ = true;
oclVersion_ = reportAsOCL12Device ? OpenCL12 : XCONCAT(OpenCL,XCONCAT(OPENCL_MAJOR,OPENCL_MINOR));
diff --git a/rocclr/runtime/device/gpu/gslbe/src/include/cal/cal.h b/rocclr/runtime/device/gpu/gslbe/src/include/cal/cal.h
index 46c9600dbf..caef5dff22 100644
--- a/rocclr/runtime/device/gpu/gslbe/src/include/cal/cal.h
+++ b/rocclr/runtime/device/gpu/gslbe/src/include/cal/cal.h
@@ -237,6 +237,7 @@ typedef struct CALdeviceattribsRec {
CALuint64 vaStart; /**< VA start address */
CALuint64 vaEnd; /**< VA end address */
bool isWorkstation; /**< Whether Device is a Workstation/Server part */
+ CALuint numOfVpu; /**< number of vpu in the device*/
} CALdeviceattribs;
/** CAL device status */
diff --git a/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp b/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp
index 7f157e68e4..c01deaa22a 100644
--- a/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp
+++ b/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp
@@ -154,6 +154,7 @@ CALGSLDevice::getAttribs_int(gsl::gsCtx* cs)
m_attribs.vaStart = static_cast(m_adp->pAsicInfo->vaStart);
m_attribs.vaEnd = static_cast(m_adp->pAsicInfo->vaEnd);
+ m_attribs.numOfVpu = m_adp->pAsicInfo->numberOfVPU;
}
void