[PVC] Remove tlb flush from CCS

Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2022-12-23 11:51:48 +00:00
committed by Compute-Runtime-Automation
parent c3a86232d9
commit e711aa9bc7
8 changed files with 31 additions and 7 deletions

View File

@@ -161,8 +161,9 @@ bool DrmDirectSubmission<GfxFamily, Dispatcher>::handleResidency() {
template <typename GfxFamily, typename Dispatcher>
bool DrmDirectSubmission<GfxFamily, Dispatcher>::isNewResourceHandleNeeded() {
const auto &productHelper = *ProductHelper::get(this->hwInfo->platform.eProductFamily);
auto osContextLinux = static_cast<OsContextLinux *>(&this->osContext);
auto newResourcesBound = osContextLinux->isTlbFlushRequired();
auto newResourcesBound = productHelper.isTlbFlushRequired(osContextLinux->getEngineType()) && osContextLinux->isTlbFlushRequired();
if (DebugManager.flags.DirectSubmissionNewResourceTlbFlush.get() != -1) {
newResourcesBound = DebugManager.flags.DirectSubmissionNewResourceTlbFlush.get();

View File

@@ -150,6 +150,7 @@ class ProductHelper {
virtual bool isResolveDependenciesByPipeControlsSupported(const HardwareInfo &hwInfo, bool isOOQ) const = 0;
virtual bool isMidThreadPreemptionDisallowedForRayTracingKernels() const = 0;
virtual bool isBufferPoolAllocatorSupported() const = 0;
virtual bool isTlbFlushRequired(aub_stream::EngineType engineType) const = 0;
virtual bool getFrontEndPropertyScratchSizeSupport() const = 0;
virtual bool getFrontEndPropertyPrivateScratchSizeSupport() const = 0;
@@ -295,6 +296,7 @@ class ProductHelperHw : public ProductHelper {
bool isResolveDependenciesByPipeControlsSupported(const HardwareInfo &hwInfo, bool isOOQ) const override;
bool isMidThreadPreemptionDisallowedForRayTracingKernels() const override;
bool isBufferPoolAllocatorSupported() const override;
bool isTlbFlushRequired(aub_stream::EngineType engineType) const override;
bool getFrontEndPropertyScratchSizeSupport() const override;
bool getFrontEndPropertyPrivateScratchSizeSupport() const override;

View File

@@ -50,6 +50,11 @@ void ProductHelperHw<gfxProduct>::adjustPlatformForProductFamily(HardwareInfo *h
template <PRODUCT_FAMILY gfxProduct>
void ProductHelperHw<gfxProduct>::adjustSamplerState(void *sampler, const HardwareInfo &hwInfo) {}
template <PRODUCT_FAMILY gfxProduct>
bool ProductHelperHw<gfxProduct>::isTlbFlushRequired(aub_stream::EngineType engineType) const {
return true;
}
template <PRODUCT_FAMILY gfxProduct>
void ProductHelperHw<gfxProduct>::enableBlitterOperationsSupport(HardwareInfo *hwInfo) const {
hwInfo->capabilityTable.blitterOperationsSupported = obtainBlitterPreference(*hwInfo);

View File

@@ -657,9 +657,10 @@ uint32_t Drm::getVirtualMemoryAddressSpace(uint32_t vmId) const {
}
void Drm::setNewResourceBoundToVM(uint32_t vmHandleId) {
const auto &productHelper = *ProductHelper::get(this->getRootDeviceEnvironment().getHardwareInfo()->platform.eProductFamily);
const auto &engines = this->rootDeviceEnvironment.executionEnvironment.memoryManager->getRegisteredEngines();
for (const auto &engine : engines) {
if (engine.osContext->getDeviceBitfield().test(vmHandleId)) {
if (engine.osContext->getDeviceBitfield().test(vmHandleId) && productHelper.isTlbFlushRequired(engine.osContext->getEngineType())) {
auto osContextLinux = static_cast<OsContextLinux *>(engine.osContext);
if (&osContextLinux->getDrm() == this) {

View File

@@ -43,6 +43,11 @@ std::pair<bool, bool> ProductHelperHw<gfxProduct>::isPipeControlPriorToNonPipeli
return {isBasicWARequired, isExtendedWARequired};
}
template <>
bool ProductHelperHw<gfxProduct>::isTlbFlushRequired(aub_stream::EngineType engineType) const {
return EngineHelpers::isBcs(engineType);
}
template <>
void ProductHelperHw<gfxProduct>::adjustSamplerState(void *sampler, const HardwareInfo &hwInfo) {
using SAMPLER_STATE = typename XeHpcCoreFamily::SAMPLER_STATE;

View File

@@ -566,6 +566,7 @@ HWTEST_F(DrmDirectSubmissionTest, givenNewResourceBoundWhenDispatchCommandBuffer
DebugManagerStateRestore restorer;
DebugManager.flags.DirectSubmissionNewResourceTlbFlush.set(-1);
const auto &productHelper = *ProductHelper::get(device->getHardwareInfo().platform.eProductFamily);
MockDrmDirectSubmission<FamilyType, Dispatcher> directSubmission(*device->getDefaultEngine().commandStreamReceiver);
@@ -584,9 +585,12 @@ HWTEST_F(DrmDirectSubmissionTest, givenNewResourceBoundWhenDispatchCommandBuffer
hwParse.parseCommands<FamilyType>(directSubmission.ringCommandStream, 0);
hwParse.findHardwareCommands<FamilyType>();
auto *pipeControl = hwParse.getCommand<PIPE_CONTROL>();
EXPECT_TRUE(pipeControl->getTlbInvalidate());
EXPECT_TRUE(pipeControl->getTextureCacheInvalidationEnable());
EXPECT_FALSE(osContext->isTlbFlushRequired());
if (productHelper.isTlbFlushRequired(osContext->getEngineType())) {
auto *pipeControl = hwParse.getCommand<PIPE_CONTROL>();
EXPECT_TRUE(pipeControl->getTlbInvalidate());
} else {
EXPECT_EQ(pipeControl, nullptr);
}
EXPECT_EQ(directSubmission.getSizeNewResourceHandler(), sizeof(PIPE_CONTROL));
}

View File

@@ -116,12 +116,13 @@ TEST_F(DrmMemoryOperationsHandlerBindMultiRootDeviceTest, whenSetNewResourceBoun
struct MockOsContextLinux : OsContextLinux {
using OsContextLinux::lastFlushedTlbFlushCounter;
};
const auto &productHelper = *ProductHelper::get(executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->platform.eProductFamily);
mock->setNewResourceBoundToVM(1u);
for (const auto &engine : device->getAllEngines()) {
auto osContexLinux = static_cast<MockOsContextLinux *>(engine.osContext);
if (osContexLinux->getDeviceBitfield().test(1u)) {
if (osContexLinux->getDeviceBitfield().test(1u) && productHelper.isTlbFlushRequired(osContexLinux->getEngineType())) {
EXPECT_TRUE(osContexLinux->isTlbFlushRequired());
} else {
EXPECT_FALSE(osContexLinux->isTlbFlushRequired());
@@ -139,7 +140,7 @@ TEST_F(DrmMemoryOperationsHandlerBindMultiRootDeviceTest, whenSetNewResourceBoun
for (const auto &engine : devices[1]->getAllEngines()) {
auto osContexLinux = static_cast<OsContextLinux *>(engine.osContext);
if (osContexLinux->getDeviceBitfield().test(0u)) {
if (osContexLinux->getDeviceBitfield().test(0u) && productHelper.isTlbFlushRequired(osContexLinux->getEngineType())) {
EXPECT_TRUE(osContexLinux->isTlbFlushRequired());
} else {
EXPECT_FALSE(osContexLinux->isTlbFlushRequired());

View File

@@ -27,6 +27,11 @@ PVCTEST_F(PvcProductHelper, whenGettingAubstreamProductFamilyThenProperEnumValue
EXPECT_EQ(aub_stream::ProductFamily::Pvc, productHelper->getAubStreamProductFamily());
}
PVCTEST_F(PvcProductHelper, whenCheckIsTlbFlushRequiredThenReturnProperValue) {
EXPECT_TRUE(productHelper->isTlbFlushRequired(aub_stream::EngineType::ENGINE_BCS2));
EXPECT_FALSE(productHelper->isTlbFlushRequired(aub_stream::EngineType::ENGINE_CCS1));
}
PVCTEST_F(PvcProductHelper, givenPVCRevId3AndAboveWhenGettingThreadEuRatioForScratchThen16IsReturned) {
auto hwInfo = *defaultHwInfo;
hwInfo.platform.usRevId = 3;