diff --git a/runtime/command_stream/preemption.h b/runtime/command_stream/preemption.h index 1c90817f93..8ec24ed4c5 100644 --- a/runtime/command_stream/preemption.h +++ b/runtime/command_stream/preemption.h @@ -45,7 +45,7 @@ class PreemptionHelper { static size_t getRequiredPreambleSize(const Device &device); template - static void programPreamble(LinearStream &preambleCmdStream, const Device &device, const GraphicsAllocation *preemptionCsr); + static void programPreamble(LinearStream &preambleCmdStream, Device &device, const GraphicsAllocation *preemptionCsr); template static size_t getRequiredCmdStreamSize(PreemptionMode newPreemptionMode, PreemptionMode oldPreemptionMode); diff --git a/runtime/command_stream/preemption.inl b/runtime/command_stream/preemption.inl index da950171ba..fe5c978b1b 100644 --- a/runtime/command_stream/preemption.inl +++ b/runtime/command_stream/preemption.inl @@ -20,6 +20,8 @@ * OTHER DEALINGS IN THE SOFTWARE. */ +#include "runtime/built_ins/built_ins.h" +#include "runtime/built_ins/sip.h" #include "runtime/command_stream/preemption.h" #include "runtime/device/device.h" #include "runtime/command_queue/dispatch_walker_helper.h" @@ -72,7 +74,7 @@ void PreemptionHelper::applyPreemptionWaCmdsEnd(LinearStream *pCommandStream, co } template -void PreemptionHelper::programPreamble(LinearStream &preambleCmdStream, const Device &device, +void PreemptionHelper::programPreamble(LinearStream &preambleCmdStream, Device &device, const GraphicsAllocation *preemptionCsr) { if (device.getPreemptionMode() != PreemptionMode::MidThread) { return; @@ -88,7 +90,7 @@ void PreemptionHelper::programPreamble(LinearStream &preambleCmdStream, const De auto sip = reinterpret_cast(preambleCmdStream.getSpace(sizeof(STATE_SIP))); sip->init(); - sip->setSystemInstructionPointer(0); + sip->setSystemInstructionPointer(BuiltIns::getInstance().getSipKernel(SipKernelType::Csr, device).getSipAllocation()->getGpuAddressToPatch()); } template diff --git a/runtime/gen8/preemption.cpp b/runtime/gen8/preemption.cpp index 86afde7595..f795abf60d 100644 --- a/runtime/gen8/preemption.cpp +++ b/runtime/gen8/preemption.cpp @@ -62,7 +62,7 @@ size_t PreemptionHelper::getRequiredPreambleSize(const Device &device } template <> -void PreemptionHelper::programPreamble(LinearStream &preambleCmdStream, const Device &device, +void PreemptionHelper::programPreamble(LinearStream &preambleCmdStream, Device &device, const GraphicsAllocation *preemptionCsr) { } diff --git a/runtime/gen9/preemption.cpp b/runtime/gen9/preemption.cpp index 4003304c7a..299d4bdfb7 100644 --- a/runtime/gen9/preemption.cpp +++ b/runtime/gen9/preemption.cpp @@ -47,7 +47,7 @@ template void PreemptionHelper::programCmdStream(LinearStream &cmdStr PreemptionMode newPreemptionMode, PreemptionMode oldPreemptionMode, GraphicsAllocation *preemptionCsr, Device &device); -template void PreemptionHelper::programPreamble(LinearStream &preambleCmdStream, const Device &device, const GraphicsAllocation *preemptionCsr); +template void PreemptionHelper::programPreamble(LinearStream &preambleCmdStream, Device &device, const GraphicsAllocation *preemptionCsr); template size_t PreemptionHelper::getRequiredPreambleSize(const Device &device); template size_t PreemptionHelper::getRequiredCmdStreamSize(PreemptionMode newPreemptionMode, PreemptionMode oldPreemptionMode); template size_t PreemptionHelper::getPreemptionWaCsSize(const Device &device); diff --git a/runtime/helpers/preamble.h b/runtime/helpers/preamble.h index 519d4316d7..ef449efad2 100644 --- a/runtime/helpers/preamble.h +++ b/runtime/helpers/preamble.h @@ -45,10 +45,10 @@ struct PreambleHelper { static void programPipelineSelect(LinearStream *pCommandStream, bool mediaSamplerRequired); static uint32_t getDefaultThreadArbitrationPolicy(); static void programThreadArbitration(LinearStream *pCommandStream, uint32_t requiredThreadArbitrationPolicy); - static void programPreemption(LinearStream *pCommandStream, const Device &device, GraphicsAllocation *preemptionCsr); + static void programPreemption(LinearStream *pCommandStream, Device &device, GraphicsAllocation *preemptionCsr); static void addPipeControlBeforeVfeCmd(LinearStream *pCommandStream, const HardwareInfo *hwInfo); static void programVFEState(LinearStream *pCommandStream, const HardwareInfo &hwInfo, int scratchSize, uint64_t scratchAddress); - static void programPreamble(LinearStream *pCommandStream, const Device &device, uint32_t l3Config, + static void programPreamble(LinearStream *pCommandStream, Device &device, uint32_t l3Config, uint32_t requiredThreadArbitrationPolicy, GraphicsAllocation *preemptionCsr); static uint32_t getL3Config(const HardwareInfo &hwInfo, bool useSLM); static size_t getAdditionalCommandsSize(const Device &device); diff --git a/runtime/helpers/preamble.inl b/runtime/helpers/preamble.inl index 9588f61640..10c6773dc9 100644 --- a/runtime/helpers/preamble.inl +++ b/runtime/helpers/preamble.inl @@ -79,7 +79,7 @@ void PreambleHelper::programL3(LinearStream *pCommandStream, uint32_t } template -void PreambleHelper::programPreamble(LinearStream *pCommandStream, const Device &device, uint32_t l3Config, +void PreambleHelper::programPreamble(LinearStream *pCommandStream, Device &device, uint32_t l3Config, uint32_t requiredThreadArbitrationPolicy, GraphicsAllocation *preemptionCsr) { programL3(pCommandStream, l3Config); programThreadArbitration(pCommandStream, requiredThreadArbitrationPolicy); @@ -88,7 +88,7 @@ void PreambleHelper::programPreamble(LinearStream *pCommandStream, co } template -void PreambleHelper::programPreemption(LinearStream *pCommandStream, const Device &device, GraphicsAllocation *preemptionCsr) { +void PreambleHelper::programPreemption(LinearStream *pCommandStream, Device &device, GraphicsAllocation *preemptionCsr) { PreemptionHelper::programPreamble(*pCommandStream, device, preemptionCsr); } diff --git a/unit_tests/gen9/skl/test_preamble_skl.cpp b/unit_tests/gen9/skl/test_preamble_skl.cpp index 2449ba6100..8c4b5d7f61 100644 --- a/unit_tests/gen9/skl/test_preamble_skl.cpp +++ b/unit_tests/gen9/skl/test_preamble_skl.cpp @@ -79,7 +79,8 @@ SKLTEST_F(ThreadArbitration, givenPreambleWhenItIsProgrammedThenThreadArbitratio typedef SKLFamily::PIPE_CONTROL PIPE_CONTROL; LinearStream &cs = linearStream; uint32_t l3Config = PreambleHelper::getL3Config(**platformDevices, true); - PreambleHelper::programPreamble(&linearStream, MockDevice(**platformDevices), l3Config, + MockDevice mockDevice(**platformDevices); + PreambleHelper::programPreamble(&linearStream, mockDevice, l3Config, ThreadArbitrationPolicy::RoundRobin, nullptr); diff --git a/unit_tests/gen9/test_preemption.cpp b/unit_tests/gen9/test_preemption.cpp index 8da376d7f0..f284deb9b1 100644 --- a/unit_tests/gen9/test_preemption.cpp +++ b/unit_tests/gen9/test_preemption.cpp @@ -19,7 +19,7 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ - +#include "runtime/built_ins/built_ins.h" #include "runtime/command_stream/preemption.h" #include "unit_tests/command_queue/enqueue_fixture.h" #include "unit_tests/fixtures/preemption_fixture.h" @@ -101,7 +101,7 @@ GEN9TEST_F(Gen9PreemptionTests, whenMidThreadPreemptionIsAvailableThenProgramsPr auto stateSipCmd = hwParsePreamble.getCommand(); ASSERT_NE(nullptr, stateSipCmd); - EXPECT_EQ(0U, stateSipCmd->getSystemInstructionPointer()); + EXPECT_EQ(BuiltIns::getInstance().getSipKernel(SipKernelType::Csr, *device).getSipAllocation()->getGpuAddressToPatch(), stateSipCmd->getSystemInstructionPointer()); } GEN9TEST_F(Gen9ThreadGroupPreemptionEnqueueKernelTest, givenSecondEnqueueWithTheSamePreemptionRequestThenDontReprogramThreadGroupNoWa) {