Skip to content

Commit 296c527

Browse files
[23/n] Internal 4GB allocator.
- Align SIP kernel & STATE_SIP programming. - on Linux address may be non 0 - on Windows address is expected to be always 0 Change-Id: I385ed59ef652382f3f17d1afe55f6050d07ed1f4
1 parent 2b6fc61 commit 296c527

File tree

8 files changed

+15
-12
lines changed

8 files changed

+15
-12
lines changed

runtime/command_stream/preemption.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class PreemptionHelper {
4545
static size_t getRequiredPreambleSize(const Device &device);
4646

4747
template <typename GfxFamily>
48-
static void programPreamble(LinearStream &preambleCmdStream, const Device &device, const GraphicsAllocation *preemptionCsr);
48+
static void programPreamble(LinearStream &preambleCmdStream, Device &device, const GraphicsAllocation *preemptionCsr);
4949

5050
template <typename GfxFamily>
5151
static size_t getRequiredCmdStreamSize(PreemptionMode newPreemptionMode, PreemptionMode oldPreemptionMode);

runtime/command_stream/preemption.inl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
* OTHER DEALINGS IN THE SOFTWARE.
2121
*/
2222

23+
#include "runtime/built_ins/built_ins.h"
24+
#include "runtime/built_ins/sip.h"
2325
#include "runtime/command_stream/preemption.h"
2426
#include "runtime/device/device.h"
2527
#include "runtime/command_queue/dispatch_walker_helper.h"
@@ -72,7 +74,7 @@ void PreemptionHelper::applyPreemptionWaCmdsEnd(LinearStream *pCommandStream, co
7274
}
7375

7476
template <typename GfxFamily>
75-
void PreemptionHelper::programPreamble(LinearStream &preambleCmdStream, const Device &device,
77+
void PreemptionHelper::programPreamble(LinearStream &preambleCmdStream, Device &device,
7678
const GraphicsAllocation *preemptionCsr) {
7779
if (device.getPreemptionMode() != PreemptionMode::MidThread) {
7880
return;
@@ -88,7 +90,7 @@ void PreemptionHelper::programPreamble(LinearStream &preambleCmdStream, const De
8890

8991
auto sip = reinterpret_cast<STATE_SIP *>(preambleCmdStream.getSpace(sizeof(STATE_SIP)));
9092
sip->init();
91-
sip->setSystemInstructionPointer(0);
93+
sip->setSystemInstructionPointer(BuiltIns::getInstance().getSipKernel(SipKernelType::Csr, device).getSipAllocation()->getGpuAddressToPatch());
9294
}
9395

9496
template <typename GfxFamily>

runtime/gen8/preemption.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ size_t PreemptionHelper::getRequiredPreambleSize<GfxFamily>(const Device &device
6262
}
6363

6464
template <>
65-
void PreemptionHelper::programPreamble<GfxFamily>(LinearStream &preambleCmdStream, const Device &device,
65+
void PreemptionHelper::programPreamble<GfxFamily>(LinearStream &preambleCmdStream, Device &device,
6666
const GraphicsAllocation *preemptionCsr) {
6767
}
6868

runtime/gen9/preemption.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ template void PreemptionHelper::programCmdStream<GfxFamily>(LinearStream &cmdStr
4747
PreemptionMode newPreemptionMode, PreemptionMode oldPreemptionMode,
4848
GraphicsAllocation *preemptionCsr,
4949
Device &device);
50-
template void PreemptionHelper::programPreamble<GfxFamily>(LinearStream &preambleCmdStream, const Device &device, const GraphicsAllocation *preemptionCsr);
50+
template void PreemptionHelper::programPreamble<GfxFamily>(LinearStream &preambleCmdStream, Device &device, const GraphicsAllocation *preemptionCsr);
5151
template size_t PreemptionHelper::getRequiredPreambleSize<GfxFamily>(const Device &device);
5252
template size_t PreemptionHelper::getRequiredCmdStreamSize<GfxFamily>(PreemptionMode newPreemptionMode, PreemptionMode oldPreemptionMode);
5353
template size_t PreemptionHelper::getPreemptionWaCsSize<GfxFamily>(const Device &device);

runtime/helpers/preamble.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ struct PreambleHelper {
4545
static void programPipelineSelect(LinearStream *pCommandStream, bool mediaSamplerRequired);
4646
static uint32_t getDefaultThreadArbitrationPolicy();
4747
static void programThreadArbitration(LinearStream *pCommandStream, uint32_t requiredThreadArbitrationPolicy);
48-
static void programPreemption(LinearStream *pCommandStream, const Device &device, GraphicsAllocation *preemptionCsr);
48+
static void programPreemption(LinearStream *pCommandStream, Device &device, GraphicsAllocation *preemptionCsr);
4949
static void addPipeControlBeforeVfeCmd(LinearStream *pCommandStream, const HardwareInfo *hwInfo);
5050
static void programVFEState(LinearStream *pCommandStream, const HardwareInfo &hwInfo, int scratchSize, uint64_t scratchAddress);
51-
static void programPreamble(LinearStream *pCommandStream, const Device &device, uint32_t l3Config,
51+
static void programPreamble(LinearStream *pCommandStream, Device &device, uint32_t l3Config,
5252
uint32_t requiredThreadArbitrationPolicy, GraphicsAllocation *preemptionCsr);
5353
static uint32_t getL3Config(const HardwareInfo &hwInfo, bool useSLM);
5454
static size_t getAdditionalCommandsSize(const Device &device);

runtime/helpers/preamble.inl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void PreambleHelper<GfxFamily>::programL3(LinearStream *pCommandStream, uint32_t
7979
}
8080

8181
template <typename GfxFamily>
82-
void PreambleHelper<GfxFamily>::programPreamble(LinearStream *pCommandStream, const Device &device, uint32_t l3Config,
82+
void PreambleHelper<GfxFamily>::programPreamble(LinearStream *pCommandStream, Device &device, uint32_t l3Config,
8383
uint32_t requiredThreadArbitrationPolicy, GraphicsAllocation *preemptionCsr) {
8484
programL3(pCommandStream, l3Config);
8585
programThreadArbitration(pCommandStream, requiredThreadArbitrationPolicy);
@@ -88,7 +88,7 @@ void PreambleHelper<GfxFamily>::programPreamble(LinearStream *pCommandStream, co
8888
}
8989

9090
template <typename GfxFamily>
91-
void PreambleHelper<GfxFamily>::programPreemption(LinearStream *pCommandStream, const Device &device, GraphicsAllocation *preemptionCsr) {
91+
void PreambleHelper<GfxFamily>::programPreemption(LinearStream *pCommandStream, Device &device, GraphicsAllocation *preemptionCsr) {
9292
PreemptionHelper::programPreamble<GfxFamily>(*pCommandStream, device, preemptionCsr);
9393
}
9494

unit_tests/gen9/skl/test_preamble_skl.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ SKLTEST_F(ThreadArbitration, givenPreambleWhenItIsProgrammedThenThreadArbitratio
7979
typedef SKLFamily::PIPE_CONTROL PIPE_CONTROL;
8080
LinearStream &cs = linearStream;
8181
uint32_t l3Config = PreambleHelper<FamilyType>::getL3Config(**platformDevices, true);
82-
PreambleHelper<SKLFamily>::programPreamble(&linearStream, MockDevice(**platformDevices), l3Config,
82+
MockDevice mockDevice(**platformDevices);
83+
PreambleHelper<SKLFamily>::programPreamble(&linearStream, mockDevice, l3Config,
8384
ThreadArbitrationPolicy::RoundRobin,
8485
nullptr);
8586

unit_tests/gen9/test_preemption.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2020
* OTHER DEALINGS IN THE SOFTWARE.
2121
*/
22-
22+
#include "runtime/built_ins/built_ins.h"
2323
#include "runtime/command_stream/preemption.h"
2424
#include "unit_tests/command_queue/enqueue_fixture.h"
2525
#include "unit_tests/fixtures/preemption_fixture.h"
@@ -101,7 +101,7 @@ GEN9TEST_F(Gen9PreemptionTests, whenMidThreadPreemptionIsAvailableThenProgramsPr
101101

102102
auto stateSipCmd = hwParsePreamble.getCommand<STATE_SIP>();
103103
ASSERT_NE(nullptr, stateSipCmd);
104-
EXPECT_EQ(0U, stateSipCmd->getSystemInstructionPointer());
104+
EXPECT_EQ(BuiltIns::getInstance().getSipKernel(SipKernelType::Csr, *device).getSipAllocation()->getGpuAddressToPatch(), stateSipCmd->getSystemInstructionPointer());
105105
}
106106

107107
GEN9TEST_F(Gen9ThreadGroupPreemptionEnqueueKernelTest, givenSecondEnqueueWithTheSamePreemptionRequestThenDontReprogramThreadGroupNoWa) {

0 commit comments

Comments
 (0)