Refactor: pass rootDeviceEnvironment to dispatchProfilingCommands

Related-To: NEO-6853
Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
Kamil Kopryk
2022-12-22 13:19:10 +00:00
committed by Compute-Runtime-Automation
parent 7d0ef38a83
commit 47b6801b0b
6 changed files with 20 additions and 16 deletions

View File

@ -52,12 +52,12 @@ class GpgpuWalkerHelper {
static void dispatchProfilingCommandsStart(
TagNodeBase &hwTimeStamps,
LinearStream *commandStream,
const HardwareInfo &hwInfo);
const RootDeviceEnvironment &rootDeviceEnvironment);
static void dispatchProfilingCommandsEnd(
TagNodeBase &hwTimeStamps,
LinearStream *commandStream,
const HardwareInfo &hwInfo);
const RootDeviceEnvironment &rootDeviceEnvironment);
static void dispatchPerfCountersCommandsStart(
CommandQueue &commandQueue,

View File

@ -106,12 +106,13 @@ template <typename GfxFamily>
void GpgpuWalkerHelper<GfxFamily>::dispatchProfilingCommandsStart(
TagNodeBase &hwTimeStamps,
LinearStream *commandStream,
const HardwareInfo &hwInfo) {
const RootDeviceEnvironment &rootDeviceEnvironment) {
using MI_STORE_REGISTER_MEM = typename GfxFamily::MI_STORE_REGISTER_MEM;
// PIPE_CONTROL for global timestamp
uint64_t timeStampAddress = hwTimeStamps.getGpuAddress() + offsetof(HwTimeStamps, GlobalStartTS);
PipeControlArgs args;
const auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo();
MemorySynchronizationCommands<GfxFamily>::addBarrierWithPostSyncOperation(
*commandStream,
PostSyncMode::Timestamp,
@ -120,7 +121,8 @@ void GpgpuWalkerHelper<GfxFamily>::dispatchProfilingCommandsStart(
hwInfo,
args);
if (!GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily).useOnlyGlobalTimestamps()) {
auto &gfxCoreHelper = rootDeviceEnvironment.getHelper<GfxCoreHelper>();
if (!gfxCoreHelper.useOnlyGlobalTimestamps()) {
// MI_STORE_REGISTER_MEM for context local timestamp
timeStampAddress = hwTimeStamps.getGpuAddress() + offsetof(HwTimeStamps, ContextStartTS);
@ -138,12 +140,13 @@ template <typename GfxFamily>
void GpgpuWalkerHelper<GfxFamily>::dispatchProfilingCommandsEnd(
TagNodeBase &hwTimeStamps,
LinearStream *commandStream,
const HardwareInfo &hwInfo) {
const RootDeviceEnvironment &rootDeviceEnvironment) {
using MI_STORE_REGISTER_MEM = typename GfxFamily::MI_STORE_REGISTER_MEM;
// PIPE_CONTROL for global timestamp
uint64_t timeStampAddress = hwTimeStamps.getGpuAddress() + offsetof(HwTimeStamps, GlobalEndTS);
PipeControlArgs args;
const auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo();
MemorySynchronizationCommands<GfxFamily>::addBarrierWithPostSyncOperation(
*commandStream,
PostSyncMode::Timestamp,
@ -152,7 +155,8 @@ void GpgpuWalkerHelper<GfxFamily>::dispatchProfilingCommandsEnd(
hwInfo,
args);
if (!GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily).useOnlyGlobalTimestamps()) {
auto &gfxCoreHelper = rootDeviceEnvironment.getHelper<GfxCoreHelper>();
if (!gfxCoreHelper.useOnlyGlobalTimestamps()) {
// MI_STORE_REGISTER_MEM for context local timestamp
uint64_t timeStampAddress = hwTimeStamps.getGpuAddress() + offsetof(HwTimeStamps, ContextEndTS);

View File

@ -158,11 +158,11 @@ size_t EnqueueOperation<GfxFamily>::getSizeRequiredForTimestampPacketWrite() {
}
template <typename GfxFamily>
void GpgpuWalkerHelper<GfxFamily>::dispatchProfilingCommandsStart(TagNodeBase &hwTimeStamps, LinearStream *commandStream, const HardwareInfo &hwInfo) {
void GpgpuWalkerHelper<GfxFamily>::dispatchProfilingCommandsStart(TagNodeBase &hwTimeStamps, LinearStream *commandStream, const RootDeviceEnvironment &rootDeviceEnvironment) {
}
template <typename GfxFamily>
void GpgpuWalkerHelper<GfxFamily>::dispatchProfilingCommandsEnd(TagNodeBase &hwTimeStamps, LinearStream *commandStream, const HardwareInfo &hwInfo) {
void GpgpuWalkerHelper<GfxFamily>::dispatchProfilingCommandsEnd(TagNodeBase &hwTimeStamps, LinearStream *commandStream, const RootDeviceEnvironment &rootDeviceEnvironment) {
}
template <typename GfxFamily>

View File

@ -36,7 +36,7 @@ inline void HardwareInterface<GfxFamily>::dispatchProfilingPerfStartCommands(
// If hwTimeStampAlloc is passed (not nullptr), then we know that profiling is enabled
if (hwTimeStamps != nullptr) {
GpgpuWalkerHelper<GfxFamily>::dispatchProfilingCommandsStart(*hwTimeStamps, commandStream, commandQueue.getDevice().getHardwareInfo());
GpgpuWalkerHelper<GfxFamily>::dispatchProfilingCommandsStart(*hwTimeStamps, commandStream, commandQueue.getDevice().getRootDeviceEnvironment());
}
if (hwPerfCounter != nullptr) {
GpgpuWalkerHelper<GfxFamily>::dispatchPerfCountersCommandsStart(commandQueue, *hwPerfCounter, commandStream);
@ -52,7 +52,7 @@ inline void HardwareInterface<GfxFamily>::dispatchProfilingPerfEndCommands(
// If hwTimeStamps is passed (not nullptr), then we know that profiling is enabled
if (hwTimeStamps != nullptr) {
GpgpuWalkerHelper<GfxFamily>::dispatchProfilingCommandsEnd(*hwTimeStamps, commandStream, commandQueue.getDevice().getHardwareInfo());
GpgpuWalkerHelper<GfxFamily>::dispatchProfilingCommandsEnd(*hwTimeStamps, commandStream, commandQueue.getDevice().getRootDeviceEnvironment());
}
if (hwPerfCounter != nullptr) {
GpgpuWalkerHelper<GfxFamily>::dispatchPerfCountersCommandsEnd(commandQueue, *hwPerfCounter, commandStream);

View File

@ -1321,12 +1321,12 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ProfilingCommandsTest, givenKernelWhenProfilingComma
auto hwTimeStamp1 = timeStampAllocator.getTag();
ASSERT_NE(nullptr, hwTimeStamp1);
GpgpuWalkerHelper<FamilyType>::dispatchProfilingCommandsStart(*hwTimeStamp1, &cmdStream, pDevice->getHardwareInfo());
GpgpuWalkerHelper<FamilyType>::dispatchProfilingCommandsStart(*hwTimeStamp1, &cmdStream, pDevice->getRootDeviceEnvironment());
auto hwTimeStamp2 = timeStampAllocator.getTag();
ASSERT_NE(nullptr, hwTimeStamp2);
GpgpuWalkerHelper<FamilyType>::dispatchProfilingCommandsStart(*hwTimeStamp2, &cmdStream, pDevice->getHardwareInfo());
GpgpuWalkerHelper<FamilyType>::dispatchProfilingCommandsStart(*hwTimeStamp2, &cmdStream, pDevice->getRootDeviceEnvironment());
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, cmdStream.getCpuBase(), cmdStream.getUsed()));
@ -1393,11 +1393,11 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ProfilingCommandsTest, givenKernelWhenProfilingComma
auto hwTimeStamp1 = timeStampAllocator.getTag();
ASSERT_NE(nullptr, hwTimeStamp1);
GpgpuWalkerHelper<FamilyType>::dispatchProfilingCommandsEnd(*hwTimeStamp1, &cmdStream, pDevice->getHardwareInfo());
GpgpuWalkerHelper<FamilyType>::dispatchProfilingCommandsEnd(*hwTimeStamp1, &cmdStream, pDevice->getRootDeviceEnvironment());
auto hwTimeStamp2 = timeStampAllocator.getTag();
ASSERT_NE(nullptr, hwTimeStamp2);
GpgpuWalkerHelper<FamilyType>::dispatchProfilingCommandsEnd(*hwTimeStamp2, &cmdStream, pDevice->getHardwareInfo());
GpgpuWalkerHelper<FamilyType>::dispatchProfilingCommandsEnd(*hwTimeStamp2, &cmdStream, pDevice->getRootDeviceEnvironment());
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, cmdStream.getCpuBase(), cmdStream.getUsed()));

View File

@ -1460,9 +1460,9 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTest, whenDispatchPr
auto hwTimeStamp1 = timeStampAllocator.getTag();
GpgpuWalkerHelper<FamilyType>::dispatchProfilingCommandsStart(*hwTimeStamp1, &cmdStream, device->getHardwareInfo());
GpgpuWalkerHelper<FamilyType>::dispatchProfilingCommandsStart(*hwTimeStamp1, &cmdStream, device->getRootDeviceEnvironment());
GpgpuWalkerHelper<FamilyType>::dispatchProfilingCommandsEnd(*hwTimeStamp1, &cmdStream, device->getHardwareInfo());
GpgpuWalkerHelper<FamilyType>::dispatchProfilingCommandsEnd(*hwTimeStamp1, &cmdStream, device->getRootDeviceEnvironment());
EXPECT_EQ(0u, cmdStream.getUsed());
}