Check Isa placement for every root device

Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2021-06-21 10:45:19 +00:00
committed by Compute-Runtime-Automation
parent 3c1288de09
commit 48feca4f44
4 changed files with 16 additions and 7 deletions

View File

@@ -41,9 +41,13 @@ MemoryManager::MemoryManager(ExecutionEnvironment &executionEnvironment) : execu
multiContextResourceDestructor(std::make_unique<DeferredDeleter>()) {
bool anyLocalMemorySupported = false;
const auto rootEnvCount = executionEnvironment.rootDeviceEnvironments.size();
defaultEngineIndex.resize(executionEnvironment.rootDeviceEnvironments.size());
for (uint32_t rootDeviceIndex = 0; rootDeviceIndex < executionEnvironment.rootDeviceEnvironments.size(); ++rootDeviceIndex) {
defaultEngineIndex.resize(rootEnvCount);
checkIsaPlacementOnceFlags = std::make_unique<std::once_flag[]>(rootEnvCount);
isaInLocalMemory.resize(rootEnvCount);
for (uint32_t rootDeviceIndex = 0; rootDeviceIndex < rootEnvCount; ++rootDeviceIndex) {
auto hwInfo = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo();
localMemoryUsageBankSelector.emplace_back(new LocalMemoryUsageBankSelector(HwHelper::getSubDevicesCount(hwInfo)));
this->localMemorySupported.push_back(HwHelper::get(hwInfo->platform.eRenderCoreFamily).getEnableLocalMemory(*hwInfo));
@@ -785,14 +789,14 @@ bool MemoryManager::isAllocationTypeToCapture(GraphicsAllocation::AllocationType
}
bool MemoryManager::isLocalMemoryUsedForIsa(uint32_t rootDeviceIndex) {
std::call_once(checkIsaPlacementOnce, [&] {
std::call_once(checkIsaPlacementOnceFlags[rootDeviceIndex], [&] {
AllocationProperties properties = {rootDeviceIndex, 0x1000, GraphicsAllocation::AllocationType::KERNEL_ISA, 1};
AllocationData data;
getAllocationData(data, properties, nullptr, StorageInfo());
isaInLocalMemory = !data.flags.useSystemMemory;
isaInLocalMemory[rootDeviceIndex] = !data.flags.useSystemMemory;
});
return isaInLocalMemory;
return isaInLocalMemory[rootDeviceIndex];
}
bool MemoryTransferHelper::transferMemoryToAllocation(bool useBlitter, const Device &device, GraphicsAllocation *dstAllocation, size_t dstOffset, const void *srcMemory, size_t srcSize) {

View File

@@ -265,8 +265,8 @@ class MemoryManager {
OSMemory::ReservedCpuAddressRange reservedCpuAddressRange;
HeapAssigner heapAssigner;
AlignmentSelector alignmentSelector = {};
std::once_flag checkIsaPlacementOnce;
bool isaInLocalMemory = false;
std::unique_ptr<std::once_flag[]> checkIsaPlacementOnceFlags;
std::vector<bool> isaInLocalMemory;
};
std::unique_ptr<DeferredDeleter> createDeferredDeleter();