P4 to Git Change 1192638 by xcui@merged_opencl_jxcwin on 2015/09/21 14:34:25

SWDEV-17662 - EPR #426715 - for CZ enabled PX system, we need discrete GPU be the first device to do SVM allocation, and the fine grain system capable device do the allocation after discrete GPU.

	precheckin:
	http://ocltc.amd.com:8111/viewModification.html?modId=58725&personal=true&buildTypeId=&tab=vcsModificationBuilds&show_all_builds=true

	code review:
	http://ocltc.amd.com/reviews/r/8513/

Affected files ...

... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#255 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/context.cpp#36 edit


[ROCm/clr commit: ff9a6c0c58]
This commit is contained in:
foreman
2015-09-21 14:46:15 -04:00
parent c3fca75c4c
commit 98131ac83e
2 ha cambiato i file con 21 aggiunte e 4 eliminazioni
@@ -1537,6 +1537,11 @@ public:
CL_DEVICE_SVM_FINE_GRAIN_SYSTEM)) != 0 ? true : false;
}
//! check svm FGS support capability.
inline bool isFineGrainedSystem() const {
return (info().svmCapabilities_ & CL_DEVICE_SVM_FINE_GRAIN_SYSTEM) != 0 ? true : false;
}
//! Return this device's type.
cl_device_type type() const {
return info().type_ & ~(CL_DEVICE_TYPE_DEFAULT | CL_HSA_ENABLED_AMD
@@ -40,10 +40,22 @@ Context::Context(
svmAllocDevice_.push_back(device);
}
}
//make sure the first device is GPU
if ((svmAllocDevice_.size() > 1)
&& (svmAllocDevice_.front()->type() == CL_DEVICE_TYPE_CPU)) {
std::swap(svmAllocDevice_.front(), svmAllocDevice_.back());
if (svmAllocDevice_.size() > 1) {
//make sure the CPU is the last device to do allocation.
if ((svmAllocDevice_.front()->type() == CL_DEVICE_TYPE_CPU)) {
std::swap(svmAllocDevice_.front(), svmAllocDevice_.back());
}
uint isFirstDeviceFGSEnabled = svmAllocDevice_.front()->isFineGrainedSystem();
for (auto& dev : svmAllocDevice_) {
//allocation on fine - grained system incapable device first
if (isFirstDeviceFGSEnabled && (dev->type() == CL_DEVICE_TYPE_GPU)
&& (!(dev->isFineGrainedSystem()))) {
std::swap(svmAllocDevice_.front(), dev);
break;
}
}
}
}