mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-25 21:42:53 +08:00
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:
committed by
Compute-Runtime-Automation
parent
619b47e3d5
commit
674c4a15ad
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
46
shared/source/helpers/state_base_address_helper.h
Normal file
46
shared/source/helpers/state_base_address_helper.h
Normal 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
|
||||
Reference in New Issue
Block a user