Skip to content

Commit d7d3a6b

Browse files
fix: use full address to sip if needed
Related-To: NEO-7621 Signed-off-by: Kamil Kopryk <[email protected]>
1 parent 028a5ee commit d7d3a6b

File tree

6 files changed

+24
-14
lines changed

6 files changed

+24
-14
lines changed

shared/source/command_stream/preemption.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2018-2023 Intel Corporation
2+
* Copyright (C) 2018-2024 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -86,7 +86,7 @@ class PreemptionHelper {
8686
static void programCsrBaseAddressCmd(LinearStream &preambleCmdStream, const GraphicsAllocation *preemptionCsr);
8787

8888
template <typename GfxFamily>
89-
static void programStateSipCmd(LinearStream &preambleCmdStream, GraphicsAllocation *sipAllocation);
89+
static void programStateSipCmd(LinearStream &preambleCmdStream, GraphicsAllocation *sipAllocation, bool useFullAddress);
9090
};
9191

9292
template <typename GfxFamily>

shared/source/command_stream/preemption.inl

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2018-2023 Intel Corporation
2+
* Copyright (C) 2018-2024 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -11,6 +11,7 @@
1111
#include "shared/source/command_stream/preemption_mode.h"
1212
#include "shared/source/device/device.h"
1313
#include "shared/source/execution_environment/execution_environment.h"
14+
#include "shared/source/helpers/compiler_product_helper.h"
1415
#include "shared/source/helpers/gfx_core_helper.h"
1516
#include "shared/source/helpers/pipe_control_args.h"
1617
#include "shared/source/helpers/preamble.h"
@@ -43,19 +44,28 @@ void PreemptionHelper::programStateSip(LinearStream &preambleCmdStream, Device &
4344
bool debuggingEnabled = device.getDebugger() != nullptr;
4445
bool isMidThreadPreemption = device.getPreemptionMode() == PreemptionMode::MidThread;
4546

47+
auto &compilerProductHelper = device.getCompilerProductHelper();
48+
bool useFullAddress = compilerProductHelper.isHeaplessModeEnabled();
49+
4650
if (isMidThreadPreemption || debuggingEnabled) {
4751
GraphicsAllocation *sipAllocation = SipKernel::getSipKernel(device, context).getSipAllocation();
48-
programStateSipCmd<GfxFamily>(preambleCmdStream, sipAllocation);
52+
programStateSipCmd<GfxFamily>(preambleCmdStream, sipAllocation, useFullAddress);
4953
}
5054
}
5155

