P4 to Git Change 1094476 by xcui@merged_opencl_jxcwin on 2014/11/06 14:39:20

EPR #406328 - removed the customSVMallocator from runtime, and also changed the name of customSvmAllocDevice to svmAllocDevice, because we don't use custom svm allocator for devices.
	precheckin testing:
	http://ocltc.amd.com:8111/viewModification.html?modId=43040&personal=true&buildTypeId=&tab=vcsModificationBuilds&show_all_builds=true
	code review:
	http://ocltc.amd.com/reviews/r/6222/

Affected files ...

... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpusettings.cpp#29 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/device.cpp#171 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#232 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpusettings.cpp#293 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/hsa/hsasettings.cpp#36 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/context.cpp#33 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/context.hpp#23 edit


[ROCm/clr commit: 37a837dc8f]
This commit is contained in:
foreman
2014-11-06 15:47:27 -05:00
rodzic 9e62f38405
commit 188325c160
7 zmienionych plików z 22 dodań i 26 usunięć
@@ -54,7 +54,6 @@ Settings::create()
enableExtension(ClKhrSubGroups);
supportDepthsRGB_ = true;
enableExtension(ClKhrDepthImages);
customSvmAllocator_ = true;
}
// Map CPUID feature bits to our own feature bits
@@ -518,7 +518,6 @@ Settings::Settings()
supportRA_ = true;
largeHostMemAlloc_ = false;
customHostAllocator_ = false;
customSvmAllocator_ = false;
waitCommand_ = AMD_OCL_WAIT_COMMAND;
supportDepthsRGB_ = false;
assumeAliases_ = false;
@@ -586,10 +586,9 @@ public:
uint waitCommand_: 1; //!< Enables a wait for every submitted command
uint customHostAllocator_: 1;//!< True if device has custom host allocator
// that replaces generic OS allocation routines
uint customSvmAllocator_: 1; //!< True if device has custom SVM allocator
uint supportDepthsRGB_: 1; //!< Support DEPTH and sRGB channel order format
uint assumeAliases_: 1; //!< Assume aliases in the compilation process
uint reserved_: 24;
uint reserved_: 25;
};
uint value_;
};
@@ -1515,6 +1514,14 @@ public:
const device::Info& info() const { return info_; }
//! Return svm support capability.
bool svmSupport() const {
return (info().svmCapabilities_ &
(CL_DEVICE_SVM_COARSE_GRAIN_BUFFER |
CL_DEVICE_SVM_FINE_GRAIN_BUFFER |
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
@@ -1614,13 +1621,6 @@ public:
ShouldNotCallThis();
}
/**
* @return True if the device has its own custom SVM allocator
*/
bool customSvmAllocator() const {
return settings().customSvmAllocator_ == 1;
}
/**
* @copydoc amd::Context::svmAlloc
*/
@@ -318,7 +318,6 @@ Settings::create(
if (oclVersion_ >= OpenCL20) {
supportDepthsRGB_ = true;
customSvmAllocator_ = true;
}
if (use64BitPtr_) {
if (GPU_ENABLE_LARGE_ALLOCATION) {
@@ -36,7 +36,6 @@ Settings::create(bool doublePrecision)
{
largeHostMemAlloc_ = true;
customHostAllocator_ = true;
customSvmAllocator_ = true;
// Enable extensions
enableExtension(ClKhrByteAddressableStore);
@@ -36,14 +36,14 @@ Context::Context(
"is allowed per context");
customHostAllocDevice_ = device;
}
if (device->customSvmAllocator()) {
customSvmAllocDevice_.push_back(device);
if (device->svmSupport()) {
svmAllocDevice_.push_back(device);
}
}
//make sure the first device is GPU
if ((customSvmAllocDevice_.size() > 1)
&& (customSvmAllocDevice_.front()->type() == CL_DEVICE_TYPE_CPU)) {
std::swap(customSvmAllocDevice_.front(), customSvmAllocDevice_.back());
if ((svmAllocDevice_.size() > 1)
&& (svmAllocDevice_.front()->type() == CL_DEVICE_TYPE_CPU)) {
std::swap(svmAllocDevice_.front(), svmAllocDevice_.back());
}
}
@@ -293,22 +293,22 @@ Context::hostFree(void* ptr) const
void*
Context::svmAlloc(size_t size, size_t alignment, cl_svm_mem_flags flags)
{
unsigned int numSVMDev = customSvmAllocDevice_.size();
unsigned int numSVMDev = svmAllocDevice_.size();
if (numSVMDev < 1) {
return NULL;
}
if (customSvmAllocDevice_.front()->type() == CL_DEVICE_TYPE_CPU) {
if (svmAllocDevice_.front()->type() == CL_DEVICE_TYPE_CPU) {
return AlignedMemory::allocate(size, alignment);
}
else {
void* svmPtrAlloced = NULL;
void* tempPtr = NULL;
for (const auto& dev : customSvmAllocDevice_) {
for (const auto& dev : svmAllocDevice_) {
if (dev->type() == CL_DEVICE_TYPE_GPU) {
tempPtr = dev->svmAlloc(*this, size, alignment, flags);
if (dev == customSvmAllocDevice_.front()) {
if (dev == svmAllocDevice_.front()) {
svmPtrAlloced = tempPtr;
}
if ((svmPtrAlloced != tempPtr) || (NULL == tempPtr)) {
@@ -323,12 +323,12 @@ Context::svmAlloc(size_t size, size_t alignment, cl_svm_mem_flags flags)
void
Context::svmFree(void* ptr) const
{
if (customSvmAllocDevice_.front()->type() == CL_DEVICE_TYPE_CPU) {
if (svmAllocDevice_.front()->type() == CL_DEVICE_TYPE_CPU) {
AlignedMemory::deallocate(ptr);
return;
}
for (const auto& dev : customSvmAllocDevice_) {
for (const auto& dev : svmAllocDevice_) {
if (dev->type() == CL_DEVICE_TYPE_GPU) {
dev->svmFree(ptr);
}
@@ -143,7 +143,7 @@ public:
const std::vector<Device*>& devices() const { return devices_; }
//! Return the SVM capable devices associated with this context.
const std::vector<Device*>& svmDevices() const { return customSvmAllocDevice_; }
const std::vector<Device*>& svmDevices() const { return svmAllocDevice_; }
//! Returns true if the given device is associated with this context.
bool containsDevice(const Device* device) const;
@@ -187,7 +187,7 @@ private:
cl_context_properties* properties_; //!< Original properties
GLFunctions* glenv_; //!< OpenGL context
Device* customHostAllocDevice_; //!< Device responsible for host allocations
std::vector<Device*> customSvmAllocDevice_; //!< Devices can support SVM allocations
std::vector<Device*> svmAllocDevice_; //!< Devices can support SVM allocations
std::map<const Device*, DeviceQueueInfo> deviceQueues_; //!< Device queues mapping
Monitor ctxLock_; //!< Lock for the context access
};