fix: use correct gpu address when bindless heaps helper is enabled

Related-To: NEO-7063
Signed-off-by: Fabian Zwoliński <fabian.zwolinski@intel.com>
This commit is contained in:
Fabian Zwoliński
2024-08-05 14:02:25 +00:00
committed by Compute-Runtime-Automation
parent 619b47e3d5
commit 674c4a15ad
19 changed files with 510 additions and 212 deletions

View File

@@ -147,6 +147,7 @@ set(NEO_CORE_HELPERS
${CMAKE_CURRENT_SOURCE_DIR}/state_base_address_base.inl
${CMAKE_CURRENT_SOURCE_DIR}/state_base_address_bdw.inl
${CMAKE_CURRENT_SOURCE_DIR}/state_base_address_bdw_and_later.inl
${CMAKE_CURRENT_SOURCE_DIR}/state_base_address_helper.h
${CMAKE_CURRENT_SOURCE_DIR}/state_base_address_icllp_and_later.inl
${CMAKE_CURRENT_SOURCE_DIR}/state_base_address_skl.inl
${CMAKE_CURRENT_SOURCE_DIR}/stdio.h

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -16,10 +16,17 @@ bool HeapDirtyState::updateAndCheck(const IndirectHeap *heap) {
sizeInPages = 0llu;
return true;
}
bool dirty = gpuBaseAddress != heap->getHeapGpuBase() || sizeInPages != heap->getHeapSizeInPages();
if (dirty) {
gpuBaseAddress = heap->getHeapGpuBase();
sizeInPages = heap->getHeapSizeInPages();
}
return dirty;
return updateAndCheck(heap, heap->getHeapGpuBase(), heap->getHeapSizeInPages());
}
bool HeapDirtyState::updateAndCheck(const IndirectHeap *heap, const uint64_t comparedGpuAddress, const size_t comparedSize) {
bool dirty = gpuBaseAddress != comparedGpuAddress || sizeInPages != comparedSize;
if (dirty) {
gpuBaseAddress = comparedGpuAddress;
sizeInPages = comparedSize;
}
return dirty;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2023 Intel Corporation
* Copyright (C) 2020-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -15,6 +15,8 @@ class IndirectHeap;
class HeapDirtyState {
public:
bool updateAndCheck(const IndirectHeap *heap);
bool updateAndCheck(const IndirectHeap *heap,
const uint64_t comparedGpuAddress, const size_t comparedSize);
protected:
uint64_t gpuBaseAddress = 0llu;

View File

@@ -0,0 +1,46 @@
/*
* Copyright (C) 2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/indirect_heap/indirect_heap.h"
namespace NEO {
inline uint64_t getStateBaseAddress(const IndirectHeap &heap, const bool useGlobalHeaps) {
if (useGlobalHeaps) {
return heap.getGraphicsAllocation()->getGpuBaseAddress();
} else {
return heap.getHeapGpuBase();
}
}
inline size_t getStateSize(const IndirectHeap &heap, const bool useGlobalHeaps) {
if (useGlobalHeaps) {
return MemoryConstants::sizeOf4GBinPageEntities;
} else {
return heap.getHeapSizeInPages();
}
}
inline uint64_t getStateBaseAddress(const IndirectHeap &heap, const bool useGlobalHeaps, const bool isBindlessKernel) {
if (useGlobalHeaps && isBindlessKernel) {
return heap.getGraphicsAllocation()->getGpuBaseAddress();
} else {
return heap.getHeapGpuBase();
}
}
inline size_t getStateSize(const IndirectHeap &heap, const bool useGlobalHeaps, const bool isBindlessKernel) {
if (useGlobalHeaps && isBindlessKernel) {
return MemoryConstants::sizeOf4GBinPageEntities;
} else {
return heap.getHeapSizeInPages();
}
}
} // namespace NEO