L3 programming refactor 1/n

- Clean up size estimation functions
- Make some tests gen specific

Change-Id: If9c15f311306282ba035b380e6d4cadc17584815
This commit is contained in:
Maciej Dziuban 2018-04-13 11:05:09 +02:00 committed by sys_ocldev
parent 588d982989
commit 1392b79b58
10 changed files with 243 additions and 114 deletions

View File

@ -52,7 +52,7 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
void flushBatchedSubmissions() override;
void addPipeControl(LinearStream &commandStream, bool dcFlush) override;
int getRequiredPipeControlSize();
int getRequiredPipeControlSize() const;
static void addBatchBufferEnd(LinearStream &commandStream, void **patchLocation);
static void addBatchBufferStart(MI_BATCH_BUFFER_START *commandBufferMemory, uint64_t startAddress);
@ -60,6 +60,9 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
size_t getRequiredCmdStreamSize(const DispatchFlags &dispatchFlags);
size_t getRequiredCmdStreamSizeAligned(const DispatchFlags &dispatchFlags);
size_t getCmdSizeForPreemption(const DispatchFlags &dispatchFlags) const;
size_t getCmdSizeForL3Config() const;
size_t getCmdSizeForPipelineSelect() const;
size_t getCmdSizeForCoherency();
size_t getCmdSizeForMediaSampler(bool mediaSamplerRequired) const;
void programCoherency(LinearStream &csr, DispatchFlags &dispatchFlags);

View File

