Refactor direct submission

Related-To: NEO-4338

Change-Id: Ic858a9324e5f892532d39c98a4029df9d2a64e46
Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2020-03-26 20:13:10 +01:00
committed by sys_ocldev
parent 5caa8bc28d
commit 49d3c39fae
34 changed files with 568 additions and 469 deletions

View File

@@ -177,17 +177,16 @@ bool WddmCommandStreamReceiver<GfxFamily>::initDirectSubmission(Device &device,
}
if (directSubmissionProperty.engineSupported && startDirect) {
if (contextEngineType == ENGINE_TYPE_BCS) {
directSubmission = std::make_unique<WddmDirectSubmission<GfxFamily>>(device,
std::make_unique<BlitterDispatcher<GfxFamily>>(),
osContext);
if (contextEngineType == aub_stream::ENGINE_BCS) {
blitterDirectSubmission = std::make_unique<
WddmDirectSubmission<GfxFamily, BlitterDispatcher<GfxFamily>>>(device, osContext);
ret = blitterDirectSubmission->initialize(directSubmissionProperty.submitOnInit);
} else {
directSubmission = std::make_unique<WddmDirectSubmission<GfxFamily>>(device,
std::make_unique<RenderDispatcher<GfxFamily>>(),
osContext);
directSubmission = std::make_unique<
WddmDirectSubmission<GfxFamily, RenderDispatcher<GfxFamily>>>(device, osContext);
ret = directSubmission->initialize(directSubmissionProperty.submitOnInit);
this->dispatchMode = DispatchMode::ImmediateDispatch;
}
ret = directSubmission->initialize(directSubmissionProperty.submitOnInit);
this->dispatchMode = DispatchMode::ImmediateDispatch;
}
}
return ret;

View File

@@ -35,6 +35,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
using BaseClass::getScratchSpaceController;
using BaseClass::indirectHeap;
using BaseClass::iohState;
using BaseClass::isBlitterDirectSubmissionEnabled;
using BaseClass::isDirectSubmissionEnabled;
using BaseClass::perDssBackedBuffer;
using BaseClass::programEnginePrologue;
@@ -54,6 +55,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
using BaseClass::CommandStreamReceiver::GSBAFor32BitProgrammed;
using BaseClass::CommandStreamReceiver::initDirectSubmission;
using BaseClass::CommandStreamReceiver::internalAllocationStorage;
using BaseClass::CommandStreamReceiver::isBlitterDirectSubmissionEnabled;
using BaseClass::CommandStreamReceiver::isDirectSubmissionEnabled;
using BaseClass::CommandStreamReceiver::isEnginePrologueSent;
using BaseClass::CommandStreamReceiver::isPreambleSent;
@@ -221,6 +223,17 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
}
return directSubmissionAvailable;
}
bool isBlitterDirectSubmissionEnabled() const override {
if (ultHwConfig.csrBaseCallBlitterDirectSubmissionAvailable) {
return BaseClass::isBlitterDirectSubmissionEnabled();
}
if (ultHwConfig.csrSuperBaseCallBlitterDirectSubmissionAvailable) {
return BaseClass::CommandStreamReceiver::isBlitterDirectSubmissionEnabled();
}
return blitterDirectSubmissionAvailable;
}
std::atomic<uint32_t> recursiveLockCounter;
bool createPageTableManagerCalled = false;
bool recordFlusheBatchBuffer = false;
@@ -240,5 +253,6 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
DispatchFlags recordedDispatchFlags;
bool multiOsContextCapable = false;
bool directSubmissionAvailable = false;
bool blitterDirectSubmissionAvailable = false;
};
} // namespace NEO

View File

