P4 to Git Change 1191418 by gandryey@gera-dev-w7 on 2015/09/16 16:13:13
ECR #304775 - Remove EG/NI specific features
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/device.cpp#185 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#251 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpublit.cpp#117 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#522 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.hpp#147 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.cpp#296 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.hpp#115 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuresource.cpp#226 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuresource.hpp#82 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuscr800.cpp#11 delete
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuscsi.cpp#34 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpusettings.cpp#326 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpusettings.hpp#93 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuvirtual.cpp#378 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuvirtual.hpp#134 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/GSLContext.cpp#79 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/GSLContext.h#51 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp#142 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/GSLDevice.h#56 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/program.cpp#66 edit
... //depot/stg/opencl/drivers/opencl/runtime/utils/flags.hpp#241 edit
[ROCm/clr commit: 10b19089fe]
This commit is contained in:
@@ -521,7 +521,6 @@ Settings::Settings()
|
||||
customHostAllocator_ = false;
|
||||
waitCommand_ = AMD_OCL_WAIT_COMMAND;
|
||||
supportDepthsRGB_ = false;
|
||||
assumeAliases_ = false;
|
||||
enableHwDebug_ = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +101,6 @@ enum OclExtensions {
|
||||
ClKhrD3d9Sharing,
|
||||
#endif
|
||||
ClKhrImage2dFromBuffer,
|
||||
ClAmdImage2dFromBufferReadOnly,
|
||||
ClAmdSemaphore,
|
||||
ClAMDBusAddressableMemory,
|
||||
ClAMDC11Atomics,
|
||||
@@ -143,7 +142,6 @@ OclExtensionsString[] = {
|
||||
"cl_khr_dx9_media_sharing ",
|
||||
#endif
|
||||
"cl_khr_image2d_from_buffer ",
|
||||
"cl_amd_image2d_from_buffer_read_only ",
|
||||
"",
|
||||
"cl_amd_bus_addressable_memory ",
|
||||
"cl_amd_c11_atomics ",
|
||||
@@ -582,9 +580,8 @@ public:
|
||||
uint customHostAllocator_: 1;//!< True if device has custom host allocator
|
||||
// that replaces generic OS allocation routines
|
||||
uint supportDepthsRGB_: 1; //!< Support DEPTH and sRGB channel order format
|
||||
uint assumeAliases_: 1; //!< Assume aliases in the compilation process
|
||||
uint enableHwDebug_: 1; //!< Enable HW debug support
|
||||
uint reserved_: 24;
|
||||
uint reserved_: 25;
|
||||
};
|
||||
uint value_;
|
||||
};
|
||||
|
||||
@@ -582,7 +582,7 @@ DmaBlitManager::copyBufferRect(
|
||||
|
||||
uint bytesPerElement = 16;
|
||||
bool optimalElementSize = false;
|
||||
bool subWindowRectCopy = dev().settings().rectLinearDMA_;
|
||||
bool subWindowRectCopy = true;
|
||||
|
||||
srcOffset = srcRect.offset(0, 0, 0);
|
||||
dstOffset = dstRect.offset(0, 0, 0);
|
||||
@@ -605,13 +605,12 @@ DmaBlitManager::copyBufferRect(
|
||||
size_t pitchLimit = dev().settings().ciPlus_ ? (0x3FFF * bytesPerElement) | 0xF : 0x7FFFF;
|
||||
size_t sizeLimit = dev().settings().ciPlus_ ? (0x3FFF * bytesPerElement) | 0xF : 0x3FFF;
|
||||
|
||||
if (subWindowRectCopy &&
|
||||
(!optimalElementSize ||
|
||||
if (!optimalElementSize ||
|
||||
(srcRect.rowPitch_ > pitchLimit) ||
|
||||
(dstRect.rowPitch_ > pitchLimit) ||
|
||||
(size[0] > sizeLimit) || // See above
|
||||
(size[1] > 0x3fff) || // 14 bits limit in HW
|
||||
(size[2] > 0x7ff))) { // 11 bits limit in HW
|
||||
(size[2] > 0x7ff)) { // 11 bits limit in HW
|
||||
// Restriction with rectLinearDRMDMA packet
|
||||
subWindowRectCopy = false;
|
||||
}
|
||||
@@ -1232,8 +1231,6 @@ KernelBlitManager::copyBufferToImageKernel(
|
||||
size_t globalWorkOffset[3] = { 0, 0, 0 };
|
||||
size_t globalWorkSize[3];
|
||||
size_t localWorkSize[3];
|
||||
bool swapLayer = (gpuMem(dstMemory).cal()->dimension_ == GSL_MOA_TEXTURE_1D_ARRAY) &&
|
||||
!dev().settings().siPlus_;
|
||||
|
||||
// Program the kernels workload depending on the blit dimensions
|
||||
dim = 3;
|
||||
@@ -1250,14 +1247,6 @@ KernelBlitManager::copyBufferToImageKernel(
|
||||
globalWorkSize[2] = amd::alignUp(size[2], 1);
|
||||
localWorkSize[0] = localWorkSize[1] = 16;
|
||||
localWorkSize[2] = 1;
|
||||
// Swap the Y and Z components, apparently HW expects
|
||||
// layer in Z
|
||||
if (swapLayer) {
|
||||
globalWorkSize[2] = globalWorkSize[1];
|
||||
globalWorkSize[1] = 1;
|
||||
localWorkSize[2] = localWorkSize[1];
|
||||
localWorkSize[1] = 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
globalWorkSize[0] = amd::alignUp(size[0], 8);
|
||||
@@ -1294,12 +1283,7 @@ KernelBlitManager::copyBufferToImageKernel(
|
||||
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;
|
||||
copySize[2] = copySize[1];
|
||||
copySize[1] = 1;
|
||||
}
|
||||
|
||||
setArgument(kernels_[blitType], 3, sizeof(dstOrg), dstOrg);
|
||||
setArgument(kernels_[blitType], 4, sizeof(copySize), copySize);
|
||||
|
||||
@@ -1579,8 +1563,6 @@ KernelBlitManager::copyImageToBufferKernel(
|
||||
size_t globalWorkOffset[3] = { 0, 0, 0 };
|
||||
size_t globalWorkSize[3];
|
||||
size_t localWorkSize[3];
|
||||
bool swapLayer = (gpuMem(srcMemory).cal()->dimension_ == GSL_MOA_TEXTURE_1D_ARRAY) &&
|
||||
!dev().settings().siPlus_;
|
||||
|
||||
// Program the kernels workload depending on the blit dimensions
|
||||
dim = 3;
|
||||
@@ -1598,14 +1580,6 @@ KernelBlitManager::copyImageToBufferKernel(
|
||||
globalWorkSize[2] = amd::alignUp(size[2], 1);
|
||||
localWorkSize[0] = localWorkSize[1] = 16;
|
||||
localWorkSize[2] = 1;
|
||||
// Swap the Y and Z components, apparently HW expects
|
||||
// layer in Z
|
||||
if (swapLayer) {
|
||||
globalWorkSize[2] = globalWorkSize[1];
|
||||
globalWorkSize[1] = 1;
|
||||
localWorkSize[2] = localWorkSize[1];
|
||||
localWorkSize[1] = 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
globalWorkSize[0] = amd::alignUp(size[0], 8);
|
||||
@@ -1633,12 +1607,6 @@ KernelBlitManager::copyImageToBufferKernel(
|
||||
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;
|
||||
copySize[2] = copySize[1];
|
||||
copySize[1] = 1;
|
||||
}
|
||||
setArgument(kernels_[blitType], 4, sizeof(srcOrg), srcOrg);
|
||||
const MemFormatStruct& memFmt = memoryFormatSize(gpuMem(srcMemory).cal()->format_);
|
||||
|
||||
@@ -1799,20 +1767,12 @@ KernelBlitManager::copyImage(
|
||||
cl_int srcOrg[4] = { (cl_int)srcOrigin[0],
|
||||
(cl_int)srcOrigin[1],
|
||||
(cl_int)srcOrigin[2], 0 };
|
||||
if ((gpuMem(srcMemory).cal()->dimension_ == GSL_MOA_TEXTURE_1D_ARRAY) &&
|
||||
!dev().settings().siPlus_) {
|
||||
srcOrg[3] = 1;
|
||||
}
|
||||
setArgument(kernels_[blitType], 2, sizeof(srcOrg), srcOrg);
|
||||
|
||||
// Program destinaiton origin
|
||||
cl_int dstOrg[4] = { (cl_int)dstOrigin[0],
|
||||
(cl_int)dstOrigin[1],
|
||||
(cl_int)dstOrigin[2], 0 };
|
||||
if ((gpuMem(dstMemory).cal()->dimension_ == GSL_MOA_TEXTURE_1D_ARRAY) &&
|
||||
!dev().settings().siPlus_) {
|
||||
dstOrg[3] = 1;
|
||||
}
|
||||
setArgument(kernels_[blitType], 3, sizeof(dstOrg), dstOrg);
|
||||
|
||||
cl_int copySize[4] = { (cl_int)size[0],
|
||||
@@ -1995,13 +1955,11 @@ KernelBlitManager::copyBufferRect(
|
||||
|
||||
// Fall into the CAL path for rejected transfers
|
||||
if (setup_.disableCopyBufferRect_ ||
|
||||
((gpuMem(srcMemory).isHostMemDirectAccess() || gpuMem(dstMemory).isHostMemDirectAccess()) &&
|
||||
dev().settings().rectLinearDMA_) ||
|
||||
(gpuMem(srcMemory).isHostMemDirectAccess() || gpuMem(dstMemory).isHostMemDirectAccess()) ||
|
||||
(!dev().heap()->isVirtual() &&
|
||||
((gpuMem(dstMemory).hb() == NULL) || (gpuMem(srcMemory).hb() == NULL)))) {
|
||||
// Copy data with CAL (no VM mode only)
|
||||
if ((gpuMem(srcMemory).isHostMemDirectAccess() || gpuMem(dstMemory).isHostMemDirectAccess())
|
||||
&& dev().settings().rectLinearDMA_) {
|
||||
if (gpuMem(srcMemory).isHostMemDirectAccess() || gpuMem(dstMemory).isHostMemDirectAccess()) {
|
||||
result = DmaBlitManager::copyBufferRect(srcMemory, dstMemory,
|
||||
srcRectIn, dstRectIn, sizeIn, entire);
|
||||
}
|
||||
@@ -2570,9 +2528,6 @@ KernelBlitManager::fillImage(
|
||||
Memory* memView = &gpuMem(memory);
|
||||
amd::Image::Format newFormat(gpuMem(memory).owner()->asImage()->getImageFormat());
|
||||
|
||||
bool swapLayer = (memView->cal()->dimension_ == GSL_MOA_TEXTURE_1D_ARRAY) &&
|
||||
!dev().settings().siPlus_;
|
||||
|
||||
// Program the kernels workload depending on the fill dimensions
|
||||
fillType = FillImage;
|
||||
dim = 3;
|
||||
@@ -2641,14 +2596,6 @@ KernelBlitManager::fillImage(
|
||||
globalWorkSize[2] = amd::alignUp(size[2], 1);
|
||||
localWorkSize[0] = localWorkSize[1] = 16;
|
||||
localWorkSize[2] = 1;
|
||||
// Swap the Y and Z components, apparently HW expects
|
||||
// layer in Z
|
||||
if (swapLayer) {
|
||||
globalWorkSize[2] = globalWorkSize[1];
|
||||
globalWorkSize[1] = 1;
|
||||
localWorkSize[2] = localWorkSize[1];
|
||||
localWorkSize[1] = 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
globalWorkSize[0] = amd::alignUp(size[0], 8);
|
||||
@@ -2671,12 +2618,6 @@ KernelBlitManager::fillImage(
|
||||
cl_int fillSize[4] = { (cl_int)size[0],
|
||||
(cl_int)size[1],
|
||||
(cl_int)size[2], 0 };
|
||||
if (swapLayer) {
|
||||
fillOrigin[2] = fillOrigin[1];
|
||||
fillOrigin[1] = 0;
|
||||
fillSize[2] = fillSize[1];
|
||||
fillSize[1] = 1;
|
||||
}
|
||||
setArgument(kernels_[fillType], 4, sizeof(fillOrigin), fillOrigin);
|
||||
setArgument(kernels_[fillType], 5, sizeof(fillSize), fillSize);
|
||||
|
||||
|
||||
@@ -235,31 +235,20 @@ void NullDevice::fillDeviceInfo(
|
||||
info_.maxWorkItemDimensions_ = 3;
|
||||
info_.numberOfShaderEngines = calAttr.numberOfShaderEngines;
|
||||
|
||||
if (settings().siPlus_) {
|
||||
// SI parts are scalar. Also, reads don't need to be 128-bits to get peak rates.
|
||||
// For example, float4 is not faster than float as long as all threads fetch the same
|
||||
// amount of data and the reads are coalesced. This is from the H/W team and confirmed
|
||||
// through experimentation. May also be true on EG/NI, but no point in confusing
|
||||
// developers now.
|
||||
info_.nativeVectorWidthChar_ = info_.preferredVectorWidthChar_ = 4;
|
||||
info_.nativeVectorWidthShort_ = info_.preferredVectorWidthShort_ = 2;
|
||||
info_.nativeVectorWidthInt_ = info_.preferredVectorWidthInt_ = 1;
|
||||
info_.nativeVectorWidthLong_ = info_.preferredVectorWidthLong_ = 1;
|
||||
info_.nativeVectorWidthFloat_ = info_.preferredVectorWidthFloat_ = 1;
|
||||
info_.nativeVectorWidthDouble_ = info_.preferredVectorWidthDouble_ =
|
||||
(settings().checkExtension(ClKhrFp64)) ? 1 : 0;
|
||||
info_.nativeVectorWidthHalf_ = info_.preferredVectorWidthHalf_ = 0; // no half support
|
||||
}
|
||||
else {
|
||||
info_.nativeVectorWidthChar_ = info_.preferredVectorWidthChar_ = 16;
|
||||
info_.nativeVectorWidthShort_ = info_.preferredVectorWidthShort_ = 8;
|
||||
info_.nativeVectorWidthInt_ = info_.preferredVectorWidthInt_ = 4;
|
||||
info_.nativeVectorWidthLong_ = info_.preferredVectorWidthLong_ = 2;
|
||||
info_.nativeVectorWidthFloat_ = info_.preferredVectorWidthFloat_ = 4;
|
||||
info_.nativeVectorWidthDouble_ = info_.preferredVectorWidthDouble_ =
|
||||
(settings().checkExtension(ClKhrFp64)) ? 2 : 0;
|
||||
info_.nativeVectorWidthHalf_ = info_.preferredVectorWidthHalf_ = 0; // no half support
|
||||
}
|
||||
// SI parts are scalar. Also, reads don't need to be 128-bits to get peak rates.
|
||||
// For example, float4 is not faster than float as long as all threads fetch the same
|
||||
// amount of data and the reads are coalesced. This is from the H/W team and confirmed
|
||||
// through experimentation. May also be true on EG/NI, but no point in confusing
|
||||
// developers now.
|
||||
info_.nativeVectorWidthChar_ = info_.preferredVectorWidthChar_ = 4;
|
||||
info_.nativeVectorWidthShort_ = info_.preferredVectorWidthShort_ = 2;
|
||||
info_.nativeVectorWidthInt_ = info_.preferredVectorWidthInt_ = 1;
|
||||
info_.nativeVectorWidthLong_ = info_.preferredVectorWidthLong_ = 1;
|
||||
info_.nativeVectorWidthFloat_ = info_.preferredVectorWidthFloat_ = 1;
|
||||
info_.nativeVectorWidthDouble_ = info_.preferredVectorWidthDouble_ =
|
||||
(settings().checkExtension(ClKhrFp64)) ? 1 : 0;
|
||||
info_.nativeVectorWidthHalf_ = info_.preferredVectorWidthHalf_ = 0; // no half support
|
||||
|
||||
info_.maxClockFrequency_ = (calAttr.engineClock != 0) ? calAttr.engineClock : 555;
|
||||
info_.maxParameterSize_ = 1024;
|
||||
info_.minDataTypeAlignSize_ = sizeof(cl_long16);
|
||||
@@ -959,7 +948,7 @@ Device::initializeHeapResources()
|
||||
|
||||
// Initialize the number of mem object for the scratch buffer
|
||||
for (uint s = 0; s < scratch_.size(); ++s) {
|
||||
scratch_[s] = new ScratchBuffer((settings().siPlus_) ? 1 : info_.numberOfShaderEngines);
|
||||
scratch_[s] = new ScratchBuffer();
|
||||
if (NULL == scratch_[s]) {
|
||||
return false;
|
||||
}
|
||||
@@ -2301,11 +2290,9 @@ Device::ScratchBuffer::~ScratchBuffer()
|
||||
void
|
||||
Device::ScratchBuffer::destroyMemory()
|
||||
{
|
||||
for (uint i = 0; i < memObjs_.size(); ++i) {
|
||||
// Release memory object
|
||||
delete memObjs_[i];
|
||||
memObjs_[i] = NULL;
|
||||
}
|
||||
// Release memory object
|
||||
delete memObj_;
|
||||
memObj_ = NULL;
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -2333,7 +2320,7 @@ Device::allocScratch(uint regNum, const VirtualGPU* vgpu)
|
||||
// Calculate the size of the scratch buffer for a queue
|
||||
scratchBuf->size_ = calcScratchBufferSize(scratchBuf->regNum_);
|
||||
scratchBuf->offset_ = offset;
|
||||
size += scratchBuf->size_ * scratchBuf->memObjs_.size();
|
||||
size += scratchBuf->size_;
|
||||
offset += scratchBuf->size_;
|
||||
}
|
||||
}
|
||||
@@ -2352,22 +2339,20 @@ Device::allocScratch(uint regNum, const VirtualGPU* vgpu)
|
||||
}
|
||||
|
||||
for (uint s = 0; s < scratch_.size(); ++s) {
|
||||
std::vector<Memory*>& mems = scratch_[s]->memObjs_;
|
||||
|
||||
// Loop through all memory objects and reallocate them
|
||||
for (uint i = 0; i < mems.size(); ++i) {
|
||||
if (scratch_[s]->regNum_ > 0) {
|
||||
// Allocate new buffer
|
||||
mems[i] = new gpu::Memory(*this, scratch_[s]->size_);
|
||||
Resource::ViewParams view;
|
||||
view.resource_ = globalScratchBuf_;
|
||||
view.offset_ = scratch_[s]->offset_ + i * scratch_[s]->size_;
|
||||
view.size_ = scratch_[s]->size_;
|
||||
if ((mems[i] == NULL) || !mems[i]->create(Resource::View, &view)) {
|
||||
LogError("Couldn't allocate a scratch view");
|
||||
scratch_[s]->regNum_ = 0;
|
||||
return false;
|
||||
}
|
||||
if (scratch_[s]->regNum_ > 0) {
|
||||
// Allocate new buffer
|
||||
scratch_[s]->memObj_ = new gpu::Memory(*this, scratch_[s]->size_);
|
||||
Resource::ViewParams view;
|
||||
view.resource_ = globalScratchBuf_;
|
||||
view.offset_ = scratch_[s]->offset_;
|
||||
view.size_ = scratch_[s]->size_;
|
||||
if ((scratch_[s]->memObj_ == NULL) ||
|
||||
!scratch_[s]->memObj_->create(Resource::View, &view)) {
|
||||
LogError("Couldn't allocate a scratch view");
|
||||
delete scratch_[s]->memObj_;
|
||||
scratch_[s]->regNum_ = 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,12 +303,12 @@ public:
|
||||
struct ScratchBuffer : public amd::HeapObject
|
||||
{
|
||||
uint regNum_; //!< The number of used scratch registers
|
||||
std::vector<Memory*> memObjs_; //!< Memory objects for scratch buffers
|
||||
Memory* memObj_; //!< Memory objects for scratch buffers
|
||||
uint offset_; //!< Offset from the global scratch store
|
||||
uint size_; //!< Scratch buffer size on this queue
|
||||
|
||||
//! Default constructor
|
||||
ScratchBuffer(uint numMems): regNum_(0), memObjs_(numMems), offset_(0) {}
|
||||
ScratchBuffer(): regNum_(0), memObj_(NULL), offset_(0) {}
|
||||
|
||||
//! Default constructor
|
||||
~ScratchBuffer();
|
||||
|
||||
@@ -533,8 +533,6 @@ NullKernel::NullKernel(
|
||||
{
|
||||
// UAV raw index will be detected
|
||||
uavRaw_ = UavIdUndefined;
|
||||
// Initialize UAV arena index(should be 8)
|
||||
uavArena_ = VirtualGPU::UavArena;
|
||||
// CB index will be detected
|
||||
cbId_ = UavIdUndefined;
|
||||
// Printf index will be detected
|
||||
@@ -771,7 +769,6 @@ NullKernel::create(
|
||||
workGroupInfo_.usedLDSSize_ = calFuncInfo.LDSSizeUsed;
|
||||
workGroupInfo_.availableStackSize_ = calFuncInfo.stackSizeAvailable;
|
||||
workGroupInfo_.usedStackSize_ = calFuncInfo.stackSizeUsed;
|
||||
setBufferForNumGroup_ = calFuncInfo.setBufferForNumGroup;
|
||||
|
||||
device::Kernel::parameters_t params;
|
||||
if (!createSignature(params)) {
|
||||
@@ -935,12 +932,7 @@ NullKernel::createMultiBinary(uint* imageSize, void** image, const void* isa)
|
||||
AMUabiMultiBinary amuBinary;
|
||||
amuABIMultiBinaryCreate(&amuBinary);
|
||||
|
||||
if (nullDev().settings().siPlus_) {
|
||||
result = siCreateHwInfo(shader, encoding);
|
||||
}
|
||||
else {
|
||||
result = r800CreateHwInfo(shader, encoding);
|
||||
}
|
||||
result = siCreateHwInfo(shader, encoding);
|
||||
if (!result) {
|
||||
delete [] tmpMem;
|
||||
LogWarning("Error Creating program info");
|
||||
@@ -975,7 +967,6 @@ NullKernel::createMultiBinary(uint* imageSize, void** image, const void* isa)
|
||||
uint inputResourceCount = 0;
|
||||
|
||||
uint uavCount = 0;
|
||||
bool globalBound = false;
|
||||
bool cbBound = false;
|
||||
bool printfBound = false;
|
||||
for (uint i = 0; i < arguments_.size(); ++i) {
|
||||
@@ -986,30 +977,11 @@ NullKernel::createMultiBinary(uint* imageSize, void** image, const void* isa)
|
||||
constBuffers[constBufferCount++].index = arg->index_;
|
||||
break;
|
||||
case KernelArg::PointerGlobal:
|
||||
if (nullDev().settings().useAliases_) {
|
||||
if (!globalBound) {
|
||||
uav[uavCount].offset = uavRaw_;
|
||||
uav[uavCount].type = AMU_ABI_UAV_TYPE_RAW;
|
||||
uav[uavCount].dimension = AMU_ABI_DIM_BUFFER;
|
||||
uav[uavCount].format = AMU_ABI_UAV_FORMAT_TYPELESS;
|
||||
uavCount++;
|
||||
if (uavArena_ != 0) {
|
||||
uav[uavCount].offset = uavArena_;
|
||||
uav[uavCount].type = AMU_ABI_UAV_TYPE_ARENA;
|
||||
uav[uavCount].dimension = AMU_ABI_DIM_BUFFER;
|
||||
uav[uavCount].format = AMU_ABI_UAV_FORMAT_TYPELESS;
|
||||
uavCount++;
|
||||
}
|
||||
}
|
||||
globalBound = true;
|
||||
}
|
||||
else {
|
||||
uav[uavCount].offset = arg->index_;
|
||||
uav[uavCount].type = AMU_ABI_UAV_TYPE_TYPELESS;
|
||||
uav[uavCount].dimension = AMU_ABI_DIM_BUFFER;
|
||||
uav[uavCount].format = AMU_ABI_UAV_FORMAT_TYPELESS;
|
||||
uavCount++;
|
||||
}
|
||||
uav[uavCount].offset = arg->index_;
|
||||
uav[uavCount].type = AMU_ABI_UAV_TYPE_TYPELESS;
|
||||
uav[uavCount].dimension = AMU_ABI_DIM_BUFFER;
|
||||
uav[uavCount].format = AMU_ABI_UAV_FORMAT_TYPELESS;
|
||||
uavCount++;
|
||||
break;
|
||||
case KernelArg::ConstBufId:
|
||||
if (!cbBound) {
|
||||
@@ -1032,8 +1004,7 @@ NullKernel::createMultiBinary(uint* imageSize, void** image, const void* isa)
|
||||
printfBound = true;
|
||||
break;
|
||||
case KernelArg::UavId:
|
||||
if (!nullDev().settings().useAliases_ &&
|
||||
(UavIdUndefined != uavRaw_) &&
|
||||
if ((UavIdUndefined != uavRaw_) &&
|
||||
!(flags() & PrintfOutput)) {
|
||||
uav[uavCount].offset = arg->index_;
|
||||
uav[uavCount].type = AMU_ABI_UAV_TYPE_TYPELESS;
|
||||
@@ -1049,13 +1020,6 @@ NullKernel::createMultiBinary(uint* imageSize, void** image, const void* isa)
|
||||
uav[uavCount].format = AMU_ABI_UAV_FORMAT_TYPELESS;
|
||||
uavCount++;
|
||||
}
|
||||
if (uavArena_ != 0) {
|
||||
uav[uavCount].offset = uavArena_;
|
||||
uav[uavCount].type = AMU_ABI_UAV_TYPE_ARENA;
|
||||
uav[uavCount].dimension = AMU_ABI_DIM_BUFFER;
|
||||
uav[uavCount].format = AMU_ABI_UAV_FORMAT_TYPELESS;
|
||||
uavCount++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case KernelArg::Sampler:
|
||||
@@ -1518,16 +1482,14 @@ Kernel::bindConstantBuffers(VirtualGPU& gpu) const
|
||||
return result;
|
||||
}
|
||||
|
||||
bool
|
||||
void
|
||||
Kernel::processMemObjects(
|
||||
VirtualGPU& gpu,
|
||||
const amd::Kernel& kernel,
|
||||
const_address params,
|
||||
bool nativeMem) const
|
||||
{
|
||||
bool aliases = false;
|
||||
VirtualGPU::MemoryDependency& dependecy = gpu.memoryDependency();
|
||||
bool readCache = !internal_ && rwAttributes_ && !dev().settings().assumeAliases_;
|
||||
|
||||
// Mark the tracker with a new kernel,
|
||||
// so we can avoid checks of the aliased objects
|
||||
@@ -1539,7 +1501,6 @@ Kernel::processMemObjects(
|
||||
const amd::KernelParameterDescriptor& desc = signature.at(i);
|
||||
const KernelArg* arg = argument(i);
|
||||
Memory* memory = NULL;
|
||||
bool readOnly = false;
|
||||
|
||||
// Find if current argument is a buffer
|
||||
if ((desc.type_ == T_POINTER) &&
|
||||
@@ -1557,44 +1518,11 @@ Kernel::processMemObjects(
|
||||
}
|
||||
|
||||
if (memory != NULL) {
|
||||
readOnly = arg->memory_.readOnly_;
|
||||
|
||||
// Check if read cache optimization is possible
|
||||
if (readCache) {
|
||||
// Find if the same buffer was sent to other arguments (aliases)
|
||||
for (size_t j = i + 1; (j < signature.numParameters()); ++j) {
|
||||
const amd::KernelParameterDescriptor& descJ = signature.at(j);
|
||||
const KernelArg* argJ = argument(j);
|
||||
if (argJ->type_ == KernelArg::PointerGlobal) {
|
||||
bool readOnlyJ = argJ->memory_.readOnly_;
|
||||
Memory* memory2 = NULL;
|
||||
if (nativeMem) {
|
||||
memory2 = *reinterpret_cast<Memory* const*>
|
||||
(params + descJ.offset_);
|
||||
}
|
||||
else if (*reinterpret_cast<amd::Memory* const*>
|
||||
(params + descJ.offset_) != NULL) {
|
||||
memory2 = dev().getGpuMemory(
|
||||
*reinterpret_cast<amd::Memory* const*>
|
||||
(params + descJ.offset_));
|
||||
}
|
||||
if (memory == memory2) {
|
||||
if (!readOnly || !readOnlyJ) {
|
||||
aliases = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Validate memory for a dependency in the queue
|
||||
gpu.memoryDependency().validate(gpu, memory, readOnly);
|
||||
gpu.memoryDependency().validate(gpu, memory, arg->memory_.readOnly_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return aliases & readCache;
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -1612,8 +1540,7 @@ Kernel::loadParameters(
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!dev().settings().useAliases_ &&
|
||||
(UavIdUndefined != uavRaw_) &&
|
||||
if ((UavIdUndefined != uavRaw_) &&
|
||||
(!(flags() & PrintfOutput) || (printfId_ != UavIdUndefined))) {
|
||||
Memory* gpuMemory = dev().getGpuMemory(dev().dummyPage());
|
||||
// Bind a buffer for a dummy read
|
||||
@@ -1638,10 +1565,7 @@ Kernel::loadParameters(
|
||||
|
||||
result = bindConstantBuffers(gpu);
|
||||
|
||||
if (dev().settings().useAliases_) {
|
||||
result &= bindResource(gpu, dev().globalMem(), 0, GlobalBufferArena, uavArena_);
|
||||
}
|
||||
else if (flags() & PrivateFixed) {
|
||||
if (flags() & PrivateFixed) {
|
||||
result &= bindResource(gpu, dev().globalMem(), 0, GlobalBuffer, uavRaw_);
|
||||
}
|
||||
|
||||
@@ -1658,32 +1582,6 @@ bool
|
||||
Kernel::run(VirtualGPU& gpu, GpuEvent* calEvent, bool lastRun) const
|
||||
{
|
||||
const VirtualGPU::CalVirtualDesc* dispatch = gpu.cal();
|
||||
// 8xx workaround for the number of groups limit in HW
|
||||
if (setBufferForNumGroup_) {
|
||||
ConstBuffer* cb = gpu.numGrpCb();
|
||||
assert((cb != NULL) && "Runtime must have the constant buffer");
|
||||
|
||||
uint32_t* memPtr = reinterpret_cast<uint32_t*>(cb->sysMemCopy());
|
||||
memPtr[0] = dispatch->gridSize.width;
|
||||
memPtr[1] = dispatch->gridSize.height;
|
||||
memPtr[2] = dispatch->gridSize.depth;
|
||||
memPtr[3] = 0;
|
||||
|
||||
memPtr[4] = dispatch->gridBlock.width;
|
||||
memPtr[5] = dispatch->gridBlock.height;
|
||||
memPtr[6] = dispatch->gridBlock.depth;
|
||||
memPtr[7] = 0;
|
||||
|
||||
bool result = cb->uploadDataToHw(8 * sizeof(uint32_t));
|
||||
if (result) {
|
||||
gpu.setConstantBuffer(SC_INFO_CONSTANTBUFFER,
|
||||
cb->gslResource(), static_cast<CALuint>(cb->wrtOffset()), cb->hbSize());
|
||||
}
|
||||
else {
|
||||
assert(!"Runtime didn't upload data for NumGroup workaround");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
auto compProg = static_cast<gsl::ComputeProgramObject*>(gpu.gslKernelDesc()->func_);
|
||||
compProg->setWavesPerSH(waveLimiter_.getWavesPerSH(&gpu));
|
||||
@@ -1950,15 +1848,13 @@ Kernel::setArgument(
|
||||
|
||||
// Update offset only if we bind HeapBuffer or
|
||||
// it's global address space in UAV setup on SI+
|
||||
if ((type == ArgumentHeapBuffer) || dev().settings().siPlus_) {
|
||||
if (!blitKernelHack_) {
|
||||
offset += gpuMem->hbOffset();
|
||||
if (!forceZeroOffset) {
|
||||
assert((offset != 0) && "Offset 0 with a real allocation!");
|
||||
}
|
||||
if (!blitKernelHack_) {
|
||||
offset += gpuMem->hbOffset();
|
||||
if (!forceZeroOffset) {
|
||||
assert((offset != 0) && "Offset 0 with a real allocation!");
|
||||
}
|
||||
gpu.addVmMemory(gpuMem);
|
||||
}
|
||||
gpu.addVmMemory(gpuMem);
|
||||
}
|
||||
|
||||
// Wait for resource if it was used on an inactive engine
|
||||
@@ -2290,14 +2186,6 @@ Kernel::bindResource(
|
||||
physUnit = uavRaw_;
|
||||
uavType = GSL_UAV_TYPE_TYPELESS;
|
||||
break;
|
||||
case GlobalBufferArena:
|
||||
if (gpu.state_.boundGlobal_) {
|
||||
return true;
|
||||
}
|
||||
gpu.state_.boundGlobal_ = true;
|
||||
physUnit = uavArena_;
|
||||
uavType = GSL_UAV_TYPE_TYPELESS;
|
||||
break;
|
||||
case ArgumentCbID:
|
||||
if (gpu.state_.boundCb_) {
|
||||
return true;
|
||||
@@ -2365,8 +2253,7 @@ Kernel::bindResource(
|
||||
|
||||
gslMemObject gslMem = NULL;
|
||||
// Use global address space on SI+ for UAV setup
|
||||
if (dev().settings().siPlus_ &&
|
||||
((type == ArgumentBuffer) || (type == ArgumentCbID) ||
|
||||
if (((type == ArgumentBuffer) || (type == ArgumentCbID) ||
|
||||
(type == ArgumentUavID) || (type == ArgumentPrintfID)) &&
|
||||
!blitKernelHack_) {
|
||||
gslMem = dev().heap()->resource().gslResource();
|
||||
@@ -2379,7 +2266,6 @@ Kernel::bindResource(
|
||||
bool result = true;
|
||||
switch (type) {
|
||||
case GlobalBuffer:
|
||||
case GlobalBufferArena:
|
||||
case ArgumentBuffer:
|
||||
case ArgumentImageWrite:
|
||||
case ArgumentUavID:
|
||||
@@ -2396,10 +2282,6 @@ Kernel::bindResource(
|
||||
gpu.setUAVChannelOrder(physUnit, gslMem);
|
||||
gpu.cal_.uavs_[physUnit] = gslMem;
|
||||
}
|
||||
else if (!dev().settings().siPlus_)
|
||||
{
|
||||
gpu.setUAVChannelOrder(physUnit, gslMem);
|
||||
}
|
||||
break;
|
||||
case ConstantBuffer:
|
||||
case ArgumentConstBuffer:
|
||||
@@ -2425,25 +2307,6 @@ Kernel::bindResource(
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((type == GlobalBuffer) && dev().settings().useAliases_) {
|
||||
if (uavArena_ != 0) {
|
||||
if (!setupArenaAliases(gpu, resource)) {
|
||||
return false;
|
||||
}
|
||||
if ((uavArena_ != physUnit) &&
|
||||
(gpu.cal_.uavs_[uavArena_] != gslMem)) {
|
||||
gpu.cal_.uavs_[uavArena_] = gslMem;
|
||||
// Associate memory with the name
|
||||
if (!gpu.setUAVBuffer(uavArena_, gslMem,
|
||||
GSL_UAV_TYPE_TYPELESS)) {
|
||||
LogError("calCtxSetMem failed!");
|
||||
return false;
|
||||
}
|
||||
gpu.setUAVChannelOrder(uavArena_, gslMem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2494,64 +2357,12 @@ Kernel::unbindResources(
|
||||
gpu.constBufs_[i]->setBusy(gpu, calEvent);
|
||||
}
|
||||
|
||||
// 8xx workaround for the number of groups limit in HW
|
||||
if (setBufferForNumGroup_) {
|
||||
ConstBuffer* cb = gpu.numGrpCb();
|
||||
assert((cb != NULL) && "Runtime must have the constant buffer");
|
||||
cb->setBusy(gpu, calEvent);
|
||||
}
|
||||
|
||||
// Set the event object for the scratch buffer
|
||||
if (workGroupInfo()->scratchRegs_ > 0) {
|
||||
for (uint i = 0; i < dev().scratch(gpu.hwRing())->memObjs_.size(); ++i) {
|
||||
dev().scratch(gpu.hwRing())->memObjs_[i]->setBusy(gpu, calEvent);
|
||||
}
|
||||
dev().scratch(gpu.hwRing())->memObj_->setBusy(gpu, calEvent);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
Kernel::setupArenaAliases(VirtualGPU& gpu, const Resource& resource) const
|
||||
{
|
||||
const static uint ScArenaUavShortId = 9;
|
||||
const static uint ScArenaUavByteId = 10;
|
||||
|
||||
Resource* buf = &(const_cast<Resource&>(resource));
|
||||
Resource* alias;
|
||||
gslMemObject gslMem = NULL;
|
||||
//
|
||||
// byte view
|
||||
//
|
||||
alias = buf->getAliasUAVBuffer(CM_SURF_FMT_R8I);
|
||||
if (NULL == alias) {
|
||||
return false;
|
||||
}
|
||||
gslMem = alias->gslResource();
|
||||
if (gpu.cal_.uavs_[ScArenaUavByteId] != gslMem) {
|
||||
if (!gpu.setUAVBuffer(ScArenaUavByteId,
|
||||
gslMem, GSL_UAV_TYPE_TYPELESS)) {
|
||||
return false;
|
||||
}
|
||||
gpu.cal_.uavs_[ScArenaUavByteId] = gslMem;
|
||||
}
|
||||
|
||||
//
|
||||
// short view
|
||||
//
|
||||
alias = buf->getAliasUAVBuffer(CM_SURF_FMT_R16I);
|
||||
if (NULL == alias) {
|
||||
return false;
|
||||
}
|
||||
bool result = true;
|
||||
gslMem = alias->gslResource();
|
||||
if (gpu.cal_.uavs_[ScArenaUavShortId] != gslMem) {
|
||||
result = gpu.setUAVBuffer(ScArenaUavShortId,
|
||||
gslMem, GSL_UAV_TYPE_TYPELESS);
|
||||
gpu.cal_.uavs_[ScArenaUavShortId] = gslMem;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
Kernel::copyImageConstants(
|
||||
const amd::Image* amdImage,
|
||||
@@ -2993,29 +2804,13 @@ NullKernel::parseArguments(const std::string& metaData, uint* uavRefCount)
|
||||
// Check if can't use a dedicated UAV,
|
||||
// so realloc memory in the heap
|
||||
arg->memory_.realloc_ = isRealloc();
|
||||
|
||||
if (nullDev().settings().useAliases_) {
|
||||
if (uavRefCount[arg->index_] > 1) {
|
||||
// Multiple accesses, assume this is the heap
|
||||
uavRaw_ = arg->index_;
|
||||
}
|
||||
// Mark argument as an UAV buffer if no aliases or it's not arena
|
||||
else if (arg->index_ != VirtualGPU::UavArena) {
|
||||
arg->memory_.uavBuf_ = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
arg->memory_.uavBuf_ = true;
|
||||
}
|
||||
arg->memory_.uavBuf_ = true;
|
||||
break;
|
||||
case KernelArg::PointerHwConst:
|
||||
arg->memory_.realloc_ = true;
|
||||
break;
|
||||
case KernelArg::UavId:
|
||||
if (!nullDev().settings().useAliases_ ||
|
||||
(arg->index_ != VirtualGPU::UavArena)) {
|
||||
uavRaw_ = arg->index_;
|
||||
}
|
||||
uavRaw_ = arg->index_;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -3029,8 +2824,7 @@ NullKernel::parseArguments(const std::string& metaData, uint* uavRefCount)
|
||||
}
|
||||
}
|
||||
|
||||
if (!nullDev().settings().useAliases_ &&
|
||||
(uavRaw_ != UavIdUndefined) &&
|
||||
if ((uavRaw_ != UavIdUndefined) &&
|
||||
!(flags() & PrintfOutput)) {
|
||||
// Find if default UAV is already assigned to an argument
|
||||
for (uint i = 0; i < arguments_.size(); ++i) {
|
||||
|
||||
@@ -385,7 +385,6 @@ public:
|
||||
Undefined = 0x00000000, //!< resource type will be detected
|
||||
ConstantBuffer = 0x00000001, //!< resource is a constant buffer
|
||||
GlobalBuffer = 0x00000002, //!< resource is a global buffer
|
||||
GlobalBufferArena = 0x00000003, //!< resource is a global buffer
|
||||
ArgumentHeapBuffer = 0x00000004, //!< resource is an argument buffer
|
||||
ArgumentBuffer = 0x00000005, //!< resource is an argument buffer
|
||||
ArgumentImageRead = 0x00000006, //!< resource is an argument image read
|
||||
@@ -482,9 +481,6 @@ protected:
|
||||
//! Returns UAV raw index for this kernel
|
||||
uint uavRaw() const { return uavRaw_; }
|
||||
|
||||
//! Returns UAV arena index for this kernel
|
||||
uint uavArena() const { return uavArena_; }
|
||||
|
||||
cl_int buildError_; //!< Kernel's build error
|
||||
std::string ilSource_; //!< IL source code of this kernel
|
||||
|
||||
@@ -502,10 +498,8 @@ protected:
|
||||
uint numCb_; //!< total number of constant buffers
|
||||
|
||||
uint uavRaw_; //!< UAV used for RAW access
|
||||
uint uavArena_; //!< UAV used for arena access
|
||||
|
||||
bool rwAttributes_; //!< backend provides RW attributes for arguments
|
||||
bool setBufferForNumGroup_;
|
||||
|
||||
uint instructionCnt_;//!< Instruction count
|
||||
|
||||
@@ -600,7 +594,7 @@ public:
|
||||
*
|
||||
* \return True if aliases were detected in the kernel arguments
|
||||
*/
|
||||
bool processMemObjects(
|
||||
void processMemObjects(
|
||||
VirtualGPU& gpu, //!< Virtual GPU objects - queue
|
||||
const amd::Kernel& kernel, //!< AMD kernel object for execution
|
||||
const_address params, //!< pointer to the param's store
|
||||
@@ -761,12 +755,6 @@ private:
|
||||
bool lastRun //!< last run in the split execution
|
||||
) const;
|
||||
|
||||
//! Returns true if arena setup was successful
|
||||
bool setupArenaAliases(
|
||||
VirtualGPU& gpu, //!< Virtual GPU device object
|
||||
const Resource& resource //!< Resource for aliases setup
|
||||
) const;
|
||||
|
||||
//! Copies image constants to the constant buffer
|
||||
void copyImageConstants(
|
||||
const amd::Image* amdImage, //!< Abstraction layer image object
|
||||
|
||||
@@ -67,8 +67,6 @@ Resource::Resource(
|
||||
, hbOffset_(0)
|
||||
, hbSize_(0)
|
||||
, pinOffset_(0)
|
||||
, byteView_(NULL)
|
||||
, shortView_(NULL)
|
||||
, glInterop_(0)
|
||||
, gpu_(NULL)
|
||||
{
|
||||
@@ -114,8 +112,6 @@ Resource::Resource(
|
||||
, hbOffset_(0)
|
||||
, hbSize_(0)
|
||||
, pinOffset_(0)
|
||||
, byteView_(NULL)
|
||||
, shortView_(NULL)
|
||||
, glInterop_(0)
|
||||
, gpu_(NULL)
|
||||
{
|
||||
@@ -1069,15 +1065,6 @@ Resource::reallocate(CreateParams* params)
|
||||
void
|
||||
Resource::free()
|
||||
{
|
||||
if (NULL != byteView_) {
|
||||
delete byteView_;
|
||||
byteView_ = NULL;
|
||||
}
|
||||
if (NULL != shortView_) {
|
||||
delete shortView_;
|
||||
shortView_ = NULL;
|
||||
}
|
||||
|
||||
if (gslRef_ == NULL) {
|
||||
return;
|
||||
}
|
||||
@@ -1935,7 +1922,7 @@ Resource::warmUpRenames(VirtualGPU& gpu)
|
||||
// EPR #411675 - On Kaveri, benchmark "photo editing" of PCMarks takes longer time
|
||||
// if writing 0 for the buffer paging by VidMM is excuted. Not sure how PCMarks measures it.
|
||||
// Disable this code for apu
|
||||
if (dev().settings().siPlus_ && !dev().settings().apuSystem_) {
|
||||
if (!dev().settings().apuSystem_) {
|
||||
uint dummy = 0;
|
||||
const bool NoWait = false;
|
||||
// Write 0 for the buffer paging by VidMM
|
||||
@@ -1946,57 +1933,6 @@ Resource::warmUpRenames(VirtualGPU& gpu)
|
||||
}
|
||||
}
|
||||
|
||||
Resource*
|
||||
Resource::getAliasUAVBuffer(cmSurfFmt newFormat)
|
||||
{
|
||||
Resource* view = NULL;
|
||||
uint byteSize;
|
||||
|
||||
// Lock device so a view allocation is unique operation
|
||||
amd::ScopedLock k(dev().gslDeviceOps());
|
||||
|
||||
if (newFormat == CM_SURF_FMT_R8I) {
|
||||
view = byteView_;
|
||||
byteSize = 1;
|
||||
}
|
||||
else if (newFormat == CM_SURF_FMT_R16I) {
|
||||
view = shortView_;
|
||||
byteSize = 2;
|
||||
}
|
||||
else { // only take byte and short
|
||||
assert(false && "Unsupported format for a view");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// allocate byte/short view
|
||||
if (NULL == view) {
|
||||
view = new Resource(dev(), (cal()->width_ * elementSize()) / byteSize, newFormat);
|
||||
if (view == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Resource::ViewParams params;
|
||||
params.offset_ = 0;
|
||||
params.size_ = cal()->width_ * elementSize();
|
||||
params.resource_ = this;
|
||||
|
||||
if (!view->create(Resource::View, ¶ms)) {
|
||||
delete view;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// save view resource
|
||||
if (newFormat == CM_SURF_FMT_R8I) {
|
||||
byteView_ = view;
|
||||
}
|
||||
else if (newFormat == CM_SURF_FMT_R16I) {
|
||||
shortView_ = view;
|
||||
}
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
ResourceCache::~ResourceCache()
|
||||
{
|
||||
free();
|
||||
|
||||
@@ -359,9 +359,6 @@ public:
|
||||
bool isCacheable() const
|
||||
{ return (isMemoryType(Remote) || isMemoryType(Pinned)) ? true : false; }
|
||||
|
||||
//! Returns alias memory object
|
||||
Resource* getAliasUAVBuffer(cmSurfFmt newFormat);
|
||||
|
||||
bool gslGLAcquire() ;
|
||||
bool gslGLRelease() ;
|
||||
|
||||
@@ -443,8 +440,6 @@ private:
|
||||
uint64_t hbOffset_; //!< Offset in the heap (virtual or real)
|
||||
uint64_t hbSize_; //!< Memory size
|
||||
uint64_t pinOffset_; //!< Pinned memory offset
|
||||
Resource* byteView_; //!< Byte view memory object
|
||||
Resource* shortView_; //!< Short view memory object
|
||||
gslMemObject glInterop_; //!< Original GL interop object
|
||||
void* glInteropMbRes_;//!< Mb Res handle
|
||||
uint32_t glType_; //!< GL interop type
|
||||
|
||||
@@ -1,479 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2008 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#include "device/gpu/gpukernel.hpp"
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include <ctime>
|
||||
|
||||
#include "acl.h"
|
||||
#define R900_BUILD 1
|
||||
#include "SCShadersR800.h"
|
||||
#include "r8xx_r9xx_merged__offset.h"
|
||||
#include "r8xx_r9xx_merged__typedef.h"
|
||||
|
||||
namespace gpu {
|
||||
|
||||
#define NUM_R800_CS_INFOS (0x22+SC_R800_MAX_UAV+ \
|
||||
3+ /* globalReturnBuffer flag plus numUavs and numGlobalReturnBuffers */ \
|
||||
1+ /* extendedCaching flag */ \
|
||||
3+ /* globalReturnBuffer sizes for dword, shorts and bytes */ \
|
||||
3*SC_R800_MAX_UAV+ /* offsetmap, cached and uncached fetch consts */ \
|
||||
2*SC_R800_MAX_UAV+ /* 64- and 128-bit cached fetch consts */ \
|
||||
2*R800_GLOBAL_RTN_BUF_LAST /* global return buffer fetch consts and type */ )
|
||||
|
||||
struct Options {
|
||||
uint numClauseTemps_;
|
||||
uint numGPRs_;
|
||||
uint numThreads_;
|
||||
uint numStackEntries_;
|
||||
uint ldsSize_;
|
||||
|
||||
Options(CALtarget target) {
|
||||
numClauseTemps_ = 4;
|
||||
|
||||
switch (target) {
|
||||
case CAL_TARGET_DEVASTATOR:
|
||||
case CAL_TARGET_SCRAPPER:
|
||||
case CAL_TARGET_CAYMAN:
|
||||
case CAL_TARGET_KAUAI:
|
||||
numClauseTemps_ = 0;
|
||||
numStackEntries_ = 512;
|
||||
numThreads_ = 248;
|
||||
break;
|
||||
case CAL_TARGET_SUPERSUMO:
|
||||
case CAL_TARGET_TURKS:
|
||||
case CAL_TARGET_REDWOOD:
|
||||
numStackEntries_ = 256;
|
||||
numThreads_ = 248;
|
||||
break;
|
||||
case CAL_TARGET_WRESTLER:
|
||||
case CAL_TARGET_SUMO:
|
||||
case CAL_TARGET_CAICOS:
|
||||
case CAL_TARGET_CEDAR:
|
||||
numStackEntries_ = 256;
|
||||
numThreads_ = 192;
|
||||
break;
|
||||
case CAL_TARGET_CYPRESS:
|
||||
case CAL_TARGET_BARTS:
|
||||
case CAL_TARGET_JUNIPER:
|
||||
numStackEntries_ = 512;
|
||||
numThreads_ = 248;
|
||||
break;
|
||||
default:
|
||||
numStackEntries_ = 512;
|
||||
numThreads_ = 248;
|
||||
LogError("Unknown ASIC type");
|
||||
}
|
||||
|
||||
numGPRs_ = 256 - 2 * numClauseTemps_;
|
||||
ldsSize_ = 32*1024;
|
||||
}
|
||||
private:
|
||||
Options();
|
||||
Options(const Options&);
|
||||
Options& operator=(const Options&);
|
||||
};
|
||||
|
||||
static const uint UncachedFetchConst[SC_R800_MAX_UAV] =
|
||||
{ 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 173 };
|
||||
|
||||
static const uint CachedFetchConst[SC_R800_MAX_UAV] =
|
||||
{ 144, 145, 146, 148, 149, 150, 151, 152, 0, 0, 0, 153 };
|
||||
|
||||
static const uint GlobalReturnFetchConst[R800_GLOBAL_RTN_BUF_LAST] =
|
||||
{ 165, 166, 167, 168, 169, 170, 171, 172 };
|
||||
|
||||
static const uint GlobalReturnBufferType[R800_GLOBAL_RTN_BUF_LAST] =
|
||||
{ AMU_ABI_UAV_FORMAT_TYPELESS, AMU_ABI_UAV_FORMAT_FLOAT,
|
||||
AMU_ABI_UAV_FORMAT_UNORM, AMU_ABI_UAV_FORMAT_SNORM, AMU_ABI_UAV_FORMAT_UINT,
|
||||
AMU_ABI_UAV_FORMAT_SINT, AMU_ABI_UAV_FORMAT_SHORT, AMU_ABI_UAV_FORMAT_BYTE };
|
||||
|
||||
static const uint CachedFetchConst64[SC_R800_MAX_UAV] =
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 174 };
|
||||
|
||||
static const uint CachedFetchConst128[SC_R800_MAX_UAV] =
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 175 };
|
||||
|
||||
bool
|
||||
NullKernel::r800CreateHwInfo(const void* shader, AMUabiAddEncoding& encoding)
|
||||
{
|
||||
CALProgramInfoEntry* newInfos;
|
||||
const Options options(nullDev().calTarget());
|
||||
uint i = 0;
|
||||
uint numShaderEngines = 1;
|
||||
if ((nullDev().calTarget() == CAL_TARGET_CAYMAN) ||
|
||||
(nullDev().calTarget() == CAL_TARGET_CYPRESS) ||
|
||||
(nullDev().calTarget() == CAL_TARGET_BARTS)) {
|
||||
numShaderEngines = 2;
|
||||
}
|
||||
|
||||
uint infoCount = NUM_R800_CS_INFOS;
|
||||
SC_R800CSHWSHADER* cShader = (SC_R800CSHWSHADER *)shader;
|
||||
if (cShader->u32NumThreadPerGroup == 0) {
|
||||
return false;
|
||||
}
|
||||
newInfos = new CALProgramInfoEntry[infoCount];
|
||||
encoding.progInfos = newInfos;
|
||||
if (encoding.progInfos == 0) {
|
||||
infoCount = 0;
|
||||
return false;
|
||||
}
|
||||
memset(newInfos, 0, infoCount * sizeof(CALProgramInfoEntry));
|
||||
|
||||
newInfos[i].address = mmSQ_PGM_START_LS;
|
||||
newInfos[i].value = 0x0;
|
||||
i++;
|
||||
newInfos[i].address = mmSQ_PGM_RESOURCES_LS;
|
||||
cShader->sqPgmResourcesCs.bits.UNCACHED_FIRST_INST = 1;
|
||||
cShader->sqPgmResourcesCs.bits.PRIME_CACHE_ENABLE = 1;
|
||||
cShader->sqPgmResourcesCs.bits.PRIME_CACHE_ON_CONST = 0;
|
||||
newInfos[i].value = cShader->sqPgmResourcesCs.u32All;
|
||||
i++;
|
||||
newInfos[i].address = mmSQ_PGM_RESOURCES_2_LS;
|
||||
newInfos[i].value = cShader->sqPgmResources2Cs.u32All;
|
||||
i++;
|
||||
|
||||
newInfos[i].address = mmSPI_THREAD_GROUPING;
|
||||
regSPI_THREAD_GROUPING spi_thread_grouping;
|
||||
spi_thread_grouping.u32All = 0;
|
||||
spi_thread_grouping.bits.PS_GROUPING = 0;
|
||||
spi_thread_grouping.bits.VS_GROUPING = 0;
|
||||
spi_thread_grouping.bits.ES_GROUPING = 0;
|
||||
spi_thread_grouping.bits.GS_GROUPING = 0;
|
||||
// dyn_gpr_mgmt if CS_GROUPING = 1.
|
||||
spi_thread_grouping.bits.CS_GROUPING = 0;
|
||||
newInfos[i].value = spi_thread_grouping.u32All;
|
||||
i++;
|
||||
|
||||
const unsigned int numSharedGPR = cShader->u32NumSharedGprTotal;
|
||||
newInfos[i].address = mmSQ_DYN_GPR_CNTL_PS_FLUSH_REQ;
|
||||
regSQ_DYN_GPR_CNTL_PS_FLUSH_REQ sq_dyn_gpr_cntl_ps_flush_req;
|
||||
sq_dyn_gpr_cntl_ps_flush_req.u32All = 0;
|
||||
sq_dyn_gpr_cntl_ps_flush_req.bits.RING0_OFFSET = numSharedGPR;
|
||||
newInfos[i].value = sq_dyn_gpr_cntl_ps_flush_req.u32All;
|
||||
i++;
|
||||
|
||||
const unsigned int numClauseTemps = options.numClauseTemps_;
|
||||
const unsigned int MaxNumGPRsAvail = options.numGPRs_;
|
||||
newInfos[i].address = mmSQ_GPR_RESOURCE_MGMT_1;
|
||||
regSQ_GPR_RESOURCE_MGMT_1 sq_gpr_resource_mgmt_1;
|
||||
sq_gpr_resource_mgmt_1.u32All = 0;
|
||||
sq_gpr_resource_mgmt_1.bits.NUM_CLAUSE_TEMP_GPRS = numClauseTemps;
|
||||
newInfos[i].value = sq_gpr_resource_mgmt_1.u32All;
|
||||
i++;
|
||||
|
||||
newInfos[i].address = mmSQ_GPR_RESOURCE_MGMT_3__EG;
|
||||
regSQ_GPR_RESOURCE_MGMT_3__EG sq_gpr_resource_mgmt_3;
|
||||
sq_gpr_resource_mgmt_3.u32All = 0;
|
||||
{
|
||||
const unsigned int numWavefrontPerSIMD = 1 ; // ?? cShader->u32NumWavefrontPerSIMD;
|
||||
if ((cShader->u32NumSharedGprUser != cShader->u32NumSharedGprTotal)) // cShader->bIsMaxNumWavePerSIMD)
|
||||
{
|
||||
// if running with a barrier, need to limit the number of wavefronts on a SIMD.
|
||||
// force max wavefronts run on a simd by adjusting the num_es_gprs pool that all es programs can
|
||||
// allocate from. (# of gprs the program uses * numWavefrontsPerSIMD)
|
||||
sq_gpr_resource_mgmt_3.bits.NUM_LS_GPRS = cShader->sqPgmResourcesCs.bits.NUM_GPRS * numWavefrontPerSIMD;
|
||||
}
|
||||
else
|
||||
{
|
||||
sq_gpr_resource_mgmt_3.bits.NUM_LS_GPRS = MaxNumGPRsAvail - numSharedGPR;
|
||||
}
|
||||
}
|
||||
newInfos[i].value = sq_gpr_resource_mgmt_3.u32All;
|
||||
i++;
|
||||
|
||||
newInfos[i].address = mmSPI_GPR_MGMT;
|
||||
regSPI_GPR_MGMT spi_gpr_mgmt;
|
||||
spi_gpr_mgmt.u32All = 0;
|
||||
{
|
||||
const unsigned int numWavefrontPerSIMD = 1 ; // ?? cShader->u32NumWavefrontPerSIMD;
|
||||
if ((cShader->u32NumSharedGprUser != cShader->u32NumSharedGprTotal)) // cShader->bIsMaxNumWavePerSIMD)
|
||||
{
|
||||
// if running with a barrier, need to limit the number of wavefronts on a SIMD.
|
||||
// force max wavefronts run on a simd by adjusting the num_es_gprs pool that all es programs can
|
||||
// allocate from. (# of gprs the program uses * numWavefrontsPerSIMD)
|
||||
spi_gpr_mgmt.bits.NUM_LS_GPRS = (cShader->sqPgmResourcesCs.bits.NUM_GPRS * numWavefrontPerSIMD) >> 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
spi_gpr_mgmt.bits.NUM_LS_GPRS = (MaxNumGPRsAvail - numSharedGPR) >> 3;
|
||||
}
|
||||
}
|
||||
newInfos[i].value = spi_gpr_mgmt.u32All;
|
||||
i++;
|
||||
|
||||
|
||||
newInfos[i].address = mmSPI_WAVE_MGMT_1;
|
||||
regSPI_WAVE_MGMT_1 spi_wave_mgmt_1;
|
||||
spi_wave_mgmt_1.u32All = 0;
|
||||
newInfos[i].value = spi_wave_mgmt_1.u32All;
|
||||
i++;
|
||||
|
||||
newInfos[i].address = mmSPI_WAVE_MGMT_2;
|
||||
regSPI_WAVE_MGMT_2 spi_wave_mgmt_2;
|
||||
spi_wave_mgmt_2.u32All = 0;
|
||||
spi_wave_mgmt_2.bits.NUM_CS_WAVES_ONE_RING = (options.numThreads_) >> 3;
|
||||
newInfos[i].value = spi_wave_mgmt_2.u32All;
|
||||
i++;
|
||||
|
||||
newInfos[i].address = mmSQ_THREAD_RESOURCE_MGMT__EG;
|
||||
regSQ_THREAD_RESOURCE_MGMT__EG sq_thread_resource_mgmt;
|
||||
sq_thread_resource_mgmt.u32All = 0;
|
||||
sq_thread_resource_mgmt.bits.NUM_PS_THREADS = 0;
|
||||
sq_thread_resource_mgmt.bits.NUM_VS_THREADS = 0;
|
||||
sq_thread_resource_mgmt.bits.NUM_GS_THREADS = 0;
|
||||
sq_thread_resource_mgmt.bits.NUM_ES_THREADS = 0;
|
||||
newInfos[i].value = sq_thread_resource_mgmt.u32All;
|
||||
i++;
|
||||
|
||||
newInfos[i].address = mmSQ_THREAD_RESOURCE_MGMT_2__EG;
|
||||
regSQ_THREAD_RESOURCE_MGMT_2__EG sq_thread_resource_mgmt_2;
|
||||
sq_thread_resource_mgmt_2.u32All = 0;
|
||||
sq_thread_resource_mgmt_2.bits.NUM_HS_THREADS = 0;
|
||||
sq_thread_resource_mgmt_2.bits.NUM_LS_THREADS = options.numThreads_;
|
||||
newInfos[i].value = sq_thread_resource_mgmt_2.u32All;
|
||||
i++;
|
||||
|
||||
regSPI_COMPUTE_INPUT_CNTL spi_dompute_input_cntl;
|
||||
spi_dompute_input_cntl.u32All = 0;
|
||||
spi_dompute_input_cntl.bits.DISABLE_INDEX_PACK = 1;
|
||||
spi_dompute_input_cntl.bits.TID_IN_GROUP_ENA = 1;
|
||||
spi_dompute_input_cntl.bits.TGID_ENA = 1;
|
||||
newInfos[i].address = mmSPI_COMPUTE_INPUT_CNTL;
|
||||
newInfos[i].value = spi_dompute_input_cntl.u32All;
|
||||
i++;
|
||||
|
||||
newInfos[i].address = mmSQ_LDS_ALLOC;
|
||||
newInfos[i].value = cShader->sqLdsAllocCs.u32All;
|
||||
i++;
|
||||
|
||||
//This is information passed from SC to GSL, there is no valid address, so make up one.
|
||||
newInfos[i].address = AMU_ABI_CS_MAX_SCRATCH_REGS;
|
||||
newInfos[i].value = cShader->MaxScratchRegsNeeded;
|
||||
i++;
|
||||
newInfos[i].address = AMU_ABI_CS_NUM_SHARED_GPR_USER;
|
||||
newInfos[i].value = cShader->u32NumSharedGprUser;
|
||||
i++;
|
||||
newInfos[i].address = AMU_ABI_CS_NUM_SHARED_GPR_TOTAL;
|
||||
newInfos[i].value = cShader->u32NumSharedGprTotal;
|
||||
i++;
|
||||
newInfos[i].address = AMU_ABI_NUM_THREAD_PER_GROUP;
|
||||
newInfos[i].value = cShader->u32NumThreadPerGroup;
|
||||
i++;
|
||||
newInfos[i].address = AMU_ABI_NUM_THREAD_PER_GROUP_X;
|
||||
newInfos[i].value = cShader->u32NumThreadPerGroup_x;
|
||||
i++;
|
||||
newInfos[i].address = AMU_ABI_NUM_THREAD_PER_GROUP_Y;
|
||||
newInfos[i].value = cShader->u32NumThreadPerGroup_y;
|
||||
i++;
|
||||
newInfos[i].address = AMU_ABI_NUM_THREAD_PER_GROUP_Z;
|
||||
newInfos[i].value = cShader->u32NumThreadPerGroup_z;
|
||||
i++;
|
||||
newInfos[i].address = AMU_ABI_TOTAL_NUM_THREAD_GROUP;
|
||||
newInfos[i].value = cShader->u32TotalNumThreadGroup;
|
||||
i++;
|
||||
newInfos[i].address = AMU_ABI_NUM_WAVEFRONT_PER_SIMD;
|
||||
newInfos[i].value = 1;
|
||||
i++;
|
||||
newInfos[i].address = AMU_ABI_IS_MAX_NUM_WAVE_PER_SIMD;
|
||||
newInfos[i].value = 0; // ??
|
||||
i++;
|
||||
newInfos[i].address = AMU_ABI_SET_BUFFER_FOR_NUM_GROUP;
|
||||
newInfos[i].value = cShader->bSetBufferForNumGroup;
|
||||
i++;
|
||||
newInfos[i].address = AMU_ABI_RAT_OP_IS_USED;
|
||||
newInfos[i].value = cShader->u32RatOpIsUsed;
|
||||
i++;
|
||||
newInfos[i].address = AMU_ABI_RAT_ATOMIC_OP_IS_USED;
|
||||
newInfos[i].value = cShader->u32RatAtomicOpIsUsed;
|
||||
i++;
|
||||
newInfos[i].address = AMU_ABI_WAVEFRONT_SIZE;
|
||||
newInfos[i].value = nullDev().hwInfo()->simdWidth_ * 4;
|
||||
i++;
|
||||
newInfos[i].address = AMU_ABI_NUM_GPR_AVAIL;
|
||||
newInfos[i].value = options.numGPRs_;
|
||||
i++;
|
||||
newInfos[i].address = AMU_ABI_NUM_GPR_USED;
|
||||
newInfos[i].value = cShader->sqPgmResourcesCs.bits.NUM_GPRS;
|
||||
i++;
|
||||
newInfos[i].address = AMU_ABI_LDS_SIZE_AVAIL;
|
||||
newInfos[i].value = options.ldsSize_;
|
||||
i++;
|
||||
newInfos[i].address = AMU_ABI_LDS_SIZE_USED;
|
||||
newInfos[i].value = cShader->sqLdsAllocCs.bits.SIZE;
|
||||
i++;
|
||||
newInfos[i].address = AMU_ABI_STACK_SIZE_AVAIL;
|
||||
newInfos[i].value = options.numStackEntries_;
|
||||
i++;
|
||||
newInfos[i].address = AMU_ABI_STACK_SIZE_USED;
|
||||
newInfos[i].value = cShader->sqPgmResourcesCs.bits.STACK_SIZE;
|
||||
i++;
|
||||
|
||||
for (unsigned int j = 0;j <SC_R800_MAX_UAV; j++)
|
||||
{
|
||||
unsigned int bufferSize = cShader->scUavRtnBufInfoTbl[j].stride;
|
||||
|
||||
bufferSize *= 4; // convert from DWORDS to bytes
|
||||
|
||||
//
|
||||
// multiply by the maximum number of threads in flight at one time
|
||||
//
|
||||
// 256 waves * 64 threads/wave * 2 shader engines (for 870)
|
||||
//
|
||||
bufferSize *= nullDev().hwInfo()->simdWidth_ * 4; // threads/wave
|
||||
bufferSize *= 256 * 4; // maximum number of waves
|
||||
|
||||
bufferSize *= numShaderEngines;
|
||||
|
||||
newInfos[i].address = AMU_ABI_SET_BUFFER_FOR_UAV_RET_BUFFER0 + j;
|
||||
newInfos[i].value = bufferSize;
|
||||
i++;
|
||||
}
|
||||
newInfos[i].address = AMU_ABI_GLOBAL_RETURN_BUFFER;
|
||||
newInfos[i].value = true;
|
||||
i++;
|
||||
// Always use extended caching with global return buffer
|
||||
newInfos[i].address = AMU_ABI_EXTENDED_CACHING;
|
||||
newInfos[i].value = true;
|
||||
i++;
|
||||
newInfos[i].address = AMU_ABI_NUM_GLOBAL_UAV;
|
||||
newInfos[i].value = SC_R800_MAX_UAV;
|
||||
i++;
|
||||
newInfos[i].address = AMU_ABI_NUM_GLOBAL_RETURN_BUFFER;
|
||||
newInfos[i].value = R800_GLOBAL_RTN_BUF_LAST;
|
||||
i++;
|
||||
{
|
||||
unsigned int bufferSize = cShader->u32GlobalRtnBufSlot;
|
||||
|
||||
bufferSize *= 4; // convert from DWORDS to bytes
|
||||
|
||||
//
|
||||
// multiply by the maximum number of threads in flight at one time
|
||||
//
|
||||
// 256 waves * 64 threads/wave * 2 shader engines (for 870)
|
||||
//
|
||||
bufferSize *= nullDev().hwInfo()->simdWidth_ * 4; // threads/wave
|
||||
bufferSize *= 256 * 4; // maximum number of waves
|
||||
|
||||
bufferSize *= numShaderEngines;
|
||||
|
||||
newInfos[i].address = AMU_ABI_GLOBAL_RETURN_BUFFER_SIZE;
|
||||
newInfos[i].value = bufferSize;
|
||||
i++;
|
||||
}
|
||||
{
|
||||
unsigned int bufferSize = cShader->u32GlobalRtnBufSlotShort;
|
||||
|
||||
bufferSize *= 4; // convert from DWORDS to bytes
|
||||
|
||||
//
|
||||
// multiply by the maximum number of threads in flight at one time
|
||||
//
|
||||
// 256 waves * 64 threads/wave * 2 shader engines (for 870)
|
||||
//
|
||||
bufferSize *= nullDev().hwInfo()->simdWidth_ * 4; // threads/wave
|
||||
bufferSize *= 256 * 4; // maximum number of waves
|
||||
|
||||
bufferSize *= numShaderEngines;
|
||||
|
||||
newInfos[i].address = AMU_ABI_GLOBAL_RETURN_BUFFER_SIZE_SHORT;
|
||||
newInfos[i].value = bufferSize;
|
||||
i++;
|
||||
}
|
||||
{
|
||||
unsigned int bufferSize = cShader->u32GlobalRtnBufSlotByte;
|
||||
|
||||
bufferSize *= 4; // convert from DWORDS to bytes
|
||||
|
||||
//
|
||||
// multiply by the maximum number of threads in flight at one time
|
||||
//
|
||||
// 256 waves * 64 threads/wave * 2 shader engines (for 870)
|
||||
//
|
||||
bufferSize *= nullDev().hwInfo()->simdWidth_ * 4; // threads/wave
|
||||
bufferSize *= 256 * 4; // maximum number of waves
|
||||
|
||||
bufferSize *= numShaderEngines;
|
||||
|
||||
newInfos[i].address = AMU_ABI_GLOBAL_RETURN_BUFFER_SIZE_BYTE;
|
||||
newInfos[i].value = bufferSize;
|
||||
i++;
|
||||
}
|
||||
for (unsigned int j = 0; j < SC_R800_MAX_UAV; j++)
|
||||
{
|
||||
newInfos[i].address = AMU_ABI_OFFSET_TO_UAV0+j;
|
||||
newInfos[i].value = j;
|
||||
i++;
|
||||
}
|
||||
for (unsigned int j = 0; j < SC_R800_MAX_UAV; j++)
|
||||
{
|
||||
// Set up UAV->fetch constant mapping for uncached
|
||||
newInfos[i].address = AMU_ABI_UNCACHED_FETCH_CONST_UAV0+j;
|
||||
newInfos[i].value = UncachedFetchConst[j];
|
||||
i++;
|
||||
}
|
||||
for (unsigned int j = 0; j < SC_R800_MAX_UAV; j++)
|
||||
{
|
||||
newInfos[i].address = AMU_ABI_CACHED_FETCH_CONST_UAV0+j;
|
||||
newInfos[i].value = CachedFetchConst[j];
|
||||
i++;
|
||||
}
|
||||
for (unsigned int j = 0; j < R800_GLOBAL_RTN_BUF_LAST; j++)
|
||||
{
|
||||
newInfos[i].address = AMU_ABI_GLOBAL_RETURN_FETCH_CONST0+j;
|
||||
newInfos[i].value = GlobalReturnFetchConst[j];
|
||||
i++;
|
||||
}
|
||||
for (unsigned int j = 0; j < R800_GLOBAL_RTN_BUF_LAST; j++)
|
||||
{
|
||||
newInfos[i].address = AMU_ABI_GLOBAL_RETURN_BUFFER_TYPE0+j;
|
||||
newInfos[i].value = GlobalReturnBufferType[j];
|
||||
i++;
|
||||
}
|
||||
for (unsigned int j = 0; j < SC_R800_MAX_UAV; j++)
|
||||
{
|
||||
newInfos[i].address = AMU_ABI_CACHED_FETCH_CONST64_UAV0+j;
|
||||
newInfos[i].value = CachedFetchConst64[j];
|
||||
i++;
|
||||
}
|
||||
for (unsigned int j = 0; j < SC_R800_MAX_UAV; j++)
|
||||
{
|
||||
newInfos[i].address = AMU_ABI_CACHED_FETCH_CONST128_UAV0+j;
|
||||
newInfos[i].value = CachedFetchConst128[j];
|
||||
i++;
|
||||
}
|
||||
|
||||
assert(i == infoCount);
|
||||
encoding.progInfosCount = infoCount;
|
||||
|
||||
encoding.uavMask.mask[0] = cShader->u32RatOpIsUsed;
|
||||
encoding.textData = HWSHADER_Get(cShader, hShaderMemHandle);
|
||||
encoding.textSize = cShader->CodeLenInByte;
|
||||
instructionCnt_ = encoding.textSize / sizeof(uint32_t);
|
||||
encoding.scratchRegisterCount = cShader->MaxScratchRegsNeeded;
|
||||
|
||||
uint bufferSize = 0;
|
||||
bufferSize = cShader->u32GlobalRtnBufSlot +
|
||||
cShader->u32GlobalRtnBufSlotShort + cShader->u32GlobalRtnBufSlotByte;
|
||||
bufferSize *= 4; // convert from DWORDS to bytes
|
||||
|
||||
//
|
||||
// multiply by the maximum number of threads in flight at one time
|
||||
//
|
||||
// 256 waves * 64 threads/wave * 2 shader engines (for 870)
|
||||
//
|
||||
bufferSize *= nullDev().hwInfo()->simdWidth_ * 4; // threads/wave
|
||||
bufferSize *= 256 * 4; // maximum number of waves
|
||||
|
||||
bufferSize *= numShaderEngines;
|
||||
encoding.UAVReturnBufferTotalSize = bufferSize;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace gpu
|
||||
|
||||
@@ -125,9 +125,6 @@ NullKernel::siCreateHwInfo(const void* shader, AMUabiAddEncoding& encoding)
|
||||
assert((i + 4 * (16 - cShader->common.userElementCount)) == NumSiCsInfos);
|
||||
encoding.progInfosCount = infoCount;
|
||||
|
||||
CALUavMask uavMask;
|
||||
memcpy(uavMask.mask, cShader->common.uavResourceUsage, sizeof(CALUavMask));
|
||||
encoding.uavMask = uavMask;
|
||||
encoding.textData = HWSHADER_Get(cShader, common.hShaderMemHandle);
|
||||
encoding.textSize = cShader->common.codeLenInByte;
|
||||
instructionCnt_ = encoding.textSize / sizeof(uint32_t);
|
||||
|
||||
@@ -54,7 +54,6 @@ Settings::Settings()
|
||||
heapSize_ = GPU_INITIAL_HEAP_SIZE * Mi;
|
||||
heapSizeGrowth_ = GPU_HEAP_GROWTH_INCREMENT * Mi;
|
||||
|
||||
useAliases_ = false;
|
||||
imageSupport_ = false;
|
||||
hwLDSSize_ = 0;
|
||||
|
||||
@@ -108,7 +107,6 @@ Settings::Settings()
|
||||
imageDMA_ = GPU_IMAGE_DMA;
|
||||
|
||||
// Disable ASIC specific features by default
|
||||
siPlus_ = false;
|
||||
ciPlus_ = false;
|
||||
viPlus_ = false;
|
||||
aiPlus_ = false;
|
||||
@@ -116,9 +114,6 @@ Settings::Settings()
|
||||
// Number of compute rings.
|
||||
numComputeRings_ = 0;
|
||||
|
||||
// Rectangular Linear DRMDMA
|
||||
rectLinearDMA_ = false;
|
||||
|
||||
minWorkloadTime_ = 1; // 0.1 ms
|
||||
maxWorkloadTime_ = 5000; // 500 ms
|
||||
|
||||
@@ -176,68 +171,6 @@ Settings::create(
|
||||
ModifyMaxWorkload modifyMaxWorkload = {0};
|
||||
|
||||
switch (target) {
|
||||
case CAL_TARGET_SUMO:
|
||||
case CAL_TARGET_SUPERSUMO:
|
||||
case CAL_TARGET_WRESTLER:
|
||||
// Treat these like Evergreen parts as far as capabilities go
|
||||
// Fall through ...
|
||||
case CAL_TARGET_DEVASTATOR:
|
||||
case CAL_TARGET_SCRAPPER:
|
||||
apuSystem_ = true;
|
||||
reportFMAF_ = false;
|
||||
// For the system that has APU and Win 8, the work load needs to be smaller
|
||||
// This is because KMD doesn't have workaround for TDR in Win 8
|
||||
// This is needed only for EG/NI because EG/NI is using graphics ring
|
||||
modifyMaxWorkload.time = 500; // 50ms
|
||||
modifyMaxWorkload.minorVersion = 2; // Win 8
|
||||
|
||||
// Add the caps for Trinity here ...
|
||||
// Fall through ...
|
||||
case CAL_TARGET_CAYMAN:
|
||||
// Add the caps for Cayman here ...
|
||||
case CAL_TARGET_KAUAI:
|
||||
case CAL_TARGET_BARTS:
|
||||
case CAL_TARGET_TURKS:
|
||||
case CAL_TARGET_CAICOS:
|
||||
// Treat these like Evergreen parts as far as capabilities go
|
||||
// Fall through ...
|
||||
case CAL_TARGET_CYPRESS:
|
||||
case CAL_TARGET_JUNIPER:
|
||||
case CAL_TARGET_REDWOOD:
|
||||
case CAL_TARGET_CEDAR:
|
||||
// UAV arena is a pre-SI specific HW feature
|
||||
useAliases_ = true;
|
||||
|
||||
if (CAL_TARGET_CEDAR == target) {
|
||||
// Workaround for SC spill bugs.
|
||||
maxWorkGroupSize_ = 128;
|
||||
}
|
||||
// Get the link library
|
||||
libSelector_ = amd::GPU_Library_Evergreen;
|
||||
|
||||
// Max alloc size
|
||||
maxAllocSize_ = 512 * Mi;
|
||||
|
||||
if ((target == CAL_TARGET_CAYMAN) ||
|
||||
(target == CAL_TARGET_DEVASTATOR) ||
|
||||
(target == CAL_TARGET_SCRAPPER)) {
|
||||
rectLinearDMA_ = true;
|
||||
}
|
||||
|
||||
// Disable KHR_FP64 for Trinity in the mainline
|
||||
if ((target == CAL_TARGET_DEVASTATOR) ||
|
||||
(target == CAL_TARGET_SCRAPPER)) {
|
||||
doublePrecision_ &= !IS_MAINLINE || !flagIsDefault(CL_KHR_FP64);
|
||||
}
|
||||
|
||||
if (target == CAL_TARGET_CYPRESS) {
|
||||
// Float FMA is slower than "multiply + add" because we combine
|
||||
// "multiply + add" into mad. MAD is 25% faster than FMA on Cypress,
|
||||
// assuming perfect VLIW packing.
|
||||
reportFMAF_ = false;
|
||||
}
|
||||
enableExtension(ClAmdImage2dFromBufferReadOnly);
|
||||
break;
|
||||
case CAL_TARGET_GREENLAND:
|
||||
//TODO: specific codes for AI
|
||||
aiPlus_ = true;
|
||||
@@ -288,7 +221,6 @@ Settings::create(
|
||||
}
|
||||
// Fall through ...
|
||||
case CAL_TARGET_TAHITI:
|
||||
siPlus_ = true;
|
||||
// Cache line size is 64 bytes
|
||||
cacheLineSize_ = 64;
|
||||
// L1 cache size is 16KB
|
||||
@@ -352,11 +284,6 @@ Settings::create(
|
||||
enableExtension(ClKhrInt64ExtendedAtomics);
|
||||
}
|
||||
enableExtension(ClKhrImage2dFromBuffer);
|
||||
|
||||
rectLinearDMA_ = true;
|
||||
|
||||
// Disable non-aliased(multiUAV) optimization
|
||||
assumeAliases_ = true;
|
||||
break;
|
||||
default:
|
||||
assert(0 && "Unknown ASIC type!");
|
||||
@@ -543,9 +470,6 @@ Settings::override()
|
||||
numComputeRings_ = GPU_NUM_COMPUTE_RINGS;
|
||||
}
|
||||
|
||||
if (!flagIsDefault(GPU_ASSUME_ALIASES)) {
|
||||
assumeAliases_ = GPU_ASSUME_ALIASES;
|
||||
}
|
||||
if (!flagIsDefault(GPU_RESOURCE_CACHE_SIZE)) {
|
||||
resourceCacheSize_ = GPU_RESOURCE_CACHE_SIZE * Mi;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,6 @@ public:
|
||||
uint stagedXferRead_: 1; //!< Uses a staged buffer read
|
||||
uint stagedXferWrite_: 1; //!< Uses a staged buffer write
|
||||
uint disablePersistent_: 1; //!< Disables using persistent memory for staging
|
||||
uint useAliases_: 1; //!< Enables global heap aliases in HW
|
||||
uint imageSupport_: 1; //!< Report images support
|
||||
uint doublePrecision_: 1; //!< Enables double precision support
|
||||
uint reportFMAF_: 1; //!< Report FP_FAST_FMAF define in CL program
|
||||
@@ -57,11 +56,9 @@ public:
|
||||
uint force32BitOcl20_: 1; //!< Force 32bit apps to take CLANG/HSAIL path on GPU
|
||||
uint imageDMA_: 1; //!< Enable direct image DMA transfers
|
||||
uint syncObject_: 1; //!< Enable syncobject
|
||||
uint siPlus_: 1; //!< SI and post SI features
|
||||
uint ciPlus_: 1; //!< CI and post CI features
|
||||
uint viPlus_: 1; //!< VI and post VI features
|
||||
uint aiPlus_: 1; //!< AI and post AI features
|
||||
uint rectLinearDMA_: 1; //!< Rectangular linear DRMDMA support
|
||||
uint threadTraceEnable_: 1; //!< Thread trace enable
|
||||
uint linearPersistentImage_: 1; //!< Allocates linear images in persistent
|
||||
uint useSingleScratch_: 1; //!< Allocates single scratch per device
|
||||
@@ -75,6 +72,7 @@ public:
|
||||
uint hsailDirectSRD_: 1; //!< Controls direct SRD for HSAIL
|
||||
uint useDeviceQueue_: 1; //!< Submit to separate device queue
|
||||
uint singleFpDenorm_: 1; //!< Support Single FP Denorm
|
||||
uint reserved_: 3;
|
||||
};
|
||||
uint value_;
|
||||
};
|
||||
|
||||
@@ -405,7 +405,6 @@ VirtualGPU::VirtualGPU(
|
||||
, vmMems_(NULL)
|
||||
, numVmMems_(0)
|
||||
, dmaFlushMgmt_(device)
|
||||
, numGrpCb_(NULL)
|
||||
, hwRing_(0)
|
||||
, readjustTimeGPU_(0)
|
||||
, currTs_(NULL)
|
||||
@@ -624,7 +623,6 @@ VirtualGPU::~VirtualGPU()
|
||||
for (i = 0; i < constBufs_.size(); ++i) {
|
||||
delete constBufs_[i];
|
||||
}
|
||||
delete numGrpCb_;
|
||||
|
||||
gslDestroy();
|
||||
|
||||
@@ -1789,9 +1787,8 @@ VirtualGPU::submitKernelInternalHSA(
|
||||
// Check if the device allocated more registers than the old setup
|
||||
if (hsaKernel.workGroupInfo()->scratchRegs_ > 0) {
|
||||
const Device::ScratchBuffer* scratchObj = dev().scratch(hwRing());
|
||||
const std::vector<Memory*>& mems = scratchObj->memObjs_;
|
||||
scratch = mems[0]->gslResource();
|
||||
memList.push_back(mems[0]);
|
||||
scratch = scratchObj->memObj_->gslResource();
|
||||
memList.push_back(scratchObj->memObj_);
|
||||
scratchOffset = scratchObj->offset_;
|
||||
}
|
||||
|
||||
@@ -1950,7 +1947,7 @@ VirtualGPU::submitKernelInternalHSA(
|
||||
|
||||
// Fill the scratch buffer information
|
||||
if (hsaKernel.prog().maxScratchRegs() > 0) {
|
||||
gpu::Memory* scratchBuf = dev().scratch(gpuDefQueue->hwRing())->memObjs_[0];
|
||||
gpu::Memory* scratchBuf = dev().scratch(gpuDefQueue->hwRing())->memObj_;
|
||||
param->scratchSize = scratchBuf->size();
|
||||
param->scratch = scratchBuf->vmAddress();
|
||||
param->numMaxWaves = 32 * dev().info().maxComputeUnits_;
|
||||
@@ -2058,23 +2055,7 @@ VirtualGPU::submitKernelInternal(
|
||||
}
|
||||
|
||||
// Find if arguments contain memory aliases or a dependency in the queue
|
||||
if (gpuKernelOpt.processMemObjects(*this, kernel, parameters, nativeMem)) {
|
||||
// Try to obtain a kernel object without optimization
|
||||
noAlias = false;
|
||||
devKernel = const_cast<device::Kernel*>
|
||||
(kernel.getDeviceKernel(dev(), noAlias));
|
||||
if (devKernel == NULL) {
|
||||
// We don't have any, so rebuild kernel
|
||||
if (!kernel.program().buildNoOpt(dev(), gpuKernelOpt.name())) {
|
||||
LogWarning("Kernel recompilation without noAlias failed!");
|
||||
noAlias = true;
|
||||
}
|
||||
|
||||
// Get the GPU kernel object for the final execution
|
||||
devKernel = const_cast<device::Kernel*>
|
||||
(kernel.getDeviceKernel(dev(), noAlias));
|
||||
}
|
||||
}
|
||||
gpuKernelOpt.processMemObjects(*this, kernel, parameters, nativeMem);
|
||||
|
||||
Kernel& gpuKernel = static_cast<gpu::Kernel&>(*devKernel);
|
||||
bool printfEnabled = (gpuKernel.flags() &
|
||||
@@ -2247,19 +2228,12 @@ VirtualGPU::releaseMemory(gslMemObject gslResource, bool wait)
|
||||
}
|
||||
}
|
||||
|
||||
//!@todo optimize unbind
|
||||
if (numGrpCb_ != NULL) {
|
||||
setConstantBuffer(SC_INFO_CONSTANTBUFFER, NULL, 0, 0);
|
||||
}
|
||||
|
||||
if ((dev().scratch(hwRing()) != NULL) &&
|
||||
(dev().scratch(hwRing())->regNum_ > 0)) {
|
||||
// Unbind scratch memory
|
||||
const std::vector<Memory*>& mems = dev().scratch(hwRing())->memObjs_;
|
||||
for (uint i = 0; i < mems.size(); ++i) {
|
||||
if ((mems[i] != NULL) && (mems[i]->gslResource() == gslResource)) {
|
||||
setScratchBuffer(NULL, i);
|
||||
}
|
||||
const Device::ScratchBuffer* scratch = dev().scratch(hwRing());
|
||||
if ((scratch->memObj_ != NULL) && (scratch->memObj_->gslResource() == gslResource)) {
|
||||
setScratchBuffer(NULL, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2812,16 +2786,9 @@ VirtualGPU::releaseMemObjects(bool scratch)
|
||||
cal_.constBuffers_[i] = 0;
|
||||
}
|
||||
}
|
||||
//!@todo optimize unbind
|
||||
if (numGrpCb_ != NULL) {
|
||||
setConstantBuffer(SC_INFO_CONSTANTBUFFER, NULL, 0, 0);
|
||||
}
|
||||
|
||||
if (scratch) {
|
||||
uint numBufs = (dev().settings().siPlus_) ? 1 : dev().info().numberOfShaderEngines;
|
||||
for (uint i = 0; i < numBufs; ++i) {
|
||||
setScratchBuffer(NULL, i);
|
||||
}
|
||||
setScratchBuffer(NULL, 0);
|
||||
}
|
||||
|
||||
gpuEvents_.clear();
|
||||
@@ -2936,11 +2903,8 @@ VirtualGPU::validateScratchBuffer(const Kernel* kernel)
|
||||
{
|
||||
// Check if a scratch buffer is required
|
||||
if (dev().scratch(hwRing())->regNum_ > 0) {
|
||||
const std::vector<Memory*>& mems = dev().scratch(hwRing())->memObjs_;
|
||||
for (uint i = 0; i < mems.size(); ++i) {
|
||||
// Setup scratch buffer
|
||||
setScratchBuffer(mems[i]->gslResource(), i);
|
||||
}
|
||||
// Setup scratch buffer
|
||||
setScratchBuffer(dev().scratch(hwRing())->memObj_->gslResource(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2970,12 +2934,6 @@ VirtualGPU::setActiveKernelDesc(
|
||||
gslKernels_[calImage] = desc;
|
||||
}
|
||||
|
||||
// Update UAV mask if it has a different set of bits
|
||||
if ((activeKernelDesc_ == NULL) ||
|
||||
(activeKernelDesc_->uavMask_.mask[0] != desc->uavMask_.mask[0])) {
|
||||
setUavMask(desc->uavMask_);
|
||||
}
|
||||
|
||||
// Set the descriptor as active
|
||||
activeKernelDesc_ = desc;
|
||||
|
||||
@@ -3007,13 +2965,8 @@ VirtualGPU::allocConstantBuffers()
|
||||
{
|
||||
// Allocate/reallocate constant buffers
|
||||
size_t minCbSize;
|
||||
if (dev().settings().siPlus_) {
|
||||
// GCN doesn't really have a limit
|
||||
minCbSize = 128 * Ki;
|
||||
}
|
||||
else {
|
||||
minCbSize = 64 * Ki;
|
||||
}
|
||||
// GCN doesn't really have a limit
|
||||
minCbSize = 128 * Ki;
|
||||
uint i;
|
||||
|
||||
// Create/reallocate constant buffer resources
|
||||
@@ -3031,16 +2984,6 @@ VirtualGPU::allocConstantBuffers()
|
||||
}
|
||||
}
|
||||
|
||||
// 8xx workaround for num workgroups
|
||||
if (!dev().settings().siPlus_) {
|
||||
numGrpCb_ = new ConstBuffer(*this, ((minCbSize +
|
||||
ConstBuffer::VectorSize - 1) / ConstBuffer::VectorSize));
|
||||
if ((numGrpCb_ == NULL) || !numGrpCb_->create()) {
|
||||
LogError("Could not allocate num groups constant buffer!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3058,7 +3001,7 @@ VirtualGPU::allocKernelDesc(const Kernel* kernel, CALimage calImage)
|
||||
desc->image_ = calImage;
|
||||
}
|
||||
|
||||
if (!moduleLoad(calImage, &desc->func_, &desc->intCb_, &desc->uavMask_)) {
|
||||
if (!moduleLoad(calImage, &desc->func_, &desc->intCb_)) {
|
||||
LogPrintfError("calModuleLoad failed for \"%s\" kernel!",
|
||||
kernel->name().c_str());
|
||||
delete desc;
|
||||
@@ -3376,7 +3319,7 @@ VirtualGPU::buildKernelInfo(const HSAILKernel& hsaKernel,
|
||||
// Initialize structure with default values
|
||||
|
||||
if (hsaKernel.prog().maxScratchRegs() > 0) {
|
||||
gpu::Memory* scratchBuf = dev().scratch(hwRing())->memObjs_[0];
|
||||
gpu::Memory* scratchBuf = dev().scratch(hwRing())->memObj_;
|
||||
kernelInfo.scratchBufAddr = scratchBuf->vmAddress();
|
||||
kernelInfo.scratchBufferSizeInBytes = scratchBuf->size();
|
||||
|
||||
|
||||
@@ -89,16 +89,12 @@ public:
|
||||
|
||||
typedef std::vector<ConstBuffer*> constbufs_t;
|
||||
|
||||
//! \note Legacy pre SI UAV Arena support
|
||||
static const uint UavArena = MaxWriteImage; //!< 0-7 reserved for images
|
||||
|
||||
//! GSL descriptor for the GPU kernel, specific to the virtual device
|
||||
struct GslKernelDesc : public amd::HeapObject
|
||||
{
|
||||
CALimage image_; //!< CAL image for the program
|
||||
gslProgramObject func_; //!< GSL program object
|
||||
gslMemObject intCb_; //!< Internal constant buffer
|
||||
CALUavMask uavMask_; //!< UAV mask, unclear if necessary
|
||||
};
|
||||
|
||||
struct ResourceSlot
|
||||
@@ -311,9 +307,6 @@ public:
|
||||
|
||||
constbufs_t constBufs_; //!< constant buffers
|
||||
|
||||
//! Returns a resource associated with the constant buffer
|
||||
ConstBuffer* numGrpCb() const { return numGrpCb_; }
|
||||
|
||||
//! Start the command profiling
|
||||
void profilingBegin(
|
||||
amd::Command& command, //!< Command queue object
|
||||
@@ -536,7 +529,6 @@ private:
|
||||
typedef std::list<CommandBatch*> CommandBatchList;
|
||||
CommandBatchList cbList_; //!< List of command batches
|
||||
|
||||
ConstBuffer* numGrpCb_; //!< Constant buffer for 8xx workaround
|
||||
uint hwRing_; //!< HW ring used on this virtual device
|
||||
|
||||
uint64_t readjustTimeGPU_; //!< Readjust time between GPU and CPU timestamps
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include "shadertracebuffer/ShaderTraceBufferObject.h"
|
||||
#include "scratchbuffer/ScratchBufferObject.h"
|
||||
#include "memory/MemObject.h"
|
||||
#include "framebuffer/FrameBufferObject.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@@ -24,7 +23,6 @@ CALGSLContext::CALGSLContext()
|
||||
{
|
||||
m_cs = 0;
|
||||
m_rs = 0;
|
||||
m_fb = 0;
|
||||
m_allowDMA = false;
|
||||
|
||||
COMPILE_TIME_ASSERT((int)MAX_OUTPUTS <= (int)GSL_MAX_OUTPUT);
|
||||
@@ -96,18 +94,7 @@ CALGSLContext::open(
|
||||
return false;
|
||||
}
|
||||
|
||||
m_fb = m_cs->createFrameBuffer();
|
||||
if (m_fb == 0)
|
||||
{
|
||||
m_cs->destroyRenderState(m_rs);
|
||||
m_rs = 0;
|
||||
native->deleteContext(m_cs);
|
||||
m_cs = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
m_cs->setRenderState(m_rs);
|
||||
m_rs->setCurrentFrameBufferObject(m_cs, m_fb);
|
||||
m_cs->createSubAllocDesc();
|
||||
|
||||
//
|
||||
@@ -117,16 +104,7 @@ CALGSLContext::open(
|
||||
m_rs->setComputeShader(m_cs, true);
|
||||
|
||||
m_eventQueue[MainEngine].open(m_cs, GSL_SYNC_ATI, EQConfig);
|
||||
if (dev()->uavInCB())
|
||||
{
|
||||
// Evergreen uses physical mode for DRM engine, so flush 3D pipe wih DRM,
|
||||
// thus GSL can get VA ranges back from KMD asap
|
||||
m_eventQueue[SdmaEngine].open(m_cs, GSL_DRMDMA_SYNC_ATI, EQConfig);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_eventQueue[SdmaEngine].open(m_cs, GSL_DRMDMA_SYNC_ATI, EQConfig, GSL_ENGINE_MASK(GSL_ENGINEID_DRMDMA0) | GSL_ENGINE_MASK(GSL_ENGINEID_DRMDMA1));
|
||||
}
|
||||
m_eventQueue[SdmaEngine].open(m_cs, GSL_DRMDMA_SYNC_ATI, EQConfig, GSL_ENGINE_MASK(GSL_ENGINEID_DRMDMA0) | GSL_ENGINE_MASK(GSL_ENGINEID_DRMDMA1));
|
||||
|
||||
m_cs->setGPU((gslGPUMask)dev()->getVPUMask());
|
||||
|
||||
@@ -166,7 +144,6 @@ CALGSLContext::close(gsl::gsAdaptor* native)
|
||||
m_cs->Flush();
|
||||
|
||||
assert(m_rs != 0);
|
||||
assert(m_fb != 0);
|
||||
|
||||
m_cs->setRenderState(m_rs);
|
||||
|
||||
@@ -210,32 +187,19 @@ CALGSLContext::close(gsl::gsAdaptor* native)
|
||||
|
||||
if (m_scratchBuffers != NULL)
|
||||
{
|
||||
if (!dev()->uavInCB())
|
||||
{
|
||||
m_rs->setScratchBufferObject(GSL_FRAGMENT_PROGRAM, 0);
|
||||
m_scratchBuffers->setMemObject(m_cs, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_rs->setScratchBufferObject(GSL_COMPUTE_PROGRAM, 0);
|
||||
for (int i = 0; i < MAX_SHADERENGINES; i++)
|
||||
{
|
||||
m_scratchBuffers->setMemObject(m_cs, 0, i);
|
||||
}
|
||||
}
|
||||
//!@todo it should be GSL_COMPUTE_PROGRAM
|
||||
m_rs->setScratchBufferObject(GSL_FRAGMENT_PROGRAM, 0);
|
||||
m_scratchBuffers->setMemObject(m_cs, 0, 0);
|
||||
m_cs->destroyScratchBuffer(m_scratchBuffers);
|
||||
m_scratchBuffers = 0;
|
||||
}
|
||||
|
||||
m_rs->setCurrentFrameBufferObject(m_cs, 0);
|
||||
m_cs->setRenderState(0);
|
||||
|
||||
m_cs->destroyFrameBuffer(m_fb);
|
||||
m_cs->destroyRenderState(m_rs);
|
||||
m_cs->destroySubAllocDesc();
|
||||
|
||||
m_rs = 0;
|
||||
m_fb = 0;
|
||||
|
||||
for (uint32 i = 0; i < AllEngines; ++i)
|
||||
{
|
||||
@@ -293,65 +257,26 @@ CALGSLContext::setConstantBuffer(uint32 physUnit, gslMemObject mem, uint32 offse
|
||||
bool
|
||||
CALGSLContext::setUAVBuffer(uint32 physUnit, gslMemObject mem, gslUAVType uavType)
|
||||
{
|
||||
if (!dev()->uavInCB()) // SI
|
||||
{
|
||||
assert(physUnit < MAX_UAVS);
|
||||
assert(physUnit < MAX_UAVS);
|
||||
|
||||
if (m_uavResources[physUnit] == 0)
|
||||
{
|
||||
m_uavResources[physUnit] = m_cs->createUAVObject();
|
||||
m_rs->setUavObject(m_cs, GSL_COMPUTE_PROGRAM, m_uavResources[physUnit], GSL_UAV0 + physUnit);
|
||||
}
|
||||
m_uavResources[physUnit]->setMemObject(m_cs, mem, uavType);
|
||||
m_uavResources[physUnit]->setRSOBindings(m_cs, GSL_COMPUTE_PROGRAM);
|
||||
}
|
||||
else
|
||||
if (m_uavResources[physUnit] == 0)
|
||||
{
|
||||
assert(physUnit < MAX_OUTPUTS);
|
||||
m_fb->setColorBufferMemory(m_cs, mem, physUnit, true);
|
||||
m_uavResources[physUnit] = m_cs->createUAVObject();
|
||||
m_rs->setUavObject(m_cs, GSL_COMPUTE_PROGRAM, m_uavResources[physUnit], GSL_UAV0 + physUnit);
|
||||
}
|
||||
m_uavResources[physUnit]->setMemObject(m_cs, mem, uavType);
|
||||
m_uavResources[physUnit]->setRSOBindings(m_cs, GSL_COMPUTE_PROGRAM);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
CALGSLContext::setUavMask(const CALUavMask& uavMask)
|
||||
{
|
||||
// Only do this if UAV in the Color Buffer block
|
||||
if (dev()->uavInCB())
|
||||
{
|
||||
int count = 0;
|
||||
for (int i = 0; i < MAX_OUTPUTS; i++)
|
||||
{
|
||||
m_drawBuffers.buffer[i] = GSL_COLOR_NONE;
|
||||
if (uavMask.mask[0] & (1 << i))
|
||||
{
|
||||
m_drawBuffers.buffer[count] = static_cast<gslColorBuffer>(GSL_COLOR_BUFFER0 + i);
|
||||
++count;
|
||||
}
|
||||
}
|
||||
m_fb->setDrawBuffers(m_cs, m_drawBuffers);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CALGSLContext::setUAVChannelOrder(uint32 physUnit, gslMemObject mem)
|
||||
{
|
||||
if (!dev()->uavInCB()) // SI
|
||||
{
|
||||
assert(physUnit < MAX_UAVS);
|
||||
intp channelOrder = mem->getAttribs().channelOrder;
|
||||
dev()->convertInputChannelOrder(&channelOrder);
|
||||
m_uavResources[physUnit]->setParameter(GSL_UAV_RESOURCE_SWIZZLE, &channelOrder);
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(physUnit < MAX_OUTPUTS);
|
||||
int32 channelOrder[2];
|
||||
channelOrder[0] = mem->getAttribs().channelOrder;
|
||||
channelOrder[1] = physUnit;
|
||||
m_fb->setChannelOrder(m_cs, (const int32*) channelOrder);
|
||||
}
|
||||
assert(physUnit < MAX_UAVS);
|
||||
intp channelOrder = mem->getAttribs().channelOrder;
|
||||
dev()->convertInputChannelOrder(&channelOrder);
|
||||
m_uavResources[physUnit]->setParameter(GSL_UAV_RESOURCE_SWIZZLE, &channelOrder);
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -394,8 +319,8 @@ CALGSLContext::setScratchBuffer(gslMemObject mem, int32 engineId)
|
||||
// independent of program type and number of shader engineers.
|
||||
// For consistency with GSL, We will store the buffer under the
|
||||
// fragment program type for shader engine 0.
|
||||
gslProgramTargetEnum target =
|
||||
(!dev()->uavInCB()) ? GSL_FRAGMENT_PROGRAM : GSL_COMPUTE_PROGRAM;
|
||||
//!@tod should be GSL_COMPUTE_PROGRAM
|
||||
gslProgramTargetEnum target = GSL_FRAGMENT_PROGRAM;
|
||||
gslScratchBufferObject scratchBuff = (mem != NULL) ? m_scratchBuffers : NULL;
|
||||
|
||||
m_rs->setScratchBufferObject(target, m_scratchBuffers);
|
||||
@@ -550,7 +475,7 @@ CALGSLContext::setSamplerParameter(uint32 sampler, gslTexParameterPname param, v
|
||||
|
||||
bool
|
||||
CALGSLContext::moduleLoad(CALimage image,
|
||||
gslProgramObject* func, gslMemObject* constants, CALUavMask* uavMask)
|
||||
gslProgramObject* func, gslMemObject* constants)
|
||||
{
|
||||
AMUabiMultiBinary binary;
|
||||
AMUabiEncoding encoding;
|
||||
@@ -586,8 +511,6 @@ CALGSLContext::moduleLoad(CALimage image,
|
||||
}
|
||||
(*func)->programStringARB(m_cs, GSL_COMPUTE_PROGRAM, GSL_PROGRAM_FORMAT_ELF_BINARY, 0, image);
|
||||
|
||||
amuABIEncodingGetUAVMask(uavMask, encoding);
|
||||
|
||||
// Setup the loop constants from the ELF binary int const area.
|
||||
CALuint numConstants = 0;
|
||||
CALuint maxPhysical = 0;
|
||||
|
||||
@@ -36,7 +36,6 @@ public:
|
||||
bool setOutput(uint32 physUnit, gslMemObject mem);
|
||||
bool setConstantBuffer(uint32 physUnit, gslMemObject mem, CALuint offset, size_t size);
|
||||
bool setUAVBuffer(uint32 physUnit, gslMemObject mem, gslUAVType uavType);
|
||||
void setUavMask(const CALUavMask& uavMask);
|
||||
void setUAVChannelOrder(uint32 physUnit, gslMemObject mem);
|
||||
bool isDone(GpuEvent* event);
|
||||
void waitForEvent(GpuEvent* event);
|
||||
@@ -63,7 +62,7 @@ public:
|
||||
bool recompileShader(CALimage srcImage, CALimage* newImage, const CALuint type);
|
||||
bool getMachineType(CALuint* pMachine, CALuint* pType, CALimage image);
|
||||
|
||||
bool moduleLoad(CALimage image, gslProgramObject* func, gslMemObject* constants, CALUavMask* uavMask);
|
||||
bool moduleLoad(CALimage image, gslProgramObject* func, gslMemObject* constants);
|
||||
|
||||
gsl::gsCtx* cs() const { return m_cs; }
|
||||
gslRenderState rs() const { return m_rs; }
|
||||
@@ -99,7 +98,6 @@ private:
|
||||
gslTextureResourceObject m_textureResources[MAX_RESOURCES];
|
||||
gslSamplerObject m_textureSamplers[MAX_SAMPLERS];
|
||||
gslDrawBuffers m_drawBuffers;
|
||||
gslFramebufferObject m_fb;
|
||||
gslScratchBufferObject m_scratchBuffers;
|
||||
EventQueue m_eventQueue[AllEngines];
|
||||
bool m_allowDMA;
|
||||
|
||||
@@ -406,50 +406,6 @@ CALGSLDevice::SetupContext(int32 &asic_id)
|
||||
|
||||
switch (asic_id)
|
||||
{
|
||||
case GSL_ATIASIC_ID_R870:
|
||||
m_target = CAL_TARGET_CYPRESS;
|
||||
m_elfmachine = ED_ATI_CAL_MACHINE_CYPRESS_ISA;
|
||||
break;
|
||||
case GSL_ATIASIC_ID_R830:
|
||||
m_target = CAL_TARGET_JUNIPER;
|
||||
m_elfmachine = ED_ATI_CAL_MACHINE_JUNIPER_ISA;
|
||||
break;
|
||||
case GSL_ATIASIC_ID_REDWOOD:
|
||||
m_target = CAL_TARGET_REDWOOD;
|
||||
m_elfmachine = ED_ATI_CAL_MACHINE_REDWOOD_ISA;
|
||||
break;
|
||||
case GSL_ATIASIC_ID_CEDAR:
|
||||
m_target = CAL_TARGET_CEDAR;
|
||||
m_elfmachine = ED_ATI_CAL_MACHINE_CEDAR_ISA;
|
||||
break;
|
||||
case GSL_ATIASIC_ID_CAYMAN:
|
||||
m_target = CAL_TARGET_CAYMAN;
|
||||
m_elfmachine = ED_ATI_CAL_MACHINE_CAYMAN_ISA;
|
||||
break;
|
||||
case GSL_ATIASIC_ID_BARTS:
|
||||
m_target = CAL_TARGET_BARTS;
|
||||
m_elfmachine = ED_ATI_CAL_MACHINE_BARTS_ISA;
|
||||
break;
|
||||
case GSL_ATIASIC_ID_TURKS:
|
||||
m_target = CAL_TARGET_TURKS;
|
||||
m_elfmachine = ED_ATI_CAL_MACHINE_TURKS_ISA;
|
||||
break;
|
||||
case GSL_ATIASIC_ID_CAICOS:
|
||||
m_target = CAL_TARGET_CAICOS;
|
||||
m_elfmachine = ED_ATI_CAL_MACHINE_CAICOS_ISA;
|
||||
break;
|
||||
case GSL_ATIASIC_ID_SUMO:
|
||||
m_target = CAL_TARGET_SUMO;
|
||||
m_elfmachine = ED_ATI_CAL_MACHINE_SUMO_ISA;
|
||||
break;
|
||||
case GSL_ATIASIC_ID_SUPERSUMO:
|
||||
m_target = CAL_TARGET_SUPERSUMO;
|
||||
m_elfmachine = ED_ATI_CAL_MACHINE_SUPERSUMO_ISA;
|
||||
break;
|
||||
case GSL_ATIASIC_ID_WRESTLER:
|
||||
m_target = CAL_TARGET_WRESTLER;
|
||||
m_elfmachine = ED_ATI_CAL_MACHINE_WRESTLER_ISA;
|
||||
break;
|
||||
case GSL_ATIASIC_ID_TAHITI_P:
|
||||
m_target = CAL_TARGET_TAHITI;
|
||||
m_elfmachine = ED_ATI_CAL_MACHINE_TAHITI_ISA;
|
||||
@@ -462,14 +418,6 @@ CALGSLDevice::SetupContext(int32 &asic_id)
|
||||
m_target = CAL_TARGET_CAPEVERDE;
|
||||
m_elfmachine = ED_ATI_CAL_MACHINE_CAPEVERDE_ISA;
|
||||
break;
|
||||
case GSL_ATIASIC_ID_DEVASTATOR:
|
||||
m_target = CAL_TARGET_DEVASTATOR;
|
||||
m_elfmachine = ED_ATI_CAL_MACHINE_DEVASTATOR_ISA;
|
||||
break;
|
||||
case GSL_ATIASIC_ID_SCRAPPER:
|
||||
m_target = CAL_TARGET_SCRAPPER;
|
||||
m_elfmachine = ED_ATI_CAL_MACHINE_SCRAPPER_ISA;
|
||||
break;
|
||||
case GSL_ATIASIC_ID_OLAND_M:
|
||||
m_target = CAL_TARGET_OLAND;
|
||||
m_elfmachine = ED_ATI_CAL_MACHINE_OLAND_ISA;
|
||||
@@ -623,7 +571,6 @@ CALGSLDevice::PerformFullInitialization_int()
|
||||
|
||||
m_PerformLazyDeviceInit = false;
|
||||
|
||||
m_uavInCB = m_cs->getIsUAVInCB();
|
||||
m_textureResource = m_cs->createTextureResource();
|
||||
m_textureSampler = m_cs->createSampler();
|
||||
}
|
||||
@@ -1537,17 +1484,10 @@ CALGSLDevice::calcScratchBufferSize(uint32 regNum) const
|
||||
memset(scratchBufferSizes, 0, sizeof(scratchBufferSizes));
|
||||
uint32 enabledShadersFlag = 0;
|
||||
|
||||
if (!uavInCB())
|
||||
{
|
||||
enabledShadersFlag |= CM_FRAGMENT_SHADER_BIT;
|
||||
scratchSpacePerShaderStage.scratchSpace[CM_FRAGMENT_SHADER] = regNum;
|
||||
target = GSL_FRAGMENT_PROGRAM;
|
||||
}
|
||||
else
|
||||
{
|
||||
enabledShadersFlag |= CM_COMPUTE_SHADER_BIT;
|
||||
scratchSpacePerShaderStage.scratchSpace[CM_COMPUTE_SHADER] = regNum;
|
||||
}
|
||||
//!@todo should be CM_COMPUTE_SHADER
|
||||
enabledShadersFlag |= CM_FRAGMENT_SHADER_BIT;
|
||||
scratchSpacePerShaderStage.scratchSpace[CM_FRAGMENT_SHADER] = regNum;
|
||||
target = GSL_FRAGMENT_PROGRAM;
|
||||
|
||||
m_cs->CalcAllScratchBufferSizes(enabledShadersFlag, scratchSpacePerShaderStage,
|
||||
scratchBufferSizes);
|
||||
|
||||
@@ -100,7 +100,6 @@ public:
|
||||
bool isVmMode() const { return m_vmMode; };
|
||||
|
||||
uint32 getVPUMask() const { return m_vpuMask; }
|
||||
bool uavInCB() const { return m_uavInCB; }
|
||||
bool canDMA() const { return m_canDMA; }
|
||||
gslMemObject m_srcDRMDMAMem, m_dstDRMDMAMem; // memory object of flush buffer, used for DRMDMA flush
|
||||
|
||||
@@ -213,7 +212,6 @@ private:
|
||||
uint m_usePerVPUAdapterModel : 1;
|
||||
uint m_PerformLazyDeviceInit : 1;
|
||||
uint m_vmMode : 1;
|
||||
uint m_uavInCB : 1;
|
||||
uint m_isComputeRingIDForced : 1;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -467,7 +467,7 @@ Program::build(
|
||||
devProgram = getDeviceProgram(**it);
|
||||
}
|
||||
|
||||
parsedOptions.oVariables->AssumeAlias = (*it)->settings().assumeAliases_;
|
||||
parsedOptions.oVariables->AssumeAlias = true;
|
||||
|
||||
// We only build a Device-Program once
|
||||
if (devProgram->buildStatus() != CL_BUILD_NONE) {
|
||||
|
||||
@@ -140,8 +140,6 @@ release(bool, DRMDMA_FOR_LNX_CF, false, \
|
||||
"Enable DRMDMA for Linux CrossFire") \
|
||||
release(bool, GPU_HSAIL_ENABLE, false, \
|
||||
"Enable HSAIL on dGPU stack (requires CI+ HW)") \
|
||||
release(bool, GPU_ASSUME_ALIASES, false, \
|
||||
"Assume memory aliases in the compilation process") \
|
||||
release(uint, GPU_PRINT_CHILD_KERNEL, 0, \
|
||||
"Prints the specified number of the child kernels") \
|
||||
release(bool, GPU_DIRECT_SRD, false, \
|
||||
|
||||
Reference in New Issue
Block a user