P4 to Git Change 1239589 by mtomarov@stg-ocl-mtomarov on 2016/02/23 07:47:15
SWDEV-76870 - Add write feature to AMD extension (Merging //depot/rel/r6/15.30.1023/stream/opencl/... to //depot/stg/opencl/drivers/opencl/...)
Add clEnqueueReadBufferToFileAMD function to AMD extension (added declaration in cl_context.cpp)
1. Added clEnqueueReadBufferToFileAMD_fn function declaration to cl_ext.h
2. Added LiquidFlashFile::writeBlock method who implements transfer from GPU to SSD. In order to avoid code duplication LiquidFlashFile::readBlock and LiquidFlashFile::writeBlock is called from new method LiquidFlashFile::transferBlock (changes in cl_lqdflash_amd.cpp)
3. clEnqueueWriteBufferFromFileAMD and clEnqueueWriteBufferFromFileAMD call internal function EnqueueTransferBufferFromFileAMD who makes the same preparations as clEnqueueWriteBufferFromFileAMD in the prvious release
4. WriteBufferFromFileCommand class is renamed to TransferBufferFromFileCommand and new class makes the same preparation except assigning transfer direction (read or write)
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_context.cpp#48 integrate
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_lqdflash_amd.cpp#13 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_lqdflash_amd.h#4 integrate
... //depot/stg/opencl/drivers/opencl/api/opencl/khronos/headers/opencl2.0/CL/cl_ext.h#24 integrate
... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#267 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuvirtual.cpp#396 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuvirtual.hpp#138 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/command.cpp#74 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/command.hpp#81 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/memory.hpp#96 edit
[ROCm/clr commit: 1cb5415538]
This commit is contained in:
@@ -58,7 +58,7 @@ class SvmCopyMemoryCommand;
|
||||
class SvmFillMemoryCommand;
|
||||
class SvmMapMemoryCommand;
|
||||
class SvmUnmapMemoryCommand;
|
||||
class WriteBufferFromFileCommand;
|
||||
class TransferBufferFileCommand;
|
||||
class HwDebugManager;
|
||||
class Device;
|
||||
struct KernelParameterDescriptor;
|
||||
@@ -1452,7 +1452,7 @@ public:
|
||||
/// Optional extensions
|
||||
virtual void submitSignal(amd::SignalCommand & cmd) = 0;
|
||||
virtual void submitMakeBuffersResident(amd::MakeBuffersResidentCommand & cmd) = 0;
|
||||
virtual void submitWriteBufferFromFile(amd::WriteBufferFromFileCommand& cmd) { ShouldNotReachHere(); }
|
||||
virtual void submitTransferBufferFromFile(amd::TransferBufferFileCommand& cmd) { ShouldNotReachHere(); }
|
||||
|
||||
//! Get the blit manager object
|
||||
device::BlitManager& blitMgr() const { return *blitMgr_; }
|
||||
|
||||
@@ -3515,32 +3515,36 @@ VirtualGPU::assignDebugTrapHandler(const DebugToolInfo& dbgSetting,
|
||||
addVmMemory(trapBufferMem);
|
||||
addVmMemory(rtTrapHandlerMem);
|
||||
addVmMemory(rtTrapBufferMem);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
VirtualGPU::submitWriteBufferFromFile(amd::WriteBufferFromFileCommand& cmd)
|
||||
VirtualGPU::submitTransferBufferFromFile(amd::TransferBufferFileCommand& cmd)
|
||||
{
|
||||
size_t copySize = cmd.size()[0];
|
||||
size_t fileOffset = cmd.fileOffset();
|
||||
size_t dstOffset = cmd.origin()[0];
|
||||
size_t srcDstOffset = cmd.origin()[0];
|
||||
Memory* mem = dev().getGpuMemory(&cmd.memory());
|
||||
uint idx = 0;
|
||||
|
||||
assert((cmd.type() == CL_COMMAND_WRITE_BUFFER_FROM_FILE_AMD) ||
|
||||
(cmd.type() == CL_COMMAND_READ_BUFFER_FROM_FILE_AMD));
|
||||
bool writeBuffer(cmd.type() == CL_COMMAND_WRITE_BUFFER_FROM_FILE_AMD);
|
||||
|
||||
while (copySize > 0) {
|
||||
Memory* staging = dev().getGpuMemory(&cmd.staging(idx));
|
||||
size_t dstSize = amd::WriteBufferFromFileCommand::StagingBufferSize;
|
||||
dstSize = std::min(dstSize, copySize);
|
||||
void* dstBuffer = staging->cpuMap(*this);
|
||||
if (!cmd.file()->readBlock(dstBuffer, fileOffset, 0, dstSize)) {
|
||||
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)) {
|
||||
return;
|
||||
}
|
||||
staging->cpuUnmap(*this);
|
||||
|
||||
bool result = blitMgr().copyBuffer(*staging, *mem,
|
||||
fileOffset, dstOffset, dstSize, false);
|
||||
fileOffset, srcDstOffset, srcDstSize, false);
|
||||
flushDMA(getGpuEvent(staging->gslResource())->engineId_);
|
||||
dstOffset += dstSize;
|
||||
copySize -= dstSize;
|
||||
srcDstOffset += srcDstSize;
|
||||
copySize -= srcDstSize;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -243,7 +243,7 @@ public:
|
||||
virtual void submitSvmFillMemory(amd::SvmFillMemoryCommand& cmd);
|
||||
virtual void submitSvmMapMemory(amd::SvmMapMemoryCommand& cmd);
|
||||
virtual void submitSvmUnmapMemory(amd::SvmUnmapMemoryCommand& cmd);
|
||||
virtual void submitWriteBufferFromFile(amd::WriteBufferFromFileCommand& cmd);
|
||||
virtual void submitTransferBufferFromFile(amd::TransferBufferFileCommand& cmd);
|
||||
|
||||
void releaseMemory(gslMemObject gslResource, bool wait = true);
|
||||
void releaseKernel(CALimage calImage);
|
||||
|
||||
Reference in New Issue
Block a user