feature: global bindless surface state base support

- program global bindless ssba when external allocator used (
UseExternalAllocatorForSshAndDsh)

Related-To: NEO-7063

Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2023-06-26 17:49:16 +00:00
committed by Compute-Runtime-Automation
parent 11c96559a9
commit 4aba0f0340
21 changed files with 572 additions and 108 deletions

View File

@@ -2665,13 +2665,16 @@ void CommandListCoreFamily<gfxCoreFamily>::updateStreamPropertiesForRegularComma
if (this->cmdListHeapAddressModel == NEO::HeapAddressModel::PrivateHeaps) {
if (currentSurfaceStateBaseAddress == NEO::StreamProperty64::initValue || commandContainer.isHeapDirty(NEO::IndirectHeap::Type::SURFACE_STATE)) {
auto ssh = commandContainer.getIndirectHeap(NEO::IndirectHeap::Type::SURFACE_STATE);
currentSurfaceStateBaseAddress = ssh->getHeapGpuBase();
currentSurfaceStateSize = ssh->getHeapSizeInPages();
if (ssh) {
currentSurfaceStateBaseAddress = ssh->getHeapGpuBase();
currentSurfaceStateSize = ssh->getHeapSizeInPages();
currentBindingTablePoolBaseAddress = currentSurfaceStateBaseAddress;
currentBindingTablePoolSize = currentSurfaceStateSize;
currentBindingTablePoolBaseAddress = currentSurfaceStateBaseAddress;
currentBindingTablePoolSize = currentSurfaceStateSize;
checkSsh = true;
checkSsh = true;
}
DEBUG_BREAK_IF(ssh == nullptr && commandContainer.isHeapDirty(NEO::IndirectHeap::Type::SURFACE_STATE));
}
if (this->dynamicHeapRequired && (currentDynamicStateBaseAddress == NEO::StreamProperty64::initValue || commandContainer.isHeapDirty(NEO::IndirectHeap::Type::DYNAMIC_STATE))) {

View File

@@ -115,10 +115,13 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(K
auto kernelInfo = kernelImmutableData->getKernelInfo();
auto &sshReserveConfig = commandContainer.getSurfaceStateHeapReserve();
NEO::HeapReserveArguments sshReserveArgs = {
sshReserveConfig.indirectHeapReservation,
NEO::EncodeDispatchKernel<GfxFamily>::getSizeRequiredSsh(*kernelInfo),
NEO::EncodeDispatchKernel<GfxFamily>::getDefaultSshAlignment()};
NEO::HeapReserveArguments sshReserveArgs = {sshReserveConfig.indirectHeapReservation,
NEO::EncodeDispatchKernel<GfxFamily>::getSizeRequiredSsh(*kernelInfo),
NEO::EncodeDispatchKernel<GfxFamily>::getDefaultSshAlignment()};
if (device->getNEODevice()->getBindlessHeapsHelper() && NEO::KernelDescriptor::isBindlessAddressingKernel(kernelImmutableData->getDescriptor())) {
sshReserveArgs.size = 0;
}
NEO::HeapReserveArguments dshReserveArgs = {};
if (this->dynamicHeapRequired) {

View File

@@ -38,18 +38,21 @@ void CommandQueueHw<gfxCoreFamily>::programStateBaseAddress(uint64_t gsba, bool
uint64_t globalHeapsBase = 0;
uint64_t indirectObjectHeapBaseAddress = 0;
uint64_t bindlessSurfStateBase = 0ull;
if (neoDevice->getBindlessHeapsHelper()) {
if (neoDevice->getBindlessHeapsHelper()->isGlobalDshSupported()) {
useGlobalSshAndDsh = true;
globalHeapsBase = neoDevice->getBindlessHeapsHelper()->getGlobalHeapsBase();
} else {
bindlessSurfStateBase = neoDevice->getBindlessHeapsHelper()->getGlobalHeapsBase();
}
}
NEO::StateBaseAddressProperties *sbaProperties = nullptr;
if (streamProperties != nullptr) {
sbaProperties = &streamProperties->stateBaseAddress;
} else {
useGlobalSshAndDsh = NEO::ApiSpecificConfig::getGlobalBindlessHeapConfiguration();
if (useGlobalSshAndDsh) {
globalHeapsBase = neoDevice->getBindlessHeapsHelper()->getGlobalHeapsBase();
}
indirectObjectHeapBaseAddress = neoDevice->getMemoryManager()->getInternalHeapBaseAddress(device->getRootDeviceIndex(), useLocalMemoryForIndirectHeap);
}
uint64_t instructionHeapBaseAddress = neoDevice->getMemoryManager()->getInternalHeapBaseAddress(device->getRootDeviceIndex(), neoDevice->getMemoryManager()->isLocalMemoryUsedForIsa(neoDevice->getRootDeviceIndex()));
@@ -66,6 +69,7 @@ void CommandQueueHw<gfxCoreFamily>::programStateBaseAddress(uint64_t gsba, bool
instructionHeapBaseAddress, // instructionHeapBaseAddress
globalHeapsBase, // globalHeapsBaseAddress
0, // surfaceStateBaseAddress
bindlessSurfStateBase, // bindlessSurfaceStateBaseAddress
&sbaCmd, // stateBaseAddressCmd
sbaProperties, // sbaProperties
nullptr, // dsh

View File

@@ -28,22 +28,33 @@ void CommandQueueHw<gfxCoreFamily>::programStateBaseAddress(uint64_t gsba, bool
uint32_t rootDeviceIndex = neoDevice->getRootDeviceIndex();
auto csr = this->getCsr();
bool multiOsContextCapable = device->isImplicitScalingCapable();
bool isRcs = csr->isRcs();
auto isDebuggerActive = neoDevice->isDebuggerActive() || neoDevice->getDebugger() != nullptr;
bool setGeneralStateBaseAddress = false;
bool useGlobalSshAndDsh = false;
uint64_t globalHeapsBase = 0;
uint64_t indirectObjectStateBaseAddress = 0;
uint64_t instructionStateBaseAddress = neoDevice->getMemoryManager()->getInternalHeapBaseAddress(
rootDeviceIndex, neoDevice->getMemoryManager()->isLocalMemoryUsedForIsa(rootDeviceIndex));
NEO::StateBaseAddressProperties *sbaProperties = nullptr;
auto l1CachePolicyData = csr->getStoredL1CachePolicy();
if (streamProperties != nullptr) {
bool multiOsContextCapable = device->isImplicitScalingCapable();
bool isRcs = csr->isRcs();
auto isDebuggerActive = neoDevice->getDebugger() != nullptr;
bool setGeneralStateBaseAddress = false;
bool useGlobalSshAndDsh = false;
uint64_t globalHeapsBase = 0;
uint64_t indirectObjectStateBaseAddress = 0;
uint64_t instructionStateBaseAddress = neoDevice->getMemoryManager()->getInternalHeapBaseAddress(
rootDeviceIndex, neoDevice->getMemoryManager()->isLocalMemoryUsedForIsa(rootDeviceIndex));
uint64_t bindlessSurfStateBase = 0;
if (device->getNEODevice()->getBindlessHeapsHelper()) {
if (device->getNEODevice()->getBindlessHeapsHelper()->isGlobalDshSupported()) {
useGlobalSshAndDsh = true;
globalHeapsBase = device->getNEODevice()->getBindlessHeapsHelper()->getGlobalHeapsBase();
} else {
bindlessSurfStateBase = device->getNEODevice()->getBindlessHeapsHelper()->getGlobalHeapsBase();
}
}
NEO::StateBaseAddressProperties *sbaProperties = nullptr;
auto l1CachePolicyData = csr->getStoredL1CachePolicy();
sbaProperties = &streamProperties->stateBaseAddress;
auto gmmHelper = neoDevice->getGmmHelper();
@@ -56,6 +67,7 @@ void CommandQueueHw<gfxCoreFamily>::programStateBaseAddress(uint64_t gsba, bool
instructionStateBaseAddress, // instructionHeapBaseAddress
globalHeapsBase, // globalHeapsBaseAddress
0, // surfaceStateBaseAddress
bindlessSurfStateBase, // bindlessSurfaceStateBaseAddress
&sbaCmd, // stateBaseAddressCmd
sbaProperties, // sbaProperties
nullptr, // dsh