mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-10 12:53:42 +08:00
Revert "Remove fallback path for PAT index programming"
This reverts commit faf8d51f6d
.
Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
fbc91887b8
commit
f5575a1370
@ -1456,6 +1456,12 @@ HWTEST_F(HwHelperTest, GivenHwInfoWhenGetBatchBufferEndReferenceCalledThenCorrec
|
||||
EXPECT_EQ(hwHelper.getBatchBufferEndReference(), reinterpret_cast<const void *>(&FamilyType::cmdInitBatchBufferEnd));
|
||||
}
|
||||
|
||||
HWTEST_F(HwHelperTest, givenHwHelperWhenAskingForPatIndexWaThenReturnFalse) {
|
||||
const auto &hwHelper = HwHelper::get(renderCoreFamily);
|
||||
|
||||
EXPECT_FALSE(hwHelper.isPatIndexFallbackWaRequired());
|
||||
}
|
||||
|
||||
HWTEST_F(HwHelperTest, givenHwHelperWhenPassingCopyEngineTypeThenItsCopyOnly) {
|
||||
EXPECT_TRUE(EngineHelper::isCopyOnlyEngineType(EngineGroupType::Copy));
|
||||
}
|
||||
|
@ -52,3 +52,4 @@ HWTEST_EXCLUDE_PRODUCT(CommandStreamReceiverFlushTaskTests, givenOverrideThreadA
|
||||
HWTEST_EXCLUDE_PRODUCT(XeHPAndLaterAubCommandStreamReceiverWithoutFixtureTests, GivenCopyHostPtrAndHostNoAccessAndReadOnlyFlagsWhenAllocatingBufferThenAllocationIsCopiedToEveryTile, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(GetAllocationDataTestHw, givenRingBufferAllocationWhenGetAllocationDataIsCalledThenItHasProperFieldsSet, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(GetAllocationDataTestHw, givenSemaphoreBufferAllocationWhenGetAllocationDataIsCalledThenItHasProperFieldsSet, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(HwHelperTest, givenHwHelperWhenAskingForPatIndexWaThenReturnFalse, IGFX_XE_HPC_CORE);
|
||||
|
@ -826,3 +826,9 @@ XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, givenCommandBufferAllocationWhenSetExt
|
||||
XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, WhenGettingDeviceIpVersionThenMakeCorrectDeviceIpVersion) {
|
||||
EXPECT_EQ(ClHwHelperMock::makeDeviceIpVersion(12, 8, 1), ClHwHelper::get(renderCoreFamily).getDeviceIpVersion(*defaultHwInfo));
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, givenHwHelperWhenAskingForPatIndexWaThenReturnTrue) {
|
||||
const auto &hwHelper = HwHelper::get(renderCoreFamily);
|
||||
|
||||
EXPECT_TRUE(hwHelper.isPatIndexFallbackWaRequired());
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
set(NEO_CORE_GMM_HELPER
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}resource_info_${DRIVER_MODEL}.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/client_context${BRANCH_DIR_SUFFIX}/gmm_client_context_extra.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/client_context/gmm_client_context.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/client_context/gmm_client_context.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cache_settings_helper.cpp
|
||||
|
@ -79,8 +79,4 @@ void GmmClientContext::setGmmDeviceInfo(GMM_DEVICE_INFO *deviceInfo) {
|
||||
clientContext->GmmSetDeviceInfo(deviceInfo);
|
||||
}
|
||||
|
||||
uint32_t GmmClientContext::cachePolicyGetPATIndex(GMM_RESOURCE_INFO *gmmResourceInfo, GMM_RESOURCE_USAGE_TYPE usage) {
|
||||
return clientContext->CachePolicyGetPATIndex(gmmResourceInfo, usage, nullptr, false);
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/gmm_helper/client_context/gmm_client_context.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
uint32_t GmmClientContext::cachePolicyGetPATIndex(GMM_RESOURCE_INFO *gmmResourceInfo, GMM_RESOURCE_USAGE_TYPE usage) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
@ -156,6 +156,7 @@ class HwHelper {
|
||||
virtual size_t getBatchBufferEndSize() const = 0;
|
||||
virtual const void *getBatchBufferEndReference() const = 0;
|
||||
virtual bool isPlatformFlushTaskEnabled(const NEO::HardwareInfo &hwInfo) const = 0;
|
||||
virtual bool isPatIndexFallbackWaRequired() const = 0;
|
||||
virtual uint32_t getMinimalScratchSpaceSize() const = 0;
|
||||
|
||||
protected:
|
||||
@ -396,6 +397,7 @@ class HwHelperHw : public HwHelper {
|
||||
size_t getBatchBufferEndSize() const override;
|
||||
const void *getBatchBufferEndReference() const override;
|
||||
bool isPlatformFlushTaskEnabled(const NEO::HardwareInfo &hwInfo) const override;
|
||||
bool isPatIndexFallbackWaRequired() const override;
|
||||
uint32_t getMinimalScratchSpaceSize() const override;
|
||||
|
||||
protected:
|
||||
|
@ -712,4 +712,10 @@ uint64_t HwHelperHw<GfxFamily>::getPatIndex(CacheRegion cacheRegion, CachePolicy
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool HwHelperHw<GfxFamily>::isPatIndexFallbackWaRequired() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
@ -1304,13 +1304,11 @@ uint64_t Drm::getPatIndex(Gmm *gmm, AllocationType allocationType, CacheRegion c
|
||||
|
||||
uint64_t patIndex = rootDeviceEnvironment.getGmmClientContext()->cachePolicyGetPATIndex(resourceInfo, usageType);
|
||||
|
||||
UNRECOVERABLE_IF(patIndex == static_cast<uint64_t>(GMM_PAT_ERROR));
|
||||
|
||||
if (DebugManager.flags.ClosEnabled.get() != -1) {
|
||||
closEnabled = !!DebugManager.flags.ClosEnabled.get();
|
||||
}
|
||||
|
||||
if (closEnabled) {
|
||||
if (patIndex == static_cast<uint64_t>(GMM_PAT_ERROR) || closEnabled || hwHelper.isPatIndexFallbackWaRequired()) {
|
||||
patIndex = hwHelper.getPatIndex(cacheRegion, cachePolicy);
|
||||
}
|
||||
|
||||
|
@ -437,6 +437,11 @@ uint64_t HwHelperHw<Family>::getPatIndex(CacheRegion cacheRegion, CachePolicy ca
|
||||
return (static_cast<uint32_t>(cachePolicy) + (static_cast<uint16_t>(cacheRegion) * 2));
|
||||
}
|
||||
|
||||
template <>
|
||||
bool HwHelperHw<Family>::isPatIndexFallbackWaRequired() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
#include "shared/source/helpers/hw_helper_pvc_and_later.inl"
|
||||
|
@ -739,6 +739,9 @@ HWTEST_F(DrmMemoryOperationsHandlerBindTest, givenPatIndexProgrammingEnabledWhen
|
||||
|
||||
if (debugFlag == 0 || !closSupported || debugFlag == -1) {
|
||||
auto expectedIndex = static_cast<uint64_t>(MockGmmClientContextBase::MockPatIndex::cached);
|
||||
if (hwHelper.isPatIndexFallbackWaRequired()) {
|
||||
expectedIndex = hwHelper.getPatIndex(CacheRegion::Default, CachePolicy::WriteBack);
|
||||
}
|
||||
|
||||
EXPECT_EQ(expectedIndex, mock->context.receivedVmBindPatIndex.value());
|
||||
|
||||
@ -753,7 +756,51 @@ HWTEST_F(DrmMemoryOperationsHandlerBindTest, givenPatIndexProgrammingEnabledWhen
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST_F(DrmMemoryOperationsHandlerBindTest, givenPatIndexErrorAndUncachedDebugFlagSetWhenGetPatIndexCalledThenAbort) {
|
||||
HWTEST_F(DrmMemoryOperationsHandlerBindTest, givenPatIndexErrorWhenVmBindCalledThenSetDefaultPatIndexExtension) {
|
||||
DebugManager.flags.UseVmBind.set(1);
|
||||
mock->bindAvailable = true;
|
||||
|
||||
auto csr = std::make_unique<UltCommandStreamReceiver<FamilyType>>(*executionEnvironment, 0, DeviceBitfield(1));
|
||||
auto osContext = memoryManager->createAndRegisterOsContext(csr.get(), EngineDescriptorHelper::getDefaultDescriptor());
|
||||
csr->setupContext(*osContext);
|
||||
|
||||
auto &hwHelper = HwHelper::get(executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->platform.eRenderCoreFamily);
|
||||
auto hwInfoConfig = HwInfoConfig::get(executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->platform.eProductFamily);
|
||||
|
||||
bool closSupported = (hwHelper.getNumCacheRegions() > 0);
|
||||
bool patIndexProgrammingSupported = hwInfoConfig->isVmBindPatIndexProgrammingSupported();
|
||||
|
||||
if (!closSupported || !patIndexProgrammingSupported) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
uint64_t gpuAddress = 0x123000;
|
||||
size_t size = 1;
|
||||
BufferObject bo(mock, static_cast<uint64_t>(MockGmmClientContextBase::MockPatIndex::cached), 0, 1, 1);
|
||||
DrmAllocation allocation(0, 1, AllocationType::BUFFER, &bo, nullptr, gpuAddress, size, MemoryPool::System4KBPages);
|
||||
|
||||
auto allocationPtr = static_cast<GraphicsAllocation *>(&allocation);
|
||||
|
||||
static_cast<MockGmmClientContextBase *>(executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext())->returnErrorOnPatIndexQuery = true;
|
||||
|
||||
for (int32_t debugFlag : {-1, 0, 1}) {
|
||||
DebugManager.flags.ClosEnabled.set(debugFlag);
|
||||
|
||||
mock->context.receivedVmBindPatIndex.reset();
|
||||
mock->context.receivedVmUnbindPatIndex.reset();
|
||||
|
||||
bo.setPatIndex(mock->getPatIndex(allocation.getDefaultGmm(), allocation.getAllocationType(), CacheRegion::Default, CachePolicy::WriteBack, false));
|
||||
|
||||
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1));
|
||||
|
||||
EXPECT_EQ(3u, mock->context.receivedVmBindPatIndex.value());
|
||||
|
||||
operationHandler->evict(device, allocation);
|
||||
EXPECT_EQ(3u, mock->context.receivedVmUnbindPatIndex.value());
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST_F(DrmMemoryOperationsHandlerBindTest, givenPatIndexErrorAndUncachedDebugFlagSetWhenVmBindCalledThenSetDefaultPatIndexExtension) {
|
||||
DebugManager.flags.UseVmBind.set(1);
|
||||
DebugManager.flags.ForceAllResourcesUncached.set(1);
|
||||
mock->bindAvailable = true;
|
||||
@ -774,12 +821,24 @@ HWTEST_F(DrmMemoryOperationsHandlerBindTest, givenPatIndexErrorAndUncachedDebugF
|
||||
|
||||
static_cast<MockGmmClientContextBase *>(executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext())->returnErrorOnPatIndexQuery = true;
|
||||
|
||||
mock->context.receivedVmBindPatIndex.reset();
|
||||
mock->context.receivedVmUnbindPatIndex.reset();
|
||||
|
||||
uint64_t gpuAddress = 0x123000;
|
||||
size_t size = 1;
|
||||
BufferObject bo(mock, static_cast<uint64_t>(MockGmmClientContextBase::MockPatIndex::cached), 0, 1, 1);
|
||||
DrmAllocation allocation(0, 1, AllocationType::BUFFER, &bo, nullptr, gpuAddress, size, MemoryPool::System4KBPages);
|
||||
|
||||
EXPECT_ANY_THROW(mock->getPatIndex(allocation.getDefaultGmm(), allocation.getAllocationType(), CacheRegion::Default, CachePolicy::WriteBack, false));
|
||||
bo.setPatIndex(mock->getPatIndex(allocation.getDefaultGmm(), allocation.getAllocationType(), CacheRegion::Default, CachePolicy::WriteBack, false));
|
||||
|
||||
auto allocationPtr = static_cast<GraphicsAllocation *>(&allocation);
|
||||
|
||||
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1));
|
||||
|
||||
EXPECT_EQ(0u, mock->context.receivedVmBindPatIndex.value());
|
||||
|
||||
operationHandler->evict(device, allocation);
|
||||
EXPECT_EQ(0u, mock->context.receivedVmUnbindPatIndex.value());
|
||||
}
|
||||
|
||||
HWTEST_F(DrmMemoryOperationsHandlerBindTest, givenUncachedDebugFlagSetWhenVmBindCalledThenSetCorrectPatIndexExtension) {
|
||||
@ -793,6 +852,7 @@ HWTEST_F(DrmMemoryOperationsHandlerBindTest, givenUncachedDebugFlagSetWhenVmBind
|
||||
|
||||
auto timestampStorageAlloc = csr->getTimestampPacketAllocator()->getTag()->getBaseGraphicsAllocation()->getDefaultGraphicsAllocation();
|
||||
|
||||
auto &hwHelper = HwHelper::get(executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->platform.eRenderCoreFamily);
|
||||
auto hwInfoConfig = HwInfoConfig::get(executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->platform.eProductFamily);
|
||||
|
||||
if (!hwInfoConfig->isVmBindPatIndexProgrammingSupported()) {
|
||||
@ -805,6 +865,9 @@ HWTEST_F(DrmMemoryOperationsHandlerBindTest, givenUncachedDebugFlagSetWhenVmBind
|
||||
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(×tampStorageAlloc, 1));
|
||||
|
||||
auto expectedIndex = static_cast<uint64_t>(MockGmmClientContextBase::MockPatIndex::uncached);
|
||||
if (hwHelper.isPatIndexFallbackWaRequired()) {
|
||||
expectedIndex = hwHelper.getPatIndex(CacheRegion::Default, CachePolicy::Uncached);
|
||||
}
|
||||
|
||||
EXPECT_EQ(expectedIndex, mock->context.receivedVmBindPatIndex.value());
|
||||
|
||||
|
Reference in New Issue
Block a user