P4 to Git Change 1531829 by gandryey@gera-w8 on 2018/03/23 18:34:36
SWDEV-79445 - OCL generic changes and code clean-up - Implement ConstantBuffer management through a single managed buffer. It reduces the amount of allocated buffers on GPU Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palconstbuf.cpp#6 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palconstbuf.hpp#5 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palkernel.cpp#48 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palvirtual.cpp#79 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palvirtual.hpp#44 edit
This commit is contained in:
@@ -702,6 +702,7 @@ VirtualGPU::VirtualGPU(Device& device)
|
||||
printfDbgHSA_(nullptr),
|
||||
tsCache_(nullptr),
|
||||
dmaFlushMgmt_(device),
|
||||
writeBuffer_(nullptr),
|
||||
hwRing_(0),
|
||||
readjustTimeGPU_(0),
|
||||
lastTS_(nullptr),
|
||||
@@ -812,6 +813,13 @@ bool VirtualGPU::create(bool profiling, uint deviceQueueSize, uint rtCUs,
|
||||
Unimplemented();
|
||||
}
|
||||
|
||||
writeBuffer_ = new ManagedBuffer(*this, dev().settings().stagedXferSize_);
|
||||
if ((writeBuffer_ == nullptr) || !writeBuffer_->create(Resource::RemoteUSWC)) {
|
||||
// We failed to create a constant buffer
|
||||
delete writeBuffer_;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Diable double copy optimization,
|
||||
// since UAV read from nonlocal is fast enough
|
||||
blitSetup.disableCopyBufferToImageOpt_ = true;
|
||||
@@ -934,6 +942,8 @@ VirtualGPU::~VirtualGPU() {
|
||||
delete constBufs_[i];
|
||||
}
|
||||
|
||||
delete writeBuffer_;
|
||||
|
||||
//! @todo Temporarily keep the buffer mapped for debug purpose
|
||||
if (nullptr != schedParams_) {
|
||||
schedParams_->unmap(this);
|
||||
@@ -2803,15 +2813,16 @@ void VirtualGPU::waitEventLock(CommandBatch* cb) {
|
||||
}
|
||||
|
||||
bool VirtualGPU::allocConstantBuffers() {
|
||||
// Allocate constant buffers, GCN doesn't really have a limit
|
||||
static constexpr uint32_t MinCbSize = 256 * Ki;
|
||||
// Allocate constant buffers.
|
||||
// Use double size, reported to the app to account for internal arguments
|
||||
const uint32_t MinCbSize = 2 * dev().info().maxParameterSize_;
|
||||
uint i;
|
||||
|
||||
// Create/reallocate constant buffer resources
|
||||
for (i = 0; i < MaxConstBuffersArguments; ++i) {
|
||||
ManagedBuffer* constBuf = new ManagedBuffer(*this, MinCbSize);
|
||||
ConstantBuffer* constBuf = new ConstantBuffer(*writeBuffer_, MinCbSize);
|
||||
|
||||
if ((constBuf != nullptr) && constBuf->create(Resource::RemoteUSWC, true)) {
|
||||
if ((constBuf != nullptr) && constBuf->Create()) {
|
||||
addConstBuffer(constBuf);
|
||||
} else {
|
||||
// We failed to create a constant buffer
|
||||
|
||||
Reference in New Issue
Block a user