mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-29 09:03:14 +08:00
Create work partition allocation
Related-To: NEO-5546 Resolves: NEO-5561 Signed-off-by: Maciej Dziuban <maciej.dziuban@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
1844875b9d
commit
f7d105f2e2
@@ -48,6 +48,10 @@ CommandStreamReceiver::CommandStreamReceiver(ExecutionEnvironment &executionEnvi
|
||||
indirectHeap[i] = nullptr;
|
||||
}
|
||||
internalAllocationStorage = std::make_unique<InternalAllocationStorage>(*this);
|
||||
|
||||
if (DebugManager.flags.EnableStaticPartitioning.get() == 1) {
|
||||
this->staticWorkPartitioningEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
CommandStreamReceiver::~CommandStreamReceiver() {
|
||||
@@ -226,6 +230,11 @@ void CommandStreamReceiver::cleanupResources() {
|
||||
getMemoryManager()->freeGraphicsMemory(clearColorAllocation);
|
||||
clearColorAllocation = nullptr;
|
||||
}
|
||||
|
||||
if (workPartitionAllocation) {
|
||||
getMemoryManager()->freeGraphicsMemory(workPartitionAllocation);
|
||||
workPartitionAllocation = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool CommandStreamReceiver::waitForCompletionWithTimeout(bool enableTimeout, int64_t timeoutMicroseconds, uint32_t taskCountToWait) {
|
||||
@@ -474,6 +483,37 @@ bool CommandStreamReceiver::initializeTagAllocation() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CommandStreamReceiver::createWorkPartitionAllocation(const Device &device) {
|
||||
if (!staticWorkPartitioningEnabled) {
|
||||
return false;
|
||||
}
|
||||
UNRECOVERABLE_IF(device.getNumAvailableDevices() < 2);
|
||||
|
||||
AllocationProperties properties{this->rootDeviceIndex, true, 4096u, GraphicsAllocation::AllocationType::WORK_PARTITION_SURFACE, true, false, deviceBitfield};
|
||||
this->workPartitionAllocation = getMemoryManager()->allocateGraphicsMemoryWithProperties(properties);
|
||||
if (this->workPartitionAllocation == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (uint32_t deviceIndex = 0; deviceIndex < deviceBitfield.size(); deviceIndex++) {
|
||||
if (!deviceBitfield.test(deviceIndex)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const uint32_t copySrc = deviceIndex;
|
||||
const Vec3<size_t> copySrcSize = {sizeof(copySrc), 1, 1};
|
||||
DeviceBitfield copyBitfield{};
|
||||
copyBitfield.set(deviceIndex);
|
||||
BlitOperationResult blitResult = BlitHelper::blitMemoryToAllocationBanks(device, workPartitionAllocation, 0, ©Src, copySrcSize, copyBitfield);
|
||||
|
||||
if (blitResult != BlitOperationResult::Success) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CommandStreamReceiver::createGlobalFenceAllocation() {
|
||||
auto hwInfo = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo();
|
||||
if (!HwHelper::get(hwInfo->platform.eRenderCoreFamily).isFenceAllocationRequired(*hwInfo)) {
|
||||
|
||||
@@ -142,6 +142,7 @@ class CommandStreamReceiver {
|
||||
GraphicsAllocation *allocateDebugSurface(size_t size);
|
||||
GraphicsAllocation *getPreemptionAllocation() const { return preemptionAllocation; }
|
||||
GraphicsAllocation *getGlobalFenceAllocation() const { return globalFenceAllocation; }
|
||||
GraphicsAllocation *getWorkPartitionAllocation() const { return workPartitionAllocation; }
|
||||
|
||||
void requestStallingPipeControlOnNextFlush() { stallingPipeControlOnNextFlushRequired = true; }
|
||||
bool isStallingPipeControlOnNextFlushRequired() const { return stallingPipeControlOnNextFlushRequired; }
|
||||
@@ -168,6 +169,7 @@ class CommandStreamReceiver {
|
||||
void setExperimentalCmdBuffer(std::unique_ptr<ExperimentalCommandBuffer> &&cmdBuffer);
|
||||
|
||||
bool initializeTagAllocation();
|
||||
MOCKABLE_VIRTUAL bool createWorkPartitionAllocation(const Device &device);
|
||||
MOCKABLE_VIRTUAL bool createGlobalFenceAllocation();
|
||||
MOCKABLE_VIRTUAL bool createPreemptionAllocation();
|
||||
MOCKABLE_VIRTUAL bool createPerDssBackedBuffer(Device &device);
|
||||
@@ -273,6 +275,7 @@ class CommandStreamReceiver {
|
||||
GraphicsAllocation *debugSurface = nullptr;
|
||||
GraphicsAllocation *perDssBackedBuffer = nullptr;
|
||||
GraphicsAllocation *clearColorAllocation = nullptr;
|
||||
GraphicsAllocation *workPartitionAllocation = nullptr;
|
||||
|
||||
IndirectHeap *indirectHeap[IndirectHeap::NUM_TYPES];
|
||||
OsContext *osContext = nullptr;
|
||||
@@ -318,6 +321,7 @@ class CommandStreamReceiver {
|
||||
bool lastVmeSubslicesConfig = false;
|
||||
bool stallingPipeControlOnNextFlushRequired = false;
|
||||
bool timestampPacketWriteEnabled = false;
|
||||
bool staticWorkPartitioningEnabled = false;
|
||||
bool nTo1SubmissionModelEnabled = false;
|
||||
bool lastSpecialPipelineSelectMode = false;
|
||||
bool requiresInstructionCacheFlush = false;
|
||||
|
||||
Reference in New Issue
Block a user