mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
fix(l0): do not memcpy on cpu if need unlock ptr
Do not use cpu memory copy on windows if need to unlock locked ptr. Related-To: NEO-7553 Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
2484c7ceb2
commit
8da362afae
@@ -161,7 +161,7 @@ class GfxCoreHelper {
|
||||
virtual const void *getBatchBufferEndReference() const = 0;
|
||||
virtual bool isPlatformFlushTaskEnabled(const NEO::ProductHelper &productHelper) const = 0;
|
||||
virtual uint32_t getMinimalScratchSpaceSize() const = 0;
|
||||
virtual bool copyThroughLockedPtrEnabled(const HardwareInfo &hwInfo) const = 0;
|
||||
virtual bool copyThroughLockedPtrEnabled(const HardwareInfo &hwInfo, const ProductHelper &productHelper) const = 0;
|
||||
virtual uint32_t getAmountOfAllocationsToFill() const = 0;
|
||||
virtual bool isChipsetUniqueUUIDSupported() const = 0;
|
||||
virtual bool isTimestampShiftRequired() const = 0;
|
||||
@@ -375,7 +375,7 @@ class GfxCoreHelperHw : public GfxCoreHelper {
|
||||
const void *getBatchBufferEndReference() const override;
|
||||
bool isPlatformFlushTaskEnabled(const NEO::ProductHelper &productHelper) const override;
|
||||
uint32_t getMinimalScratchSpaceSize() const override;
|
||||
bool copyThroughLockedPtrEnabled(const HardwareInfo &hwInfo) const override;
|
||||
bool copyThroughLockedPtrEnabled(const HardwareInfo &hwInfo, const ProductHelper &productHelper) const override;
|
||||
uint32_t getAmountOfAllocationsToFill() const override;
|
||||
bool isChipsetUniqueUUIDSupported() const override;
|
||||
bool isTimestampShiftRequired() const override;
|
||||
|
||||
@@ -694,7 +694,7 @@ uint64_t GfxCoreHelperHw<GfxFamily>::getPatIndex(CacheRegion cacheRegion, CacheP
|
||||
}
|
||||
|
||||
template <typename gfxProduct>
|
||||
bool GfxCoreHelperHw<gfxProduct>::copyThroughLockedPtrEnabled(const HardwareInfo &hwInfo) const {
|
||||
bool GfxCoreHelperHw<gfxProduct>::copyThroughLockedPtrEnabled(const HardwareInfo &hwInfo, const ProductHelper &productHelper) const {
|
||||
if (DebugManager.flags.ExperimentalCopyThroughLock.get() != -1) {
|
||||
return DebugManager.flags.ExperimentalCopyThroughLock.get() == 1;
|
||||
}
|
||||
|
||||
@@ -431,7 +431,7 @@ uint64_t GfxCoreHelperHw<Family>::getPatIndex(CacheRegion cacheRegion, CachePoli
|
||||
}
|
||||
|
||||
template <>
|
||||
bool GfxCoreHelperHw<Family>::copyThroughLockedPtrEnabled(const HardwareInfo &hwInfo) const {
|
||||
bool GfxCoreHelperHw<Family>::copyThroughLockedPtrEnabled(const HardwareInfo &hwInfo, const ProductHelper &productHelper) const {
|
||||
if (DebugManager.flags.ExperimentalCopyThroughLock.get() != -1) {
|
||||
return DebugManager.flags.ExperimentalCopyThroughLock.get() == 1;
|
||||
}
|
||||
|
||||
@@ -145,11 +145,12 @@ bool GfxCoreHelperHw<Family>::disableL3CacheForDebug(const HardwareInfo &hwInfo,
|
||||
}
|
||||
|
||||
template <>
|
||||
bool GfxCoreHelperHw<Family>::copyThroughLockedPtrEnabled(const HardwareInfo &hwInfo) const {
|
||||
bool GfxCoreHelperHw<Family>::copyThroughLockedPtrEnabled(const HardwareInfo &hwInfo, const ProductHelper &productHelper) const {
|
||||
if (DebugManager.flags.ExperimentalCopyThroughLock.get() != -1) {
|
||||
return DebugManager.flags.ExperimentalCopyThroughLock.get() == 1;
|
||||
}
|
||||
return this->isLocalMemoryEnabled(hwInfo);
|
||||
|
||||
return this->isLocalMemoryEnabled(hwInfo) && !productHelper.isUnlockingLockedPtrNecessary(hwInfo);
|
||||
}
|
||||
|
||||
template class GfxCoreHelperHw<Family>;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
* Copyright (C) 2022-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -21,6 +21,7 @@ struct MockProductHelperHw : NEO::ProductHelperHw<productFamily> {
|
||||
uint64_t getDeviceMemoryPhysicalSizeInBytes(const OSInterface *osIface, uint32_t subDeviceIndex) const override;
|
||||
uint32_t getDeviceMemoryMaxClkRate(const HardwareInfo &hwInfo, const OSInterface *osIface, uint32_t subDeviceIndex) const override;
|
||||
uint32_t getL1CachePolicy(bool isDebuggerActive) const override;
|
||||
bool isUnlockingLockedPtrNecessary(const HardwareInfo &hwInfo) const override;
|
||||
|
||||
bool use128MbEdram = false;
|
||||
bool enableMidThreadPreemption = false;
|
||||
@@ -28,6 +29,7 @@ struct MockProductHelperHw : NEO::ProductHelperHw<productFamily> {
|
||||
bool enableMidBatchPreemption = false;
|
||||
bool failOnConfigureHardwareCustom = false;
|
||||
bool isCooperativeEngineSupportedValue = true;
|
||||
bool returnedIsUnlockingLockedPtrNecessary = false;
|
||||
uint32_t returnedStepping = 0;
|
||||
uint32_t returnedL1CachePolicy = 0;
|
||||
uint32_t returnedL1CachePolicyIfDebugger = 0;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
* Copyright (C) 2022-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -63,4 +63,9 @@ uint32_t MockProductHelperHw<gfxProduct>::getL1CachePolicy(bool isDebuggerActive
|
||||
return this->returnedL1CachePolicyIfDebugger;
|
||||
}
|
||||
return this->returnedL1CachePolicy;
|
||||
}
|
||||
}
|
||||
|
||||
template <>
|
||||
bool MockProductHelperHw<gfxProduct>::isUnlockingLockedPtrNecessary(const HardwareInfo &hwInfo) const {
|
||||
return this->returnedIsUnlockingLockedPtrNecessary;
|
||||
}
|
||||
|
||||
@@ -1349,7 +1349,8 @@ HWTEST_F(GfxCoreHelperTest, givenGfxCoreHelperWhenAskingForRelaxedOrderingSuppor
|
||||
|
||||
HWTEST2_F(GfxCoreHelperTest, givenGfxCoreHelperWhenCallCopyThroughLockedPtrEnabledThenReturnFalse, IsNotXeHpgOrXeHpcCore) {
|
||||
const auto &gfxCoreHelper = getHelper<GfxCoreHelper>();
|
||||
EXPECT_FALSE(gfxCoreHelper.copyThroughLockedPtrEnabled(*defaultHwInfo));
|
||||
const auto &productHelper = getHelper<ProductHelper>();
|
||||
EXPECT_FALSE(gfxCoreHelper.copyThroughLockedPtrEnabled(*defaultHwInfo, productHelper));
|
||||
}
|
||||
|
||||
HWTEST2_F(GfxCoreHelperTest, givenGfxCoreHelperWhenCallGetAmountOfAllocationsToFillThenReturnFalse, IsNotXeHpcCore) {
|
||||
@@ -1360,11 +1361,12 @@ HWTEST2_F(GfxCoreHelperTest, givenGfxCoreHelperWhenCallGetAmountOfAllocationsToF
|
||||
HWTEST_F(GfxCoreHelperTest, givenGfxCoreHelperWhenFlagSetAndCallCopyThroughLockedPtrEnabledThenReturnCorrectValue) {
|
||||
DebugManagerStateRestore restorer;
|
||||
const auto &gfxCoreHelper = getHelper<GfxCoreHelper>();
|
||||
const auto &productHelper = getHelper<ProductHelper>();
|
||||
DebugManager.flags.ExperimentalCopyThroughLock.set(0);
|
||||
EXPECT_FALSE(gfxCoreHelper.copyThroughLockedPtrEnabled(*defaultHwInfo));
|
||||
EXPECT_FALSE(gfxCoreHelper.copyThroughLockedPtrEnabled(*defaultHwInfo, productHelper));
|
||||
|
||||
DebugManager.flags.ExperimentalCopyThroughLock.set(1);
|
||||
EXPECT_TRUE(gfxCoreHelper.copyThroughLockedPtrEnabled(*defaultHwInfo));
|
||||
EXPECT_TRUE(gfxCoreHelper.copyThroughLockedPtrEnabled(*defaultHwInfo, productHelper));
|
||||
}
|
||||
|
||||
HWTEST_F(GfxCoreHelperTest, givenGfxCoreHelperWhenFlagSetAndCallGetAmountOfAllocationsToFillThenReturnCorrectValue) {
|
||||
|
||||
@@ -81,8 +81,9 @@ XE_HPC_CORETEST_F(ProductHelperTestXeHpcCore, givenProductHelperWhenCheckTimesta
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(GfxCoreHelperTest, givenGfxCoreHelperWhenCallCopyThroughLockedPtrEnabledThenReturnTrue) {
|
||||
auto &gfxCoreHelper = getHelper<GfxCoreHelper>();
|
||||
EXPECT_TRUE(gfxCoreHelper.copyThroughLockedPtrEnabled(*defaultHwInfo));
|
||||
const auto &gfxCoreHelper = getHelper<GfxCoreHelper>();
|
||||
const auto &productHelper = getHelper<ProductHelper>();
|
||||
EXPECT_TRUE(gfxCoreHelper.copyThroughLockedPtrEnabled(*defaultHwInfo, productHelper));
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(GfxCoreHelperTest, givenGfxCoreHelperWhenCallGetAmountOfAllocationsToFillThenReturnTrue) {
|
||||
|
||||
@@ -635,6 +635,5 @@ DG2TEST_F(ProductHelperTestDg2, givenDebugFlagWhenCheckingIsResolveDependenciesB
|
||||
}
|
||||
|
||||
DG2TEST_F(ProductHelperTestDg2, givenProductHelperWhenCheckingIsBufferPoolAllocatorSupportedThenCorrectValueIsReturned) {
|
||||
|
||||
EXPECT_TRUE(productHelper->isBufferPoolAllocatorSupported());
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "shared/test/common/fixtures/device_fixture.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/gfx_core_helper_tests.h"
|
||||
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
|
||||
#include "shared/test/common/helpers/unit_test_helper.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
@@ -295,11 +296,27 @@ XE_HPG_CORETEST_F(GfxCoreHelperTestXeHpgCore,
|
||||
EXPECT_EQ(immediateValue, pipeControl->getImmediateData());
|
||||
}
|
||||
|
||||
XE_HPG_CORETEST_F(GfxCoreHelperTestXeHpgCore, givenGfxCoreHelperWhenCallCopyThroughLockedPtrEnabledThenReturnFalse) {
|
||||
auto &gfxCoreHelper = getHelper<GfxCoreHelper>();
|
||||
if (gfxCoreHelper.isLocalMemoryEnabled(*defaultHwInfo)) {
|
||||
EXPECT_TRUE(gfxCoreHelper.copyThroughLockedPtrEnabled(*defaultHwInfo));
|
||||
} else {
|
||||
EXPECT_FALSE(gfxCoreHelper.copyThroughLockedPtrEnabled(*defaultHwInfo));
|
||||
XE_HPG_CORETEST_F(GfxCoreHelperTestXeHpgCore, givenGfxCoreHelperWhenCallCopyThroughLockedPtrEnabledThenReturnCorrectValue) {
|
||||
const auto &gfxCoreHelper = getHelper<GfxCoreHelper>();
|
||||
MockProductHelperHw<IGFX_UNKNOWN> mockProductHelper;
|
||||
{
|
||||
hardwareInfo.featureTable.flags.ftrLocalMemory = false;
|
||||
mockProductHelper.returnedIsUnlockingLockedPtrNecessary = false;
|
||||
EXPECT_FALSE(gfxCoreHelper.copyThroughLockedPtrEnabled(hardwareInfo, mockProductHelper));
|
||||
}
|
||||
{
|
||||
hardwareInfo.featureTable.flags.ftrLocalMemory = true;
|
||||
mockProductHelper.returnedIsUnlockingLockedPtrNecessary = false;
|
||||
EXPECT_TRUE(gfxCoreHelper.copyThroughLockedPtrEnabled(hardwareInfo, mockProductHelper));
|
||||
}
|
||||
{
|
||||
hardwareInfo.featureTable.flags.ftrLocalMemory = false;
|
||||
mockProductHelper.returnedIsUnlockingLockedPtrNecessary = true;
|
||||
EXPECT_FALSE(gfxCoreHelper.copyThroughLockedPtrEnabled(hardwareInfo, mockProductHelper));
|
||||
}
|
||||
{
|
||||
hardwareInfo.featureTable.flags.ftrLocalMemory = true;
|
||||
mockProductHelper.returnedIsUnlockingLockedPtrNecessary = true;
|
||||
EXPECT_FALSE(gfxCoreHelper.copyThroughLockedPtrEnabled(hardwareInfo, mockProductHelper));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user