mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-19 06:24:51 +08:00
fix(ocl): tweak resolve deps with pipecontrols
Keep resolving with semaphores if multiple (>2) queues are submitting to the same CSR. In such case, semaphores allow concurrent execution while pipecontrols would serialize it. Related-To: NEO-7321 Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
0f6140deb0
commit
d7981e153e
@@ -192,7 +192,7 @@ cl_int CommandQueueHw<GfxFamily>::enqueueHandler(Surface **surfacesForResidency,
|
||||
|
||||
if (computeCommandStreamReceiver.peekTimestampPacketWriteEnabled()) {
|
||||
canUsePipeControlInsteadOfSemaphoresForOnCsrDependencies = this->peekLatestSentEnqueueOperation() == EnqueueProperties::Operation::GpuKernel &&
|
||||
productHelper.isResolveDependenciesByPipeControlsSupported(hwInfo, this->isOOQEnabled());
|
||||
productHelper.isResolveDependenciesByPipeControlsSupported(hwInfo, this->isOOQEnabled(), this->taskCount, computeCommandStreamReceiver);
|
||||
if (false == clearDependenciesForSubCapture) {
|
||||
if (false == canUsePipeControlInsteadOfSemaphoresForOnCsrDependencies) {
|
||||
eventsRequest.fillCsrDependenciesForTimestampPacketContainer(csrDeps, computeCommandStreamReceiver, CsrDependencies::DependenciesType::OnCsr);
|
||||
|
||||
@@ -557,7 +557,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTest, givenTimestamp
|
||||
MockMultiDispatchInfo multiDispatchInfo(device.get(), std::vector<Kernel *>({kernel1.mockKernel, kernel2.mockKernel}));
|
||||
const auto &hwInfo = device->getHardwareInfo();
|
||||
const auto &productHelper = device->getProductHelper();
|
||||
const bool isResolveDependenciesByPipeControlsEnabled = productHelper.isResolveDependenciesByPipeControlsSupported(hwInfo, cmdQ.isOOQEnabled());
|
||||
const bool isResolveDependenciesByPipeControlsEnabled = productHelper.isResolveDependenciesByPipeControlsSupported(hwInfo, cmdQ.isOOQEnabled(), cmdQ.taskCount, cmdQ.getGpgpuCommandStreamReceiver());
|
||||
|
||||
device->getUltCommandStreamReceiver<FamilyType>().timestampPacketWriteEnabled = false;
|
||||
getCommandStream<FamilyType, CL_COMMAND_NDRANGE_KERNEL>(cmdQ, CsrDependencies(), false, false, false, multiDispatchInfo, nullptr, 0, false, false, isResolveDependenciesByPipeControlsEnabled, nullptr);
|
||||
|
||||
@@ -141,15 +141,15 @@ HWTEST_F(TimestampPacketTests, givenTimestampPacketWriteEnabledWhenEstimatingStr
|
||||
MockKernelWithInternals kernel2(*device);
|
||||
MockMultiDispatchInfo multiDispatchInfo(device.get(), std::vector<Kernel *>({kernel->mockKernel, kernel2.mockKernel}));
|
||||
auto mockCmdQHw = std::make_unique<MockCommandQueueHw<FamilyType>>(context, device.get(), nullptr);
|
||||
|
||||
device->getUltCommandStreamReceiver<FamilyType>().timestampPacketWriteEnabled = false;
|
||||
auto &csr = device->getUltCommandStreamReceiver<FamilyType>();
|
||||
csr.timestampPacketWriteEnabled = false;
|
||||
const auto &hwInfo = device->getHardwareInfo();
|
||||
const auto &productHelper = device->getProductHelper();
|
||||
const bool isResolveDependenciesByPipeControlsEnabled = productHelper.isResolveDependenciesByPipeControlsSupported(hwInfo, mockCmdQHw->isOOQEnabled());
|
||||
const bool isResolveDependenciesByPipeControlsEnabled = productHelper.isResolveDependenciesByPipeControlsSupported(hwInfo, mockCmdQHw->isOOQEnabled(), mockCmdQHw->taskCount, mockCmdQHw->getGpgpuCommandStreamReceiver());
|
||||
getCommandStream<FamilyType, CL_COMMAND_NDRANGE_KERNEL>(*mockCmdQHw, CsrDependencies(), false, false, false, multiDispatchInfo, nullptr, 0, false, false, isResolveDependenciesByPipeControlsEnabled, nullptr);
|
||||
auto sizeWithDisabled = mockCmdQHw->requestedCmdStreamSize;
|
||||
|
||||
device->getUltCommandStreamReceiver<FamilyType>().timestampPacketWriteEnabled = true;
|
||||
csr.timestampPacketWriteEnabled = true;
|
||||
|
||||
MockTimestampPacketContainer timestamp1(*device->getGpgpuCommandStreamReceiver().getTimestampPacketAllocator(), 1);
|
||||
MockTimestampPacketContainer timestamp2(*device->getGpgpuCommandStreamReceiver().getTimestampPacketAllocator(), 2);
|
||||
|
||||
@@ -228,7 +228,7 @@ HWTEST_F(TimestampPacketTests, givenWaitlistWhenEnqueueingBarrierThenProgramNonS
|
||||
|
||||
auto it = hwParser.cmdList.begin();
|
||||
|
||||
if (device->getProductHelper().isResolveDependenciesByPipeControlsSupported(device->getHardwareInfo(), false)) {
|
||||
if (device->getProductHelper().isResolveDependenciesByPipeControlsSupported(device->getHardwareInfo(), false, cmdQ.taskCount, cmdQ.getGpgpuCommandStreamReceiver())) {
|
||||
EXPECT_NE(nullptr, genCmdCast<PIPE_CONTROL *>(*it));
|
||||
} else {
|
||||
EXPECT_NE(nullptr, genCmdCast<MI_SEMAPHORE_WAIT *>(*it));
|
||||
|
||||
@@ -6,12 +6,13 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/command_stream/task_count_helper.h"
|
||||
|
||||
#include <igfxfmid.h>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace AOT {
|
||||
enum PRODUCT_CONFIG : uint32_t;
|
||||
}
|
||||
@@ -21,6 +22,8 @@ enum class ProductFamily : uint32_t;
|
||||
}
|
||||
|
||||
namespace NEO {
|
||||
|
||||
class CommandStreamReceiver;
|
||||
class Device;
|
||||
enum class LocalMemoryAccessMode;
|
||||
struct FrontEndPropertiesSupport;
|
||||
@@ -159,7 +162,7 @@ class ProductHelper {
|
||||
virtual bool isStatefulAddressingModeSupported() const = 0;
|
||||
virtual bool isPlatformQuerySupported() const = 0;
|
||||
virtual bool isNonBlockingGpuSubmissionSupported() const = 0;
|
||||
virtual bool isResolveDependenciesByPipeControlsSupported(const HardwareInfo &hwInfo, bool isOOQ) const = 0;
|
||||
virtual bool isResolveDependenciesByPipeControlsSupported(const HardwareInfo &hwInfo, bool isOOQ, TaskCountType queueTaskCount, const CommandStreamReceiver &queueCsr) const = 0;
|
||||
virtual bool isMidThreadPreemptionDisallowedForRayTracingKernels() const = 0;
|
||||
virtual bool isBufferPoolAllocatorSupported() const = 0;
|
||||
virtual uint64_t overridePatIndex(AllocationType allocationType, uint64_t patIndex) const = 0;
|
||||
|
||||
@@ -549,7 +549,7 @@ bool ProductHelperHw<gfxProduct>::isNonBlockingGpuSubmissionSupported() const {
|
||||
}
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
bool ProductHelperHw<gfxProduct>::isResolveDependenciesByPipeControlsSupported(const HardwareInfo &hwInfo, bool isOOQ) const {
|
||||
bool ProductHelperHw<gfxProduct>::isResolveDependenciesByPipeControlsSupported(const HardwareInfo &hwInfo, bool isOOQ, TaskCountType queueTaskCount, const CommandStreamReceiver &queueCsr) const {
|
||||
constexpr bool enabled = false;
|
||||
if (DebugManager.flags.ResolveDependenciesViaPipeControls.get() != -1) {
|
||||
return DebugManager.flags.ResolveDependenciesViaPipeControls.get() == 1;
|
||||
|
||||
@@ -114,7 +114,7 @@ class ProductHelperHw : public ProductHelper {
|
||||
uint32_t getNumberOfPartsInTileForConcurrentKernel() const override;
|
||||
bool isPlatformQuerySupported() const override;
|
||||
bool isNonBlockingGpuSubmissionSupported() const override;
|
||||
bool isResolveDependenciesByPipeControlsSupported(const HardwareInfo &hwInfo, bool isOOQ) const override;
|
||||
bool isResolveDependenciesByPipeControlsSupported(const HardwareInfo &hwInfo, bool isOOQ, TaskCountType queueTaskCount, const CommandStreamReceiver &queueCsr) const override;
|
||||
bool isMidThreadPreemptionDisallowedForRayTracingKernels() const override;
|
||||
bool isBufferPoolAllocatorSupported() const override;
|
||||
uint64_t overridePatIndex(AllocationType allocationType, uint64_t patIndex) const override;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_stream/command_stream_receiver.h"
|
||||
#include "shared/source/helpers/gfx_core_helper.h"
|
||||
#include "shared/source/memory_manager/memory_manager.h"
|
||||
|
||||
@@ -215,8 +216,8 @@ bool ProductHelperHw<gfxProduct>::isStorageInfoAdjustmentRequired() const {
|
||||
}
|
||||
|
||||
template <>
|
||||
bool ProductHelperHw<gfxProduct>::isResolveDependenciesByPipeControlsSupported(const HardwareInfo &hwInfo, bool isOOQ) const {
|
||||
const bool enabled = !isOOQ;
|
||||
bool ProductHelperHw<gfxProduct>::isResolveDependenciesByPipeControlsSupported(const HardwareInfo &hwInfo, bool isOOQ, TaskCountType queueTaskCount, const CommandStreamReceiver &queueCsr) const {
|
||||
const bool enabled = !isOOQ && queueTaskCount == queueCsr.peekTaskCount();
|
||||
if (DebugManager.flags.ResolveDependenciesViaPipeControls.get() != -1) {
|
||||
return DebugManager.flags.ResolveDependenciesViaPipeControls.get() == 1;
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ class MockCommandStreamReceiver : public CommandStreamReceiver {
|
||||
using CommandStreamReceiver::latestFlushedTaskCount;
|
||||
using CommandStreamReceiver::latestSentTaskCount;
|
||||
using CommandStreamReceiver::newResources;
|
||||
using CommandStreamReceiver::numClients;
|
||||
using CommandStreamReceiver::osContext;
|
||||
using CommandStreamReceiver::ownershipMutex;
|
||||
using CommandStreamReceiver::postSyncWriteOffset;
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#include "shared/test/common/helpers/gtest_helpers.h"
|
||||
#include "shared/test/common/helpers/mock_product_helper_hw.h"
|
||||
#include "shared/test/common/helpers/unit_test_helper.h"
|
||||
#include "shared/test/common/mocks/mock_command_stream_receiver.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
@@ -660,17 +662,27 @@ HWTEST2_F(ProductHelperTest, givenProductHelperWhenIsPlatformQueryNotSupportedTh
|
||||
HWTEST_F(ProductHelperTest, givenDebugFlagWhenCheckingIsResolveDependenciesByPipeControlsSupportedThenCorrectValueIsReturned) {
|
||||
DebugManagerStateRestore restorer;
|
||||
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
MockCommandStreamReceiver csr(*mockDevice->getExecutionEnvironment(), mockDevice->getRootDeviceIndex(), mockDevice->getDeviceBitfield());
|
||||
csr.taskCount = 2;
|
||||
|
||||
// ResolveDependenciesViaPipeControls = -1 (default)
|
||||
EXPECT_FALSE(productHelper->isResolveDependenciesByPipeControlsSupported(pInHwInfo, false));
|
||||
EXPECT_FALSE(productHelper->isResolveDependenciesByPipeControlsSupported(pInHwInfo, true));
|
||||
EXPECT_FALSE(productHelper->isResolveDependenciesByPipeControlsSupported(pInHwInfo, false, 2, csr));
|
||||
EXPECT_FALSE(productHelper->isResolveDependenciesByPipeControlsSupported(pInHwInfo, true, 2, csr));
|
||||
EXPECT_FALSE(productHelper->isResolveDependenciesByPipeControlsSupported(pInHwInfo, false, 3, csr));
|
||||
EXPECT_FALSE(productHelper->isResolveDependenciesByPipeControlsSupported(pInHwInfo, true, 3, csr));
|
||||
|
||||
DebugManager.flags.ResolveDependenciesViaPipeControls.set(0);
|
||||
EXPECT_FALSE(productHelper->isResolveDependenciesByPipeControlsSupported(pInHwInfo, false));
|
||||
EXPECT_FALSE(productHelper->isResolveDependenciesByPipeControlsSupported(pInHwInfo, true));
|
||||
EXPECT_FALSE(productHelper->isResolveDependenciesByPipeControlsSupported(pInHwInfo, false, 2, csr));
|
||||
EXPECT_FALSE(productHelper->isResolveDependenciesByPipeControlsSupported(pInHwInfo, true, 2, csr));
|
||||
EXPECT_FALSE(productHelper->isResolveDependenciesByPipeControlsSupported(pInHwInfo, false, 3, csr));
|
||||
EXPECT_FALSE(productHelper->isResolveDependenciesByPipeControlsSupported(pInHwInfo, true, 3, csr));
|
||||
|
||||
DebugManager.flags.ResolveDependenciesViaPipeControls.set(1);
|
||||
EXPECT_TRUE(productHelper->isResolveDependenciesByPipeControlsSupported(pInHwInfo, false));
|
||||
EXPECT_TRUE(productHelper->isResolveDependenciesByPipeControlsSupported(pInHwInfo, true));
|
||||
EXPECT_TRUE(productHelper->isResolveDependenciesByPipeControlsSupported(pInHwInfo, false, 2, csr));
|
||||
EXPECT_TRUE(productHelper->isResolveDependenciesByPipeControlsSupported(pInHwInfo, true, 2, csr));
|
||||
EXPECT_TRUE(productHelper->isResolveDependenciesByPipeControlsSupported(pInHwInfo, false, 3, csr));
|
||||
EXPECT_TRUE(productHelper->isResolveDependenciesByPipeControlsSupported(pInHwInfo, true, 3, csr));
|
||||
}
|
||||
|
||||
HWTEST_F(ProductHelperTest, givenProductHelperWhenCheckingIsBufferPoolAllocatorSupportedThenCorrectValueIsReturned) {
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
#include "shared/source/xe_hpg_core/hw_cmds_dg2.h"
|
||||
#include "shared/test/common/fixtures/device_fixture.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/mock_command_stream_receiver.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
#include "shared/test/unit_test/fixtures/product_config_fixture.h"
|
||||
@@ -802,17 +804,27 @@ DG2TEST_F(ProductHelperTestDg2, givenProductHelperWhenGettingEvictIfNecessaryFla
|
||||
DG2TEST_F(ProductHelperTestDg2, givenDebugFlagWhenCheckingIsResolveDependenciesByPipeControlsSupportedThenCorrectValueIsReturned) {
|
||||
DebugManagerStateRestore restorer;
|
||||
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
MockCommandStreamReceiver csr(*mockDevice->getExecutionEnvironment(), mockDevice->getRootDeviceIndex(), mockDevice->getDeviceBitfield());
|
||||
csr.taskCount = 2;
|
||||
|
||||
// ResolveDependenciesViaPipeControls = -1 (default)
|
||||
EXPECT_TRUE(productHelper->isResolveDependenciesByPipeControlsSupported(*defaultHwInfo, false));
|
||||
EXPECT_FALSE(productHelper->isResolveDependenciesByPipeControlsSupported(*defaultHwInfo, true));
|
||||
EXPECT_TRUE(productHelper->isResolveDependenciesByPipeControlsSupported(pInHwInfo, false, 2, csr));
|
||||
EXPECT_FALSE(productHelper->isResolveDependenciesByPipeControlsSupported(pInHwInfo, true, 2, csr));
|
||||
EXPECT_FALSE(productHelper->isResolveDependenciesByPipeControlsSupported(pInHwInfo, false, 3, csr));
|
||||
EXPECT_FALSE(productHelper->isResolveDependenciesByPipeControlsSupported(pInHwInfo, true, 3, csr));
|
||||
|
||||
DebugManager.flags.ResolveDependenciesViaPipeControls.set(0);
|
||||
EXPECT_FALSE(productHelper->isResolveDependenciesByPipeControlsSupported(*defaultHwInfo, false));
|
||||
EXPECT_FALSE(productHelper->isResolveDependenciesByPipeControlsSupported(*defaultHwInfo, true));
|
||||
EXPECT_FALSE(productHelper->isResolveDependenciesByPipeControlsSupported(pInHwInfo, false, 2, csr));
|
||||
EXPECT_FALSE(productHelper->isResolveDependenciesByPipeControlsSupported(pInHwInfo, true, 2, csr));
|
||||
EXPECT_FALSE(productHelper->isResolveDependenciesByPipeControlsSupported(pInHwInfo, false, 3, csr));
|
||||
EXPECT_FALSE(productHelper->isResolveDependenciesByPipeControlsSupported(pInHwInfo, true, 3, csr));
|
||||
|
||||
DebugManager.flags.ResolveDependenciesViaPipeControls.set(1);
|
||||
EXPECT_TRUE(productHelper->isResolveDependenciesByPipeControlsSupported(*defaultHwInfo, false));
|
||||
EXPECT_TRUE(productHelper->isResolveDependenciesByPipeControlsSupported(*defaultHwInfo, true));
|
||||
EXPECT_TRUE(productHelper->isResolveDependenciesByPipeControlsSupported(pInHwInfo, false, 2, csr));
|
||||
EXPECT_TRUE(productHelper->isResolveDependenciesByPipeControlsSupported(pInHwInfo, true, 2, csr));
|
||||
EXPECT_TRUE(productHelper->isResolveDependenciesByPipeControlsSupported(pInHwInfo, false, 3, csr));
|
||||
EXPECT_TRUE(productHelper->isResolveDependenciesByPipeControlsSupported(pInHwInfo, true, 3, csr));
|
||||
}
|
||||
|
||||
DG2TEST_F(ProductHelperTestDg2, givenProductHelperWhenCheckingIsBufferPoolAllocatorSupportedThenCorrectValueIsReturned) {
|
||||
|
||||
Reference in New Issue
Block a user