P4 to Git Change 1077444 by gandryey@gera-dev-w7 on 2014/09/16 14:31:35
ECR #304775 - Add capability to enable large allocations >4GB
- Update the blit kernels to consider a buffer size >4GB
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/blitcl.cpp#4 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpublit.cpp#110 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpusettings.cpp#280 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/hsa/hsablit.cpp#8 edit
... //depot/stg/opencl/drivers/opencl/runtime/utils/flags.hpp#214 edit
[ROCm/clr commit: b672b6c4da]
This commit is contained in:
@@ -1140,7 +1140,7 @@ KernelBlitManager::copyBufferToImage(
|
||||
|
||||
void
|
||||
CalcRowSlicePitches(
|
||||
cl_int* pitch, const cl_int* copySize,
|
||||
cl_ulong* pitch, const cl_int* copySize,
|
||||
size_t rowPitch, size_t slicePitch, const Memory& mem)
|
||||
{
|
||||
size_t memFmtSize = memoryFormatSize(mem.cal()->format_).size_;
|
||||
@@ -1317,17 +1317,17 @@ KernelBlitManager::copyBufferToImageKernel(
|
||||
granularity = 4;
|
||||
}
|
||||
CondLog(((srcOrigin[0] % granularity) != 0), "Unaligned offset in blit!");
|
||||
cl_int srcOrg[4] = { (cl_int)srcOrigin[0] / granularity,
|
||||
(cl_int)srcOrigin[1],
|
||||
(cl_int)srcOrigin[2], 0 };
|
||||
cl_ulong srcOrg[4] = { srcOrigin[0] / granularity,
|
||||
srcOrigin[1],
|
||||
srcOrigin[2], 0 };
|
||||
setArgument(kernels_[blitType], 2, sizeof(srcOrg), srcOrg);
|
||||
|
||||
cl_int dstOrg[4] = { (cl_int)dstOrigin[0],
|
||||
(cl_int)dstOrigin[1],
|
||||
(cl_int)dstOrigin[2], 0 };
|
||||
cl_int copySize[4] = { (cl_int)size[0],
|
||||
(cl_int)size[1],
|
||||
(cl_int)size[2], 0 };
|
||||
cl_int dstOrg[4] = { (cl_int)dstOrigin[0],
|
||||
(cl_int)dstOrigin[1],
|
||||
(cl_int)dstOrigin[2], 0 };
|
||||
cl_int copySize[4] = { (cl_int)size[0],
|
||||
(cl_int)size[1],
|
||||
(cl_int)size[2], 0 };
|
||||
if (swapLayer) {
|
||||
dstOrg[2] = dstOrg[1];
|
||||
dstOrg[1] = 0;
|
||||
@@ -1340,13 +1340,13 @@ KernelBlitManager::copyBufferToImageKernel(
|
||||
// Program memory format
|
||||
uint multiplier = memFmt.size_ / sizeof(uint32_t);
|
||||
multiplier = (multiplier == 0) ? 1 : multiplier;
|
||||
cl_int format[4] = { (cl_int)memFmt.components_,
|
||||
(cl_int)memFmt.size_ / (cl_int)memFmt.components_,
|
||||
(cl_int)multiplier, 0 };
|
||||
cl_uint format[4] = { memFmt.components_,
|
||||
memFmt.size_ / memFmt.components_,
|
||||
multiplier, 0 };
|
||||
setArgument(kernels_[blitType], 5, sizeof(format), format);
|
||||
|
||||
// Program row and slice pitches
|
||||
cl_int pitch[4] = { 0 };
|
||||
cl_ulong pitch[4] = { 0 };
|
||||
CalcRowSlicePitches(pitch, copySize, rowPitch, slicePitch, gpuMem(dstMemory));
|
||||
setArgument(kernels_[blitType], 6, sizeof(pitch), pitch);
|
||||
|
||||
@@ -1661,12 +1661,12 @@ KernelBlitManager::copyImageToBufferKernel(
|
||||
setArgument(kernels_[blitType], 2, sizeof(cl_mem), &mem);
|
||||
setArgument(kernels_[blitType], 3, sizeof(cl_mem), &mem);
|
||||
|
||||
cl_int srcOrg[4] = { (cl_int)srcOrigin[0],
|
||||
(cl_int)srcOrigin[1],
|
||||
(cl_int)srcOrigin[2], 0 };
|
||||
cl_int copySize[4] = { (cl_int)size[0],
|
||||
(cl_int)size[1],
|
||||
(cl_int)size[2], 0 };
|
||||
cl_int srcOrg[4] = { (cl_int)srcOrigin[0],
|
||||
(cl_int)srcOrigin[1],
|
||||
(cl_int)srcOrigin[2], 0 };
|
||||
cl_int copySize[4] = { (cl_int)size[0],
|
||||
(cl_int)size[1],
|
||||
(cl_int)size[2], 0 };
|
||||
if (swapLayer) {
|
||||
srcOrg[2] = srcOrg[1];
|
||||
srcOrg[1] = 0;
|
||||
@@ -1685,22 +1685,22 @@ KernelBlitManager::copyImageToBufferKernel(
|
||||
granularity = 4;
|
||||
}
|
||||
CondLog(((dstOrigin[0] % granularity) != 0), "Unaligned offset in blit!");
|
||||
cl_int dstOrg[4] = { (cl_int)dstOrigin[0] / granularity,
|
||||
(cl_int)dstOrigin[1],
|
||||
(cl_int)dstOrigin[2], 0 };
|
||||
cl_ulong dstOrg[4] = { dstOrigin[0] / granularity,
|
||||
dstOrigin[1],
|
||||
dstOrigin[2], 0 };
|
||||
setArgument(kernels_[blitType], 5, sizeof(dstOrg), dstOrg);
|
||||
setArgument(kernels_[blitType], 6, sizeof(copySize), copySize);
|
||||
|
||||
// Program memory format
|
||||
uint multiplier = memFmt.size_ / sizeof(uint32_t);
|
||||
multiplier = (multiplier == 0) ? 1 : multiplier;
|
||||
cl_int format[4] = { (cl_int)memFmt.components_,
|
||||
(cl_int)memFmt.size_ / (cl_int)memFmt.components_,
|
||||
(cl_int)multiplier, 0 };
|
||||
cl_uint format[4] = { memFmt.components_,
|
||||
memFmt.size_ / memFmt.components_,
|
||||
multiplier, 0 };
|
||||
setArgument(kernels_[blitType], 7, sizeof(format), format);
|
||||
|
||||
// Program row and slice pitches
|
||||
cl_int pitch[4] = { 0 };
|
||||
cl_ulong pitch[4] = { 0 };
|
||||
CalcRowSlicePitches(pitch, copySize, rowPitch, slicePitch, gpuMem(srcMemory));
|
||||
setArgument(kernels_[blitType], 8, sizeof(pitch), pitch);
|
||||
|
||||
@@ -2130,18 +2130,15 @@ KernelBlitManager::copyBufferRect(
|
||||
setArgument(kernels_[blitType], 0, sizeof(cl_mem), &mem);
|
||||
mem = &gpuMem(dstMemory);
|
||||
setArgument(kernels_[blitType], 1, sizeof(cl_mem), &mem);
|
||||
cl_uint src[4] = { (cl_uint)srcRect.rowPitch_,
|
||||
(cl_uint)srcRect.slicePitch_,
|
||||
(cl_uint)srcRect.start_, 0 };
|
||||
cl_ulong src[4] = { srcRect.rowPitch_,
|
||||
srcRect.slicePitch_,
|
||||
srcRect.start_, 0 };
|
||||
setArgument(kernels_[blitType], 2, sizeof(src), src);
|
||||
cl_uint dst[4] = { (cl_uint)dstRect.rowPitch_,
|
||||
(cl_uint)dstRect.slicePitch_,
|
||||
(cl_uint)dstRect.start_, 0 };
|
||||
cl_ulong dst[4] = { dstRect.rowPitch_,
|
||||
dstRect.slicePitch_,
|
||||
dstRect.start_, 0 };
|
||||
setArgument(kernels_[blitType], 3, sizeof(dst), dst);
|
||||
cl_int copySize[4] = { (cl_int)size[0],
|
||||
(cl_int)size[1],
|
||||
(cl_int)size[2],
|
||||
(cl_int)CopyRectAlignment[i] };
|
||||
cl_ulong copySize[4] = { size[0], size[1], size[2], CopyRectAlignment[i] };
|
||||
setArgument(kernels_[blitType], 4, sizeof(copySize), copySize);
|
||||
|
||||
// Create ND range object for the kernel's execution
|
||||
@@ -2426,7 +2423,7 @@ KernelBlitManager::fillBuffer(
|
||||
else {
|
||||
uint fillType = FillBuffer;
|
||||
size_t globalWorkOffset[3] = { 0, 0, 0 };
|
||||
cl_int fillSize = size[0] / patternSize;
|
||||
cl_ulong fillSize = size[0] / patternSize;
|
||||
size_t globalWorkSize = amd::alignUp(fillSize, 256);
|
||||
size_t localWorkSize = 256;
|
||||
bool dwordAligned =
|
||||
@@ -2450,7 +2447,7 @@ KernelBlitManager::fillBuffer(
|
||||
memcpy(constBuf, pattern, patternSize);
|
||||
gpuCB->unmap(&gpu());
|
||||
setArgument(kernels_[fillType], 2, sizeof(cl_mem), &gpuCB);
|
||||
cl_int offset = origin[0];
|
||||
cl_ulong offset = origin[0];
|
||||
if (dwordAligned) {
|
||||
patternSize /= sizeof(uint32_t);
|
||||
offset /= sizeof(uint32_t);
|
||||
@@ -2528,14 +2525,14 @@ KernelBlitManager::copyBuffer(
|
||||
mem = &gpuMem(dstMemory);
|
||||
setArgument(kernels_[blitType], 1, sizeof(cl_mem), &mem);
|
||||
// Program source origin
|
||||
cl_int srcOffset = srcOrigin[0] / CopyBuffAlignment[i];;
|
||||
cl_ulong srcOffset = srcOrigin[0] / CopyBuffAlignment[i];;
|
||||
setArgument(kernels_[blitType], 2, sizeof(srcOffset), &srcOffset);
|
||||
|
||||
// Program destinaiton origin
|
||||
cl_int dstOffset = dstOrigin[0] / CopyBuffAlignment[i];;
|
||||
cl_ulong dstOffset = dstOrigin[0] / CopyBuffAlignment[i];;
|
||||
setArgument(kernels_[blitType], 3, sizeof(dstOffset), &dstOffset);
|
||||
|
||||
cl_int copySize = size[0];
|
||||
cl_ulong copySize = size[0];
|
||||
setArgument(kernels_[blitType], 4, sizeof(copySize), ©Size);
|
||||
|
||||
if (blitType == BlitCopyBufferAligned) {
|
||||
|
||||
Reference in New Issue
Block a user