mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 09:14:47 +08:00
Mark SVM_GPU allocation as not lockable
require blitter usage if allocation is not lockable and in local memory Related-To: NEO-5733 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
e336f8e875
commit
fcbf1dcf32
@@ -18,6 +18,7 @@
|
||||
|
||||
#include "opencl/source/command_queue/command_queue.h"
|
||||
#include "opencl/source/command_stream/tbx_command_stream_receiver.h"
|
||||
#include "opencl/test/unit_test/aub_tests/fixtures/aub_fixture.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
@@ -34,14 +35,10 @@ void AUBCommandStreamFixture::SetUp(CommandQueue *pCmdQ) {
|
||||
auto engineType = pCmdQ->getGpgpuCommandStreamReceiver().getOsContext().getEngineType();
|
||||
strfilename << testInfo->test_case_name() << "_" << testInfo->name() << "_" << hwHelper.getCsTraits(engineType).name;
|
||||
|
||||
if (testMode == TestMode::AubTestsWithTbx) {
|
||||
pCommandStreamReceiver = TbxCommandStreamReceiver::create(strfilename.str(), true, *device.executionEnvironment, device.getRootDeviceIndex(), device.getDeviceBitfield());
|
||||
} else {
|
||||
pCommandStreamReceiver = AUBCommandStreamReceiver::create(strfilename.str(), true, *device.executionEnvironment, device.getRootDeviceIndex(), device.getDeviceBitfield());
|
||||
}
|
||||
pCommandStreamReceiver = AUBFixture::prepareComputeEngine(device, strfilename.str());
|
||||
ASSERT_NE(nullptr, pCommandStreamReceiver);
|
||||
|
||||
device.resetCommandStreamReceiver(pCommandStreamReceiver);
|
||||
AUBFixture::prepareCopyEngines(device, strfilename.str());
|
||||
|
||||
CommandStreamFixture::SetUp(pCmdQ);
|
||||
|
||||
|
||||
@@ -30,6 +30,30 @@ namespace NEO {
|
||||
|
||||
class AUBFixture : public CommandQueueHwFixture {
|
||||
public:
|
||||
static CommandStreamReceiver *prepareComputeEngine(MockDevice &device, const std::string &filename) {
|
||||
CommandStreamReceiver *pCommandStreamReceiver = nullptr;
|
||||
if (testMode == TestMode::AubTestsWithTbx) {
|
||||
pCommandStreamReceiver = TbxCommandStreamReceiver::create(filename, true, *device.executionEnvironment, device.getRootDeviceIndex(), device.getDeviceBitfield());
|
||||
} else {
|
||||
pCommandStreamReceiver = AUBCommandStreamReceiver::create(filename, true, *device.executionEnvironment, device.getRootDeviceIndex(), device.getDeviceBitfield());
|
||||
}
|
||||
device.resetCommandStreamReceiver(pCommandStreamReceiver);
|
||||
return pCommandStreamReceiver;
|
||||
}
|
||||
static void prepareCopyEngines(MockDevice &device, const std::string &filename) {
|
||||
for (auto i = 0u; i < device.engines.size(); i++) {
|
||||
if (EngineHelpers::isBcs(device.engines[i].getEngineType())) {
|
||||
CommandStreamReceiver *pBcsCommandStreamReceiver = nullptr;
|
||||
if (testMode == TestMode::AubTestsWithTbx) {
|
||||
pBcsCommandStreamReceiver = TbxCommandStreamReceiver::create(filename, true, *device.executionEnvironment, device.getRootDeviceIndex(), device.getDeviceBitfield());
|
||||
} else {
|
||||
pBcsCommandStreamReceiver = AUBCommandStreamReceiver::create(filename, true, *device.executionEnvironment, device.getRootDeviceIndex(), device.getDeviceBitfield());
|
||||
}
|
||||
device.resetCommandStreamReceiver(pBcsCommandStreamReceiver, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SetUp(const HardwareInfo *hardwareInfo) {
|
||||
const HardwareInfo &hwInfo = hardwareInfo ? *hardwareInfo : *defaultHwInfo;
|
||||
|
||||
@@ -45,15 +69,12 @@ class AUBFixture : public CommandQueueHwFixture {
|
||||
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(&hwInfo);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = std::make_unique<MockMemoryOperationsHandler>();
|
||||
|
||||
device = std::make_unique<MockClDevice>(MockDevice::create<MockDevice>(executionEnvironment, rootDeviceIndex));
|
||||
auto pDevice = MockDevice::create<MockDevice>(executionEnvironment, rootDeviceIndex);
|
||||
device = std::make_unique<MockClDevice>(pDevice);
|
||||
|
||||
if (testMode == TestMode::AubTestsWithTbx) {
|
||||
this->csr = TbxCommandStreamReceiver::create(strfilename.str(), true, *executionEnvironment, 0, device->getDeviceBitfield());
|
||||
} else {
|
||||
this->csr = AUBCommandStreamReceiver::create(strfilename.str(), true, *executionEnvironment, 0, device->getDeviceBitfield());
|
||||
}
|
||||
this->csr = prepareComputeEngine(*pDevice, strfilename.str());
|
||||
|
||||
device->resetCommandStreamReceiver(this->csr);
|
||||
prepareCopyEngines(*pDevice, strfilename.str());
|
||||
|
||||
CommandQueueHwFixture::SetUp(AUBFixture::device.get(), cl_command_queue_properties(0));
|
||||
}
|
||||
|
||||
@@ -937,13 +937,15 @@ HWTEST_F(HwHelperTest, givenDefaultHwHelperHwWhenMinimalSIMDSizeIsQueriedThen8Is
|
||||
EXPECT_EQ(8u, helper.getMinimalSIMDSize());
|
||||
}
|
||||
|
||||
HWTEST_F(HwHelperTest, whenGettingIsBlitCopyRequiredForLocalMemoryThenCorrectValuesAreReturned) {
|
||||
HWTEST_F(HwHelperTest, givenLockableAllocationWhenGettingIsBlitCopyRequiredForLocalMemoryThenCorrectValuesAreReturned) {
|
||||
DebugManagerStateRestore restore{};
|
||||
auto &helper = HwHelper::get(renderCoreFamily);
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
hwInfo.capabilityTable.blitterOperationsSupported = true;
|
||||
|
||||
MockGraphicsAllocation graphicsAllocation;
|
||||
graphicsAllocation.setAllocationType(GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
|
||||
EXPECT_TRUE(GraphicsAllocation::isLockable(graphicsAllocation.getAllocationType()));
|
||||
graphicsAllocation.overrideMemoryPool(MemoryPool::LocalMemory);
|
||||
|
||||
auto expectedDefaultValue = (helper.getLocalMemoryAccessMode(hwInfo) == LocalMemoryAccessMode::CpuAccessDisallowed);
|
||||
@@ -957,7 +959,36 @@ HWTEST_F(HwHelperTest, whenGettingIsBlitCopyRequiredForLocalMemoryThenCorrectVal
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(3);
|
||||
EXPECT_TRUE(helper.isBlitCopyRequiredForLocalMemory(hwInfo, graphicsAllocation));
|
||||
hwInfo.capabilityTable.blitterOperationsSupported = false;
|
||||
EXPECT_TRUE(helper.isBlitCopyRequiredForLocalMemory(hwInfo, graphicsAllocation));
|
||||
|
||||
graphicsAllocation.overrideMemoryPool(MemoryPool::System64KBPages);
|
||||
EXPECT_FALSE(helper.isBlitCopyRequiredForLocalMemory(hwInfo, graphicsAllocation));
|
||||
hwInfo.capabilityTable.blitterOperationsSupported = true;
|
||||
EXPECT_FALSE(helper.isBlitCopyRequiredForLocalMemory(hwInfo, graphicsAllocation));
|
||||
}
|
||||
|
||||
HWTEST_F(HwHelperTest, givenNotLockableAllocationWhenGettingIsBlitCopyRequiredForLocalMemoryThenCorrectValuesAreReturned) {
|
||||
DebugManagerStateRestore restore{};
|
||||
auto &helper = HwHelper::get(renderCoreFamily);
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
hwInfo.capabilityTable.blitterOperationsSupported = true;
|
||||
|
||||
MockGraphicsAllocation graphicsAllocation;
|
||||
graphicsAllocation.setAllocationType(GraphicsAllocation::AllocationType::SVM_GPU);
|
||||
EXPECT_FALSE(GraphicsAllocation::isLockable(graphicsAllocation.getAllocationType()));
|
||||
graphicsAllocation.overrideMemoryPool(MemoryPool::LocalMemory);
|
||||
|
||||
EXPECT_TRUE(helper.isBlitCopyRequiredForLocalMemory(hwInfo, graphicsAllocation));
|
||||
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(0);
|
||||
EXPECT_TRUE(helper.isBlitCopyRequiredForLocalMemory(hwInfo, graphicsAllocation));
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(1);
|
||||
EXPECT_TRUE(helper.isBlitCopyRequiredForLocalMemory(hwInfo, graphicsAllocation));
|
||||
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(3);
|
||||
EXPECT_TRUE(helper.isBlitCopyRequiredForLocalMemory(hwInfo, graphicsAllocation));
|
||||
hwInfo.capabilityTable.blitterOperationsSupported = false;
|
||||
EXPECT_TRUE(helper.isBlitCopyRequiredForLocalMemory(hwInfo, graphicsAllocation));
|
||||
|
||||
graphicsAllocation.overrideMemoryPool(MemoryPool::System64KBPages);
|
||||
EXPECT_FALSE(helper.isBlitCopyRequiredForLocalMemory(hwInfo, graphicsAllocation));
|
||||
@@ -999,6 +1030,7 @@ HWTEST2_F(HwHelperTest, givenDefaultHwHelperHwWhenGettingIsBlitCopyRequiredForLo
|
||||
auto &helper = HwHelper::get(renderCoreFamily);
|
||||
MockGraphicsAllocation graphicsAllocation;
|
||||
graphicsAllocation.overrideMemoryPool(MemoryPool::LocalMemory);
|
||||
graphicsAllocation.setAllocationType(GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
|
||||
|
||||
EXPECT_FALSE(helper.isBlitCopyRequiredForLocalMemory(*defaultHwInfo, graphicsAllocation));
|
||||
}
|
||||
|
||||
@@ -179,8 +179,8 @@ TEST(GraphicsAllocationTest, whenAllocationTypeIsGpuTimestampDeviceBufferThenAll
|
||||
EXPECT_TRUE(GraphicsAllocation::isLockable(GraphicsAllocation::AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER));
|
||||
}
|
||||
|
||||
TEST(GraphicsAllocationTest, whenAllocationTypeIsSvmGpuThenAllocationIsLockable) {
|
||||
EXPECT_TRUE(GraphicsAllocation::isLockable(GraphicsAllocation::AllocationType::SVM_GPU));
|
||||
TEST(GraphicsAllocationTest, whenAllocationTypeIsSvmGpuThenAllocationIsNotLockable) {
|
||||
EXPECT_FALSE(GraphicsAllocation::isLockable(GraphicsAllocation::AllocationType::SVM_GPU));
|
||||
}
|
||||
|
||||
TEST(GraphicsAllocationTest, whenAllocationTypeIsSharedResourceCopyThenAllocationIsLockable) {
|
||||
|
||||
@@ -439,18 +439,24 @@ size_t Device::getIndexOfNonEmptyEngineGroup(EngineGroupType engineGroupType) co
|
||||
return result;
|
||||
}
|
||||
|
||||
EngineControl &Device::getEngine(aub_stream::EngineType engineType, EngineUsage engineUsage) {
|
||||
EngineControl *Device::tryGetEngine(aub_stream::EngineType engineType, EngineUsage engineUsage) {
|
||||
for (auto &engine : engines) {
|
||||
if (engine.osContext->getEngineType() == engineType &&
|
||||
engine.osContext->isLowPriority() == (engineUsage == EngineUsage::LowPriority) &&
|
||||
engine.osContext->isInternalEngine() == (engineUsage == EngineUsage::Internal)) {
|
||||
return engine;
|
||||
return &engine;
|
||||
}
|
||||
}
|
||||
if (DebugManager.flags.OverrideInvalidEngineWithDefault.get()) {
|
||||
return engines[0];
|
||||
return &engines[0];
|
||||
}
|
||||
UNRECOVERABLE_IF(true);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
EngineControl &Device::getEngine(aub_stream::EngineType engineType, EngineUsage engineUsage) {
|
||||
auto engine = tryGetEngine(engineType, engineUsage);
|
||||
UNRECOVERABLE_IF(!engine);
|
||||
return *engine;
|
||||
}
|
||||
|
||||
EngineControl &Device::getEngine(uint32_t index) {
|
||||
|
||||
@@ -49,6 +49,7 @@ class Device : public ReferenceTrackedObject<Device> {
|
||||
bool getHostTimer(uint64_t *hostTimestamp) const;
|
||||
const HardwareInfo &getHardwareInfo() const;
|
||||
const DeviceInfo &getDeviceInfo() const;
|
||||
EngineControl *tryGetEngine(aub_stream::EngineType engineType, EngineUsage engineUsage);
|
||||
EngineControl &getEngine(aub_stream::EngineType engineType, EngineUsage engineUsage);
|
||||
std::vector<std::vector<EngineControl>> &getEngineGroups() {
|
||||
return this->engineGroups;
|
||||
|
||||
@@ -452,8 +452,7 @@ inline bool HwHelperHw<GfxFamily>::allowRenderCompression(const HardwareInfo &hw
|
||||
template <typename GfxFamily>
|
||||
inline bool HwHelperHw<GfxFamily>::isBlitCopyRequiredForLocalMemory(const HardwareInfo &hwInfo, const GraphicsAllocation &allocation) const {
|
||||
return allocation.isAllocatedInLocalMemoryPool() &&
|
||||
(getLocalMemoryAccessMode(hwInfo) == LocalMemoryAccessMode::CpuAccessDisallowed) &&
|
||||
hwInfo.capabilityTable.blitterOperationsSupported;
|
||||
(getLocalMemoryAccessMode(hwInfo) == LocalMemoryAccessMode::CpuAccessDisallowed || !GraphicsAllocation::isLockable(allocation.getAllocationType()));
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
|
||||
@@ -236,7 +236,6 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
|
||||
isIsaAllocationType(allocationType) ||
|
||||
allocationType == AllocationType::BUFFER_HOST_MEMORY ||
|
||||
allocationType == AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER ||
|
||||
allocationType == AllocationType::SVM_GPU ||
|
||||
allocationType == AllocationType::SHARED_RESOURCE_COPY;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user