@ -80,8 +80,7 @@ inline void CommandStreamReceiverHw<GfxFamily>::alignToCacheLine(LinearStream &c
template <typename GfxFamily>
size_t getSizeRequiredPreambleCS(const Device &device) {
return sizeof(typename GfxFamily::MI_LOAD_REGISTER_IMM) +
sizeof(typename GfxFamily::PIPE_CONTROL) +
return sizeof(typename GfxFamily::PIPE_CONTROL) +
sizeof(typename GfxFamily::MEDIA_VFE_STATE) + PreambleHelper<GfxFamily>::getAdditionalCommandsSize(device);
}
@ -102,6 +101,14 @@ void CommandStreamReceiverHw<GfxFamily>::programPipelineSelect(LinearStream &com
}
}
template <typename GfxFamily>
inline size_t CommandStreamReceiverHw<GfxFamily>::getCmdSizeForPipelineSelect() const {
if (csrSizeRequestFlags.mediaSamplerConfigChanged || !isPreambleSent) {
return sizeof(typename GfxFamily::PIPELINE_SELECT);
}
return 0;
}
template <typename GfxFamily>
CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
LinearStream &commandStreamTask,
@ -540,16 +547,13 @@ size_t CommandStreamReceiverHw<GfxFamily>::getRequiredCmdStreamSize(const Dispat
sizeof(PIPE_CONTROL) +
getRequiredPipeControlSize() +
sizeof(typename GfxFamily::MI_BATCH_BUFFER_START);
if (csrSizeRequestFlags.mediaSamplerConfigChanged || !isPreambleSent) {
size += sizeof(typename GfxFamily::PIPELINE_SELECT);
}
if (csrSizeRequestFlags.l3ConfigChanged && this->isPreambleSent) {
size += sizeof(typename GfxFamily::PIPE_CONTROL);
}
size += getCmdSizeForL3Config();
size += getCmdSizeForCoherency();
size += getCmdSizeForMediaSampler(dispatchFlags.mediaSamplerRequired);
size += getCmdSizeForPipelineSelect();
size += getCmdSizeForPreemption(dispatchFlags);
size += PreemptionHelper::getRequiredCmdStreamSize<GfxFamily>(dispatchFlags.preemptionMode, this->lastPreemptionMode);
if (getMemoryManager()->device->getWaTable()->waSamplerCacheFlushBetweenRedescribedSurfaceReads) {
if (this->samplerCacheFlushRequired != SamplerCacheFlushState::samplerCacheFlushNotRequired) {
size += sizeof(typename GfxFamily::PIPE_CONTROL);
@ -591,6 +595,11 @@ inline void CommandStreamReceiverHw<GfxFamily>::programPreemption(LinearStream &
this->lastPreemptionMode = dispatchFlags.preemptionMode;
}
template <typename GfxFamily>
inline size_t CommandStreamReceiverHw<GfxFamily>::getCmdSizeForPreemption(const DispatchFlags &dispatchFlags) const {
return PreemptionHelper::getRequiredCmdStreamSize<GfxFamily>(dispatchFlags.preemptionMode, this->lastPreemptionMode);
}
template <typename GfxFamily>
inline void CommandStreamReceiverHw<GfxFamily>::programL3(LinearStream &csr, DispatchFlags &dispatchFlags, uint32_t &newL3Config) {
typedef typename GfxFamily::PIPE_CONTROL PIPE_CONTROL;
@ -606,6 +615,16 @@ inline void CommandStreamReceiverHw<GfxFamily>::programL3(LinearStream &csr, Dis
}
}
template <typename GfxFamily>
inline size_t CommandStreamReceiverHw<GfxFamily>::getCmdSizeForL3Config() const {
if (!this->isPreambleSent) {
return sizeof(typename GfxFamily::MI_LOAD_REGISTER_IMM);
} else if (csrSizeRequestFlags.l3ConfigChanged) {
return sizeof(typename GfxFamily::MI_LOAD_REGISTER_IMM) + sizeof(typename GfxFamily::PIPE_CONTROL);
}
return 0;
}
template <typename GfxFamily>
inline void CommandStreamReceiverHw<GfxFamily>::programPreamble(LinearStream &csr, DispatchFlags &dispatchFlags, uint32_t &newL3Config) {
if (!this->isPreambleSent) {

View File

@ -43,7 +43,7 @@ void CommandStreamReceiverHw<Family>::addPipeControlWA(LinearStream &commandStre
}
template <>
int CommandStreamReceiverHw<Family>::getRequiredPipeControlSize() {
int CommandStreamReceiverHw<Family>::getRequiredPipeControlSize() const {
return 1 * sizeof(Family::PIPE_CONTROL);
}

View File

@ -48,7 +48,7 @@ void CommandStreamReceiverHw<Family>::addPipeControlWA(LinearStream &commandStre
}
template <>
int CommandStreamReceiverHw<Family>::getRequiredPipeControlSize() {
int CommandStreamReceiverHw<Family>::getRequiredPipeControlSize() const {
return 2 * sizeof(Family::PIPE_CONTROL);
}

View File

@ -24,6 +24,7 @@ set(IGDRCL_SRCS_tests_command_stream
${CMAKE_CURRENT_SOURCE_DIR}/cmd_parse_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_fixture.h
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_hw_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_hw_tests.inl
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_with_aub_dump_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/create_command_stream_receiver_tests.cpp

View File

@ -62,7 +62,6 @@ using ::testing::_;
HWTEST_F(UltCommandStreamReceiverTest, requiredCmdSizeForPreamble) {
auto expectedCmdSize =
sizeof(typename FamilyType::MI_LOAD_REGISTER_IMM) +
sizeof(typename FamilyType::PIPE_CONTROL) +
sizeof(typename FamilyType::MEDIA_VFE_STATE) +
PreambleHelper<FamilyType>::getAdditionalCommandsSize(*pDevice);
@ -700,14 +699,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, flushTaskWithOnlyEnoughMemoryForPr
auto &csrCS = commandStreamReceiver.getCS();
size_t sizeNeededForPreamble = getSizeRequiredPreambleCS<FamilyType>(MockDevice(commandStreamReceiver.hwInfo));
size_t sizeNeededForStateBaseAddress = sizeof(STATE_BASE_ADDRESS) + sizeof(PIPE_CONTROL);
size_t sizeNeededForPipeControl = commandStreamReceiver.getRequiredPipeControlSize();
size_t sizeNeededForPreemption = PreemptionHelper::getRequiredCmdStreamSize<FamilyType>(pDevice->getPreemptionMode(), commandStreamReceiver.lastPreemptionMode);
size_t sizeNeeded = sizeNeededForPreamble +
sizeNeededForStateBaseAddress +
sizeNeededForPipeControl +
sizeNeededForPreemption +
sizeof(MI_BATCH_BUFFER_END);
size_t sizeNeeded = commandStreamReceiver.getRequiredCmdStreamSize(flushTaskFlags);
sizeNeeded = alignUp(sizeNeeded, MemoryConstants::cacheLineSize);
csrCS.getSpace(csrCS.getAvailableSpace() - sizeNeededForPreamble);
@ -736,13 +728,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, flushTaskWithOnlyEnoughMemoryForPr
auto &csrCS = commandStreamReceiver.getCS();
size_t sizeNeededForPreamble = getSizeRequiredPreambleCS<FamilyType>(MockDevice(commandStreamReceiver.hwInfo));
size_t sizeNeededForStateBaseAddress = sizeof(STATE_BASE_ADDRESS) + sizeof(PIPE_CONTROL);
size_t sizeNeededForPipeControl = commandStreamReceiver.getRequiredPipeControlSize();
size_t sizeNeededForPreemption = PreemptionHelper::getRequiredCmdStreamSize<FamilyType>(pDevice->getPreemptionMode(), commandStreamReceiver.lastPreemptionMode);
size_t sizeNeeded = sizeNeededForPreamble +
sizeNeededForStateBaseAddress +
sizeNeededForPipeControl +
sizeNeededForPreemption +
sizeof(MI_BATCH_BUFFER_END);
size_t sizeNeeded = commandStreamReceiver.getRequiredCmdStreamSize(flushTaskFlags);
sizeNeeded = alignUp(sizeNeeded, MemoryConstants::cacheLineSize);
csrCS.getSpace(csrCS.getAvailableSpace() - sizeNeededForPreamble - sizeNeededForStateBaseAddress);
@ -1351,46 +1337,6 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenFlushedCallRequiringDCFlushWh
retVal = clReleaseMemObject(buffer);
}
HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenKernelWithSlmWhenPreviousNOSLML3WasSentThenProgramL3WithSLML3Config) {
typedef typename FamilyType::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM;
typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL;
size_t GWS = 1;
MockContext ctx(pDevice);
MockKernelWithInternals kernel(*pDevice);
CommandQueueHw<FamilyType> commandQueue(&ctx, pDevice, 0);
auto commandStreamReceiver = new MockCsrHw<FamilyType>(*platformDevices[0]);
pDevice->resetCommandStreamReceiver(commandStreamReceiver);
auto &commandStreamCSR = commandStreamReceiver->getCS();
// Mark Pramble as sent, override L3Config to invalid to programL3
commandStreamReceiver->isPreambleSent = true;
commandStreamReceiver->lastSentL3Config = 0;
((MockKernel *)kernel)->setTotalSLMSize(1024);
cmdList.clear();
commandQueue.enqueueKernel(kernel, 1, nullptr, &GWS, nullptr, 0, nullptr, nullptr);
// Parse command list to verify that PC was added to taskCS
parseCommands<FamilyType>(commandStreamCSR, 0);
auto itorCmd = findMmio<FamilyType>(cmdList.begin(), cmdList.end(), L3CNTLRegisterOffset<FamilyType>::registerOffset);
ASSERT_NE(cmdList.end(), itorCmd);
auto cmdMILoad = genCmdCast<MI_LOAD_REGISTER_IMM *>(*itorCmd);
ASSERT_NE(nullptr, cmdMILoad);
// MI_LOAD_REGISTER should be preceded by PC
EXPECT_NE(cmdList.begin(), itorCmd);
--itorCmd;
auto cmdPC = genCmdCast<PIPE_CONTROL *>(*itorCmd);
ASSERT_NE(nullptr, cmdPC);
uint32_t L3Config = PreambleHelper<FamilyType>::getL3Config(*platformDevices[0], true);
EXPECT_EQ(L3Config, (uint32_t)cmdMILoad->getDataDword());
}
HWTEST_F(CommandStreamReceiverFlushTaskTests, givenDefaultCommandStreamReceiverThenRoundRobinPolicyIsSelected) {
MockCsrHw<FamilyType> commandStreamReceiver(*platformDevices[0]);
EXPECT_EQ(PreambleHelper<FamilyType>::getDefaultThreadArbitrationPolicy(), commandStreamReceiver.peekThreadArbitrationPolicy());
@ -1426,51 +1372,6 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenKernelWithSlmWhenPreviousSLML
EXPECT_EQ(cmdList.end(), itorCmd);
}
HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenBlockedKernelWithSlmWhenPreviousNOSLML3WasSentThenProgramL3WithSLML3ConfigAfterUnblocking) {
typedef typename FamilyType::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM;
size_t GWS = 1;
MockContext ctx(pDevice);
MockKernelWithInternals kernel(*pDevice);
CommandQueueHw<FamilyType> commandQueue(&ctx, pDevice, 0);
auto commandStreamReceiver = new MockCsrHw<FamilyType>(*platformDevices[0]);
pDevice->resetCommandStreamReceiver(commandStreamReceiver);
cl_event blockingEvent;
MockEvent<UserEvent> mockEvent(&ctx);
blockingEvent = &mockEvent;
auto &commandStreamCSR = commandStreamReceiver->getCS();
uint32_t L3Config = PreambleHelper<FamilyType>::getL3Config(*platformDevices[0], false);
// Mark Pramble as sent, override L3Config to SLM config
commandStreamReceiver->isPreambleSent = true;
commandStreamReceiver->lastSentL3Config = 0;
((MockKernel *)kernel)->setTotalSLMSize(1024);
commandQueue.enqueueKernel(kernel, 1, nullptr, &GWS, nullptr, 1, &blockingEvent, nullptr);
// Expect nothing was sent
EXPECT_EQ(0u, commandStreamCSR.getUsed());
// Unblock Event
mockEvent.setStatus(CL_COMPLETE);
cmdList.clear();
// Parse command list
parseCommands<FamilyType>(commandStreamCSR, 0);
// Expect L3 was programmed
auto itorCmd = findMmio<FamilyType>(cmdList.begin(), cmdList.end(), L3CNTLRegisterOffset<FamilyType>::registerOffset);
ASSERT_NE(cmdList.end(), itorCmd);
auto cmdMILoad = genCmdCast<MI_LOAD_REGISTER_IMM *>(*itorCmd);
ASSERT_NE(nullptr, cmdMILoad);
L3Config = PreambleHelper<FamilyType>::getL3Config(*platformDevices[0], true);
EXPECT_EQ(L3Config, (uint32_t)cmdMILoad->getDataDword());
}
HWTEST_F(CommandStreamReceiverFlushTaskTests, CreateCommandStreamReceiverHw) {
const HardwareInfo hwInfo = *platformDevices[0];
auto csrHw = CommandStreamReceiverHw<FamilyType>::create(hwInfo);
@ -1914,6 +1815,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, flushTaskWithPCWhenPreambleSentAnd
HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrWhenPreambleSentThenRequiredCsrSizeDependsOnL3ConfigChanged) {
typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL;
typedef typename FamilyType::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM;
UltCommandStreamReceiver<FamilyType> &commandStreamReceiver = (UltCommandStreamReceiver<FamilyType> &)pDevice->getCommandStreamReceiver();
CsrSizeRequestFlags csrSizeRequest = {};
DispatchFlags flags;
@ -1929,7 +1831,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrWhenPreambleSentThenRequir
EXPECT_NE(l3ConfigNotChangedSize, l3ConfigChangedSize);
auto difference = l3ConfigChangedSize - l3ConfigNotChangedSize;
EXPECT_EQ(sizeof(PIPE_CONTROL), difference);
EXPECT_EQ(sizeof(PIPE_CONTROL) + sizeof(MI_LOAD_REGISTER_IMM), difference);
}
HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrWhenPreambleNotSentThenRequiredCsrSizeDoesntDependOnL3ConfigChanged) {

View File

@ -0,0 +1,129 @@
/*
* Copyright (c) 2018, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
using namespace OCLRT;
template <typename GfxFamily>
struct CommandStreamReceiverHwTest : public DeviceFixture,
public HardwareParse,
public ::testing::Test {
void SetUp() override {
DeviceFixture::SetUp();
HardwareParse::SetUp();
}
void TearDown() override {
HardwareParse::TearDown();
DeviceFixture::TearDown();
}
void givenKernelWithSlmWhenPreviousNOSLML3WasSentThenProgramL3WithSLML3ConfigImpl();
void givenBlockedKernelWithSlmWhenPreviousNOSLML3WasSentOnThenProgramL3WithSLML3ConfigAfterUnblockingImpl();
};
template <typename GfxFamily>
void CommandStreamReceiverHwTest<GfxFamily>::givenKernelWithSlmWhenPreviousNOSLML3WasSentThenProgramL3WithSLML3ConfigImpl() {
typedef typename GfxFamily::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM;
typedef typename GfxFamily::PIPE_CONTROL PIPE_CONTROL;
size_t GWS = 1;
MockContext ctx(pDevice);
MockKernelWithInternals kernel(*pDevice);
CommandQueueHw<GfxFamily> commandQueue(&ctx, pDevice, 0);
auto commandStreamReceiver = new MockCsrHw<GfxFamily>(*platformDevices[0]);
pDevice->resetCommandStreamReceiver(commandStreamReceiver);
auto &commandStreamCSR = commandStreamReceiver->getCS();
// Mark Preamble as sent, override L3Config to invalid to programL3
commandStreamReceiver->isPreambleSent = true;
commandStreamReceiver->lastSentL3Config = 0;
static_cast<MockKernel *>(kernel)->setTotalSLMSize(1024);
cmdList.clear();
commandQueue.enqueueKernel(kernel, 1, nullptr, &GWS, nullptr, 0, nullptr, nullptr);
// Parse command list to verify that PC was added to taskCS
parseCommands<GfxFamily>(commandStreamCSR, 0);
auto itorCmd = findMmio<GfxFamily>(cmdList.begin(), cmdList.end(), L3CNTLRegisterOffset<GfxFamily>::registerOffset);
ASSERT_NE(cmdList.end(), itorCmd);
auto cmdMILoad = genCmdCast<MI_LOAD_REGISTER_IMM *>(*itorCmd);
ASSERT_NE(nullptr, cmdMILoad);
// MI_LOAD_REGISTER should be preceded by PC
EXPECT_NE(cmdList.begin(), itorCmd);
--itorCmd;
auto cmdPC = genCmdCast<PIPE_CONTROL *>(*itorCmd);
ASSERT_NE(nullptr, cmdPC);
uint32_t L3Config = PreambleHelper<GfxFamily>::getL3Config(*platformDevices[0], true);
EXPECT_EQ(L3Config, static_cast<uint32_t>(cmdMILoad->getDataDword()));
}
template <typename GfxFamily>
void CommandStreamReceiverHwTest<GfxFamily>::givenBlockedKernelWithSlmWhenPreviousNOSLML3WasSentOnThenProgramL3WithSLML3ConfigAfterUnblockingImpl() {
typedef typename GfxFamily::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM;
size_t GWS = 1;
MockContext ctx(pDevice);
MockKernelWithInternals kernel(*pDevice);
CommandQueueHw<GfxFamily> commandQueue(&ctx, pDevice, 0);
auto commandStreamReceiver = new MockCsrHw<GfxFamily>(*platformDevices[0]);
pDevice->resetCommandStreamReceiver(commandStreamReceiver);
cl_event blockingEvent;
MockEvent<UserEvent> mockEvent(&ctx);
blockingEvent = &mockEvent;
auto &commandStreamCSR = commandStreamReceiver->getCS();
uint32_t L3Config = PreambleHelper<GfxFamily>::getL3Config(*platformDevices[0], false);
// Mark Pramble as sent, override L3Config to SLM config
commandStreamReceiver->isPreambleSent = true;
commandStreamReceiver->lastSentL3Config = 0;
static_cast<MockKernel *>(kernel)->setTotalSLMSize(1024);
commandQueue.enqueueKernel(kernel, 1, nullptr, &GWS, nullptr, 1, &blockingEvent, nullptr);
// Expect nothing was sent
EXPECT_EQ(0u, commandStreamCSR.getUsed());
// Unblock Event
mockEvent.setStatus(CL_COMPLETE);
cmdList.clear();
// Parse command list
parseCommands<GfxFamily>(commandStreamCSR, 0);
// Expect L3 was programmed
auto itorCmd = findMmio<GfxFamily>(cmdList.begin(), cmdList.end(), L3CNTLRegisterOffset<GfxFamily>::registerOffset);
ASSERT_NE(cmdList.end(), itorCmd);
auto cmdMILoad = genCmdCast<MI_LOAD_REGISTER_IMM *>(*itorCmd);
ASSERT_NE(nullptr, cmdMILoad);
L3Config = PreambleHelper<GfxFamily>::getL3Config(*platformDevices[0], true);
EXPECT_EQ(L3Config, static_cast<uint32_t>(cmdMILoad->getDataDword()));
}

View File

@ -22,6 +22,7 @@ if(TESTS_GEN8)
set(IGDRCL_SRCS_tests_gen8
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/coherency_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_hw_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/device_tests_bwd.cpp
${CMAKE_CURRENT_SOURCE_DIR}/enqueue_media_kernel.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_tests.cpp

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2018, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include "runtime/command_queue/command_queue_hw.h"
#include "runtime/command_stream/command_stream_receiver.h"
#include "runtime/command_stream/linear_stream.h"
#include "runtime/gen_common/reg_configs.h"
#include "unit_tests/fixtures/device_fixture.h"
#include "unit_tests/helpers/hw_parse.h"
#include "unit_tests/mocks/mock_event.h"
#include "unit_tests/mocks/mock_kernel.h"
#include "unit_tests/mocks/mock_command_queue.h"
#include "unit_tests/mocks/mock_context.h"
#include "unit_tests/mocks/mock_csr.h"
#include "test.h"
#include "gtest/gtest.h"
using namespace OCLRT;
#include "unit_tests/command_stream/command_stream_receiver_hw_tests.inl"
using CommandStreamReceiverHwTestGen8 = CommandStreamReceiverHwTest<BDWFamily>;
GEN8TEST_F(CommandStreamReceiverHwTestGen8, GivenKernelWithSlmWhenPreviousNOSLML3WasSentThenProgramL3WithSLML3Config) {
givenKernelWithSlmWhenPreviousNOSLML3WasSentThenProgramL3WithSLML3ConfigImpl();
}
GEN8TEST_F(CommandStreamReceiverHwTestGen8, GivenBlockedKernelWithSlmWhenPreviousNOSLML3WasSentOnThenProgramL3WithSLML3ConfigAfterUnblocking) {
givenBlockedKernelWithSlmWhenPreviousNOSLML3WasSentOnThenProgramL3WithSLML3ConfigAfterUnblockingImpl();
}

View File

@ -23,12 +23,27 @@
#include "runtime/built_ins/built_ins.h"
#include "runtime/command_queue/command_queue_hw.h"
#include "runtime/command_stream/command_stream_receiver.h"
#include "runtime/command_stream/linear_stream.h"
#include "runtime/gen_common/reg_configs.h"
#include "unit_tests/fixtures/device_fixture.h"
#include "unit_tests/fixtures/ult_command_stream_receiver_fixture.h"
#include "unit_tests/mocks/mock_graphics_allocation.h"
#include "unit_tests/helpers/hw_parse.h"
#include "unit_tests/mocks/mock_event.h"
#include "unit_tests/mocks/mock_kernel.h"
#include "unit_tests/mocks/mock_command_queue.h"
#include "unit_tests/mocks/mock_context.h"
#include "unit_tests/mocks/mock_csr.h"
#include "test.h"
#include "gtest/gtest.h"
using namespace OCLRT;
#include "unit_tests/command_stream/command_stream_receiver_hw_tests.inl"
using CommandStreamReceiverHwTestGen9 = CommandStreamReceiverHwTest<SKLFamily>;
GEN9TEST_F(UltCommandStreamReceiverTest, givenNotSentPreambleAndMidThreadPreemptionWhenPreambleIsProgrammedThenCorrectSipKernelGpuAddressIsProgrammed) {
using STATE_SIP = typename FamilyType::STATE_SIP;
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
@ -92,3 +107,11 @@ GEN9TEST_F(UltCommandStreamReceiverTest, givenNotSentPreambleAndKernelDebuggingA
auto sipAddress = stateSipCmd->getSystemInstructionPointer();
EXPECT_EQ(dbgLocalSipAllocation->getGpuAddressToPatch(), sipAddress);
}
GEN9TEST_F(CommandStreamReceiverHwTestGen9, GivenKernelWithSlmWhenPreviousNOSLML3WasSentThenProgramL3WithSLML3Config) {
givenKernelWithSlmWhenPreviousNOSLML3WasSentThenProgramL3WithSLML3ConfigImpl();
}
GEN9TEST_F(CommandStreamReceiverHwTestGen9, GivenBlockedKernelWithSlmWhenPreviousNOSLML3WasSentOnThenProgramL3WithSLML3ConfigAfterUnblocking) {
givenBlockedKernelWithSlmWhenPreviousNOSLML3WasSentOnThenProgramL3WithSLML3ConfigAfterUnblockingImpl();
}