Add helpers to avoid offsetof usage

Change-Id: I8f0ec5240b2ec2bd99b712271d87b88ffed2c5b3
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2020-05-19 16:20:41 +02:00
committed by sys_ocldev
parent 74649d3f40
commit e36d95e039
8 changed files with 45 additions and 27 deletions

View File

@@ -486,8 +486,7 @@ BlitProperties CommandQueueHw<GfxFamily>::processDispatchForBlitEnqueue(const Mu
blitProperties.outputTimestampPacket = currentTimestampPacketNode;
if (isCacheFlushForBcsRequired()) {
auto cacheFlushTimestampPacketGpuAddress = timestampPacketDependencies.cacheFlushNodes.peekNodes()[0]->getGpuAddress() +
offsetof(TimestampPacketStorage, packets[0].contextEnd);
auto cacheFlushTimestampPacketGpuAddress = TimestampPacketHelper::getContextEndGpuAddress(*timestampPacketDependencies.cacheFlushNodes.peekNodes()[0]);
PipeControlArgs args(true);
MemorySynchronizationCommands<GfxFamily>::addPipeControlAndProgramPostSyncOperation(
commandStream,
@@ -553,7 +552,7 @@ void CommandQueueHw<GfxFamily>::processDispatchForCacheFlush(Surface **surfaces,
uint64_t postSyncAddress = 0;
if (getGpgpuCommandStreamReceiver().peekTimestampPacketWriteEnabled()) {
auto timestampPacketNodeForPostSync = timestampPacketContainer->peekNodes().at(0);
postSyncAddress = timestampPacketNodeForPostSync->getGpuAddress() + offsetof(TimestampPacketStorage, packets[0].contextEnd);
postSyncAddress = TimestampPacketHelper::getContextEndGpuAddress(*timestampPacketNodeForPostSync);
}
submitCacheFlush(surfaces, numSurfaces, commandStream, postSyncAddress);

View File

@@ -187,7 +187,7 @@ void GpgpuWalkerHelper<GfxFamily>::setupTimestampPacket(
const RootDeviceEnvironment &rootDeviceEnvironment) {
if (TimestampPacketStorage::WriteOperationType::AfterWalker == writeOperationType) {
uint64_t address = timestampPacketNode->getGpuAddress() + offsetof(TimestampPacketStorage, packets[0].contextEnd);
uint64_t address = TimestampPacketHelper::getContextEndGpuAddress(*timestampPacketNode);
PipeControlArgs args;
MemorySynchronizationCommands<GfxFamily>::addPipeControlAndProgramPostSyncOperation(
*cmdStream,

View File

@@ -97,7 +97,7 @@ void HardwareInterface<GfxFamily>::dispatchWalker(
uint64_t postSyncAddress = 0;
if (commandQueue.getGpgpuCommandStreamReceiver().peekTimestampPacketWriteEnabled()) {
auto timestampPacketNodeForPostSync = currentTimestampPacketNodes->peekNodes().at(currentDispatchIndex);
postSyncAddress = timestampPacketNodeForPostSync->getGpuAddress() + offsetof(TimestampPacketStorage, packets[0].contextEnd);
postSyncAddress = TimestampPacketHelper::getContextEndGpuAddress(*timestampPacketNodeForPostSync);
}
HardwareCommandsHelper<GfxFamily>::programCacheFlushAfterWalkerCommand(commandStream, commandQueue, mainKernel, postSyncAddress);
}