Skip to content

Commit 6c38b36

Browse files
Unify getting state base address command space from command buffer
Related-To: NEO-5019 Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
1 parent d795182 commit 6c38b36

File tree

8 files changed

+12
-12
lines changed

8 files changed

+12
-12
lines changed

level_zero/core/source/cmdqueue/cmdqueue_hw_base.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void CommandQueueHw<gfxCoreFamily>::programStateBaseAddress(uint64_t gsba, bool
4040
NEO::EncodeWA<GfxFamily>::addPipeControlBeforeStateBaseAddress(commandStream, hwInfo, isRcs);
4141
NEO::EncodeWA<GfxFamily>::encodeAdditionalPipelineSelect(commandStream, {}, true, hwInfo, isRcs);
4242

43-
auto sbaCmdBuf = static_cast<STATE_BASE_ADDRESS *>(NEO::StateBaseAddressHelper<GfxFamily>::getSpaceForSbaCmd(commandStream));
43+
auto sbaCmdBuf = NEO::StateBaseAddressHelper<GfxFamily>::getSpaceForSbaCmd(commandStream);
4444
STATE_BASE_ADDRESS sbaCmd;
4545

4646
bool useGlobalSshAndDsh = NEO::ApiSpecificConfig::getBindlessConfiguration();

level_zero/core/source/cmdqueue/cmdqueue_xe_hp_core_and_later.inl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void CommandQueueHw<gfxCoreFamily>::programStateBaseAddress(uint64_t gsba, bool
4040
bool isRcs = this->getCsr()->isRcs();
4141

4242
NEO::EncodeWA<GfxFamily>::addPipeControlBeforeStateBaseAddress(commandStream, hwInfo, isRcs);
43-
auto sbaCmdBuf = static_cast<STATE_BASE_ADDRESS *>(NEO::StateBaseAddressHelper<GfxFamily>::getSpaceForSbaCmd(commandStream));
43+
auto sbaCmdBuf = NEO::StateBaseAddressHelper<GfxFamily>::getSpaceForSbaCmd(commandStream);
4444

4545
STATE_BASE_ADDRESS sbaCmd;
4646
NEO::StateBaseAddressHelperArgs<GfxFamily> args = {
@@ -68,7 +68,7 @@ void CommandQueueHw<gfxCoreFamily>::programStateBaseAddress(uint64_t gsba, bool
6868

6969
auto &hwInfoConfig = *NEO::HwInfoConfig::get(hwInfo.platform.eProductFamily);
7070
if (hwInfoConfig.isAdditionalStateBaseAddressWARequired(hwInfo)) {
71-
sbaCmdBuf = static_cast<STATE_BASE_ADDRESS *>(commandStream.getSpace(sizeof(STATE_BASE_ADDRESS)));
71+
sbaCmdBuf = NEO::StateBaseAddressHelper<GfxFamily>::getSpaceForSbaCmd(commandStream);
7272
*sbaCmdBuf = sbaCmd;
7373
}
7474

shared/source/command_container/command_encoder_bdw_and_later.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ void EncodeStateBaseAddress<Family>::encode(CommandContainer &container, STATE_B
393393

394394
StateBaseAddressHelper<Family>::programStateBaseAddress(args);
395395

396-
auto cmdSpace = reinterpret_cast<STATE_BASE_ADDRESS *>(container.getCommandStream()->getSpace(sizeof(STATE_BASE_ADDRESS)));
396+
auto cmdSpace = StateBaseAddressHelper<Family>::getSpaceForSbaCmd(*container.getCommandStream());
397397
*cmdSpace = sbaCmd;
398398

399399
EncodeWA<Family>::encodeAdditionalPipelineSelect(*container.getCommandStream(), {}, false, hwInfo, isRcs);

shared/source/command_container/command_encoder_xehp_and_later.inl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,13 +500,13 @@ void EncodeStateBaseAddress<Family>::encode(CommandContainer &container, STATE_B
500500

501501
StateBaseAddressHelper<Family>::programStateBaseAddress(args);
502502

503-
auto cmdSpace = reinterpret_cast<STATE_BASE_ADDRESS *>(container.getCommandStream()->getSpace(sizeof(STATE_BASE_ADDRESS)));
503+
auto cmdSpace = StateBaseAddressHelper<Family>::getSpaceForSbaCmd(*container.getCommandStream());
504504
*cmdSpace = sbaCmd;
505505

506506
auto &hwInfo = container.getDevice()->getHardwareInfo();
507507
auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
508508
if (hwInfoConfig.isAdditionalStateBaseAddressWARequired(hwInfo)) {
509-
cmdSpace = reinterpret_cast<STATE_BASE_ADDRESS *>(container.getCommandStream()->getSpace(sizeof(STATE_BASE_ADDRESS)));
509+
cmdSpace = StateBaseAddressHelper<Family>::getSpaceForSbaCmd(*container.getCommandStream());
510510
*cmdSpace = sbaCmd;
511511
}
512512

shared/source/command_stream/command_stream_receiver_hw_base.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
403403
}
404404

405405
auto stateBaseAddressCmdOffset = commandStreamCSR.getUsed();
406-
auto stateBaseAddressCmdBuffer = static_cast<STATE_BASE_ADDRESS *>(StateBaseAddressHelper<GfxFamily>::getSpaceForSbaCmd(commandStreamCSR));
406+
auto stateBaseAddressCmdBuffer = StateBaseAddressHelper<GfxFamily>::getSpaceForSbaCmd(commandStreamCSR);
407407
auto instructionHeapBaseAddress = getMemoryManager()->getInternalHeapBaseAddress(rootDeviceIndex, getMemoryManager()->isLocalMemoryUsedForIsa(rootDeviceIndex));
408408
uint64_t indirectObjectStateBaseAddress = getMemoryManager()->getInternalHeapBaseAddress(rootDeviceIndex, ioh->getGraphicsAllocation()->isAllocatedInLocalMemoryPool());
409409

shared/source/helpers/state_base_address.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ template <typename GfxFamily>
4949
struct StateBaseAddressHelper {
5050
using STATE_BASE_ADDRESS = typename GfxFamily::STATE_BASE_ADDRESS;
5151

52-
static void *getSpaceForSbaCmd(LinearStream &cmdStream);
52+
static STATE_BASE_ADDRESS *getSpaceForSbaCmd(LinearStream &cmdStream);
5353

5454
static void programStateBaseAddress(StateBaseAddressHelperArgs<GfxFamily> &args);
5555

shared/source/helpers/state_base_address_base.inl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ void StateBaseAddressHelper<GfxFamily>::programStateBaseAddress(
8585
}
8686

8787
template <typename GfxFamily>
88-
void *StateBaseAddressHelper<GfxFamily>::getSpaceForSbaCmd(LinearStream &cmdStream) {
89-
return cmdStream.getSpace(sizeof(STATE_BASE_ADDRESS));
88+
typename GfxFamily::STATE_BASE_ADDRESS *StateBaseAddressHelper<GfxFamily>::getSpaceForSbaCmd(LinearStream &cmdStream) {
89+
return cmdStream.getSpaceForCmd<typename GfxFamily::STATE_BASE_ADDRESS>();
9090
}
9191

9292
template <typename GfxFamily>

shared/source/xe_hpg_core/command_stream_receiver_hw_xe_hpg_core.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ void CommandStreamReceiverHw<Family>::programAdditionalStateBaseAddress(LinearSt
4848
auto &hwInfo = *device.getRootDeviceEnvironment().getHardwareInfo();
4949
auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
5050
if (hwInfoConfig.isAdditionalStateBaseAddressWARequired(hwInfo)) {
51-
auto pCmd = static_cast<STATE_BASE_ADDRESS *>(csr.getSpace(sizeof(STATE_BASE_ADDRESS)));
52-
*pCmd = cmd;
51+
auto cmdSpace = StateBaseAddressHelper<Family>::getSpaceForSbaCmd(csr);
52+
*cmdSpace = cmd;
5353
}
5454
}
5555

0 commit comments

Comments
 (0)