mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 09:14:47 +08:00
Flush tag update at device init
Resolves: NEO-7642 Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
49837b7bb5
commit
8ba950176d
@@ -228,6 +228,17 @@ HWTEST_TEMPLATED_F(BlitAuxTranslationTests, whenFlushTagUpdateThenMiFlushDwIsFlu
|
|||||||
EXPECT_NE(cmdFound, cmdListBcs.end());
|
EXPECT_NE(cmdFound, cmdListBcs.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HWTEST_TEMPLATED_F(BlitAuxTranslationTests, whenInitializeDeviceWithFirstSubmissionThenMiFlushDwIsFlushed) {
|
||||||
|
using MI_FLUSH_DW = typename FamilyType::MI_FLUSH_DW;
|
||||||
|
|
||||||
|
EXPECT_EQ(SubmissionStatus::SUCCESS, bcsCsr->initializeDeviceWithFirstSubmission());
|
||||||
|
|
||||||
|
auto cmdListBcs = getCmdList<FamilyType>(bcsCsr->getCS(0), 0);
|
||||||
|
|
||||||
|
auto cmdFound = expectCommand<MI_FLUSH_DW>(cmdListBcs.begin(), cmdListBcs.end());
|
||||||
|
EXPECT_NE(cmdFound, cmdListBcs.end());
|
||||||
|
}
|
||||||
|
|
||||||
HWTEST_TEMPLATED_F(BlitAuxTranslationTests, whenFlushTagUpdateThenSetStallingCmdsFlag) {
|
HWTEST_TEMPLATED_F(BlitAuxTranslationTests, whenFlushTagUpdateThenSetStallingCmdsFlag) {
|
||||||
auto ultCsr = static_cast<UltCommandStreamReceiver<FamilyType> *>(bcsCsr);
|
auto ultCsr = static_cast<UltCommandStreamReceiver<FamilyType> *>(bcsCsr);
|
||||||
|
|
||||||
|
|||||||
@@ -884,6 +884,14 @@ TEST(DeviceTest, whenCheckBlitSplitEnabledThenReturnsTrue) {
|
|||||||
EXPECT_TRUE(Device::isBlitSplitEnabled());
|
EXPECT_TRUE(Device::isBlitSplitEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(DeviceTest, givenCsrHwWhenCheckIsInitDeviceWithFirstSubmissionEnabledThenReturnsTrue) {
|
||||||
|
EXPECT_TRUE(Device::isInitDeviceWithFirstSubmissionEnabled(CommandStreamReceiverType::CSR_HW));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(DeviceTest, givenCsrNonHwWhenCheckIsInitDeviceWithFirstSubmissionEnabledThenReturnsTrue) {
|
||||||
|
EXPECT_FALSE(Device::isInitDeviceWithFirstSubmissionEnabled(CommandStreamReceiverType::CSR_TBX));
|
||||||
|
}
|
||||||
|
|
||||||
TEST(PlatformsDestructor, whenGlobalPlatformsDestructorIsCalledThenGlobalPlatformsAreDestroyed) {
|
TEST(PlatformsDestructor, whenGlobalPlatformsDestructorIsCalledThenGlobalPlatformsAreDestroyed) {
|
||||||
EXPECT_NE(nullptr, platformsImpl);
|
EXPECT_NE(nullptr, platformsImpl);
|
||||||
platformsDestructor();
|
platformsDestructor();
|
||||||
|
|||||||
@@ -1348,6 +1348,7 @@ SubmissionStatus CommandStreamReceiverHw<GfxFamily>::flushPipeControl() {
|
|||||||
|
|
||||||
auto &commandStream = getCS(MemorySynchronizationCommands<GfxFamily>::getSizeForBarrierWithPostSyncOperation(hwInfo, args.tlbInvalidation));
|
auto &commandStream = getCS(MemorySynchronizationCommands<GfxFamily>::getSizeForBarrierWithPostSyncOperation(hwInfo, args.tlbInvalidation));
|
||||||
auto commandStreamStart = commandStream.getUsed();
|
auto commandStreamStart = commandStream.getUsed();
|
||||||
|
this->makeResident(*commandStream.getGraphicsAllocation());
|
||||||
|
|
||||||
MemorySynchronizationCommands<GfxFamily>::addBarrierWithPostSyncOperation(commandStream,
|
MemorySynchronizationCommands<GfxFamily>::addBarrierWithPostSyncOperation(commandStream,
|
||||||
PostSyncMode::ImmediateData,
|
PostSyncMode::ImmediateData,
|
||||||
@@ -1594,11 +1595,7 @@ void CommandStreamReceiverHw<GfxFamily>::createKernelArgsBufferAllocation() {
|
|||||||
|
|
||||||
template <typename GfxFamily>
|
template <typename GfxFamily>
|
||||||
SubmissionStatus CommandStreamReceiverHw<GfxFamily>::initializeDeviceWithFirstSubmission() {
|
SubmissionStatus CommandStreamReceiverHw<GfxFamily>::initializeDeviceWithFirstSubmission() {
|
||||||
auto lock = obtainUniqueOwnership();
|
return this->flushTagUpdate();
|
||||||
|
|
||||||
auto &commandStream = getCS(EncodeBatchBufferStartOrEnd<GfxFamily>::getBatchBufferEndSize());
|
|
||||||
auto commandStreamStart = commandStream.getUsed();
|
|
||||||
return this->flushSmallTask(commandStream, commandStreamStart);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename GfxFamily>
|
template <typename GfxFamily>
|
||||||
|
|||||||
@@ -382,13 +382,18 @@ bool Device::createEngine(uint32_t deviceCsrIndex, EngineTypeUsage engineTypeUsa
|
|||||||
|
|
||||||
commandStreamReceiver->createKernelArgsBufferAllocation();
|
commandStreamReceiver->createKernelArgsBufferAllocation();
|
||||||
|
|
||||||
|
if (preemptionMode == PreemptionMode::MidThread && !commandStreamReceiver->createPreemptionAllocation()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (isDefaultEngine) {
|
if (isDefaultEngine) {
|
||||||
bool defaultEngineAlreadySet = (allEngines.size() > defaultEngineIndex) && (allEngines[defaultEngineIndex].getEngineType() == engineType);
|
bool defaultEngineAlreadySet = (allEngines.size() > defaultEngineIndex) && (allEngines[defaultEngineIndex].getEngineType() == engineType);
|
||||||
|
|
||||||
if (!defaultEngineAlreadySet) {
|
if (!defaultEngineAlreadySet) {
|
||||||
defaultEngineIndex = deviceCsrIndex;
|
defaultEngineIndex = deviceCsrIndex;
|
||||||
|
|
||||||
if (osContext->isDebuggableContext()) {
|
if (osContext->isDebuggableContext() ||
|
||||||
|
this->isInitDeviceWithFirstSubmissionSupported(commandStreamReceiver->getType())) {
|
||||||
if (SubmissionStatus::SUCCESS != commandStreamReceiver->initializeDeviceWithFirstSubmission()) {
|
if (SubmissionStatus::SUCCESS != commandStreamReceiver->initializeDeviceWithFirstSubmission()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -400,15 +405,12 @@ bool Device::createEngine(uint32_t deviceCsrIndex, EngineTypeUsage engineTypeUsa
|
|||||||
defaultBcsEngineIndex = deviceCsrIndex;
|
defaultBcsEngineIndex = deviceCsrIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preemptionMode == PreemptionMode::MidThread && !commandStreamReceiver->createPreemptionAllocation()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
EngineControl engine{commandStreamReceiver.get(), osContext};
|
EngineControl engine{commandStreamReceiver.get(), osContext};
|
||||||
allEngines.push_back(engine);
|
allEngines.push_back(engine);
|
||||||
if (engineUsage == EngineUsage::Regular) {
|
if (engineUsage == EngineUsage::Regular) {
|
||||||
addEngineToEngineGroup(engine);
|
addEngineToEngineGroup(engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
commandStreamReceivers.push_back(std::move(commandStreamReceiver));
|
commandStreamReceivers.push_back(std::move(commandStreamReceiver));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -441,6 +443,11 @@ bool Device::isBcsSplitSupported() {
|
|||||||
return bcsSplit;
|
return bcsSplit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Device::isInitDeviceWithFirstSubmissionSupported(CommandStreamReceiverType csrType) {
|
||||||
|
return getProductHelper().isInitDeviceWithFirstSubmissionRequired(getHardwareInfo()) &&
|
||||||
|
Device::isInitDeviceWithFirstSubmissionEnabled(csrType);
|
||||||
|
}
|
||||||
|
|
||||||
double Device::getPlatformHostTimerResolution() const {
|
double Device::getPlatformHostTimerResolution() const {
|
||||||
if (getOSTime()) {
|
if (getOSTime()) {
|
||||||
return getOSTime()->getHostTimerResolution();
|
return getOSTime()->getHostTimerResolution();
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include "shared/source/helpers/engine_control.h"
|
#include "shared/source/helpers/engine_control.h"
|
||||||
#include "shared/source/helpers/engine_node_helper.h"
|
#include "shared/source/helpers/engine_node_helper.h"
|
||||||
#include "shared/source/helpers/non_copyable_or_moveable.h"
|
#include "shared/source/helpers/non_copyable_or_moveable.h"
|
||||||
|
#include "shared/source/helpers/options.h"
|
||||||
#include "shared/source/os_interface/hw_info_config.h"
|
#include "shared/source/os_interface/hw_info_config.h"
|
||||||
#include "shared/source/os_interface/performance_counters.h"
|
#include "shared/source/os_interface/performance_counters.h"
|
||||||
#include "shared/source/utilities/reference_tracked_object.h"
|
#include "shared/source/utilities/reference_tracked_object.h"
|
||||||
@@ -108,7 +109,9 @@ class Device : public ReferenceTrackedObject<Device> {
|
|||||||
RootDeviceEnvironment &getRootDeviceEnvironmentRef() const;
|
RootDeviceEnvironment &getRootDeviceEnvironmentRef() const;
|
||||||
bool isFullRangeSvm() const;
|
bool isFullRangeSvm() const;
|
||||||
static bool isBlitSplitEnabled();
|
static bool isBlitSplitEnabled();
|
||||||
|
static bool isInitDeviceWithFirstSubmissionEnabled(CommandStreamReceiverType csrType);
|
||||||
bool isBcsSplitSupported();
|
bool isBcsSplitSupported();
|
||||||
|
bool isInitDeviceWithFirstSubmissionSupported(CommandStreamReceiverType csrType);
|
||||||
bool areSharedSystemAllocationsAllowed() const;
|
bool areSharedSystemAllocationsAllowed() const;
|
||||||
template <typename SpecializedDeviceT>
|
template <typename SpecializedDeviceT>
|
||||||
void setSpecializedDevice(SpecializedDeviceT *specializedDevice) {
|
void setSpecializedDevice(SpecializedDeviceT *specializedDevice) {
|
||||||
|
|||||||
@@ -13,4 +13,8 @@ bool Device::isBlitSplitEnabled() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Device::isInitDeviceWithFirstSubmissionEnabled(CommandStreamReceiverType csrType) {
|
||||||
|
return csrType == CommandStreamReceiverType::CSR_HW;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|||||||
@@ -135,6 +135,7 @@ class ProductHelper {
|
|||||||
virtual bool allowMemoryPrefetch(const HardwareInfo &hwInfo) const = 0;
|
virtual bool allowMemoryPrefetch(const HardwareInfo &hwInfo) const = 0;
|
||||||
virtual bool isBcsReportWaRequired(const HardwareInfo &hwInfo) const = 0;
|
virtual bool isBcsReportWaRequired(const HardwareInfo &hwInfo) const = 0;
|
||||||
virtual bool isBlitSplitEnqueueWARequired(const HardwareInfo &hwInfo) const = 0;
|
virtual bool isBlitSplitEnqueueWARequired(const HardwareInfo &hwInfo) const = 0;
|
||||||
|
virtual bool isInitDeviceWithFirstSubmissionRequired(const HardwareInfo &hwInfo) const = 0;
|
||||||
virtual bool isBlitCopyRequiredForLocalMemory(const HardwareInfo &hwInfo, const GraphicsAllocation &allocation) const = 0;
|
virtual bool isBlitCopyRequiredForLocalMemory(const HardwareInfo &hwInfo, const GraphicsAllocation &allocation) const = 0;
|
||||||
virtual bool isImplicitScalingSupported(const HardwareInfo &hwInfo) const = 0;
|
virtual bool isImplicitScalingSupported(const HardwareInfo &hwInfo) const = 0;
|
||||||
virtual bool isCpuCopyNecessary(const void *ptr, MemoryManager *memoryManager) const = 0;
|
virtual bool isCpuCopyNecessary(const void *ptr, MemoryManager *memoryManager) const = 0;
|
||||||
@@ -280,6 +281,7 @@ class ProductHelperHw : public ProductHelper {
|
|||||||
bool isTimestampWaitSupportedForEvents() const override;
|
bool isTimestampWaitSupportedForEvents() const override;
|
||||||
bool isTilePlacementResourceWaRequired(const HardwareInfo &hwInfo) const override;
|
bool isTilePlacementResourceWaRequired(const HardwareInfo &hwInfo) const override;
|
||||||
bool isBlitSplitEnqueueWARequired(const HardwareInfo &hwInfo) const override;
|
bool isBlitSplitEnqueueWARequired(const HardwareInfo &hwInfo) const override;
|
||||||
|
bool isInitDeviceWithFirstSubmissionRequired(const HardwareInfo &hwInfo) const override;
|
||||||
bool allowMemoryPrefetch(const HardwareInfo &hwInfo) const override;
|
bool allowMemoryPrefetch(const HardwareInfo &hwInfo) const override;
|
||||||
bool isBcsReportWaRequired(const HardwareInfo &hwInfo) const override;
|
bool isBcsReportWaRequired(const HardwareInfo &hwInfo) const override;
|
||||||
bool isBlitCopyRequiredForLocalMemory(const HardwareInfo &hwInfo, const GraphicsAllocation &allocation) const override;
|
bool isBlitCopyRequiredForLocalMemory(const HardwareInfo &hwInfo, const GraphicsAllocation &allocation) const override;
|
||||||
|
|||||||
@@ -469,6 +469,11 @@ bool ProductHelperHw<gfxProduct>::isBlitSplitEnqueueWARequired(const HardwareInf
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <PRODUCT_FAMILY gfxProduct>
|
||||||
|
bool ProductHelperHw<gfxProduct>::isInitDeviceWithFirstSubmissionRequired(const HardwareInfo &hwInfo) const {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
template <PRODUCT_FAMILY gfxProduct>
|
template <PRODUCT_FAMILY gfxProduct>
|
||||||
bool ProductHelperHw<gfxProduct>::isBlitCopyRequiredForLocalMemory(const HardwareInfo &hwInfo, const GraphicsAllocation &allocation) const {
|
bool ProductHelperHw<gfxProduct>::isBlitCopyRequiredForLocalMemory(const HardwareInfo &hwInfo, const GraphicsAllocation &allocation) const {
|
||||||
return allocation.isAllocatedInLocalMemoryPool() &&
|
return allocation.isAllocatedInLocalMemoryPool() &&
|
||||||
|
|||||||
@@ -173,6 +173,11 @@ bool ProductHelperHw<gfxProduct>::isBlitSplitEnqueueWARequired(const HardwareInf
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
bool ProductHelperHw<gfxProduct>::isInitDeviceWithFirstSubmissionRequired(const HardwareInfo &hwInfo) const {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool ProductHelperHw<gfxProduct>::isImplicitScalingSupported(const HardwareInfo &hwInfo) const {
|
bool ProductHelperHw<gfxProduct>::isImplicitScalingSupported(const HardwareInfo &hwInfo) const {
|
||||||
return getSteppingFromHwRevId(hwInfo) >= REVISION_B;
|
return getSteppingFromHwRevId(hwInfo) >= REVISION_B;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ void NEO::BaseUltConfigListener::OnTestEnd(const ::testing::TestInfo &) {
|
|||||||
|
|
||||||
// Ensure that global state is restored
|
// Ensure that global state is restored
|
||||||
UltHwConfig expectedState{};
|
UltHwConfig expectedState{};
|
||||||
static_assert(sizeof(UltHwConfig) == 13 * sizeof(bool), ""); // Ensure that there is no internal padding
|
static_assert(sizeof(UltHwConfig) == 14 * sizeof(bool), ""); // Ensure that there is no internal padding
|
||||||
EXPECT_EQ(0, memcmp(&expectedState, &ultHwConfig, sizeof(UltHwConfig)));
|
EXPECT_EQ(0, memcmp(&expectedState, &ultHwConfig, sizeof(UltHwConfig)));
|
||||||
|
|
||||||
EXPECT_EQ(0, memcmp(&referencedHwInfo.platform, &defaultHwInfo->platform, sizeof(PLATFORM)));
|
EXPECT_EQ(0, memcmp(&referencedHwInfo.platform, &defaultHwInfo->platform, sizeof(PLATFORM)));
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ struct UltHwConfig {
|
|||||||
bool forceOsAgnosticMemoryManager = true;
|
bool forceOsAgnosticMemoryManager = true;
|
||||||
bool useWaitForTimestamps = false;
|
bool useWaitForTimestamps = false;
|
||||||
bool useBlitSplit = false;
|
bool useBlitSplit = false;
|
||||||
|
bool useFirstSubmissionInitDevice = false;
|
||||||
|
|
||||||
bool csrFailInitDirectSubmission = false;
|
bool csrFailInitDirectSubmission = false;
|
||||||
bool csrBaseCallDirectSubmissionAvailable = false;
|
bool csrBaseCallDirectSubmissionAvailable = false;
|
||||||
|
|||||||
@@ -7,11 +7,14 @@
|
|||||||
|
|
||||||
#include "shared/source/device/device.h"
|
#include "shared/source/device/device.h"
|
||||||
#include "shared/test/common/helpers/ult_hw_config.h"
|
#include "shared/test/common/helpers/ult_hw_config.h"
|
||||||
|
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
|
|
||||||
bool Device::isBlitSplitEnabled() {
|
bool Device::isBlitSplitEnabled() {
|
||||||
return ultHwConfig.useBlitSplit;
|
return ultHwConfig.useBlitSplit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Device::isInitDeviceWithFirstSubmissionEnabled(CommandStreamReceiverType csrType) {
|
||||||
|
return ultHwConfig.useFirstSubmissionInitDevice;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|||||||
@@ -673,6 +673,9 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, DeviceTests, givenZexNumberOfCssEnvVariableSetAmbig
|
|||||||
}
|
}
|
||||||
|
|
||||||
HWCMDTEST_F(IGFX_XE_HP_CORE, DeviceTests, givenDebuggableOsContextWhenDeviceCreatesEnginesThenDeviceIsInitializedWithFirstSubmission) {
|
HWCMDTEST_F(IGFX_XE_HP_CORE, DeviceTests, givenDebuggableOsContextWhenDeviceCreatesEnginesThenDeviceIsInitializedWithFirstSubmission) {
|
||||||
|
VariableBackup<UltHwConfig> backup(&ultHwConfig);
|
||||||
|
ultHwConfig.useFirstSubmissionInitDevice = true;
|
||||||
|
|
||||||
auto hwInfo = *defaultHwInfo;
|
auto hwInfo = *defaultHwInfo;
|
||||||
hardwareInfoSetup[hwInfo.platform.eProductFamily](&hwInfo, true, 0);
|
hardwareInfoSetup[hwInfo.platform.eProductFamily](&hwInfo, true, 0);
|
||||||
|
|
||||||
@@ -687,7 +690,10 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, DeviceTests, givenDebuggableOsContextWhenDeviceCrea
|
|||||||
EXPECT_EQ(1u, csr->peekLatestSentTaskCount());
|
EXPECT_EQ(1u, csr->peekLatestSentTaskCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
HWCMDTEST_F(IGFX_XE_HP_CORE, DeviceTests, givenNonDebuggableOsContextWhenDeviceCreatesEnginesThenDeviceIsNotInitializedWithFirstSubmission) {
|
HWCMDTEST_F(IGFX_XE_HP_CORE, DeviceTests, whenDeviceCreatesEnginesThenDeviceIsInitializedWithFirstSubmission) {
|
||||||
|
VariableBackup<UltHwConfig> backup(&ultHwConfig);
|
||||||
|
ultHwConfig.useFirstSubmissionInitDevice = true;
|
||||||
|
|
||||||
auto hwInfo = *defaultHwInfo;
|
auto hwInfo = *defaultHwInfo;
|
||||||
hardwareInfoSetup[hwInfo.platform.eProductFamily](&hwInfo, true, 0);
|
hardwareInfoSetup[hwInfo.platform.eProductFamily](&hwInfo, true, 0);
|
||||||
|
|
||||||
@@ -698,7 +704,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, DeviceTests, givenNonDebuggableOsContextWhenDeviceC
|
|||||||
|
|
||||||
auto device = deviceFactory.rootDevices[0];
|
auto device = deviceFactory.rootDevices[0];
|
||||||
auto csr = device->allEngines[device->defaultEngineIndex].commandStreamReceiver;
|
auto csr = device->allEngines[device->defaultEngineIndex].commandStreamReceiver;
|
||||||
EXPECT_EQ(0u, csr->peekLatestSentTaskCount());
|
EXPECT_EQ(device->isInitDeviceWithFirstSubmissionSupported(csr->getType()), csr->peekLatestSentTaskCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(FailDeviceTest, GivenFailedDeviceWhenCreatingDeviceThenNullIsReturned) {
|
TEST(FailDeviceTest, GivenFailedDeviceWhenCreatingDeviceThenNullIsReturned) {
|
||||||
|
|||||||
Reference in New Issue
Block a user