mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 17:29:14 +08:00
MaxDualSubSlicesSupported is filled inside GT_SYSTEM_INFO structure when querying the KMD appropriately with the number of enabled DualSubSlices. However we need to find the highest index of the last enabled DualSubSlice. For proper allocation of thread scratch space, allocation has to be done based on native die config (including unfused or non-enabled DualSubSlices). Since HW doesn't provide us a way to know the exact native die config, in SW we need to allocate RT stacks with enough size based on the last used DualSubSlice. The IsDynamicallyPopulated field in GT_SYSTEM_INFO is used to indicate if system details are populated either via Fuse reg. or hard-coded. Based on this field's value, we calcuate the numRtStacks appropriately. Related-To: LOCI-3954 Signed-off-by: Raiyan Latif <raiyan.latif@intel.com>
58 lines
2.1 KiB
C++
58 lines
2.1 KiB
C++
/*
|
|
* Copyright (C) 2018-2023 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "shared/source/device/device.h"
|
|
#include "shared/source/helpers/aligned_memory.h"
|
|
#include "shared/source/helpers/basic_math.h"
|
|
#include "shared/source/helpers/gfx_core_helper.h"
|
|
#include "shared/source/helpers/hw_info.h"
|
|
#include "shared/source/helpers/non_copyable_or_moveable.h"
|
|
|
|
#include "ocl_igc_shared/raytracing/ocl_raytracing_structures.h"
|
|
|
|
#include <cstdint>
|
|
namespace NEO {
|
|
class RayTracingHelper : public NonCopyableOrMovableClass {
|
|
public:
|
|
static constexpr uint32_t stackDssMultiplier = 2048;
|
|
static constexpr uint32_t hitInfoSize = 64;
|
|
static constexpr uint32_t bvhStackSize = 96;
|
|
static constexpr uint32_t memoryBackedFifoSizePerDss = 8 * KB;
|
|
static constexpr uint32_t maxBvhLevels = 8;
|
|
|
|
static size_t getDispatchGlobalSize() {
|
|
return static_cast<size_t>(alignUp(sizeof(RTDispatchGlobals), MemoryConstants::cacheLineSize));
|
|
}
|
|
|
|
static size_t getRTStackSizePerTile(const Device &device, uint32_t tiles, uint32_t maxBvhLevel, uint32_t extraBytesLocal, uint32_t extraBytesGlobal) {
|
|
return static_cast<size_t>(alignUp(getStackSizePerRay(maxBvhLevel, extraBytesLocal) * (getNumRtStacks(device)) + extraBytesGlobal, MemoryConstants::cacheLineSize));
|
|
}
|
|
|
|
static size_t getTotalMemoryBackedFifoSize(const Device &device) {
|
|
return static_cast<size_t>(NEO::GfxCoreHelper::getHighestEnabledDualSubSlice(device.getHardwareInfo())) * memoryBackedFifoSizePerDss;
|
|
}
|
|
|
|
static size_t getMemoryBackedFifoSizeToPatch() {
|
|
return static_cast<size_t>(Math::log2(memoryBackedFifoSizePerDss / KB) - 1);
|
|
}
|
|
|
|
static uint32_t getNumRtStacks(const Device &device) {
|
|
return NEO::GfxCoreHelper::getHighestEnabledDualSubSlice(device.getHardwareInfo()) * stackDssMultiplier;
|
|
}
|
|
|
|
static uint32_t getNumRtStacksPerDss(const Device &device) {
|
|
return stackDssMultiplier;
|
|
}
|
|
|
|
static uint32_t getStackSizePerRay(uint32_t maxBvhLevel, uint32_t extraBytesLocal) {
|
|
return hitInfoSize + bvhStackSize * maxBvhLevel + extraBytesLocal;
|
|
}
|
|
};
|
|
} // namespace NEO
|