@@ -87,6 +87,7 @@ struct MockWddmCsr : public WddmCommandStreamReceiver<GfxFamily> {
using CommandStreamReceiver::commandStream;
using CommandStreamReceiver::dispatchMode;
using CommandStreamReceiver::getCS;
using CommandStreamReceiverHw<GfxFamily>::blitterDirectSubmission;
using CommandStreamReceiverHw<GfxFamily>::directSubmission;
using WddmCommandStreamReceiver<GfxFamily>::commandBufferHeader;
using WddmCommandStreamReceiver<GfxFamily>::WddmCommandStreamReceiver;
@@ -962,6 +963,7 @@ TEST_F(WddmCommandStreamTest, whenDirectSubmissionDisabledThenExpectNoFeatureAva
bool ret = csr->initDirectSubmission(*device.get(), *osContext.get());
EXPECT_TRUE(ret);
EXPECT_FALSE(csr->isDirectSubmissionEnabled());
EXPECT_FALSE(csr->isBlitterDirectSubmissionEnabled());
}
TEST_F(WddmCommandStreamTest, whenDirectSubmissionEnabledOnRcsThenExpectFeatureAvailable) {
@@ -973,6 +975,7 @@ TEST_F(WddmCommandStreamTest, whenDirectSubmissionEnabledOnRcsThenExpectFeatureA
bool ret = csr->initDirectSubmission(*device.get(), *osContext.get());
EXPECT_TRUE(ret);
EXPECT_TRUE(csr->isDirectSubmissionEnabled());
EXPECT_FALSE(csr->isBlitterDirectSubmissionEnabled());
}
TEST_F(WddmCommandStreamTest, givenDirectSubmissionEnabledWhenPlatformNotSupportsRcsThenExpectFeatureNotAvailable) {
@@ -999,7 +1002,8 @@ TEST_F(WddmCommandStreamTest, whenDirectSubmissionEnabledOnBcsThenExpectFeatureA
bool ret = csr->initDirectSubmission(*device.get(), *osContext.get());
EXPECT_TRUE(ret);
EXPECT_TRUE(csr->isDirectSubmissionEnabled());
EXPECT_FALSE(csr->isDirectSubmissionEnabled());
EXPECT_TRUE(csr->isBlitterDirectSubmissionEnabled());
}
TEST_F(WddmCommandStreamTest, givenDirectSubmissionEnabledWhenPlatformNotSupportsBcsThenExpectFeatureNotAvailable) {
@@ -1016,6 +1020,7 @@ TEST_F(WddmCommandStreamTest, givenDirectSubmissionEnabledWhenPlatformNotSupport
bool ret = csr->initDirectSubmission(*device.get(), *osContext.get());
EXPECT_TRUE(ret);
EXPECT_FALSE(csr->isDirectSubmissionEnabled());
EXPECT_FALSE(csr->isBlitterDirectSubmissionEnabled());
}
TEST_F(WddmCommandStreamTest, givenLowPriorityContextWhenDirectSubmissionDisabledOnLowPriorityThenExpectFeatureNotAvailable) {

View File

@@ -30,7 +30,7 @@ void NEO::UltConfigListener::OnTestEnd(const ::testing::TestInfo &testInfo) {
// Ensure that global state is restored
UltHwConfig expectedState{};
static_assert(sizeof(UltHwConfig) == 7 * sizeof(bool), ""); // Ensure that there is no internal padding
static_assert(sizeof(UltHwConfig) == 9 * sizeof(bool), ""); // Ensure that there is no internal padding
EXPECT_EQ(0, memcmp(&expectedState, &ultHwConfig, sizeof(UltHwConfig)));
EXPECT_EQ(0, memcmp(&referencedHwInfo, defaultHwInfo.get(), sizeof(HardwareInfo)));
}

View File

@@ -202,6 +202,10 @@ class CommandStreamReceiver {
return false;
}
virtual bool isBlitterDirectSubmissionEnabled() const {
return false;
}
bool isRcs() const;
protected:

View File

@@ -7,6 +7,9 @@
#pragma once
#include "shared/source/command_stream/command_stream_receiver.h"
#include "shared/source/direct_submission/direct_submission_hw.h"
#include "shared/source/direct_submission/dispatchers/blitter_dispatcher.h"
#include "shared/source/direct_submission/dispatchers/render_dispatcher.h"
#include "shared/source/execution_environment/execution_environment.h"
#include "shared/source/helpers/dirty_state_helpers.h"
#include "shared/source/helpers/hw_cmds.h"
@@ -15,8 +18,6 @@
namespace NEO {
template <typename GfxFamily>
class DeviceCommandStreamReceiver;
template <typename GfxFamily>
class DirectSubmissionHw;
template <typename GfxFamily>
class CommandStreamReceiverHw : public CommandStreamReceiver {
@@ -87,6 +88,10 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
return directSubmission.get() != nullptr;
}
bool isBlitterDirectSubmissionEnabled() const override {
return blitterDirectSubmission.get() != nullptr;
}
protected:
void programPreemption(LinearStream &csr, DispatchFlags &dispatchFlags);
void programL3(LinearStream &csr, DispatchFlags &dispatchFlags, uint32_t &newL3Config);
@@ -123,7 +128,8 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
CsrSizeRequestFlags csrSizeRequestFlags = {};
std::unique_ptr<DirectSubmissionHw<GfxFamily>> directSubmission;
std::unique_ptr<DirectSubmissionHw<GfxFamily, RenderDispatcher<GfxFamily>>> directSubmission;
std::unique_ptr<DirectSubmissionHw<GfxFamily, BlitterDispatcher<GfxFamily>>> blitterDirectSubmission;
};
} // namespace NEO

View File

@@ -40,14 +40,12 @@ class FlushStampTracker;
class GraphicsAllocation;
struct HardwareInfo;
class Device;
class Dispatcher;
class OsContext;
template <typename GfxFamily>
template <typename GfxFamily, typename Dispatcher>
class DirectSubmissionHw {
public:
DirectSubmissionHw(Device &device,
std::unique_ptr<Dispatcher> cmdDispatcher,
OsContext &osContext);
virtual ~DirectSubmissionHw();
@@ -111,7 +109,6 @@ class DirectSubmissionHw {
};
LinearStream ringCommandStream;
std::unique_ptr<Dispatcher> cmdDispatcher;
FlushStamp completionRingBuffers[RingBufferUse::MaxBuffers] = {0ull, 0ull};
uint64_t semaphoreGpuVa = 0u;

View File

@@ -10,7 +10,6 @@
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/device/device.h"
#include "shared/source/direct_submission/direct_submission_hw.h"
#include "shared/source/direct_submission/dispatchers/dispatcher.h"
#include "shared/source/helpers/flush_stamp.h"
#include "shared/source/helpers/ptr_math.h"
#include "shared/source/memory_manager/allocation_properties.h"
@@ -24,14 +23,12 @@
namespace NEO {
template <typename GfxFamily>
DirectSubmissionHw<GfxFamily>::DirectSubmissionHw(Device &device,
std::unique_ptr<Dispatcher> cmdDispatcher,
OsContext &osContext)
template <typename GfxFamily, typename Dispatcher>
DirectSubmissionHw<GfxFamily, Dispatcher>::DirectSubmissionHw(Device &device,
OsContext &osContext)
: device(device), osContext(osContext) {
UNRECOVERABLE_IF(!CpuInfo::getInstance().isFeatureSupported(CpuInfo::featureClflush));
this->cmdDispatcher = std::move(cmdDispatcher);
int32_t disableCacheFlushKey = DebugManager.flags.DirectSubmissionDisableCpuCacheFlush.get();
if (disableCacheFlushKey != -1) {
disableCpuCacheFlush = disableCacheFlushKey == 1 ? true : false;
@@ -42,12 +39,12 @@ DirectSubmissionHw<GfxFamily>::DirectSubmissionHw(Device &device,
hwInfo = &device.getHardwareInfo();
}
template <typename GfxFamily>
DirectSubmissionHw<GfxFamily>::~DirectSubmissionHw() {
template <typename GfxFamily, typename Dispatcher>
DirectSubmissionHw<GfxFamily, Dispatcher>::~DirectSubmissionHw() {
}
template <typename GfxFamily>
bool DirectSubmissionHw<GfxFamily>::allocateResources() {
template <typename GfxFamily, typename Dispatcher>
bool DirectSubmissionHw<GfxFamily, Dispatcher>::allocateResources() {
DirectSubmissionAllocations allocations;
bool isMultiOsContextCapable = osContext.getNumSupportedDevices() > 1u;
@@ -91,8 +88,8 @@ bool DirectSubmissionHw<GfxFamily>::allocateResources() {
return allocateOsResources(allocations);
}
template <typename GfxFamily>
inline void DirectSubmissionHw<GfxFamily>::cpuCachelineFlush(void *ptr, size_t size) {
template <typename GfxFamily, typename Dispatcher>
inline void DirectSubmissionHw<GfxFamily, Dispatcher>::cpuCachelineFlush(void *ptr, size_t size) {
if (disableCpuCacheFlush) {
return;
}
@@ -110,13 +107,13 @@ inline void DirectSubmissionHw<GfxFamily>::cpuCachelineFlush(void *ptr, size_t s
}
}
template <typename GfxFamily>
bool DirectSubmissionHw<GfxFamily>::initialize(bool submitOnInit) {
template <typename GfxFamily, typename Dispatcher>
bool DirectSubmissionHw<GfxFamily, Dispatcher>::initialize(bool submitOnInit) {
bool ret = allocateResources();
if (ret && submitOnInit) {
size_t startBufferSize = cmdDispatcher->getSizePreemption() +
size_t startBufferSize = Dispatcher::getSizePreemption() +
getSizeSemaphoreSection();
cmdDispatcher->dispatchPreemption(ringCommandStream);
Dispatcher::dispatchPreemption(ringCommandStream);
dispatchSemaphoreSection(currentQueueWorkCount);
ringStart = submit(ringCommandStream.getGraphicsAllocation()->getGpuAddress(), startBufferSize);
@@ -125,8 +122,8 @@ bool DirectSubmissionHw<GfxFamily>::initialize(bool submitOnInit) {
return ret;
}
template <typename GfxFamily>
bool DirectSubmissionHw<GfxFamily>::startRingBuffer() {
template <typename GfxFamily, typename Dispatcher>
bool DirectSubmissionHw<GfxFamily, Dispatcher>::startRingBuffer() {
if (ringStart) {
return true;
}
@@ -145,8 +142,8 @@ bool DirectSubmissionHw<GfxFamily>::startRingBuffer() {
return ringStart;
}
template <typename GfxFamily>
bool DirectSubmissionHw<GfxFamily>::stopRingBuffer() {
template <typename GfxFamily, typename Dispatcher>
bool DirectSubmissionHw<GfxFamily, Dispatcher>::stopRingBuffer() {
void *flushPtr = ringCommandStream.getSpace(0);
dispatchFlushSection();
if (disableMonitorFence) {
@@ -163,8 +160,8 @@ bool DirectSubmissionHw<GfxFamily>::stopRingBuffer() {
return true;
}
template <typename GfxFamily>
inline void *DirectSubmissionHw<GfxFamily>::dispatchSemaphoreSection(uint32_t value) {
template <typename GfxFamily, typename Dispatcher>
inline void *DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchSemaphoreSection(uint32_t value) {
using MI_SEMAPHORE_WAIT = typename GfxFamily::MI_SEMAPHORE_WAIT;
using COMPARE_OPERATION = typename GfxFamily::MI_SEMAPHORE_WAIT::COMPARE_OPERATION;
@@ -179,103 +176,79 @@ inline void *DirectSubmissionHw<GfxFamily>::dispatchSemaphoreSection(uint32_t va
return semaphorePosition;
}
template <typename GfxFamily>
inline size_t DirectSubmissionHw<GfxFamily>::getSizeSemaphoreSection() {
template <typename GfxFamily, typename Dispatcher>
inline size_t DirectSubmissionHw<GfxFamily, Dispatcher>::getSizeSemaphoreSection() {
size_t semaphoreSize = EncodeSempahore<GfxFamily>::getSizeMiSemaphoreWait();
return (semaphoreSize + prefetchSize);
}
template <typename GfxFamily>
inline void DirectSubmissionHw<GfxFamily>::dispatchStartSection(uint64_t gpuStartAddress) {
using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START;
auto bbufferStart = ringCommandStream.getSpaceForCmd<MI_BATCH_BUFFER_START>();
*bbufferStart = GfxFamily::cmdInitBatchBufferStart;
bbufferStart->setBatchBufferStartAddressGraphicsaddress472(gpuStartAddress);
bbufferStart->setAddressSpaceIndicator(MI_BATCH_BUFFER_START::ADDRESS_SPACE_INDICATOR_PPGTT);
template <typename GfxFamily, typename Dispatcher>
inline void DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchStartSection(uint64_t gpuStartAddress) {
Dispatcher::dispatchStartCommandBuffer(ringCommandStream, gpuStartAddress);
}
template <typename GfxFamily>
inline size_t DirectSubmissionHw<GfxFamily>::getSizeStartSection() {
using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START;
size_t size = sizeof(MI_BATCH_BUFFER_START);
return size;
template <typename GfxFamily, typename Dispatcher>
inline size_t DirectSubmissionHw<GfxFamily, Dispatcher>::getSizeStartSection() {
return Dispatcher::getSizeStartCommandBuffer();
}
template <typename GfxFamily>
inline void DirectSubmissionHw<GfxFamily>::dispatchSwitchRingBufferSection(uint64_t nextBufferGpuAddress) {
using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START;
auto bbufferStart = ringCommandStream.getSpaceForCmd<MI_BATCH_BUFFER_START>();
*bbufferStart = GfxFamily::cmdInitBatchBufferStart;
bbufferStart->setBatchBufferStartAddressGraphicsaddress472(nextBufferGpuAddress);
bbufferStart->setAddressSpaceIndicator(MI_BATCH_BUFFER_START::ADDRESS_SPACE_INDICATOR_PPGTT);
template <typename GfxFamily, typename Dispatcher>
inline void DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchSwitchRingBufferSection(uint64_t nextBufferGpuAddress) {
Dispatcher::dispatchStartCommandBuffer(ringCommandStream, nextBufferGpuAddress);
}
template <typename GfxFamily>
inline size_t DirectSubmissionHw<GfxFamily>::getSizeSwitchRingBufferSection() {
using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START;
return sizeof(MI_BATCH_BUFFER_START);
template <typename GfxFamily, typename Dispatcher>
inline size_t DirectSubmissionHw<GfxFamily, Dispatcher>::getSizeSwitchRingBufferSection() {
return Dispatcher::getSizeStartCommandBuffer();
}
template <typename GfxFamily>
inline void *DirectSubmissionHw<GfxFamily>::dispatchFlushSection() {
template <typename GfxFamily, typename Dispatcher>
inline void *DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchFlushSection() {
void *currentPosition = ringCommandStream.getSpace(0);
cmdDispatcher->dispatchCacheFlush(ringCommandStream, *hwInfo);
Dispatcher::dispatchCacheFlush(ringCommandStream, *hwInfo);
return currentPosition;
}
template <typename GfxFamily>
inline size_t DirectSubmissionHw<GfxFamily>::getSizeFlushSection() {
return cmdDispatcher->getSizeCacheFlush(*hwInfo);
template <typename GfxFamily, typename Dispatcher>
inline size_t DirectSubmissionHw<GfxFamily, Dispatcher>::getSizeFlushSection() {
return Dispatcher::getSizeCacheFlush(*hwInfo);
}
template <typename GfxFamily>
inline void *DirectSubmissionHw<GfxFamily>::dispatchTagUpdateSection(uint64_t address, uint64_t value) {
template <typename GfxFamily, typename Dispatcher>
inline void *DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchTagUpdateSection(uint64_t address, uint64_t value) {
void *currentPosition = ringCommandStream.getSpace(0);
cmdDispatcher->dispatchMonitorFence(ringCommandStream, address, value, *hwInfo);
Dispatcher::dispatchMonitorFence(ringCommandStream, address, value, *hwInfo);
return currentPosition;
}
template <typename GfxFamily>
inline size_t DirectSubmissionHw<GfxFamily>::getSizeTagUpdateSection() {
size_t size = cmdDispatcher->getSizeMonitorFence(*hwInfo);
template <typename GfxFamily, typename Dispatcher>
inline size_t DirectSubmissionHw<GfxFamily, Dispatcher>::getSizeTagUpdateSection() {
size_t size = Dispatcher::getSizeMonitorFence(*hwInfo);
return size;
}
template <typename GfxFamily>
inline void DirectSubmissionHw<GfxFamily>::dispatchEndingSection() {
using MI_BATCH_BUFFER_END = typename GfxFamily::MI_BATCH_BUFFER_END;
auto bbufferEnd = ringCommandStream.getSpaceForCmd<MI_BATCH_BUFFER_END>();
*bbufferEnd = GfxFamily::cmdInitBatchBufferEnd;
template <typename GfxFamily, typename Dispatcher>
inline void DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchEndingSection() {
Dispatcher::dispatchStopCommandBuffer(ringCommandStream);
}
template <typename GfxFamily>
inline size_t DirectSubmissionHw<GfxFamily>::getSizeEndingSection() {
using MI_BATCH_BUFFER_END = typename GfxFamily::MI_BATCH_BUFFER_END;
return sizeof(MI_BATCH_BUFFER_END);
template <typename GfxFamily, typename Dispatcher>
inline size_t DirectSubmissionHw<GfxFamily, Dispatcher>::getSizeEndingSection() {
return Dispatcher::getSizeStopCommandBuffer();
}
template <typename GfxFamily>
inline void DirectSubmissionHw<GfxFamily>::dispatchStoreDataSection(uint64_t gpuVa, uint32_t value) {
using MI_STORE_DATA_IMM = typename GfxFamily::MI_STORE_DATA_IMM;
auto storeDataImmediate = ringCommandStream.getSpaceForCmd<MI_STORE_DATA_IMM>();
*storeDataImmediate = GfxFamily::cmdInitStoreDataImm;
storeDataImmediate->setAddress(gpuVa);
storeDataImmediate->setDataDword0(value);
template <typename GfxFamily, typename Dispatcher>
inline void DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchStoreDataSection(uint64_t gpuVa, uint32_t value) {
Dispatcher::dispatchStoreDwordCommand(ringCommandStream, gpuVa, value);
}
template <typename GfxFamily>
inline size_t DirectSubmissionHw<GfxFamily>::getSizeStoraDataSection() {
using MI_STORE_DATA_IMM = typename GfxFamily::MI_STORE_DATA_IMM;
return sizeof(MI_STORE_DATA_IMM);
template <typename GfxFamily, typename Dispatcher>
inline size_t DirectSubmissionHw<GfxFamily, Dispatcher>::getSizeStoraDataSection() {
return Dispatcher::getSizeStoreDwordCommand();
}
template <typename GfxFamily>
inline size_t DirectSubmissionHw<GfxFamily>::getSizeEnd() {
template <typename GfxFamily, typename Dispatcher>
inline size_t DirectSubmissionHw<GfxFamily, Dispatcher>::getSizeEnd() {
size_t size = getSizeEndingSection() +
getSizeFlushSection();
if (disableMonitorFence) {
@@ -284,16 +257,16 @@ inline size_t DirectSubmissionHw<GfxFamily>::getSizeEnd() {
return size;
}
template <typename GfxFamily>
inline uint64_t DirectSubmissionHw<GfxFamily>::getCommandBufferPositionGpuAddress(void *position) {
template <typename GfxFamily, typename Dispatcher>
inline uint64_t DirectSubmissionHw<GfxFamily, Dispatcher>::getCommandBufferPositionGpuAddress(void *position) {
void *currentBase = ringCommandStream.getCpuBase();
size_t offset = ptrDiff(position, currentBase);
return ringCommandStream.getGraphicsAllocation()->getGpuAddress() + static_cast<uint64_t>(offset);
}
template <typename GfxFamily>
inline size_t DirectSubmissionHw<GfxFamily>::getSizeDispatch() {
template <typename GfxFamily, typename Dispatcher>
inline size_t DirectSubmissionHw<GfxFamily, Dispatcher>::getSizeDispatch() {
size_t size = getSizeSemaphoreSection();
if (workloadMode == 0) {
size += getSizeStartSection();
@@ -312,8 +285,8 @@ inline size_t DirectSubmissionHw<GfxFamily>::getSizeDispatch() {
return size;
}
template <typename GfxFamily>
void *DirectSubmissionHw<GfxFamily>::dispatchWorkloadSection(BatchBuffer &batchBuffer) {
template <typename GfxFamily, typename Dispatcher>
void *DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchWorkloadSection(BatchBuffer &batchBuffer) {
void *currentPosition = ringCommandStream.getSpace(0);
if (workloadMode == 0) {
@@ -345,8 +318,11 @@ void *DirectSubmissionHw<GfxFamily>::dispatchWorkloadSection(BatchBuffer &batchB
return currentPosition;
}
template <typename GfxFamily>
bool DirectSubmissionHw<GfxFamily>::dispatchCommandBuffer(BatchBuffer &batchBuffer, FlushStampTracker &flushStamp) {
template <typename GfxFamily, typename Dispatcher>
bool DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchCommandBuffer(BatchBuffer &batchBuffer, FlushStampTracker &flushStamp) {
//for now workloads requiring cache coherency are not supported
UNRECOVERABLE_IF(batchBuffer.requiresCoherency);
size_t dispatchSize = getSizeDispatch();
size_t cycleSize = getSizeSwitchRingBufferSection();
size_t requiredMinimalSize = dispatchSize + cycleSize + getSizeEnd();
@@ -386,16 +362,16 @@ bool DirectSubmissionHw<GfxFamily>::dispatchCommandBuffer(BatchBuffer &batchBuff
return ringStart;
}
template <typename GfxFamily>
inline void DirectSubmissionHw<GfxFamily>::setReturnAddress(void *returnCmd, uint64_t returnAddress) {
template <typename GfxFamily, typename Dispatcher>
inline void DirectSubmissionHw<GfxFamily, Dispatcher>::setReturnAddress(void *returnCmd, uint64_t returnAddress) {
using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START;
MI_BATCH_BUFFER_START *returnBBStart = static_cast<MI_BATCH_BUFFER_START *>(returnCmd);
returnBBStart->setBatchBufferStartAddressGraphicsaddress472(returnAddress);
}
template <typename GfxFamily>
inline GraphicsAllocation *DirectSubmissionHw<GfxFamily>::switchRingBuffersAllocations() {
template <typename GfxFamily, typename Dispatcher>
inline GraphicsAllocation *DirectSubmissionHw<GfxFamily, Dispatcher>::switchRingBuffersAllocations() {
GraphicsAllocation *nextAllocation = nullptr;
if (currentRingBuffer == RingBufferUse::FirstBuffer) {
nextAllocation = ringBuffer2;
@@ -407,8 +383,8 @@ inline GraphicsAllocation *DirectSubmissionHw<GfxFamily>::switchRingBuffersAlloc
return nextAllocation;
}
template <typename GfxFamily>
void DirectSubmissionHw<GfxFamily>::deallocateResources() {
template <typename GfxFamily, typename Dispatcher>
void DirectSubmissionHw<GfxFamily, Dispatcher>::deallocateResources() {
MemoryManager *memoryManager = device.getExecutionEnvironment()->memoryManager.get();
if (ringBuffer) {

View File

@@ -9,6 +9,7 @@ set(NEO_CORE_DIRECT_SUBMISSION_DISPATCHERS
${CMAKE_CURRENT_SOURCE_DIR}/blitter_dispatcher.h
${CMAKE_CURRENT_SOURCE_DIR}/blitter_dispatcher.inl
${CMAKE_CURRENT_SOURCE_DIR}/dispatcher.h
${CMAKE_CURRENT_SOURCE_DIR}/dispatcher.inl
${CMAKE_CURRENT_SOURCE_DIR}/render_dispatcher.h
${CMAKE_CURRENT_SOURCE_DIR}/render_dispatcher.inl
)

View File

@@ -11,20 +11,18 @@
namespace NEO {
template <typename GfxFamily>
class BlitterDispatcher : public Dispatcher {
class BlitterDispatcher : public Dispatcher<GfxFamily> {
public:
BlitterDispatcher() = default;
static void dispatchPreemption(LinearStream &cmdBuffer);
static size_t getSizePreemption();
void dispatchPreemption(LinearStream &cmdBuffer) override;
size_t getSizePreemption() override;
static void dispatchMonitorFence(LinearStream &cmdBuffer,
uint64_t gpuAddress,
uint64_t immediateData,
const HardwareInfo &hwInfo);
static size_t getSizeMonitorFence(const HardwareInfo &hwInfo);
void dispatchMonitorFence(LinearStream &cmdBuffer,
uint64_t gpuAddress,
uint64_t immediateData,
const HardwareInfo &hwInfo) override;
size_t getSizeMonitorFence(const HardwareInfo &hwInfo) override;
void dispatchCacheFlush(LinearStream &cmdBuffer, const HardwareInfo &hwInfo) override;
size_t getSizeCacheFlush(const HardwareInfo &hwInfo) override;
static void dispatchCacheFlush(LinearStream &cmdBuffer, const HardwareInfo &hwInfo);
static size_t getSizeCacheFlush(const HardwareInfo &hwInfo);
};
} // namespace NEO

View File

@@ -6,7 +6,6 @@
*/
#pragma once
#include <cstddef>
#include <cstdint>
@@ -15,21 +14,16 @@ namespace NEO {
struct HardwareInfo;
class LinearStream;
template <typename GfxFamily>
class Dispatcher {
public:
Dispatcher() = default;
virtual ~Dispatcher() = default;
static void dispatchStartCommandBuffer(LinearStream &cmdBuffer, uint64_t gpuStartAddress);
static size_t getSizeStartCommandBuffer();
virtual void dispatchPreemption(LinearStream &cmdBuffer) = 0;
virtual size_t getSizePreemption() = 0;
static void dispatchStopCommandBuffer(LinearStream &cmdBuffer);
static size_t getSizeStopCommandBuffer();
virtual void dispatchMonitorFence(LinearStream &cmdBuffer,
uint64_t gpuAddress,
uint64_t immediateData,
const HardwareInfo &hwInfo) = 0;
virtual size_t getSizeMonitorFence(const HardwareInfo &hwInfo) = 0;
virtual void dispatchCacheFlush(LinearStream &cmdBuffer, const HardwareInfo &hwInfo) = 0;
virtual size_t getSizeCacheFlush(const HardwareInfo &hwInfo) = 0;
static void dispatchStoreDwordCommand(LinearStream &cmdBuffer, uint64_t gpuVa, uint32_t value);
static size_t getSizeStoreDwordCommand();
};
} // namespace NEO

View File

@@ -0,0 +1,61 @@
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/command_stream/linear_stream.h"
#include "shared/source/direct_submission/dispatchers/dispatcher.h"
namespace NEO {
class LinearStream;
template <typename GfxFamily>
inline void Dispatcher<GfxFamily>::dispatchStartCommandBuffer(LinearStream &cmdBuffer, uint64_t gpuStartAddress) {
using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START;
auto bbufferStart = cmdBuffer.getSpaceForCmd<MI_BATCH_BUFFER_START>();
*bbufferStart = GfxFamily::cmdInitBatchBufferStart;
bbufferStart->setBatchBufferStartAddressGraphicsaddress472(gpuStartAddress);
bbufferStart->setAddressSpaceIndicator(MI_BATCH_BUFFER_START::ADDRESS_SPACE_INDICATOR_PPGTT);
}
template <typename GfxFamily>
inline size_t Dispatcher<GfxFamily>::getSizeStartCommandBuffer() {
using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START;
return sizeof(MI_BATCH_BUFFER_START);
}
template <typename GfxFamily>
inline void Dispatcher<GfxFamily>::dispatchStopCommandBuffer(LinearStream &cmdBuffer) {
using MI_BATCH_BUFFER_END = typename GfxFamily::MI_BATCH_BUFFER_END;
auto bbufferEnd = cmdBuffer.getSpaceForCmd<MI_BATCH_BUFFER_END>();
*bbufferEnd = GfxFamily::cmdInitBatchBufferEnd;
}
template <typename GfxFamily>
inline size_t Dispatcher<GfxFamily>::getSizeStopCommandBuffer() {
using MI_BATCH_BUFFER_END = typename GfxFamily::MI_BATCH_BUFFER_END;
return sizeof(MI_BATCH_BUFFER_END);
}
template <typename GfxFamily>
inline void Dispatcher<GfxFamily>::dispatchStoreDwordCommand(LinearStream &cmdBuffer, uint64_t gpuVa, uint32_t value) {
using MI_STORE_DATA_IMM = typename GfxFamily::MI_STORE_DATA_IMM;
auto storeDataImmediate = cmdBuffer.getSpaceForCmd<MI_STORE_DATA_IMM>();
*storeDataImmediate = GfxFamily::cmdInitStoreDataImm;
storeDataImmediate->setAddress(gpuVa);
storeDataImmediate->setDataDword0(value);
}
template <typename GfxFamily>
inline size_t Dispatcher<GfxFamily>::getSizeStoreDwordCommand() {
using MI_STORE_DATA_IMM = typename GfxFamily::MI_STORE_DATA_IMM;
return sizeof(MI_STORE_DATA_IMM);
}
} // namespace NEO

View File

@@ -11,20 +11,18 @@
namespace NEO {
template <typename GfxFamily>
class RenderDispatcher : public Dispatcher {
class RenderDispatcher : public Dispatcher<GfxFamily> {
public:
RenderDispatcher() = default;
static void dispatchPreemption(LinearStream &cmdBuffer);
static size_t getSizePreemption();
void dispatchPreemption(LinearStream &cmdBuffer) override;
size_t getSizePreemption() override;
static void dispatchMonitorFence(LinearStream &cmdBuffer,
uint64_t gpuAddress,
uint64_t immediateData,
const HardwareInfo &hwInfo);
static size_t getSizeMonitorFence(const HardwareInfo &hwInfo);
void dispatchMonitorFence(LinearStream &cmdBuffer,
uint64_t gpuAddress,
uint64_t immediateData,
const HardwareInfo &hwInfo) override;
size_t getSizeMonitorFence(const HardwareInfo &hwInfo) override;
void dispatchCacheFlush(LinearStream &cmdBuffer, const HardwareInfo &hwInfo) override;
size_t getSizeCacheFlush(const HardwareInfo &hwInfo) override;
static void dispatchCacheFlush(LinearStream &cmdBuffer, const HardwareInfo &hwInfo);
static size_t getSizeCacheFlush(const HardwareInfo &hwInfo);
};
} // namespace NEO

View File

@@ -10,17 +10,13 @@
namespace NEO {
class OsContextWin;
class Wddm;
template <typename GfxFamily>
class DrmDirectSubmission : public DirectSubmissionHw<GfxFamily> {
template <typename GfxFamily, typename Dispatcher>
class DrmDirectSubmission : public DirectSubmissionHw<GfxFamily, Dispatcher> {
public:
using DirectSubmissionHw<GfxFamily>::ringCommandStream;
using DirectSubmissionHw<GfxFamily>::switchRingBuffersAllocations;
using DirectSubmissionHw<GfxFamily, Dispatcher>::ringCommandStream;
using DirectSubmissionHw<GfxFamily, Dispatcher>::switchRingBuffersAllocations;
DrmDirectSubmission(Device &device,
std::unique_ptr<Dispatcher> cmdDispatcher,
OsContext &osContext);
protected:

View File

@@ -11,40 +11,39 @@
namespace NEO {
template <typename GfxFamily>
DrmDirectSubmission<GfxFamily>::DrmDirectSubmission(Device &device,
std::unique_ptr<Dispatcher> cmdDispatcher,
OsContext &osContext)
: DirectSubmissionHw<GfxFamily>(device, std::move(cmdDispatcher), osContext) {
template <typename GfxFamily, typename Dispatcher>
DrmDirectSubmission<GfxFamily, Dispatcher>::DrmDirectSubmission(Device &device,
OsContext &osContext)
: DirectSubmissionHw<GfxFamily, Dispatcher>(device, osContext) {
}
template <typename GfxFamily>
bool DrmDirectSubmission<GfxFamily>::allocateOsResources(DirectSubmissionAllocations &allocations) {
template <typename GfxFamily, typename Dispatcher>
bool DrmDirectSubmission<GfxFamily, Dispatcher>::allocateOsResources(DirectSubmissionAllocations &allocations) {
return false;
}
template <typename GfxFamily>
bool DrmDirectSubmission<GfxFamily>::submit(uint64_t gpuAddress, size_t size) {
template <typename GfxFamily, typename Dispatcher>
bool DrmDirectSubmission<GfxFamily, Dispatcher>::submit(uint64_t gpuAddress, size_t size) {
return false;
}
template <typename GfxFamily>
bool DrmDirectSubmission<GfxFamily>::handleResidency() {
template <typename GfxFamily, typename Dispatcher>
bool DrmDirectSubmission<GfxFamily, Dispatcher>::handleResidency() {
return false;
}
template <typename GfxFamily>
uint64_t DrmDirectSubmission<GfxFamily>::switchRingBuffers() {
template <typename GfxFamily, typename Dispatcher>
uint64_t DrmDirectSubmission<GfxFamily, Dispatcher>::switchRingBuffers() {
return 0ull;
}
template <typename GfxFamily>
uint64_t DrmDirectSubmission<GfxFamily>::updateTagValue() {
template <typename GfxFamily, typename Dispatcher>
uint64_t DrmDirectSubmission<GfxFamily, Dispatcher>::updateTagValue() {
return 0ull;
}
template <typename GfxFamily>
void DrmDirectSubmission<GfxFamily>::getTagAddressValue(TagData &tagData) {
template <typename GfxFamily, typename Dispatcher>
void DrmDirectSubmission<GfxFamily, Dispatcher>::getTagAddressValue(TagData &tagData) {
tagData.tagAddress = 0ull;
tagData.tagValue = 0ull;
}

View File

@@ -16,11 +16,10 @@ namespace NEO {
class OsContextWin;
class Wddm;
template <typename GfxFamily>
class WddmDirectSubmission : public DirectSubmissionHw<GfxFamily> {
template <typename GfxFamily, typename Dispatcher>
class WddmDirectSubmission : public DirectSubmissionHw<GfxFamily, Dispatcher> {
public:
WddmDirectSubmission(Device &device,
std::unique_ptr<Dispatcher> cmdDispatcher,
OsContext &osContext);
~WddmDirectSubmission();

View File

@@ -20,11 +20,10 @@ namespace NEO {
// Initialize COMMAND_BUFFER_HEADER Type PatchList Streamer Perf Tag
DECLARE_COMMAND_BUFFER(CommandBufferHeader, UMD_OCL, FALSE, FALSE, PERFTAG_OCL);
template <typename GfxFamily>
WddmDirectSubmission<GfxFamily>::WddmDirectSubmission(Device &device,
std::unique_ptr<Dispatcher> cmdDispatcher,
OsContext &osContext)
: DirectSubmissionHw<GfxFamily>(device, std::move(cmdDispatcher), osContext) {
template <typename GfxFamily, typename Dispatcher>
WddmDirectSubmission<GfxFamily, Dispatcher>::WddmDirectSubmission(Device &device,
OsContext &osContext)
: DirectSubmissionHw<GfxFamily, Dispatcher>(device, osContext) {
osContextWin = reinterpret_cast<OsContextWin *>(&osContext);
wddm = osContextWin->getWddm();
commandBufferHeader = std::make_unique<COMMAND_BUFFER_HEADER_REC>();
@@ -34,18 +33,18 @@ WddmDirectSubmission<GfxFamily>::WddmDirectSubmission(Device &device,
}
}
template <typename GfxFamily>
WddmDirectSubmission<GfxFamily>::~WddmDirectSubmission() {
template <typename GfxFamily, typename Dispatcher>
WddmDirectSubmission<GfxFamily, Dispatcher>::~WddmDirectSubmission() {
if (ringStart) {
stopRingBuffer();
WddmDirectSubmission<GfxFamily>::handleCompletionRingBuffer(ringFence.lastSubmittedFence, ringFence);
WddmDirectSubmission<GfxFamily, Dispatcher>::handleCompletionRingBuffer(ringFence.lastSubmittedFence, ringFence);
}
deallocateResources();
wddm->getWddmInterface()->destroyMonitorFence(ringFence);
}
template <typename GfxFamily>
bool WddmDirectSubmission<GfxFamily>::allocateOsResources(DirectSubmissionAllocations &allocations) {
template <typename GfxFamily, typename Dispatcher>
bool WddmDirectSubmission<GfxFamily, Dispatcher>::allocateOsResources(DirectSubmissionAllocations &allocations) {
//for now only WDDM2.0
UNRECOVERABLE_IF(wddm->getWddmVersion() != WddmVersion::WDDM_2_0);
@@ -61,8 +60,8 @@ bool WddmDirectSubmission<GfxFamily>::allocateOsResources(DirectSubmissionAlloca
return ret;
}
template <typename GfxFamily>
bool WddmDirectSubmission<GfxFamily>::submit(uint64_t gpuAddress, size_t size) {
template <typename GfxFamily, typename Dispatcher>
bool WddmDirectSubmission<GfxFamily, Dispatcher>::submit(uint64_t gpuAddress, size_t size) {
COMMAND_BUFFER_HEADER *pHeader = reinterpret_cast<COMMAND_BUFFER_HEADER *>(commandBufferHeader.get());
pHeader->RequiresCoherency = false;
@@ -80,14 +79,14 @@ bool WddmDirectSubmission<GfxFamily>::submit(uint64_t gpuAddress, size_t size) {
return wddm->submit(gpuAddress, size, pHeader, submitArgs);
}
template <typename GfxFamily>
bool WddmDirectSubmission<GfxFamily>::handleResidency() {
template <typename GfxFamily, typename Dispatcher>
bool WddmDirectSubmission<GfxFamily, Dispatcher>::handleResidency() {
wddm->waitOnPagingFenceFromCpu();
return true;
}
template <typename GfxFamily>
uint64_t WddmDirectSubmission<GfxFamily>::switchRingBuffers() {
template <typename GfxFamily, typename Dispatcher>
uint64_t WddmDirectSubmission<GfxFamily, Dispatcher>::switchRingBuffers() {
GraphicsAllocation *nextRingBuffer = switchRingBuffersAllocations();
void *flushPtr = ringCommandStream.getSpace(0);
uint64_t currentBufferGpuVa = getCommandBufferPositionGpuAddress(flushPtr);
@@ -110,8 +109,8 @@ uint64_t WddmDirectSubmission<GfxFamily>::switchRingBuffers() {
return currentBufferGpuVa;
}
template <typename GfxFamily>
uint64_t WddmDirectSubmission<GfxFamily>::updateTagValue() {
template <typename GfxFamily, typename Dispatcher>
uint64_t WddmDirectSubmission<GfxFamily, Dispatcher>::updateTagValue() {
MonitoredFence &currentFence = osContextWin->getResidencyController().getMonitoredFence();
currentFence.lastSubmittedFence = currentFence.currentFenceValue;
@@ -121,13 +120,13 @@ uint64_t WddmDirectSubmission<GfxFamily>::updateTagValue() {
return currentFence.lastSubmittedFence;
}
template <typename GfxFamily>
void WddmDirectSubmission<GfxFamily>::handleCompletionRingBuffer(uint64_t completionValue, MonitoredFence &fence) {
template <typename GfxFamily, typename Dispatcher>
void WddmDirectSubmission<GfxFamily, Dispatcher>::handleCompletionRingBuffer(uint64_t completionValue, MonitoredFence &fence) {
wddm->waitFromCpu(completionValue, fence);
}
template <typename GfxFamily>
void WddmDirectSubmission<GfxFamily>::getTagAddressValue(TagData &tagData) {
template <typename GfxFamily, typename Dispatcher>
void WddmDirectSubmission<GfxFamily, Dispatcher>::getTagAddressValue(TagData &tagData) {
MonitoredFence &currentFence = osContextWin->getResidencyController().getMonitoredFence();
tagData.tagAddress = GmmHelper::canonize(currentFence.gpuAddress);

View File

@@ -7,14 +7,21 @@
#include "shared/source/direct_submission/direct_submission_hw.inl"
#include "shared/source/direct_submission/dispatchers/blitter_dispatcher.inl"
#include "shared/source/direct_submission/dispatchers/dispatcher.inl"
#include "shared/source/direct_submission/dispatchers/render_dispatcher.inl"
#include "shared/source/direct_submission/linux/drm_direct_submission.inl"
#include "shared/source/helpers/hw_cmds.h"
namespace NEO {
template class BlitterDispatcher<ICLFamily>;
template class RenderDispatcher<ICLFamily>;
using GfxFamily = ICLFamily;
template class DirectSubmissionHw<ICLFamily>;
template class DrmDirectSubmission<ICLFamily>;
template class Dispatcher<GfxFamily>;
template class BlitterDispatcher<GfxFamily>;
template class RenderDispatcher<GfxFamily>;
template class DirectSubmissionHw<GfxFamily, BlitterDispatcher<GfxFamily>>;
template class DirectSubmissionHw<GfxFamily, RenderDispatcher<GfxFamily>>;
template class DrmDirectSubmission<GfxFamily, BlitterDispatcher<GfxFamily>>;
template class DrmDirectSubmission<GfxFamily, RenderDispatcher<GfxFamily>>;
} // namespace NEO

View File

@@ -7,14 +7,21 @@
#include "shared/source/direct_submission/direct_submission_hw.inl"
#include "shared/source/direct_submission/dispatchers/blitter_dispatcher.inl"
#include "shared/source/direct_submission/dispatchers/dispatcher.inl"
#include "shared/source/direct_submission/dispatchers/render_dispatcher.inl"
#include "shared/source/direct_submission/windows/wddm_direct_submission.inl"
#include "shared/source/helpers/hw_cmds.h"
namespace NEO {
template class BlitterDispatcher<ICLFamily>;
template class RenderDispatcher<ICLFamily>;
using GfxFamily = ICLFamily;
template class DirectSubmissionHw<ICLFamily>;
template class WddmDirectSubmission<ICLFamily>;
template class Dispatcher<GfxFamily>;
template class BlitterDispatcher<GfxFamily>;
template class RenderDispatcher<GfxFamily>;
template class DirectSubmissionHw<GfxFamily, BlitterDispatcher<GfxFamily>>;
template class DirectSubmissionHw<GfxFamily, RenderDispatcher<GfxFamily>>;
template class WddmDirectSubmission<GfxFamily, BlitterDispatcher<GfxFamily>>;
template class WddmDirectSubmission<GfxFamily, RenderDispatcher<GfxFamily>>;
} // namespace NEO

View File

@@ -7,14 +7,21 @@
#include "shared/source/direct_submission/direct_submission_hw.inl"
#include "shared/source/direct_submission/dispatchers/blitter_dispatcher.inl"
#include "shared/source/direct_submission/dispatchers/dispatcher.inl"
#include "shared/source/direct_submission/dispatchers/render_dispatcher.inl"
#include "shared/source/direct_submission/linux/drm_direct_submission.inl"
#include "shared/source/helpers/hw_cmds.h"
namespace NEO {
template class BlitterDispatcher<TGLLPFamily>;
template class RenderDispatcher<TGLLPFamily>;
using GfxFamily = TGLLPFamily;
template class DirectSubmissionHw<TGLLPFamily>;
template class DrmDirectSubmission<TGLLPFamily>;
template class Dispatcher<GfxFamily>;
template class BlitterDispatcher<GfxFamily>;
template class RenderDispatcher<GfxFamily>;
template class DirectSubmissionHw<GfxFamily, BlitterDispatcher<GfxFamily>>;
template class DirectSubmissionHw<GfxFamily, RenderDispatcher<GfxFamily>>;
template class DrmDirectSubmission<GfxFamily, BlitterDispatcher<GfxFamily>>;
template class DrmDirectSubmission<GfxFamily, RenderDispatcher<GfxFamily>>;
} // namespace NEO

View File

@@ -7,14 +7,21 @@
#include "shared/source/direct_submission/direct_submission_hw.inl"
#include "shared/source/direct_submission/dispatchers/blitter_dispatcher.inl"
#include "shared/source/direct_submission/dispatchers/dispatcher.inl"
#include "shared/source/direct_submission/dispatchers/render_dispatcher.inl"
#include "shared/source/direct_submission/windows/wddm_direct_submission.inl"
#include "shared/source/helpers/hw_cmds.h"
namespace NEO {
template class BlitterDispatcher<TGLLPFamily>;
template class RenderDispatcher<TGLLPFamily>;
using GfxFamily = TGLLPFamily;
template class DirectSubmissionHw<TGLLPFamily>;
template class WddmDirectSubmission<TGLLPFamily>;
template class Dispatcher<GfxFamily>;
template class BlitterDispatcher<GfxFamily>;
template class RenderDispatcher<GfxFamily>;
template class DirectSubmissionHw<GfxFamily, BlitterDispatcher<GfxFamily>>;
template class DirectSubmissionHw<GfxFamily, RenderDispatcher<GfxFamily>>;
template class WddmDirectSubmission<GfxFamily, BlitterDispatcher<GfxFamily>>;
template class WddmDirectSubmission<GfxFamily, RenderDispatcher<GfxFamily>>;
} // namespace NEO

View File

@@ -7,14 +7,21 @@
#include "shared/source/direct_submission/direct_submission_hw.inl"
#include "shared/source/direct_submission/dispatchers/blitter_dispatcher.inl"
#include "shared/source/direct_submission/dispatchers/dispatcher.inl"
#include "shared/source/direct_submission/dispatchers/render_dispatcher.inl"
#include "shared/source/direct_submission/linux/drm_direct_submission.inl"
#include "shared/source/helpers/hw_cmds.h"
namespace NEO {
template class BlitterDispatcher<BDWFamily>;
template class RenderDispatcher<BDWFamily>;
using GfxFamily = BDWFamily;
template class DirectSubmissionHw<BDWFamily>;
template class DrmDirectSubmission<BDWFamily>;
template class Dispatcher<GfxFamily>;
template class BlitterDispatcher<GfxFamily>;
template class RenderDispatcher<GfxFamily>;
template class DirectSubmissionHw<GfxFamily, BlitterDispatcher<GfxFamily>>;
template class DirectSubmissionHw<GfxFamily, RenderDispatcher<GfxFamily>>;
template class DrmDirectSubmission<GfxFamily, BlitterDispatcher<GfxFamily>>;
template class DrmDirectSubmission<GfxFamily, RenderDispatcher<GfxFamily>>;
} // namespace NEO

View File

@@ -7,14 +7,21 @@
#include "shared/source/direct_submission/direct_submission_hw.inl"
#include "shared/source/direct_submission/dispatchers/blitter_dispatcher.inl"
#include "shared/source/direct_submission/dispatchers/dispatcher.inl"
#include "shared/source/direct_submission/dispatchers/render_dispatcher.inl"
#include "shared/source/direct_submission/windows/wddm_direct_submission.inl"
#include "shared/source/helpers/hw_cmds.h"
namespace NEO {
template class BlitterDispatcher<BDWFamily>;
template class RenderDispatcher<BDWFamily>;
using GfxFamily = BDWFamily;
template class DirectSubmissionHw<BDWFamily>;
template class WddmDirectSubmission<BDWFamily>;
template class Dispatcher<GfxFamily>;
template class BlitterDispatcher<GfxFamily>;
template class RenderDispatcher<GfxFamily>;
template class DirectSubmissionHw<GfxFamily, BlitterDispatcher<GfxFamily>>;
template class DirectSubmissionHw<GfxFamily, RenderDispatcher<GfxFamily>>;
template class WddmDirectSubmission<GfxFamily, BlitterDispatcher<GfxFamily>>;
template class WddmDirectSubmission<GfxFamily, RenderDispatcher<GfxFamily>>;
} // namespace NEO

View File

@@ -7,14 +7,21 @@
#include "shared/source/direct_submission/direct_submission_hw.inl"
#include "shared/source/direct_submission/dispatchers/blitter_dispatcher.inl"
#include "shared/source/direct_submission/dispatchers/dispatcher.inl"
#include "shared/source/direct_submission/dispatchers/render_dispatcher.inl"
#include "shared/source/direct_submission/linux/drm_direct_submission.inl"
#include "shared/source/helpers/hw_cmds.h"
namespace NEO {
template class BlitterDispatcher<SKLFamily>;
template class RenderDispatcher<SKLFamily>;
using GfxFamily = SKLFamily;
template class DirectSubmissionHw<SKLFamily>;
template class DrmDirectSubmission<SKLFamily>;
template class Dispatcher<GfxFamily>;
template class BlitterDispatcher<GfxFamily>;
template class RenderDispatcher<GfxFamily>;
template class DirectSubmissionHw<GfxFamily, BlitterDispatcher<GfxFamily>>;
template class DirectSubmissionHw<GfxFamily, RenderDispatcher<GfxFamily>>;
template class DrmDirectSubmission<GfxFamily, BlitterDispatcher<GfxFamily>>;
template class DrmDirectSubmission<GfxFamily, RenderDispatcher<GfxFamily>>;
} // namespace NEO

View File

@@ -7,14 +7,21 @@
#include "shared/source/direct_submission/direct_submission_hw.inl"
#include "shared/source/direct_submission/dispatchers/blitter_dispatcher.inl"
#include "shared/source/direct_submission/dispatchers/dispatcher.inl"
#include "shared/source/direct_submission/dispatchers/render_dispatcher.inl"
#include "shared/source/direct_submission/windows/wddm_direct_submission.inl"
#include "shared/source/helpers/hw_cmds.h"
namespace NEO {
template class BlitterDispatcher<SKLFamily>;
template class RenderDispatcher<SKLFamily>;
using GfxFamily = SKLFamily;
template class DirectSubmissionHw<SKLFamily>;
template class WddmDirectSubmission<SKLFamily>;
template class Dispatcher<GfxFamily>;
template class BlitterDispatcher<GfxFamily>;
template class RenderDispatcher<GfxFamily>;
template class DirectSubmissionHw<GfxFamily, BlitterDispatcher<GfxFamily>>;
template class DirectSubmissionHw<GfxFamily, RenderDispatcher<GfxFamily>>;
template class WddmDirectSubmission<GfxFamily, BlitterDispatcher<GfxFamily>>;
template class WddmDirectSubmission<GfxFamily, RenderDispatcher<GfxFamily>>;
} // namespace NEO

View File

@@ -74,9 +74,8 @@ HWTEST_F(DirectSubmissionTest, whenDebugCacheFlushDisabledSetThenExpectNoCpuCach
DebugManagerStateRestore restore;
DebugManager.flags.DirectSubmissionDisableCpuCacheFlush.set(1);
MockDirectSubmissionHw<FamilyType> directSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice,
*osContext.get());
EXPECT_TRUE(directSubmission.disableCpuCacheFlush);
uintptr_t expectedPtrVal = 0;
@@ -91,9 +90,8 @@ HWTEST_F(DirectSubmissionTest, whenDebugCacheFlushDisabledNotSetThenExpectCpuCac
DebugManagerStateRestore restore;
DebugManager.flags.DirectSubmissionDisableCpuCacheFlush.set(0);
MockDirectSubmissionHw<FamilyType> directSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice,
*osContext.get());
EXPECT_FALSE(directSubmission.disableCpuCacheFlush);
uintptr_t expectedPtrVal = 0xABCD00u;
@@ -105,9 +103,8 @@ HWTEST_F(DirectSubmissionTest, whenDebugCacheFlushDisabledNotSetThenExpectCpuCac
}
HWTEST_F(DirectSubmissionTest, givenDirectSubmissionInitializedWhenRingIsStartedThenExpectAllocationsCreatedAndCommandsDispatched) {
MockDirectSubmissionHw<FamilyType> directSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice,
*osContext.get());
EXPECT_FALSE(directSubmission.disableCpuCacheFlush);
bool ret = directSubmission.initialize(true);
@@ -122,9 +119,8 @@ HWTEST_F(DirectSubmissionTest, givenDirectSubmissionInitializedWhenRingIsStarted
}
HWTEST_F(DirectSubmissionTest, givenDirectSubmissionInitializedWhenRingIsNotStartedThenExpectAllocationsCreatedAndCommandsNotDispatched) {
MockDirectSubmissionHw<FamilyType> directSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice,
*osContext.get());
bool ret = directSubmission.initialize(false);
EXPECT_TRUE(ret);
@@ -138,10 +134,9 @@ HWTEST_F(DirectSubmissionTest, givenDirectSubmissionInitializedWhenRingIsNotStar
}
HWTEST_F(DirectSubmissionTest, givenDirectSubmissionSwitchBuffersWhenCurrentIsPrimaryThenExpectNextSecondary) {
using RingBufferUse = typename MockDirectSubmissionHw<FamilyType>::RingBufferUse;
MockDirectSubmissionHw<FamilyType> directSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
using RingBufferUse = typename MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>>::RingBufferUse;
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice,
*osContext.get());
bool ret = directSubmission.initialize(false);
EXPECT_TRUE(ret);
@@ -153,10 +148,9 @@ HWTEST_F(DirectSubmissionTest, givenDirectSubmissionSwitchBuffersWhenCurrentIsPr
}
HWTEST_F(DirectSubmissionTest, givenDirectSubmissionSwitchBuffersWhenCurrentIsSecondaryThenExpectNextPrimary) {
using RingBufferUse = typename MockDirectSubmissionHw<FamilyType>::RingBufferUse;
MockDirectSubmissionHw<FamilyType> directSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
using RingBufferUse = typename MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>>::RingBufferUse;
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice,
*osContext.get());
bool ret = directSubmission.initialize(false);
EXPECT_TRUE(ret);
@@ -171,9 +165,8 @@ HWTEST_F(DirectSubmissionTest, givenDirectSubmissionSwitchBuffersWhenCurrentIsSe
EXPECT_EQ(RingBufferUse::FirstBuffer, directSubmission.currentRingBuffer);
}
HWTEST_F(DirectSubmissionTest, givenDirectSubmissionAllocateFailWhenRingIsStartedThenExpectRingNotStarted) {
MockDirectSubmissionHw<FamilyType> directSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice,
*osContext.get());
EXPECT_FALSE(directSubmission.disableCpuCacheFlush);
directSubmission.allocateOsResourcesReturn = false;
@@ -185,9 +178,8 @@ HWTEST_F(DirectSubmissionTest, givenDirectSubmissionAllocateFailWhenRingIsStarte
}
HWTEST_F(DirectSubmissionTest, givenDirectSubmissionSubmitFailWhenRingIsStartedThenExpectRingNotStartedCommandsDispatched) {
MockDirectSubmissionHw<FamilyType> directSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice,
*osContext.get());
directSubmission.submitReturn = false;
bool ret = directSubmission.initialize(true);
@@ -198,9 +190,8 @@ HWTEST_F(DirectSubmissionTest, givenDirectSubmissionSubmitFailWhenRingIsStartedT
}
HWTEST_F(DirectSubmissionTest, givenDirectSubmissionStartWhenRingIsStartedThenExpectNoStartCommandsDispatched) {
MockDirectSubmissionHw<FamilyType> directSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice,
*osContext.get());
bool ret = directSubmission.initialize(true);
EXPECT_TRUE(ret);
@@ -212,9 +203,8 @@ HWTEST_F(DirectSubmissionTest, givenDirectSubmissionStartWhenRingIsStartedThenEx
}
HWTEST_F(DirectSubmissionTest, givenDirectSubmissionStartWhenRingIsNotStartedThenExpectStartCommandsDispatched) {
MockDirectSubmissionHw<FamilyType> directSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice,
*osContext.get());
bool ret = directSubmission.initialize(false);
EXPECT_TRUE(ret);
@@ -227,9 +217,8 @@ HWTEST_F(DirectSubmissionTest, givenDirectSubmissionStartWhenRingIsNotStartedThe
}
HWTEST_F(DirectSubmissionTest, givenDirectSubmissionStartWhenRingIsNotStartedSubmitFailThenExpectStartCommandsDispatchedRingNotStarted) {
MockDirectSubmissionHw<FamilyType> directSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice,
*osContext.get());
bool ret = directSubmission.initialize(false);
EXPECT_TRUE(ret);
@@ -243,9 +232,8 @@ HWTEST_F(DirectSubmissionTest, givenDirectSubmissionStartWhenRingIsNotStartedSub
}
HWTEST_F(DirectSubmissionTest, givenDirectSubmissionStartWhenRingIsNotStartedAndSwitchBufferIsNeededThenExpectRingAllocationChangedStartCommandsDispatched) {
MockDirectSubmissionHw<FamilyType> directSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice,
*osContext.get());
bool ret = directSubmission.initialize(false);
EXPECT_TRUE(ret);
@@ -266,9 +254,8 @@ HWTEST_F(DirectSubmissionTest, givenDirectSubmissionStartWhenRingIsNotStartedAnd
}
HWTEST_F(DirectSubmissionTest, givenDirectSubmissionStopWhenStopRingIsCalledThenExpectStopCommandDispatched) {
MockDirectSubmissionHw<FamilyType> directSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice,
*osContext.get());
bool ret = directSubmission.initialize(true);
EXPECT_TRUE(ret);
@@ -287,17 +274,15 @@ HWTEST_F(DirectSubmissionTest,
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
using MI_BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END;
MockDirectSubmissionHw<FamilyType> regularDirectSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> regularDirectSubmission(*pDevice,
*osContext.get());
size_t regularSizeEnd = regularDirectSubmission.getSizeEnd();
DebugManagerStateRestore restore;
DebugManager.flags.DirectSubmissionDisableMonitorFence.set(true);
MockDirectSubmissionHw<FamilyType> directSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice,
*osContext.get());
bool ret = directSubmission.initialize(true);
EXPECT_TRUE(ret);
@@ -344,17 +329,15 @@ HWTEST_F(DirectSubmissionDispatchBufferTest,
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
using MI_BATCH_BUFFER_START = typename FamilyType::MI_BATCH_BUFFER_START;
MockDirectSubmissionHw<FamilyType> regularDirectSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> regularDirectSubmission(*pDevice,
*osContext.get());
size_t regularSizeDispatch = regularDirectSubmission.getSizeDispatch();
DebugManagerStateRestore restore;
DebugManager.flags.DirectSubmissionDisableMonitorFence.set(true);
MockDirectSubmissionHw<FamilyType> directSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice,
*osContext.get());
bool ret = directSubmission.initialize(true);
EXPECT_TRUE(ret);
@@ -399,17 +382,15 @@ HWTEST_F(DirectSubmissionDispatchBufferTest,
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
using MI_BATCH_BUFFER_START = typename FamilyType::MI_BATCH_BUFFER_START;
MockDirectSubmissionHw<FamilyType> regularDirectSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> regularDirectSubmission(*pDevice,
*osContext.get());
size_t regularSizeDispatch = regularDirectSubmission.getSizeDispatch();
DebugManagerStateRestore restore;
DebugManager.flags.DirectSubmissionDisableCacheFlush.set(true);
MockDirectSubmissionHw<FamilyType> directSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice,
*osContext.get());
bool ret = directSubmission.initialize(true);
EXPECT_TRUE(ret);
@@ -435,7 +416,7 @@ HWTEST_F(DirectSubmissionDispatchBufferTest,
LinearStream parseDispatch;
uint8_t buffer[256];
parseDispatch.replaceBuffer(buffer, 256);
directSubmission.cmdDispatcher->dispatchCacheFlush(parseDispatch, *directSubmission.hwInfo);
RenderDispatcher<FamilyType>::dispatchCacheFlush(parseDispatch, *directSubmission.hwInfo);
auto expectedPipeControl = static_cast<PIPE_CONTROL *>(parseDispatch.getCpuBase());
for (auto it = hwParse.pipeControlList.begin(); it != hwParse.pipeControlList.end(); it++) {
auto pipeControl = genCmdCast<PIPE_CONTROL *>(*it);
@@ -452,18 +433,16 @@ HWTEST_F(DirectSubmissionDispatchBufferTest,
using MI_BATCH_BUFFER_START = typename FamilyType::MI_BATCH_BUFFER_START;
using MI_STORE_DATA_IMM = typename FamilyType::MI_STORE_DATA_IMM;
MockDirectSubmissionHw<FamilyType> regularDirectSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> regularDirectSubmission(*pDevice,
*osContext.get());
size_t regularSizeDispatch = regularDirectSubmission.getSizeDispatch();
DebugManagerStateRestore restore;
DebugManager.flags.DirectSubmissionEnableDebugBuffer.set(1);
MockDirectSubmissionHw<FamilyType> directSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice,
*osContext.get());
bool ret = directSubmission.initialize(true);
EXPECT_TRUE(ret);
@@ -500,17 +479,15 @@ HWTEST_F(DirectSubmissionDispatchBufferTest,
using MI_BATCH_BUFFER_START = typename FamilyType::MI_BATCH_BUFFER_START;
using MI_STORE_DATA_IMM = typename FamilyType::MI_STORE_DATA_IMM;
MockDirectSubmissionHw<FamilyType> regularDirectSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> regularDirectSubmission(*pDevice,
*osContext.get());
size_t regularSizeDispatch = regularDirectSubmission.getSizeDispatch();
DebugManagerStateRestore restore;
DebugManager.flags.DirectSubmissionEnableDebugBuffer.set(2);
MockDirectSubmissionHw<FamilyType> directSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice,
*osContext.get());
bool ret = directSubmission.initialize(true);
EXPECT_TRUE(ret);
@@ -536,9 +513,8 @@ HWTEST_F(DirectSubmissionDispatchBufferTest,
}
HWTEST_F(DirectSubmissionTest, givenDirectSubmissionWhenDispatchSemaphoreThenExpectCorrectSizeUsed) {
MockDirectSubmissionHw<FamilyType> directSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice,
*osContext.get());
bool ret = directSubmission.initialize(false);
EXPECT_TRUE(ret);
@@ -548,9 +524,8 @@ HWTEST_F(DirectSubmissionTest, givenDirectSubmissionWhenDispatchSemaphoreThenExp
}
HWTEST_F(DirectSubmissionTest, givenDirectSubmissionWhenDispatchStartSectionThenExpectCorrectSizeUsed) {
MockDirectSubmissionHw<FamilyType> directSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice,
*osContext.get());
bool ret = directSubmission.initialize(false);
EXPECT_TRUE(ret);
@@ -560,9 +535,7 @@ HWTEST_F(DirectSubmissionTest, givenDirectSubmissionWhenDispatchStartSectionThen
}
HWTEST_F(DirectSubmissionTest, givenDirectSubmissionWhenDispatchSwitchRingBufferSectionThenExpectCorrectSizeUsed) {
MockDirectSubmissionHw<FamilyType> directSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice, *osContext.get());
bool ret = directSubmission.initialize(false);
EXPECT_TRUE(ret);
@@ -572,9 +545,8 @@ HWTEST_F(DirectSubmissionTest, givenDirectSubmissionWhenDispatchSwitchRingBuffer
}
HWTEST_F(DirectSubmissionTest, givenDirectSubmissionWhenDispatchFlushSectionThenExpectCorrectSizeUsed) {
MockDirectSubmissionHw<FamilyType> directSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice,
*osContext.get());
bool ret = directSubmission.initialize(false);
EXPECT_TRUE(ret);
@@ -584,9 +556,8 @@ HWTEST_F(DirectSubmissionTest, givenDirectSubmissionWhenDispatchFlushSectionThen
}
HWTEST_F(DirectSubmissionTest, givenDirectSubmissionWhenDispatchTagUpdateSectionThenExpectCorrectSizeUsed) {
MockDirectSubmissionHw<FamilyType> directSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>>
directSubmission(*pDevice, *osContext.get());
bool ret = directSubmission.initialize(false);
EXPECT_TRUE(ret);
@@ -597,9 +568,8 @@ HWTEST_F(DirectSubmissionTest, givenDirectSubmissionWhenDispatchTagUpdateSection
}
HWTEST_F(DirectSubmissionTest, givenDirectSubmissionWhenDispatchEndingSectionThenExpectCorrectSizeUsed) {
MockDirectSubmissionHw<FamilyType> directSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice,
*osContext.get());
bool ret = directSubmission.initialize(false);
EXPECT_TRUE(ret);
@@ -610,9 +580,8 @@ HWTEST_F(DirectSubmissionTest, givenDirectSubmissionWhenDispatchEndingSectionThe
}
HWTEST_F(DirectSubmissionTest, givenDirectSubmissionWhenGetDispatchSizeThenExpectCorrectSizeReturned) {
MockDirectSubmissionHw<FamilyType> directSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice,
*osContext.get());
size_t expectedSize = directSubmission.getSizeStartSection() +
directSubmission.getSizeFlushSection() +
@@ -627,9 +596,8 @@ HWTEST_F(DirectSubmissionTest,
DebugManagerStateRestore restore;
DebugManager.flags.DirectSubmissionEnableDebugBuffer.set(1);
MockDirectSubmissionHw<FamilyType> directSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice,
*osContext.get());
size_t expectedSize = directSubmission.getSizeStoraDataSection() +
directSubmission.getSizeFlushSection() +
directSubmission.getSizeTagUpdateSection() +
@@ -643,9 +611,8 @@ HWTEST_F(DirectSubmissionTest,
DebugManagerStateRestore restore;
DebugManager.flags.DirectSubmissionEnableDebugBuffer.set(2);
MockDirectSubmissionHw<FamilyType> directSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice,
*osContext.get());
size_t expectedSize = directSubmission.getSizeFlushSection() +
directSubmission.getSizeTagUpdateSection() +
directSubmission.getSizeSemaphoreSection();
@@ -658,9 +625,8 @@ HWTEST_F(DirectSubmissionTest,
DebugManagerStateRestore restore;
DebugManager.flags.DirectSubmissionDisableCacheFlush.set(true);
MockDirectSubmissionHw<FamilyType> directSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice,
*osContext.get());
size_t expectedSize = directSubmission.getSizeStartSection() +
directSubmission.getSizeTagUpdateSection() +
directSubmission.getSizeSemaphoreSection();
@@ -673,9 +639,8 @@ HWTEST_F(DirectSubmissionTest,
DebugManagerStateRestore restore;
DebugManager.flags.DirectSubmissionDisableMonitorFence.set(true);
MockDirectSubmissionHw<FamilyType> directSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice,
*osContext.get());
size_t expectedSize = directSubmission.getSizeStartSection() +
directSubmission.getSizeFlushSection() +
@@ -685,9 +650,8 @@ HWTEST_F(DirectSubmissionTest,
}
HWTEST_F(DirectSubmissionTest, givenDirectSubmissionWhenGetEndSizeThenExpectCorrectSizeReturned) {
MockDirectSubmissionHw<FamilyType> directSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice,
*osContext.get());
size_t expectedSize = directSubmission.getSizeEndingSection() +
directSubmission.getSizeFlushSection();
@@ -698,9 +662,8 @@ HWTEST_F(DirectSubmissionTest, givenDirectSubmissionWhenGetEndSizeThenExpectCorr
HWTEST_F(DirectSubmissionTest, givenDirectSubmissionWhenSettingAddressInReturnCommandThenVerifyCorrectlySet) {
using MI_BATCH_BUFFER_START = typename FamilyType::MI_BATCH_BUFFER_START;
MockDirectSubmissionHw<FamilyType> directSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice,
*osContext.get());
bool ret = directSubmission.initialize(false);
EXPECT_TRUE(ret);
@@ -715,10 +678,9 @@ HWTEST_F(DirectSubmissionTest, givenDirectSubmissionWhenSettingAddressInReturnCo
HWTEST_F(DirectSubmissionTest, whenDirectSubmissionInitializedThenExpectCreatedAllocationsFreed) {
MemoryManager *memoryManager = pDevice->getExecutionEnvironment()->memoryManager.get();
std::unique_ptr<MockDirectSubmissionHw<FamilyType>> directSubmission =
std::make_unique<MockDirectSubmissionHw<FamilyType>>(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
std::unique_ptr<MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>>> directSubmission =
std::make_unique<MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>>>(*pDevice,
*osContext.get());
bool ret = directSubmission->initialize(false);
EXPECT_TRUE(ret);
@@ -727,10 +689,9 @@ HWTEST_F(DirectSubmissionTest, whenDirectSubmissionInitializedThenExpectCreatedA
directSubmission.reset(nullptr);
memoryManager->freeGraphicsMemory(nulledAllocation);
directSubmission =
std::make_unique<MockDirectSubmissionHw<FamilyType>>(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
directSubmission = std::make_unique<
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>>>(*pDevice,
*osContext.get());
ret = directSubmission->initialize(false);
EXPECT_TRUE(ret);
@@ -739,10 +700,9 @@ HWTEST_F(DirectSubmissionTest, whenDirectSubmissionInitializedThenExpectCreatedA
directSubmission.reset(nullptr);
memoryManager->freeGraphicsMemory(nulledAllocation);
directSubmission =
std::make_unique<MockDirectSubmissionHw<FamilyType>>(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
directSubmission = std::make_unique<
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>>>(*pDevice,
*osContext.get());
ret = directSubmission->initialize(false);
EXPECT_TRUE(ret);
nulledAllocation = directSubmission->semaphores;
@@ -757,9 +717,8 @@ HWTEST_F(DirectSubmissionDispatchBufferTest,
FlushStampTracker flushStamp(true);
MockDirectSubmissionHw<FamilyType> directSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice,
*osContext.get());
bool ret = directSubmission.initialize(true);
EXPECT_TRUE(ret);
@@ -769,7 +728,7 @@ HWTEST_F(DirectSubmissionDispatchBufferTest,
EXPECT_EQ(0u, directSubmission.semaphoreData->QueueWorkCount);
EXPECT_EQ(1u, directSubmission.currentQueueWorkCount);
EXPECT_EQ(1u, directSubmission.submitCount);
size_t submitSize = directSubmission.cmdDispatcher->getSizePreemption() +
size_t submitSize = RenderDispatcher<FamilyType>::getSizePreemption() +
directSubmission.getSizeSemaphoreSection();
EXPECT_EQ(submitSize, directSubmission.submitSize);
EXPECT_EQ(oldRingAllocation->getGpuAddress(), directSubmission.submitGpuAddress);
@@ -797,9 +756,8 @@ HWTEST_F(DirectSubmissionDispatchBufferTest,
givenDirectSubmissionRingNotStartAndSwitchBuffersWhenDispatchingCommandBufferThenExpectDispatchInCommandBufferQueueCountIncreaseAndSubmitToGpu) {
FlushStampTracker flushStamp(true);
MockDirectSubmissionHw<FamilyType> directSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice,
*osContext.get());
bool ret = directSubmission.initialize(false);
EXPECT_TRUE(ret);
@@ -830,9 +788,8 @@ HWTEST_F(DirectSubmissionDispatchBufferTest,
givenDirectSubmissionRingStartWhenDispatchingCommandBufferThenExpectDispatchInCommandBufferAndQueueCountIncrease) {
FlushStampTracker flushStamp(true);
MockDirectSubmissionHw<FamilyType> directSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice,
*osContext.get());
bool ret = directSubmission.initialize(true);
EXPECT_TRUE(ret);
@@ -842,7 +799,7 @@ HWTEST_F(DirectSubmissionDispatchBufferTest,
EXPECT_EQ(0u, directSubmission.semaphoreData->QueueWorkCount);
EXPECT_EQ(1u, directSubmission.currentQueueWorkCount);
EXPECT_EQ(1u, directSubmission.submitCount);
size_t submitSize = directSubmission.cmdDispatcher->getSizePreemption() +
size_t submitSize = RenderDispatcher<FamilyType>::getSizePreemption() +
directSubmission.getSizeSemaphoreSection();
EXPECT_EQ(submitSize, directSubmission.submitSize);
EXPECT_EQ(oldRingAllocation->getGpuAddress(), directSubmission.submitGpuAddress);
@@ -867,9 +824,8 @@ HWTEST_F(DirectSubmissionDispatchBufferTest,
givenDirectSubmissionRingNotStartWhenDispatchingCommandBufferThenExpectDispatchInCommandBufferQueueCountIncreaseAndSubmitToGpu) {
FlushStampTracker flushStamp(true);
MockDirectSubmissionHw<FamilyType> directSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice,
*osContext.get());
bool ret = directSubmission.initialize(false);
EXPECT_TRUE(ret);
@@ -901,6 +857,7 @@ HWTEST_F(DirectSubmissionDispatchBufferTest,
HWTEST_F(DirectSubmissionTest, givenSuperBaseCsrWhenCheckingDirectSubmissionAvailableThenReturnFalse) {
VariableBackup<UltHwConfig> backup(&ultHwConfig);
ultHwConfig.csrSuperBaseCallDirectSubmissionAvailable = true;
ultHwConfig.csrSuperBaseCallBlitterDirectSubmissionAvailable = true;
int32_t executionStamp = 0;
std::unique_ptr<MockCsr<FamilyType>> mockCsr =
@@ -908,11 +865,14 @@ HWTEST_F(DirectSubmissionTest, givenSuperBaseCsrWhenCheckingDirectSubmissionAvai
bool ret = mockCsr->isDirectSubmissionEnabled();
EXPECT_FALSE(ret);
ret = mockCsr->isBlitterDirectSubmissionEnabled();
EXPECT_FALSE(ret);
}
HWTEST_F(DirectSubmissionTest, givenBaseCsrWhenCheckingDirectSubmissionAvailableThenReturnFalse) {
VariableBackup<UltHwConfig> backup(&ultHwConfig);
ultHwConfig.csrBaseCallDirectSubmissionAvailable = true;
ultHwConfig.csrBaseCallBlitterDirectSubmissionAvailable = true;
int32_t executionStamp = 0;
std::unique_ptr<MockCsr<FamilyType>> mockCsr =
@@ -920,6 +880,8 @@ HWTEST_F(DirectSubmissionTest, givenBaseCsrWhenCheckingDirectSubmissionAvailable
bool ret = mockCsr->isDirectSubmissionEnabled();
EXPECT_FALSE(ret);
ret = mockCsr->isBlitterDirectSubmissionEnabled();
EXPECT_FALSE(ret);
}
HWTEST_F(DirectSubmissionTest, givenDirectSubmissionAvailableWhenProgrammingEndingCommandThenUseBatchBufferStart) {

View File

@@ -9,6 +9,7 @@ set(NEO_CORE_DIRECT_SUBMISSION_DISPATCHERS_TESTS
${CMAKE_CURRENT_SOURCE_DIR}/blitter_dispatcher_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/dispatcher_fixture.cpp
${CMAKE_CURRENT_SOURCE_DIR}/dispatcher_fixture.h
${CMAKE_CURRENT_SOURCE_DIR}/dispatcher_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/render_dispatcher_tests.cpp
)

View File

@@ -15,36 +15,30 @@ using namespace NEO;
using BlitterDispatcheTest = Test<DispatcherFixture>;
HWTEST_F(BlitterDispatcheTest, givenBlitterWhenAskingForPreemptionCmdSizeThenReturnZero) {
BlitterDispatcher<FamilyType> blitterDispatcher;
EXPECT_EQ(0u, blitterDispatcher.getSizePreemption());
EXPECT_EQ(0u, BlitterDispatcher<FamilyType>::getSizePreemption());
}
HWTEST_F(BlitterDispatcheTest, givenBlitterWhenDispatchingPreemptionCmdThenDispatchNothing) {
BlitterDispatcher<FamilyType> blitterDispatcher;
blitterDispatcher.dispatchPreemption(cmdBuffer);
BlitterDispatcher<FamilyType>::dispatchPreemption(cmdBuffer);
EXPECT_EQ(0u, cmdBuffer.getUsed());
}
HWTEST_F(BlitterDispatcheTest, givenBlitterWhenAskingForMonitorFenceCmdSizeThenReturnZero) {
BlitterDispatcher<FamilyType> blitterDispatcher;
EXPECT_EQ(0u, blitterDispatcher.getSizeMonitorFence(pDevice->getHardwareInfo()));
EXPECT_EQ(0u, BlitterDispatcher<FamilyType>::getSizeMonitorFence(pDevice->getHardwareInfo()));
}
HWTEST_F(BlitterDispatcheTest, givenBlitterWhenDispatchingMonitorFenceCmdThenDispatchNothing) {
BlitterDispatcher<FamilyType> blitterDispatcher;
blitterDispatcher.dispatchMonitorFence(cmdBuffer, MemoryConstants::pageSize64k, 1ull, pDevice->getHardwareInfo());
BlitterDispatcher<FamilyType>::dispatchMonitorFence(cmdBuffer, MemoryConstants::pageSize64k, 1ull, pDevice->getHardwareInfo());
EXPECT_EQ(0u, cmdBuffer.getUsed());
}
HWTEST_F(BlitterDispatcheTest, givenBlitterWhenAskingForCacheFlushCmdSizeThenReturnZero) {
BlitterDispatcher<FamilyType> blitterDispatcher;
EXPECT_EQ(0u, blitterDispatcher.getSizeCacheFlush(pDevice->getHardwareInfo()));
EXPECT_EQ(0u, BlitterDispatcher<FamilyType>::getSizeCacheFlush(pDevice->getHardwareInfo()));
}
HWTEST_F(BlitterDispatcheTest, givenBlitterWhenDispatchingCacheFlushCmdThenDispatchNothing) {
BlitterDispatcher<FamilyType> blitterDispatcher;
blitterDispatcher.dispatchCacheFlush(cmdBuffer, pDevice->getHardwareInfo());
BlitterDispatcher<FamilyType>::dispatchCacheFlush(cmdBuffer, pDevice->getHardwareInfo());
EXPECT_EQ(0u, cmdBuffer.getUsed());
}

View File

@@ -0,0 +1,71 @@
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/direct_submission/dispatchers/dispatcher.h"
#include "shared/test/unit_test/direct_submission/dispatchers/dispatcher_fixture.h"
#include "opencl/test/unit_test/helpers/hw_parse.h"
#include "test.h"
using namespace NEO;
using DispatcherTest = Test<DispatcherFixture>;
HWTEST_F(DispatcherTest, givenBaseDispatcherWhenAskingForStartCmdSizeThenReturnBbStartCmdSize) {
using MI_BATCH_BUFFER_START = typename FamilyType::MI_BATCH_BUFFER_START;
EXPECT_EQ(sizeof(MI_BATCH_BUFFER_START), Dispatcher<FamilyType>::getSizeStartCommandBuffer());
}
HWTEST_F(DispatcherTest, givenBaseDispatcherWhenAddingStartCmdThenExpectBbStart) {
using MI_BATCH_BUFFER_START = typename FamilyType::MI_BATCH_BUFFER_START;
uint64_t gpuVa = 0xFF0000;
Dispatcher<FamilyType>::dispatchStartCommandBuffer(cmdBuffer, gpuVa);
HardwareParse hwParse;
hwParse.parseCommands<FamilyType>(cmdBuffer);
MI_BATCH_BUFFER_START *start = hwParse.getCommand<MI_BATCH_BUFFER_START>();
ASSERT_NE(nullptr, start);
EXPECT_EQ(gpuVa, start->getBatchBufferStartAddressGraphicsaddress472());
}
HWTEST_F(DispatcherTest, givenBaseDispatcherWhenAskingForStopCmdSizeThenReturnBbStopCmdSize) {
using MI_BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END;
EXPECT_EQ(sizeof(MI_BATCH_BUFFER_END), Dispatcher<FamilyType>::getSizeStopCommandBuffer());
}
HWTEST_F(DispatcherTest, givenBaseDispatcherWhenAddingStopCmdThenExpectBbStop) {
using MI_BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END;
Dispatcher<FamilyType>::dispatchStopCommandBuffer(cmdBuffer);
HardwareParse hwParse;
hwParse.parseCommands<FamilyType>(cmdBuffer);
MI_BATCH_BUFFER_END *stop = hwParse.getCommand<MI_BATCH_BUFFER_END>();
ASSERT_NE(nullptr, stop);
}
HWTEST_F(DispatcherTest, givenBaseDispatcherWhenAskingForStoreCmdSizeThenReturnStoreDataImmCmdSize) {
using MI_STORE_DATA_IMM = typename FamilyType::MI_STORE_DATA_IMM;
EXPECT_EQ(sizeof(MI_STORE_DATA_IMM), Dispatcher<FamilyType>::getSizeStoreDwordCommand());
}
HWTEST_F(DispatcherTest, givenBaseDispatcherWhenAddingStoreCmdThenExpectStoreDataImm) {
using MI_STORE_DATA_IMM = typename FamilyType::MI_STORE_DATA_IMM;
uint64_t gpuVa = 0xFF0000;
uint32_t val = 123;
Dispatcher<FamilyType>::dispatchStoreDwordCommand(cmdBuffer, gpuVa, val);
HardwareParse hwParse;
hwParse.parseCommands<FamilyType>(cmdBuffer);
MI_STORE_DATA_IMM *sdi = hwParse.getCommand<MI_STORE_DATA_IMM>();
ASSERT_NE(nullptr, sdi);
EXPECT_EQ(gpuVa, sdi->getAddress());
EXPECT_EQ(val, sdi->getDataDword0());
}

View File

@@ -23,8 +23,7 @@ HWTEST_F(RenderDispatcheTest, givenRenderWhenAskingForPreemptionCmdSizeThenRetur
if (GetPreemptionTestHwDetails<FamilyType>().supportsPreemptionProgramming()) {
expectedCmdSize = sizeof(MI_LOAD_REGISTER_IMM);
}
RenderDispatcher<FamilyType> renderDispatcher;
EXPECT_EQ(expectedCmdSize, renderDispatcher.getSizePreemption());
EXPECT_EQ(expectedCmdSize, RenderDispatcher<FamilyType>::getSizePreemption());
}
HWTEST_F(RenderDispatcheTest, givenRenderWhenAddingPreemptionCmdThenExpectProperMmioAddress) {
@@ -32,8 +31,7 @@ HWTEST_F(RenderDispatcheTest, givenRenderWhenAddingPreemptionCmdThenExpectProper
auto preemptionDetails = GetPreemptionTestHwDetails<FamilyType>();
RenderDispatcher<FamilyType> renderDispatcher;
renderDispatcher.dispatchPreemption(cmdBuffer);
RenderDispatcher<FamilyType>::dispatchPreemption(cmdBuffer);
HardwareParse hwParse;
hwParse.parseCommands<FamilyType>(cmdBuffer);
@@ -54,8 +52,7 @@ HWTEST_F(RenderDispatcheTest, givenRenderWhenAddingPreemptionCmdThenExpectProper
HWTEST_F(RenderDispatcheTest, givenRenderWhenAskingForMonitorFenceCmdSizeThenReturnRequiredPipeControlCmdSize) {
size_t expectedSize = MemorySynchronizationCommands<FamilyType>::getSizeForPipeControlWithPostSyncOperation(hardwareInfo);
RenderDispatcher<FamilyType> renderDispatcher;
EXPECT_EQ(expectedSize, renderDispatcher.getSizeMonitorFence(hardwareInfo));
EXPECT_EQ(expectedSize, RenderDispatcher<FamilyType>::getSizeMonitorFence(hardwareInfo));
}
HWTEST_F(RenderDispatcheTest, givenRenderWhenAddingMonitorFenceCmdThenExpectPipeControlWithProperAddressAndValue) {
@@ -67,8 +64,7 @@ HWTEST_F(RenderDispatcheTest, givenRenderWhenAddingMonitorFenceCmdThenExpectPipe
uint32_t gpuVaLow = static_cast<uint32_t>(gpuVa & 0x0000FFFFFFFFull);
uint32_t gpuVaHigh = static_cast<uint32_t>(gpuVa >> 32);
RenderDispatcher<FamilyType> renderDispatcher;
renderDispatcher.dispatchMonitorFence(cmdBuffer, gpuVa, value, hardwareInfo);
RenderDispatcher<FamilyType>::dispatchMonitorFence(cmdBuffer, gpuVa, value, hardwareInfo);
HardwareParse hwParse;
hwParse.parseCommands<FamilyType>(cmdBuffer);
@@ -93,16 +89,14 @@ HWTEST_F(RenderDispatcheTest, givenRenderWhenAddingMonitorFenceCmdThenExpectPipe
HWTEST_F(RenderDispatcheTest, givenRenderWhenAskingForCacheFlushCmdSizeThenReturnSetRequiredPipeControls) {
size_t expectedSize = MemorySynchronizationCommands<FamilyType>::getSizeForFullCacheFlush();
RenderDispatcher<FamilyType> renderDispatcher;
size_t actualSize = renderDispatcher.getSizeCacheFlush(hardwareInfo);
size_t actualSize = RenderDispatcher<FamilyType>::getSizeCacheFlush(hardwareInfo);
EXPECT_EQ(expectedSize, actualSize);
}
HWTEST_F(RenderDispatcheTest, givenRenderWhenAddingCacheFlushCmdThenExpectPipeControlWithProperFields) {
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
RenderDispatcher<FamilyType> renderDispatcher;
renderDispatcher.dispatchCacheFlush(cmdBuffer, hardwareInfo);
RenderDispatcher<FamilyType>::dispatchCacheFlush(cmdBuffer, hardwareInfo);
HardwareParse hwParse;
hwParse.parseCommands<FamilyType>(cmdBuffer);

View File

@@ -31,15 +31,11 @@ struct DrmDirectSubmissionFixture : public DeviceFixture {
DrmMock drmMock;
};
template <typename GfxFamily>
struct MockDrmDirectSubmission : public DrmDirectSubmission<GfxFamily> {
MockDrmDirectSubmission(Device &device,
std::unique_ptr<Dispatcher> cmdDispatcher,
OsContext &osContext)
: DrmDirectSubmission<GfxFamily>(device, std::move(cmdDispatcher), osContext) {
}
using BaseClass = DrmDirectSubmission<GfxFamily>;
template <typename GfxFamily, typename Dispatcher>
struct MockDrmDirectSubmission : public DrmDirectSubmission<GfxFamily, Dispatcher> {
using BaseClass = DrmDirectSubmission<GfxFamily, Dispatcher>;
using BaseClass::allocateOsResources;
using BaseClass::DrmDirectSubmission;
using BaseClass::getTagAddressValue;
using BaseClass::handleResidency;
using BaseClass::submit;
@@ -52,9 +48,8 @@ using DrmDirectSubmissionTest = Test<DrmDirectSubmissionFixture>;
using namespace NEO;
HWTEST_F(DrmDirectSubmissionTest, givenDrmDirectSubmissionWhenCallingLinuxImplementationThenExpectAllFailAsNotImplemented) {
MockDrmDirectSubmission<FamilyType> drmDirectSubmission(*pDevice,
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockDrmDirectSubmission<FamilyType, RenderDispatcher<FamilyType>> drmDirectSubmission(*pDevice,
*osContext.get());
DirectSubmissionAllocations allocations;
EXPECT_FALSE(drmDirectSubmission.allocateOsResources(allocations));

View File

@@ -39,14 +39,9 @@ struct WddmDirectSubmissionFixture : public WddmFixture {
std::unique_ptr<VariableBackup<UltHwConfig>> backupUlt;
};
template <typename GfxFamily>
struct MockWddmDirectSubmission : public WddmDirectSubmission<GfxFamily> {
MockWddmDirectSubmission(Device &device,
std::unique_ptr<Dispatcher> cmdDispatcher,
OsContext &osContext)
: WddmDirectSubmission<GfxFamily>(device, std::move(cmdDispatcher), osContext) {
}
using BaseClass = WddmDirectSubmission<GfxFamily>;
template <typename GfxFamily, typename Dispatcher>
struct MockWddmDirectSubmission : public WddmDirectSubmission<GfxFamily, Dispatcher> {
using BaseClass = WddmDirectSubmission<GfxFamily, Dispatcher>;
using BaseClass::allocateOsResources;
using BaseClass::commandBufferHeader;
using BaseClass::completionRingBuffers;
@@ -66,6 +61,7 @@ struct MockWddmDirectSubmission : public WddmDirectSubmission<GfxFamily> {
using BaseClass::switchRingBuffers;
using BaseClass::updateTagValue;
using BaseClass::wddm;
using BaseClass::WddmDirectSubmission;
using typename BaseClass::RingBufferUse;
};
@@ -74,10 +70,9 @@ using WddmDirectSubmissionTest = WddmDirectSubmissionFixture;
using namespace NEO;
HWTEST_F(WddmDirectSubmissionTest, givenWddmWhenDirectIsInitializedAndStartedThenExpectProperCommandsDispatched) {
std::unique_ptr<MockWddmDirectSubmission<FamilyType>> wddmDirectSubmission =
std::make_unique<MockWddmDirectSubmission<FamilyType>>(*device.get(),
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
std::unique_ptr<MockWddmDirectSubmission<FamilyType, RenderDispatcher<FamilyType>>> wddmDirectSubmission =
std::make_unique<MockWddmDirectSubmission<FamilyType, RenderDispatcher<FamilyType>>>(*device.get(),
*osContext.get());
EXPECT_EQ(1u, wddmDirectSubmission->commandBufferHeader->NeedsMidBatchPreEmptionSupport);
@@ -107,10 +102,9 @@ HWTEST_F(WddmDirectSubmissionTest, givenWddmWhenDirectIsInitializedAndStartedThe
HWTEST_F(WddmDirectSubmissionTest, givenWddmWhenDirectIsInitializedAndNotStartedThenExpectNoCommandsDispatched) {
device->setPreemptionMode(PreemptionMode::Disabled);
std::unique_ptr<MockWddmDirectSubmission<FamilyType>> wddmDirectSubmission =
std::make_unique<MockWddmDirectSubmission<FamilyType>>(*device.get(),
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
std::unique_ptr<MockWddmDirectSubmission<FamilyType, RenderDispatcher<FamilyType>>> wddmDirectSubmission =
std::make_unique<MockWddmDirectSubmission<FamilyType, RenderDispatcher<FamilyType>>>(*device.get(),
*osContext.get());
EXPECT_EQ(0u, wddmDirectSubmission->commandBufferHeader->NeedsMidBatchPreEmptionSupport);
@@ -136,9 +130,8 @@ HWTEST_F(WddmDirectSubmissionTest, givenWddmWhenDirectIsInitializedAndNotStarted
}
HWTEST_F(WddmDirectSubmissionTest, givenWddmWhenSubmitingCmdBufferThenExpectPassWddmContextAndProperHeader) {
MockWddmDirectSubmission<FamilyType> wddmDirectSubmission(*device.get(),
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockWddmDirectSubmission<FamilyType, RenderDispatcher<FamilyType>> wddmDirectSubmission(*device.get(),
*osContext.get());
bool ret = wddmDirectSubmission.initialize(false);
EXPECT_TRUE(ret);
@@ -165,9 +158,8 @@ HWTEST_F(WddmDirectSubmissionTest, givenWddmWhenAllocateOsResourcesThenExpectRin
GraphicsAllocation *ringBuffer = memoryManager->allocateGraphicsMemoryWithProperties(commandStreamAllocationProperties);
ASSERT_NE(nullptr, ringBuffer);
MockWddmDirectSubmission<FamilyType> wddmDirectSubmission(*device.get(),
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockWddmDirectSubmission<FamilyType, RenderDispatcher<FamilyType>> wddmDirectSubmission(*device.get(),
*osContext.get());
DirectSubmissionAllocations allocations;
allocations.push_back(ringBuffer);
@@ -192,9 +184,8 @@ HWTEST_F(WddmDirectSubmissionTest, givenWddmWhenAllocateOsResourcesFenceCreation
GraphicsAllocation *ringBuffer = memoryManager->allocateGraphicsMemoryWithProperties(commandStreamAllocationProperties);
ASSERT_NE(nullptr, ringBuffer);
MockWddmDirectSubmission<FamilyType> wddmDirectSubmission(*device.get(),
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockWddmDirectSubmission<FamilyType, RenderDispatcher<FamilyType>> wddmDirectSubmission(*device.get(),
*osContext.get());
DirectSubmissionAllocations allocations;
allocations.push_back(ringBuffer);
@@ -221,9 +212,8 @@ HWTEST_F(WddmDirectSubmissionTest, givenWddmWhenAllocateOsResourcesResidencyFail
GraphicsAllocation *ringBuffer = memoryManager->allocateGraphicsMemoryWithProperties(commandStreamAllocationProperties);
ASSERT_NE(nullptr, ringBuffer);
MockWddmDirectSubmission<FamilyType> wddmDirectSubmission(*device.get(),
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockWddmDirectSubmission<FamilyType, RenderDispatcher<FamilyType>> wddmDirectSubmission(*device.get(),
*osContext.get());
DirectSubmissionAllocations allocations;
allocations.push_back(ringBuffer);
@@ -249,9 +239,8 @@ HWTEST_F(WddmDirectSubmissionTest, givenWddmWhenGettingTagDataThenExpectContextM
contextFence.gpuAddress = address;
contextFence.currentFenceValue = value;
MockWddmDirectSubmission<FamilyType> wddmDirectSubmission(*device.get(),
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockWddmDirectSubmission<FamilyType, RenderDispatcher<FamilyType>> wddmDirectSubmission(*device.get(),
*osContext.get());
TagData tagData;
wddmDirectSubmission.getTagAddressValue(tagData);
@@ -261,9 +250,8 @@ HWTEST_F(WddmDirectSubmissionTest, givenWddmWhenGettingTagDataThenExpectContextM
}
HWTEST_F(WddmDirectSubmissionTest, givenWddmWhenHandleResidencyThenExpectWddmWaitOnPaginfFenceFromCpuCalled) {
MockWddmDirectSubmission<FamilyType> wddmDirectSubmission(*device.get(),
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockWddmDirectSubmission<FamilyType, RenderDispatcher<FamilyType>> wddmDirectSubmission(*device.get(),
*osContext.get());
wddmDirectSubmission.handleResidency();
@@ -277,9 +265,8 @@ HWTEST_F(WddmDirectSubmissionTest, givenWddmWhenHandlingRingBufferCompletionThen
contextFence.gpuAddress = address;
contextFence.currentFenceValue = value;
MockWddmDirectSubmission<FamilyType> wddmDirectSubmission(*device.get(),
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockWddmDirectSubmission<FamilyType, RenderDispatcher<FamilyType>> wddmDirectSubmission(*device.get(),
*osContext.get());
uint64_t completionValue = 0x12345679ull;
wddmDirectSubmission.handleCompletionRingBuffer(completionValue, contextFence);
@@ -292,9 +279,8 @@ HWTEST_F(WddmDirectSubmissionTest, givenWddmWhenHandlingRingBufferCompletionThen
HWTEST_F(WddmDirectSubmissionTest, givenWddmWhenSwitchingRingBufferStartedThenExpectDispatchSwitchCommandsLinearStreamUpdated) {
using MI_BATCH_BUFFER_START = typename FamilyType::MI_BATCH_BUFFER_START;
MockWddmDirectSubmission<FamilyType> wddmDirectSubmission(*device.get(),
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockWddmDirectSubmission<FamilyType, RenderDispatcher<FamilyType>> wddmDirectSubmission(*device.get(),
*osContext.get());
bool ret = wddmDirectSubmission.initialize(true);
EXPECT_TRUE(ret);
@@ -319,9 +305,8 @@ HWTEST_F(WddmDirectSubmissionTest, givenWddmWhenSwitchingRingBufferStartedThenEx
HWTEST_F(WddmDirectSubmissionTest, givenWddmWhenSwitchingRingBufferNotStartedThenExpectNoSwitchCommandsLinearStreamUpdated) {
using MI_BATCH_BUFFER_START = typename FamilyType::MI_BATCH_BUFFER_START;
MockWddmDirectSubmission<FamilyType> wddmDirectSubmission(*device.get(),
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockWddmDirectSubmission<FamilyType, RenderDispatcher<FamilyType>> wddmDirectSubmission(*device.get(),
*osContext.get());
bool ret = wddmDirectSubmission.initialize(false);
EXPECT_TRUE(ret);
@@ -345,11 +330,10 @@ HWTEST_F(WddmDirectSubmissionTest, givenWddmWhenSwitchingRingBufferNotStartedThe
}
HWTEST_F(WddmDirectSubmissionTest, givenWddmWhenSwitchingRingBufferStartedAndWaitFenceUpdateThenExpectWaitCalled) {
using RingBufferUse = typename MockWddmDirectSubmission<FamilyType>::RingBufferUse;
using RingBufferUse = typename MockWddmDirectSubmission<FamilyType, RenderDispatcher<FamilyType>>::RingBufferUse;
using MI_BATCH_BUFFER_START = typename FamilyType::MI_BATCH_BUFFER_START;
MockWddmDirectSubmission<FamilyType> wddmDirectSubmission(*device.get(),
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockWddmDirectSubmission<FamilyType, RenderDispatcher<FamilyType>> wddmDirectSubmission(*device.get(),
*osContext.get());
bool ret = wddmDirectSubmission.initialize(true);
EXPECT_TRUE(ret);
@@ -384,9 +368,8 @@ HWTEST_F(WddmDirectSubmissionTest, givenWddmWhenUpdatingTagValueThenExpectComple
contextFence.gpuAddress = address;
contextFence.currentFenceValue = value;
MockWddmDirectSubmission<FamilyType> wddmDirectSubmission(*device.get(),
std::make_unique<RenderDispatcher<FamilyType>>(),
*osContext.get());
MockWddmDirectSubmission<FamilyType, RenderDispatcher<FamilyType>> wddmDirectSubmission(*device.get(),
*osContext.get());
uint64_t actualTagValue = wddmDirectSubmission.updateTagValue();
EXPECT_EQ(value, actualTagValue);

View File

@@ -16,6 +16,9 @@ struct UltHwConfig {
bool csrFailInitDirectSubmission = false;
bool csrBaseCallDirectSubmissionAvailable = false;
bool csrSuperBaseCallDirectSubmissionAvailable = false;
bool csrBaseCallBlitterDirectSubmissionAvailable = false;
bool csrSuperBaseCallBlitterDirectSubmissionAvailable = false;
};
extern UltHwConfig ultHwConfig;

View File

@@ -11,17 +11,17 @@
namespace NEO {
template <typename GfxFamily>
struct MockDirectSubmissionHw : public DirectSubmissionHw<GfxFamily> {
using BaseClass = DirectSubmissionHw<GfxFamily>;
template <typename GfxFamily, typename Dispatcher>
struct MockDirectSubmissionHw : public DirectSubmissionHw<GfxFamily, Dispatcher> {
using BaseClass = DirectSubmissionHw<GfxFamily, Dispatcher>;
using BaseClass::allocateResources;
using BaseClass::cmdDispatcher;
using BaseClass::completionRingBuffers;
using BaseClass::cpuCachelineFlush;
using BaseClass::currentQueueWorkCount;
using BaseClass::currentRingBuffer;
using BaseClass::deallocateResources;
using BaseClass::device;
using BaseClass::DirectSubmissionHw;
using BaseClass::disableCpuCacheFlush;
using BaseClass::dispatchEndingSection;
using BaseClass::dispatchFlushSection;
@@ -55,12 +55,6 @@ struct MockDirectSubmissionHw : public DirectSubmissionHw<GfxFamily> {
using BaseClass::switchRingBuffersAllocations;
using typename BaseClass::RingBufferUse;
MockDirectSubmissionHw(Device &device,
std::unique_ptr<Dispatcher> cmdDispatcher,
OsContext &osContext)
: DirectSubmissionHw<GfxFamily>(device, std::move(cmdDispatcher), osContext) {
}
~MockDirectSubmissionHw() override {
if (ringStart) {
stopRingBuffer();