Implement BCS selection heuristic for OpenCL CommandQueue
Related-To: NEO-6057 Signed-off-by: Maciej Dziuban <maciej.dziuban@intel.com>
This commit is contained in:
parent
3bff852ac0
commit
4c4b37f8d2
|
@ -157,16 +157,53 @@ CommandStreamReceiver *CommandQueue::getBcsForAuxTranslation() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandStreamReceiver &CommandQueue::selectCsrForBuiltinOperation(const CsrSelectionArgs &args) const {
|
CommandStreamReceiver &CommandQueue::selectCsrForBuiltinOperation(const CsrSelectionArgs &args) const {
|
||||||
const bool blitAllowed = blitEnqueueAllowed(args);
|
if (isCopyOnly) {
|
||||||
const bool blitPreferred = blitEnqueuePreferred(args);
|
|
||||||
const bool blitRequired = isCopyOnly;
|
|
||||||
const bool blit = blitAllowed && (blitPreferred || blitRequired);
|
|
||||||
|
|
||||||
if (blit) {
|
|
||||||
return *getAnyBcs();
|
return *getAnyBcs();
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
if (!blitEnqueueAllowed(args)) {
|
||||||
return getGpgpuCommandStreamReceiver();
|
return getGpgpuCommandStreamReceiver();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool preferBcs = true;
|
||||||
|
aub_stream::EngineType preferredBcsEngineType = aub_stream::EngineType::NUM_ENGINES;
|
||||||
|
switch (args.direction) {
|
||||||
|
case TransferDirection::LocalToLocal: {
|
||||||
|
const auto &clHwHelper = ClHwHelper::get(device->getHardwareInfo().platform.eRenderCoreFamily);
|
||||||
|
preferBcs = clHwHelper.preferBlitterForLocalToLocalTransfers();
|
||||||
|
if (auto flag = DebugManager.flags.PreferCopyEngineForCopyBufferToBuffer.get(); flag != -1) {
|
||||||
|
preferBcs = static_cast<bool>(flag);
|
||||||
|
}
|
||||||
|
if (preferBcs) {
|
||||||
|
preferredBcsEngineType = aub_stream::EngineType::ENGINE_BCS;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TransferDirection::HostToHost:
|
||||||
|
case TransferDirection::HostToLocal:
|
||||||
|
case TransferDirection::LocalToHost: {
|
||||||
|
preferBcs = true;
|
||||||
|
preferredBcsEngineType = EngineHelpers::getBcsEngineType(device->getHardwareInfo(), device->getDeviceBitfield(),
|
||||||
|
device->getSelectorCopyEngine(), false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
UNRECOVERABLE_IF(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
CommandStreamReceiver *selectedCsr = nullptr;
|
||||||
|
if (preferBcs) {
|
||||||
|
selectedCsr = getBcsCommandStreamReceiver(preferredBcsEngineType);
|
||||||
|
if (selectedCsr == nullptr) {
|
||||||
|
selectedCsr = getAnyBcs();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (selectedCsr == nullptr) {
|
||||||
|
selectedCsr = &getGpgpuCommandStreamReceiver();
|
||||||
|
}
|
||||||
|
|
||||||
|
UNRECOVERABLE_IF(selectedCsr == nullptr);
|
||||||
|
return *selectedCsr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Device &CommandQueue::getDevice() const noexcept {
|
Device &CommandQueue::getDevice() const noexcept {
|
||||||
|
@ -752,10 +789,6 @@ bool CommandQueue::queueDependenciesClearRequired() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CommandQueue::blitEnqueueAllowed(const CsrSelectionArgs &args) const {
|
bool CommandQueue::blitEnqueueAllowed(const CsrSelectionArgs &args) const {
|
||||||
if (getAnyBcs() == nullptr) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool blitEnqueueAllowed = getGpgpuCommandStreamReceiver().peekTimestampPacketWriteEnabled() || this->isCopyOnly;
|
bool blitEnqueueAllowed = getGpgpuCommandStreamReceiver().peekTimestampPacketWriteEnabled() || this->isCopyOnly;
|
||||||
if (DebugManager.flags.EnableBlitterForEnqueueOperations.get() != -1) {
|
if (DebugManager.flags.EnableBlitterForEnqueueOperations.get() != -1) {
|
||||||
blitEnqueueAllowed = DebugManager.flags.EnableBlitterForEnqueueOperations.get();
|
blitEnqueueAllowed = DebugManager.flags.EnableBlitterForEnqueueOperations.get();
|
||||||
|
@ -789,18 +822,6 @@ bool CommandQueue::blitEnqueueAllowed(const CsrSelectionArgs &args) const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CommandQueue::blitEnqueuePreferred(const CsrSelectionArgs &args) const {
|
|
||||||
if (args.direction == TransferDirection::LocalToLocal) {
|
|
||||||
if (DebugManager.flags.PreferCopyEngineForCopyBufferToBuffer.get() != -1) {
|
|
||||||
return static_cast<bool>(DebugManager.flags.PreferCopyEngineForCopyBufferToBuffer.get());
|
|
||||||
}
|
|
||||||
const auto &clHwHelper = ClHwHelper::get(device->getHardwareInfo().platform.eRenderCoreFamily);
|
|
||||||
return clHwHelper.preferBlitterForLocalToLocalTransfers();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CommandQueue::blitEnqueueImageAllowed(const size_t *origin, const size_t *region, const Image &image) const {
|
bool CommandQueue::blitEnqueueImageAllowed(const size_t *origin, const size_t *region, const Image &image) const {
|
||||||
const auto &hwInfo = device->getHardwareInfo();
|
const auto &hwInfo = device->getHardwareInfo();
|
||||||
const auto &hwInfoConfig = HwInfoConfig::get(hwInfo.platform.eProductFamily);
|
const auto &hwInfoConfig = HwInfoConfig::get(hwInfo.platform.eProductFamily);
|
||||||
|
|
|
@ -368,7 +368,6 @@ class CommandQueue : public BaseObject<_cl_command_queue> {
|
||||||
void providePerformanceHint(TransferProperties &transferProperties);
|
void providePerformanceHint(TransferProperties &transferProperties);
|
||||||
bool queueDependenciesClearRequired() const;
|
bool queueDependenciesClearRequired() const;
|
||||||
bool blitEnqueueAllowed(const CsrSelectionArgs &args) const;
|
bool blitEnqueueAllowed(const CsrSelectionArgs &args) const;
|
||||||
bool blitEnqueuePreferred(const CsrSelectionArgs &args) const;
|
|
||||||
MOCKABLE_VIRTUAL bool blitEnqueueImageAllowed(const size_t *origin, const size_t *region, const Image &image) const;
|
MOCKABLE_VIRTUAL bool blitEnqueueImageAllowed(const size_t *origin, const size_t *region, const Image &image) const;
|
||||||
void aubCaptureHook(bool &blocking, bool &clearAllDependencies, const MultiDispatchInfo &multiDispatchInfo);
|
void aubCaptureHook(bool &blocking, bool &clearAllDependencies, const MultiDispatchInfo &multiDispatchInfo);
|
||||||
virtual bool obtainTimestampPacketForCacheFlush(bool isCacheFlushRequired) const = 0;
|
virtual bool obtainTimestampPacketForCacheFlush(bool isCacheFlushRequired) const = 0;
|
||||||
|
|
|
@ -1301,11 +1301,44 @@ TEST(CommandQueue, givenImageToBufferClCommandWhenCallingBlitEnqueueAllowedThenR
|
||||||
EXPECT_FALSE(queue.blitEnqueueAllowed(args));
|
EXPECT_FALSE(queue.blitEnqueueAllowed(args));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(CommandQueue, givenLocalToLocalCopyBufferCommandWhenCallingBlitEnqueuePreferredThenReturnValueBasedOnDebugFlagAndHwPreference) {
|
template <bool blitter, bool selectBlitterWithQueueFamilies>
|
||||||
const bool preferBlitterHw = ClHwHelper::get(::defaultHwInfo->platform.eRenderCoreFamily).preferBlitterForLocalToLocalTransfers();
|
struct CsrSelectionCommandQueueTests : ::testing::Test {
|
||||||
|
void SetUp() override {
|
||||||
|
HardwareInfo hwInfo = *::defaultHwInfo;
|
||||||
|
hwInfo.capabilityTable.blitterOperationsSupported = blitter;
|
||||||
|
if (blitter) {
|
||||||
|
REQUIRE_FULL_BLITTER_OR_SKIP(&hwInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
device = MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo);
|
||||||
|
clDevice = std::make_unique<MockClDevice>(device);
|
||||||
|
context = std::make_unique<MockContext>(clDevice.get());
|
||||||
|
|
||||||
|
cl_command_queue_properties queueProperties[5] = {};
|
||||||
|
if (selectBlitterWithQueueFamilies) {
|
||||||
|
queueProperties[0] = CL_QUEUE_FAMILY_INTEL;
|
||||||
|
queueProperties[1] = device->getIndexOfNonEmptyEngineGroup(EngineGroupType::Copy);
|
||||||
|
queueProperties[2] = CL_QUEUE_INDEX_INTEL;
|
||||||
|
queueProperties[3] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
queue = std::make_unique<MockCommandQueue>(context.get(), clDevice.get(), queueProperties, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
MockDevice *device;
|
||||||
|
std::unique_ptr<MockClDevice> clDevice;
|
||||||
|
std::unique_ptr<MockContext> context;
|
||||||
|
std::unique_ptr<MockCommandQueue> queue;
|
||||||
|
};
|
||||||
|
|
||||||
|
using CsrSelectionCommandQueueWithoutBlitterTests = CsrSelectionCommandQueueTests<false, false>;
|
||||||
|
using CsrSelectionCommandQueueWithBlitterTests = CsrSelectionCommandQueueTests<true, false>;
|
||||||
|
using CsrSelectionCommandQueueWithQueueFamiliesBlitterTests = CsrSelectionCommandQueueTests<true, true>;
|
||||||
|
|
||||||
|
TEST_F(CsrSelectionCommandQueueWithoutBlitterTests, givenBlitterNotPresentWhenSelectingBlitterThenReturnGpgpuCsr) {
|
||||||
DebugManagerStateRestore restore{};
|
DebugManagerStateRestore restore{};
|
||||||
MockContext context{};
|
DebugManager.flags.EnableBlitterForEnqueueOperations.set(1);
|
||||||
MockCommandQueue queue{context};
|
|
||||||
BuiltinOpParams builtinOpParams{};
|
BuiltinOpParams builtinOpParams{};
|
||||||
MockGraphicsAllocation srcGraphicsAllocation{};
|
MockGraphicsAllocation srcGraphicsAllocation{};
|
||||||
MockGraphicsAllocation dstGraphicsAllocation{};
|
MockGraphicsAllocation dstGraphicsAllocation{};
|
||||||
|
@ -1313,24 +1346,104 @@ TEST(CommandQueue, givenLocalToLocalCopyBufferCommandWhenCallingBlitEnqueuePrefe
|
||||||
MockBuffer dstMemObj{dstGraphicsAllocation};
|
MockBuffer dstMemObj{dstGraphicsAllocation};
|
||||||
builtinOpParams.srcMemObj = &srcMemObj;
|
builtinOpParams.srcMemObj = &srcMemObj;
|
||||||
builtinOpParams.dstMemObj = &dstMemObj;
|
builtinOpParams.dstMemObj = &dstMemObj;
|
||||||
|
|
||||||
|
{
|
||||||
|
srcGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
||||||
|
dstGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
||||||
|
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||||
|
EXPECT_EQ(&queue->getGpgpuCommandStreamReceiver(), &queue->selectCsrForBuiltinOperation(args));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
srcGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
||||||
|
dstGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||||
|
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||||
|
EXPECT_EQ(&queue->getGpgpuCommandStreamReceiver(), &queue->selectCsrForBuiltinOperation(args));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
srcGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||||
|
dstGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
||||||
|
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||||
|
EXPECT_EQ(&queue->getGpgpuCommandStreamReceiver(), &queue->selectCsrForBuiltinOperation(args));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
srcGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||||
|
dstGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||||
|
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||||
|
EXPECT_EQ(&queue->getGpgpuCommandStreamReceiver(), &queue->selectCsrForBuiltinOperation(args));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(CsrSelectionCommandQueueWithBlitterTests, givenBlitterPresentButDisabledWithDebugFlagWhenSelectingBlitterThenReturnGpgpuCsr) {
|
||||||
|
DebugManagerStateRestore restore{};
|
||||||
|
DebugManager.flags.EnableBlitterForEnqueueOperations.set(0);
|
||||||
|
|
||||||
|
BuiltinOpParams builtinOpParams{};
|
||||||
|
MockGraphicsAllocation srcGraphicsAllocation{};
|
||||||
|
MockGraphicsAllocation dstGraphicsAllocation{};
|
||||||
|
MockBuffer srcMemObj{srcGraphicsAllocation};
|
||||||
|
MockBuffer dstMemObj{dstGraphicsAllocation};
|
||||||
|
builtinOpParams.srcMemObj = &srcMemObj;
|
||||||
|
builtinOpParams.dstMemObj = &dstMemObj;
|
||||||
|
|
||||||
|
{
|
||||||
|
srcGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
||||||
|
dstGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
||||||
|
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||||
|
EXPECT_EQ(&queue->getGpgpuCommandStreamReceiver(), &queue->selectCsrForBuiltinOperation(args));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
srcGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
||||||
|
dstGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||||
|
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||||
|
EXPECT_EQ(&queue->getGpgpuCommandStreamReceiver(), &queue->selectCsrForBuiltinOperation(args));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
srcGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||||
|
dstGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
||||||
|
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||||
|
EXPECT_EQ(&queue->getGpgpuCommandStreamReceiver(), &queue->selectCsrForBuiltinOperation(args));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
srcGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||||
|
dstGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||||
|
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||||
|
EXPECT_EQ(&queue->getGpgpuCommandStreamReceiver(), &queue->selectCsrForBuiltinOperation(args));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(CsrSelectionCommandQueueWithBlitterTests, givenBlitterPresentAndLocalToLocalCopyBufferCommandWhenSelectingBlitterThenReturnValueBasedOnDebugFlagAndHwPreference) {
|
||||||
|
DebugManagerStateRestore restore{};
|
||||||
|
DebugManager.flags.EnableBlitterForEnqueueOperations.set(1);
|
||||||
|
|
||||||
|
const bool hwPreference = ClHwHelper::get(::defaultHwInfo->platform.eRenderCoreFamily).preferBlitterForLocalToLocalTransfers();
|
||||||
|
const auto &hwPreferenceCsr = hwPreference ? *queue->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS) : queue->getGpgpuCommandStreamReceiver();
|
||||||
|
|
||||||
|
BuiltinOpParams builtinOpParams{};
|
||||||
|
MockGraphicsAllocation srcGraphicsAllocation{};
|
||||||
|
MockGraphicsAllocation dstGraphicsAllocation{};
|
||||||
|
MockBuffer srcMemObj{srcGraphicsAllocation};
|
||||||
|
MockBuffer dstMemObj{dstGraphicsAllocation};
|
||||||
|
builtinOpParams.srcMemObj = &srcMemObj;
|
||||||
|
builtinOpParams.dstMemObj = &dstMemObj;
|
||||||
|
|
||||||
srcGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
srcGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||||
dstGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
dstGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||||
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||||
|
|
||||||
DebugManager.flags.PreferCopyEngineForCopyBufferToBuffer.set(-1);
|
DebugManager.flags.PreferCopyEngineForCopyBufferToBuffer.set(-1);
|
||||||
EXPECT_EQ(preferBlitterHw, queue.blitEnqueuePreferred(args));
|
EXPECT_EQ(&hwPreferenceCsr, &queue->selectCsrForBuiltinOperation(args));
|
||||||
|
|
||||||
DebugManager.flags.PreferCopyEngineForCopyBufferToBuffer.set(0);
|
DebugManager.flags.PreferCopyEngineForCopyBufferToBuffer.set(0);
|
||||||
EXPECT_FALSE(queue.blitEnqueuePreferred(args));
|
EXPECT_EQ(&queue->getGpgpuCommandStreamReceiver(), &queue->selectCsrForBuiltinOperation(args));
|
||||||
|
|
||||||
DebugManager.flags.PreferCopyEngineForCopyBufferToBuffer.set(1);
|
DebugManager.flags.PreferCopyEngineForCopyBufferToBuffer.set(1);
|
||||||
EXPECT_TRUE(queue.blitEnqueuePreferred(args));
|
EXPECT_EQ(queue->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS), &queue->selectCsrForBuiltinOperation(args));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(CommandQueue, givenNotLocalToLocalCopyBufferCommandWhenCallingBlitEnqueuePreferredThenReturnTrueRegardlessOfDebugFlag) {
|
TEST_F(CsrSelectionCommandQueueWithBlitterTests, givenBlitterPresentAndNotLocalToLocalCopyBufferCommandWhenSelectingCsrThenUseBcsRegardlessOfDebugFlag) {
|
||||||
DebugManagerStateRestore restore{};
|
DebugManagerStateRestore restore{};
|
||||||
MockContext context{};
|
DebugManager.flags.EnableBlitterForEnqueueOperations.set(1);
|
||||||
MockCommandQueue queue{context};
|
|
||||||
|
const auto &bcsCsr = *queue->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS);
|
||||||
|
|
||||||
BuiltinOpParams builtinOpParams{};
|
BuiltinOpParams builtinOpParams{};
|
||||||
MockGraphicsAllocation srcGraphicsAllocation{};
|
MockGraphicsAllocation srcGraphicsAllocation{};
|
||||||
MockGraphicsAllocation dstGraphicsAllocation{};
|
MockGraphicsAllocation dstGraphicsAllocation{};
|
||||||
|
@ -1344,35 +1457,125 @@ TEST(CommandQueue, givenNotLocalToLocalCopyBufferCommandWhenCallingBlitEnqueuePr
|
||||||
dstGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
dstGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||||
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||||
DebugManager.flags.PreferCopyEngineForCopyBufferToBuffer.set(-1);
|
DebugManager.flags.PreferCopyEngineForCopyBufferToBuffer.set(-1);
|
||||||
EXPECT_TRUE(queue.blitEnqueuePreferred(args));
|
EXPECT_EQ(&bcsCsr, &queue->selectCsrForBuiltinOperation(args));
|
||||||
DebugManager.flags.PreferCopyEngineForCopyBufferToBuffer.set(0);
|
DebugManager.flags.PreferCopyEngineForCopyBufferToBuffer.set(0);
|
||||||
EXPECT_TRUE(queue.blitEnqueuePreferred(args));
|
EXPECT_EQ(&bcsCsr, &queue->selectCsrForBuiltinOperation(args));
|
||||||
DebugManager.flags.PreferCopyEngineForCopyBufferToBuffer.set(1);
|
DebugManager.flags.PreferCopyEngineForCopyBufferToBuffer.set(1);
|
||||||
EXPECT_TRUE(queue.blitEnqueuePreferred(args));
|
EXPECT_EQ(&bcsCsr, &queue->selectCsrForBuiltinOperation(args));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
srcGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
srcGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||||
dstGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
dstGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
||||||
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||||
DebugManager.flags.PreferCopyEngineForCopyBufferToBuffer.set(-1);
|
DebugManager.flags.PreferCopyEngineForCopyBufferToBuffer.set(-1);
|
||||||
EXPECT_TRUE(queue.blitEnqueuePreferred(args));
|
EXPECT_EQ(&bcsCsr, &queue->selectCsrForBuiltinOperation(args));
|
||||||
DebugManager.flags.PreferCopyEngineForCopyBufferToBuffer.set(0);
|
DebugManager.flags.PreferCopyEngineForCopyBufferToBuffer.set(0);
|
||||||
EXPECT_TRUE(queue.blitEnqueuePreferred(args));
|
EXPECT_EQ(&bcsCsr, &queue->selectCsrForBuiltinOperation(args));
|
||||||
DebugManager.flags.PreferCopyEngineForCopyBufferToBuffer.set(1);
|
DebugManager.flags.PreferCopyEngineForCopyBufferToBuffer.set(1);
|
||||||
EXPECT_TRUE(queue.blitEnqueuePreferred(args));
|
EXPECT_EQ(&bcsCsr, &queue->selectCsrForBuiltinOperation(args));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
srcGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
srcGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
||||||
dstGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
dstGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
||||||
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||||
DebugManager.flags.PreferCopyEngineForCopyBufferToBuffer.set(-1);
|
DebugManager.flags.PreferCopyEngineForCopyBufferToBuffer.set(-1);
|
||||||
EXPECT_TRUE(queue.blitEnqueuePreferred(args));
|
EXPECT_EQ(&bcsCsr, &queue->selectCsrForBuiltinOperation(args));
|
||||||
DebugManager.flags.PreferCopyEngineForCopyBufferToBuffer.set(0);
|
DebugManager.flags.PreferCopyEngineForCopyBufferToBuffer.set(0);
|
||||||
EXPECT_TRUE(queue.blitEnqueuePreferred(args));
|
EXPECT_EQ(&bcsCsr, &queue->selectCsrForBuiltinOperation(args));
|
||||||
DebugManager.flags.PreferCopyEngineForCopyBufferToBuffer.set(1);
|
DebugManager.flags.PreferCopyEngineForCopyBufferToBuffer.set(1);
|
||||||
EXPECT_TRUE(queue.blitEnqueuePreferred(args));
|
EXPECT_EQ(&bcsCsr, &queue->selectCsrForBuiltinOperation(args));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(CsrSelectionCommandQueueWithBlitterTests, givenInvalidTransferDirectionWhenSelectingCsrThenThrowError) {
|
||||||
|
DebugManagerStateRestore restore{};
|
||||||
|
DebugManager.flags.EnableBlitterForEnqueueOperations.set(1);
|
||||||
|
|
||||||
|
BuiltinOpParams builtinOpParams{};
|
||||||
|
MockGraphicsAllocation srcGraphicsAllocation{};
|
||||||
|
MockGraphicsAllocation dstGraphicsAllocation{};
|
||||||
|
MockBuffer srcMemObj{srcGraphicsAllocation};
|
||||||
|
MockBuffer dstMemObj{dstGraphicsAllocation};
|
||||||
|
builtinOpParams.srcMemObj = &srcMemObj;
|
||||||
|
builtinOpParams.dstMemObj = &dstMemObj;
|
||||||
|
|
||||||
|
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||||
|
args.direction = static_cast<TransferDirection>(0xFF);
|
||||||
|
EXPECT_ANY_THROW(queue->selectCsrForBuiltinOperation(args));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(CsrSelectionCommandQueueWithQueueFamiliesBlitterTests, givenBlitterSelectedWithQueueFamiliesWhenSelectingBlitterThenSelectBlitter) {
|
||||||
|
DebugManagerStateRestore restore{};
|
||||||
|
|
||||||
|
BuiltinOpParams builtinOpParams{};
|
||||||
|
MockGraphicsAllocation srcGraphicsAllocation{};
|
||||||
|
MockGraphicsAllocation dstGraphicsAllocation{};
|
||||||
|
MockBuffer srcMemObj{srcGraphicsAllocation};
|
||||||
|
MockBuffer dstMemObj{dstGraphicsAllocation};
|
||||||
|
builtinOpParams.srcMemObj = &srcMemObj;
|
||||||
|
builtinOpParams.dstMemObj = &dstMemObj;
|
||||||
|
|
||||||
|
{
|
||||||
|
srcGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
||||||
|
dstGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
||||||
|
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||||
|
EXPECT_EQ(queue->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS), &queue->selectCsrForBuiltinOperation(args));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
srcGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
||||||
|
dstGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||||
|
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||||
|
EXPECT_EQ(queue->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS), &queue->selectCsrForBuiltinOperation(args));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
srcGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||||
|
dstGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
||||||
|
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||||
|
EXPECT_EQ(queue->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS), &queue->selectCsrForBuiltinOperation(args));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
srcGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||||
|
dstGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||||
|
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||||
|
EXPECT_EQ(queue->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS), &queue->selectCsrForBuiltinOperation(args));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(CsrSelectionCommandQueueWithQueueFamiliesBlitterTests, givenBlitterSelectedWithQueueFamiliesButDisabledWithDebugFlagWhenSelectingBlitterThenIgnoreDebugFlagAndSelectBlitter) {
|
||||||
|
DebugManagerStateRestore restore{};
|
||||||
|
DebugManager.flags.EnableBlitterForEnqueueOperations.set(0);
|
||||||
|
|
||||||
|
BuiltinOpParams builtinOpParams{};
|
||||||
|
MockGraphicsAllocation srcGraphicsAllocation{};
|
||||||
|
MockGraphicsAllocation dstGraphicsAllocation{};
|
||||||
|
MockBuffer srcMemObj{srcGraphicsAllocation};
|
||||||
|
MockBuffer dstMemObj{dstGraphicsAllocation};
|
||||||
|
builtinOpParams.srcMemObj = &srcMemObj;
|
||||||
|
builtinOpParams.dstMemObj = &dstMemObj;
|
||||||
|
|
||||||
|
{
|
||||||
|
srcGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
||||||
|
dstGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
||||||
|
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||||
|
EXPECT_EQ(queue->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS), &queue->selectCsrForBuiltinOperation(args));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
srcGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
||||||
|
dstGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||||
|
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||||
|
EXPECT_EQ(queue->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS), &queue->selectCsrForBuiltinOperation(args));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
srcGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||||
|
dstGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
||||||
|
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||||
|
EXPECT_EQ(queue->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS), &queue->selectCsrForBuiltinOperation(args));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
srcGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||||
|
dstGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||||
|
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||||
|
EXPECT_EQ(queue->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS), &queue->selectCsrForBuiltinOperation(args));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -218,6 +218,7 @@ HWTEST_F(EnqueueCopyImageTest, givenDeviceWithBlitterSupportWhenEnqueueCopyImage
|
||||||
auto hwInfo = pClDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
|
auto hwInfo = pClDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||||
const auto &hwInfoConfig = HwInfoConfig::get(hwInfo->platform.eProductFamily);
|
const auto &hwInfoConfig = HwInfoConfig::get(hwInfo->platform.eProductFamily);
|
||||||
hwInfo->capabilityTable.blitterOperationsSupported = true;
|
hwInfo->capabilityTable.blitterOperationsSupported = true;
|
||||||
|
REQUIRE_FULL_BLITTER_OR_SKIP(hwInfo);
|
||||||
|
|
||||||
size_t srcOrigin[] = {0, 0, 0};
|
size_t srcOrigin[] = {0, 0, 0};
|
||||||
size_t dstOrigin[] = {0, 0, 0};
|
size_t dstOrigin[] = {0, 0, 0};
|
||||||
|
|
|
@ -217,6 +217,7 @@ HWTEST_F(EnqueueWriteImageTest, givenDeviceWithBlitterSupportWhenEnqueueWriteIma
|
||||||
auto hwInfo = pClDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
|
auto hwInfo = pClDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||||
const auto &hwInfoConfig = HwInfoConfig::get(hwInfo->platform.eProductFamily);
|
const auto &hwInfoConfig = HwInfoConfig::get(hwInfo->platform.eProductFamily);
|
||||||
hwInfo->capabilityTable.blitterOperationsSupported = true;
|
hwInfo->capabilityTable.blitterOperationsSupported = true;
|
||||||
|
REQUIRE_FULL_BLITTER_OR_SKIP(hwInfo);
|
||||||
size_t origin[] = {0, 0, 0};
|
size_t origin[] = {0, 0, 0};
|
||||||
auto mockCmdQ = std::make_unique<MockCommandQueueHw<FamilyType>>(context, pClDevice, nullptr);
|
auto mockCmdQ = std::make_unique<MockCommandQueueHw<FamilyType>>(context, pClDevice, nullptr);
|
||||||
std::unique_ptr<Image> image(Image2dHelper<>::create(context));
|
std::unique_ptr<Image> image(Image2dHelper<>::create(context));
|
||||||
|
|
|
@ -21,7 +21,6 @@ class MockCommandQueue : public CommandQueue {
|
||||||
using CommandQueue::bcsEngines;
|
using CommandQueue::bcsEngines;
|
||||||
using CommandQueue::blitEnqueueAllowed;
|
using CommandQueue::blitEnqueueAllowed;
|
||||||
using CommandQueue::blitEnqueueImageAllowed;
|
using CommandQueue::blitEnqueueImageAllowed;
|
||||||
using CommandQueue::blitEnqueuePreferred;
|
|
||||||
using CommandQueue::bufferCpuCopyAllowed;
|
using CommandQueue::bufferCpuCopyAllowed;
|
||||||
using CommandQueue::device;
|
using CommandQueue::device;
|
||||||
using CommandQueue::gpgpuEngine;
|
using CommandQueue::gpgpuEngine;
|
||||||
|
|
Loading…
Reference in New Issue