5256
template <typename GfxFamily>
53-
void PreemptionHelper::programStateSipCmd(LinearStream &preambleCmdStream, GraphicsAllocation *sipAllocation) {
57+
void PreemptionHelper::programStateSipCmd(LinearStream &preambleCmdStream, GraphicsAllocation *sipAllocation, bool useFullAddress) {
5458
using STATE_SIP = typename GfxFamily::STATE_SIP;
5559

5660
auto sip = reinterpret_cast<STATE_SIP *>(preambleCmdStream.getSpace(sizeof(STATE_SIP)));
5761
STATE_SIP cmd = GfxFamily::cmdInitStateSip;
58-
cmd.setSystemInstructionPointer(sipAllocation->getGpuAddressToPatch());
62+
if (useFullAddress) {
63+
cmd.setSystemInstructionPointer(sipAllocation->getGpuAddress());
64+
65+
} else {
66+
cmd.setSystemInstructionPointer(sipAllocation->getGpuAddressToPatch());
67+
}
68+
5969
*sip = cmd;
6070
}
6171

shared/source/gen11/preemption_gen11.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019-2023 Intel Corporation
2+
* Copyright (C) 2019-2024 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -19,7 +19,7 @@ template size_t PreemptionHelper::getRequiredPreambleSize<GfxFamily>(const Devic
1919
template void PreemptionHelper::programCsrBaseAddress<GfxFamily>(LinearStream &preambleCmdStream, Device &device, const GraphicsAllocation *preemptionCsr);
2020
template void PreemptionHelper::programCsrBaseAddressCmd<GfxFamily>(LinearStream &preambleCmdStream, const GraphicsAllocation *preemptionCsr);
2121
template void PreemptionHelper::programStateSip<GfxFamily>(LinearStream &preambleCmdStream, Device &device, OsContext *context);
22-
template void PreemptionHelper::programStateSipCmd<GfxFamily>(LinearStream &preambleCmdStream, GraphicsAllocation *sipAllocation);
22+
template void PreemptionHelper::programStateSipCmd<GfxFamily>(LinearStream &preambleCmdStream, GraphicsAllocation *sipAllocation, bool useFullAddress);
2323
template size_t PreemptionHelper::getRequiredStateSipCmdSize<GfxFamily>(Device &device, bool isRcs);
2424
template size_t PreemptionHelper::getRequiredCmdStreamSize<GfxFamily>(PreemptionMode newPreemptionMode, PreemptionMode oldPreemptionMode);
2525
template size_t PreemptionHelper::getPreemptionWaCsSize<GfxFamily>(const Device &device);

shared/source/gen12lp/preemption_gen12lp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019-2023 Intel Corporation
2+
* Copyright (C) 2019-2024 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -19,7 +19,7 @@ template size_t PreemptionHelper::getRequiredPreambleSize<GfxFamily>(const Devic
1919
template void PreemptionHelper::programCsrBaseAddress<GfxFamily>(LinearStream &preambleCmdStream, Device &device, const GraphicsAllocation *preemptionCsr);
2020
template void PreemptionHelper::programCsrBaseAddressCmd<GfxFamily>(LinearStream &preambleCmdStream, const GraphicsAllocation *preemptionCsr);
2121
template void PreemptionHelper::programStateSip<GfxFamily>(LinearStream &preambleCmdStream, Device &device, OsContext *context);
22-
template void PreemptionHelper::programStateSipCmd<GfxFamily>(LinearStream &preambleCmdStream, GraphicsAllocation *sipAllocation);
22+
template void PreemptionHelper::programStateSipCmd<GfxFamily>(LinearStream &preambleCmdStream, GraphicsAllocation *sipAllocation, bool useFullAddress);
2323
template size_t PreemptionHelper::getRequiredStateSipCmdSize<GfxFamily>(Device &device, bool isRcs);
2424
template size_t PreemptionHelper::getRequiredCmdStreamSize<GfxFamily>(PreemptionMode newPreemptionMode, PreemptionMode oldPreemptionMode);
2525
template size_t PreemptionHelper::getPreemptionWaCsSize<GfxFamily>(const Device &device);

shared/source/gen8/preemption_gen8.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2018-2023 Intel Corporation
2+
* Copyright (C) 2018-2024 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -67,7 +67,7 @@ void PreemptionHelper::programStateSip<GfxFamily>(LinearStream &preambleCmdStrea
6767
}
6868

6969
template <>
70-
void PreemptionHelper::programStateSipCmd<GfxFamily>(LinearStream &preambleCmdStream, GraphicsAllocation *sipAllocation) {
70+
void PreemptionHelper::programStateSipCmd<GfxFamily>(LinearStream &preambleCmdStream, GraphicsAllocation *sipAllocation, bool useFullAddress) {
7171
}
7272

7373
template <>

shared/source/gen9/preemption_gen9.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2018-2023 Intel Corporation
2+
* Copyright (C) 2018-2024 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -74,7 +74,7 @@ template size_t PreemptionHelper::getRequiredPreambleSize<GfxFamily>(const Devic
7474
template void PreemptionHelper::programCsrBaseAddress<GfxFamily>(LinearStream &preambleCmdStream, Device &device, const GraphicsAllocation *preemptionCsr);
7575
template void PreemptionHelper::programCsrBaseAddressCmd<GfxFamily>(LinearStream &preambleCmdStream, const GraphicsAllocation *preemptionCsr);
7676
template void PreemptionHelper::programStateSip<GfxFamily>(LinearStream &preambleCmdStream, Device &device, OsContext *context);
77-
template void PreemptionHelper::programStateSipCmd<GfxFamily>(LinearStream &preambleCmdStream, GraphicsAllocation *sipAllocation);
77+
template void PreemptionHelper::programStateSipCmd<GfxFamily>(LinearStream &preambleCmdStream, GraphicsAllocation *sipAllocation, bool useFullAddress);
7878
template size_t PreemptionHelper::getRequiredStateSipCmdSize<GfxFamily>(Device &device, bool isRcs);
7979
template size_t PreemptionHelper::getRequiredCmdStreamSize<GfxFamily>(PreemptionMode newPreemptionMode, PreemptionMode oldPreemptionMode);
8080

0 commit comments

Comments
 (0)