P4 to Git Change 1552704 by gandryey@gera-w8 on 2018/05/09 15:11:23

SWDEV-79445 - OCL generic changes and code clean-up
	- Following CL#1552596. Make sure virtual GPU is set for the internal allocations before the create() call, since the deferred alloc is disabled.

Affected files ...

... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpublit.cpp#128 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuvirtual.cpp#416 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuvirtual.hpp#144 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palblit.cpp#22 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palvirtual.cpp#96 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palvirtual.hpp#51 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocblit.cpp#21 edit


[ROCm/clr commit: c11b2d52b7]
This commit is contained in:
foreman
2018-05-09 15:16:40 -04:00
parent 8dd3fe48d3
commit 8c04fe57cc
7 changed files with 21 additions and 40 deletions
@@ -720,7 +720,8 @@ bool KernelBlitManager::createProgram(Device& device) {
// Create an internal constant buffer
constantBuffer_ = new (*context_) amd::Buffer(*context_, CL_MEM_ALLOC_HOST_PTR, 4 * Ki);
// Assign the constant buffer to the current virtual GPU
constantBuffer_->setVirtualDevice(&gpu());
if ((constantBuffer_ != nullptr) && !constantBuffer_->create(nullptr)) {
constantBuffer_->release();
constantBuffer_ = nullptr;
@@ -729,15 +730,15 @@ bool KernelBlitManager::createProgram(Device& device) {
return false;
}
// Assign the constant buffer to the current virtual GPU
constantBuffer_->setVirtualDevice(&gpu());
if (dev().settings().xferBufSize_ > 0) {
xferBufferSize_ = dev().settings().xferBufSize_;
for (uint i = 0; i < MaxXferBuffers; ++i) {
// Create internal xfer buffers for image copy optimization
xferBuffers_[i] = new (*context_) amd::Buffer(*context_, 0, xferBufferSize_);
// Assign the xfer buffer to the current virtual GPU
xferBuffers_[i]->setVirtualDevice(&gpu());
if ((xferBuffers_[i] != nullptr) && !xferBuffers_[i]->create(nullptr)) {
xferBuffers_[i]->release();
xferBuffers_[i] = nullptr;
@@ -746,8 +747,6 @@ bool KernelBlitManager::createProgram(Device& device) {
return false;
}
// Assign the xfer buffer to the current virtual GPU
xferBuffers_[i]->setVirtualDevice(&gpu());
//! @note Workaround for conformance allocation test.
//! Force GPU mem alloc.
//! Unaligned images require xfer optimization,
@@ -2051,7 +2050,7 @@ amd::Memory* DmaBlitManager::pinHostMemory(const void* hostMem, size_t pinSize,
}
amdMemory = new (*context_) amd::Buffer(*context_, CL_MEM_USE_HOST_PTR, pinAllocSize);
amdMemory->setVirtualDevice(&gpu());
if ((amdMemory != nullptr) && !amdMemory->create(tmpHost, SysMem)) {
amdMemory->release();
return nullptr;
@@ -2059,7 +2058,6 @@ amd::Memory* DmaBlitManager::pinHostMemory(const void* hostMem, size_t pinSize,
// Get device memory for this virtual device
// @note: This will force real memory pinning
amdMemory->setVirtualDevice(&gpu());
Memory* srcMemory = dev().getRocMemory(amdMemory);
if (srcMemory == nullptr) {