From 630f34919141e5b6e07f273f7f7d0aed833012cb Mon Sep 17 00:00:00 2001 From: foreman Date: Mon, 3 Oct 2016 16:00:17 -0400 Subject: [PATCH] P4 to Git Change 1321888 by gandryey@gera-w8 on 2016/10/03 15:55:50 SWDEV-79445 - OCL generic changes and code clean-up - Add the destinaiton buffer size to the LF transfer method Affected files ... ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_lqdflash_amd.cpp#15 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuvirtual.cpp#406 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palvirtual.cpp#26 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/command.cpp#75 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/memory.hpp#97 edit --- rocclr/runtime/device/gpu/gpuvirtual.cpp | 4 +++- rocclr/runtime/device/pal/palvirtual.cpp | 4 +++- rocclr/runtime/platform/command.cpp | 3 ++- rocclr/runtime/platform/memory.hpp | 1 + 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/rocclr/runtime/device/gpu/gpuvirtual.cpp b/rocclr/runtime/device/gpu/gpuvirtual.cpp index dc9f0076a8..2facbbe466 100644 --- a/rocclr/runtime/device/gpu/gpuvirtual.cpp +++ b/rocclr/runtime/device/gpu/gpuvirtual.cpp @@ -3575,7 +3575,9 @@ VirtualGPU::submitTransferBufferFromFile(amd::TransferBufferFileCommand& cmd) size_t srcDstSize = amd::TransferBufferFileCommand::StagingBufferSize; srcDstSize = std::min(srcDstSize, copySize); void* srcDstBuffer = staging->cpuMap(*this); - if (!cmd.file()->transferBlock(writeBuffer, srcDstBuffer, fileOffset, 0, srcDstSize)) { + if (!cmd.file()->transferBlock(writeBuffer, + srcDstBuffer, staging->size(), fileOffset, 0, srcDstSize)) { + cmd.setStatus(CL_INVALID_OPERATION); return; } staging->cpuUnmap(*this); diff --git a/rocclr/runtime/device/pal/palvirtual.cpp b/rocclr/runtime/device/pal/palvirtual.cpp index 40e2ed043e..687e5e0009 100644 --- a/rocclr/runtime/device/pal/palvirtual.cpp +++ b/rocclr/runtime/device/pal/palvirtual.cpp @@ -3434,7 +3434,9 @@ VirtualGPU::submitTransferBufferFromFile(amd::TransferBufferFileCommand& cmd) size_t srcDstSize = amd::TransferBufferFileCommand::StagingBufferSize; srcDstSize = std::min(srcDstSize, copySize); void* srcDstBuffer = staging->cpuMap(*this); - if (!cmd.file()->transferBlock(writeBuffer, srcDstBuffer, fileOffset, 0, srcDstSize)) { + if (!cmd.file()->transferBlock(writeBuffer, + srcDstBuffer, staging->size(), fileOffset, 0, srcDstSize)) { + cmd.setStatus(CL_INVALID_OPERATION); return; } staging->cpuUnmap(*this); diff --git a/rocclr/runtime/platform/command.cpp b/rocclr/runtime/platform/command.cpp index 194a04f7b9..a525a693af 100644 --- a/rocclr/runtime/platform/command.cpp +++ b/rocclr/runtime/platform/command.cpp @@ -595,8 +595,9 @@ TransferBufferFileCommand::submit(device::VirtualDevice& device) void* srcDstBuffer = mem->cpuMap(device); // Make HD transfer to the host accessible memory bool writeBuffer(type() == CL_COMMAND_WRITE_BUFFER_FROM_FILE_AMD); - if (!file()->transferBlock(writeBuffer, srcDstBuffer, + if (!file()->transferBlock(writeBuffer, srcDstBuffer, mem->size(), fileOffset(), origin()[0], size()[0])) { + setStatus(CL_INVALID_OPERATION); return; } mem->cpuUnmap(device); diff --git a/rocclr/runtime/platform/memory.hpp b/rocclr/runtime/platform/memory.hpp index 1dbab69cd6..cc07cb7f15 100644 --- a/rocclr/runtime/platform/memory.hpp +++ b/rocclr/runtime/platform/memory.hpp @@ -695,6 +695,7 @@ public: bool transferBlock( bool read, void* dst, + uint64_t bufferSize, uint64_t fileOffset, uint64_t bufferOffset, uint64_t size) const;