mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
Add canonized gpuAddress to GraphicsAllocation constructor
Related-To: NEO-6523 Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
1a7c11e4f1
commit
81899c4477
@@ -155,7 +155,7 @@ TEST(DebugSettingsManager, givenPrintDebugSettingsEnabledOnDisabledDebugManagerW
|
||||
}
|
||||
|
||||
TEST(AllocationInfoLogging, givenBaseGraphicsAllocationWhenGettingImplementationSpecificAllocationInfoThenReturnEmptyInfoString) {
|
||||
GraphicsAllocation graphicsAllocation(0, AllocationType::UNKNOWN, nullptr, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount);
|
||||
GraphicsAllocation graphicsAllocation(0, AllocationType::UNKNOWN, nullptr, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount, 0llu);
|
||||
EXPECT_STREQ(graphicsAllocation.getAllocationInfoString().c_str(), "");
|
||||
}
|
||||
|
||||
|
||||
@@ -33,13 +33,17 @@ class GivenLinearStreamWhenCallDispatchBlitMemoryColorFillThenCorrectDepthIsProg
|
||||
uint32_t streamBuffer[100] = {};
|
||||
LinearStream stream(streamBuffer, sizeof(streamBuffer));
|
||||
auto size = 0x1000;
|
||||
auto ptr = reinterpret_cast<void *>(0x1234);
|
||||
auto gmmHelper = device->getGmmHelper();
|
||||
auto canonizedGpuAddress = gmmHelper->canonize(castToUint64(ptr));
|
||||
MockGraphicsAllocation mockAllocation(0,
|
||||
AllocationType::INTERNAL_HOST_MEMORY,
|
||||
reinterpret_cast<void *>(0x1234),
|
||||
ptr,
|
||||
size,
|
||||
0u,
|
||||
MemoryPool::System4KBPages,
|
||||
MemoryManager::maxOsContextCount);
|
||||
MemoryManager::maxOsContextCount,
|
||||
canonizedGpuAddress);
|
||||
uint32_t patternToCommand[4];
|
||||
memset(patternToCommand, 4, patternSize);
|
||||
BlitCommandsHelper<FamilyType>::dispatchBlitMemoryColorFill(&mockAllocation, 0, patternToCommand, patternSize, stream, mockAllocation.getUnderlyingBufferSize(), *device->getExecutionEnvironment()->rootDeviceEnvironments[device->getRootDeviceIndex()]);
|
||||
|
||||
@@ -29,7 +29,7 @@ class MockGraphicsAllocation : public MemoryAllocation {
|
||||
using MemoryAllocation::usageInfos;
|
||||
|
||||
MockGraphicsAllocation()
|
||||
: MemoryAllocation(0, AllocationType::UNKNOWN, nullptr, 0u, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount) {}
|
||||
: MemoryAllocation(0, AllocationType::UNKNOWN, nullptr, 0u, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount, 0llu) {}
|
||||
|
||||
MockGraphicsAllocation(void *buffer, size_t sizeIn)
|
||||
: MemoryAllocation(0, AllocationType::UNKNOWN, buffer, castToUint64(buffer), 0llu, sizeIn, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount) {}
|
||||
|
||||
@@ -361,8 +361,10 @@ HWTEST_F(CommandStreamReceiverTest, givenGpuHangAndNonEmptyAllocationsListWhenCa
|
||||
|
||||
auto hostPtr = reinterpret_cast<void *>(0x1234);
|
||||
size_t size = 100;
|
||||
|
||||
auto temporaryAllocation = std::make_unique<MemoryAllocation>(0, AllocationType::EXTERNAL_HOST_PTR, hostPtr, size, 0, MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
|
||||
auto gmmHelper = pDevice->getGmmHelper();
|
||||
auto canonizedGpuAddress = gmmHelper->canonize(castToUint64(hostPtr));
|
||||
auto temporaryAllocation = std::make_unique<MemoryAllocation>(0, AllocationType::EXTERNAL_HOST_PTR, hostPtr, size, 0,
|
||||
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount, canonizedGpuAddress);
|
||||
temporaryAllocation->updateTaskCount(0u, 0u);
|
||||
csr.getInternalAllocationStorage()->storeAllocationWithTaskCount(std::move(temporaryAllocation), TEMPORARY_ALLOCATION, 2u);
|
||||
|
||||
@@ -1382,7 +1384,10 @@ TEST(CommandStreamReceiverSimpleTest, givenMultipleActivePartitionsWhenWaitingFo
|
||||
|
||||
auto hostPtr = reinterpret_cast<void *>(0x1234);
|
||||
size_t size = 100;
|
||||
auto temporaryAllocation = std::make_unique<MemoryAllocation>(0, AllocationType::EXTERNAL_HOST_PTR, hostPtr, size, 0, MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
|
||||
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[0]->getGmmHelper();
|
||||
auto canonizedGpuAddress = gmmHelper->canonize(castToUint64(hostPtr));
|
||||
auto temporaryAllocation = std::make_unique<MemoryAllocation>(0, AllocationType::EXTERNAL_HOST_PTR, hostPtr, size, 0,
|
||||
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount, canonizedGpuAddress);
|
||||
temporaryAllocation->updateTaskCount(0u, 0u);
|
||||
csr.getInternalAllocationStorage()->storeAllocationWithTaskCount(std::move(temporaryAllocation), TEMPORARY_ALLOCATION, 2u);
|
||||
|
||||
@@ -1489,8 +1494,10 @@ struct CreateAllocationForHostSurfaceTest : public ::testing::Test {
|
||||
TEST_F(CreateAllocationForHostSurfaceTest, givenTemporaryAllocationWhenCreateAllocationForHostSurfaceThenReuseTemporaryAllocationWhenSizeAndAddressMatch) {
|
||||
auto hostPtr = reinterpret_cast<void *>(0x1234);
|
||||
size_t size = 100;
|
||||
auto temporaryAllocation = std::make_unique<MemoryAllocation>(0,
|
||||
AllocationType::EXTERNAL_HOST_PTR, hostPtr, size, 0, MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
|
||||
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[0]->getGmmHelper();
|
||||
auto canonizedGpuAddress = gmmHelper->canonize(castToUint64(hostPtr));
|
||||
auto temporaryAllocation = std::make_unique<MemoryAllocation>(0, AllocationType::EXTERNAL_HOST_PTR, hostPtr, size, 0,
|
||||
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount, canonizedGpuAddress);
|
||||
auto allocationPtr = temporaryAllocation.get();
|
||||
temporaryAllocation->updateTaskCount(0u, 0u);
|
||||
commandStreamReceiver->getInternalAllocationStorage()->storeAllocation(std::move(temporaryAllocation), TEMPORARY_ALLOCATION);
|
||||
@@ -1517,8 +1524,10 @@ TEST_F(CreateAllocationForHostSurfaceTest, givenTemporaryAllocationWhenCreateAll
|
||||
mockCsr->osContext = &commandStreamReceiver->getOsContext();
|
||||
auto hostPtr = reinterpret_cast<void *>(0x1234);
|
||||
size_t size = 100;
|
||||
auto temporaryAllocation = std::make_unique<MemoryAllocation>(0,
|
||||
AllocationType::EXTERNAL_HOST_PTR, hostPtr, size, 0, MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
|
||||
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[0]->getGmmHelper();
|
||||
auto canonizedGpuAddress = gmmHelper->canonize(castToUint64(hostPtr));
|
||||
auto temporaryAllocation = std::make_unique<MemoryAllocation>(0, AllocationType::EXTERNAL_HOST_PTR, hostPtr, size, 0,
|
||||
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount, canonizedGpuAddress);
|
||||
auto allocationPtr = temporaryAllocation.get();
|
||||
temporaryAllocation->updateTaskCount(0u, 0u);
|
||||
mockCsr->getInternalAllocationStorage()->storeAllocation(std::move(temporaryAllocation), TEMPORARY_ALLOCATION);
|
||||
@@ -1534,8 +1543,10 @@ TEST_F(CreateAllocationForHostSurfaceTest, givenTemporaryAllocationWhenCreateAll
|
||||
TEST_F(CreateAllocationForHostSurfaceTest, givenTemporaryAllocationWhenCreateAllocationForHostSurfaceThenAllocTaskCountEqualZero) {
|
||||
auto hostPtr = reinterpret_cast<void *>(0x1234);
|
||||
size_t size = 100;
|
||||
auto temporaryAllocation = std::make_unique<MemoryAllocation>(0,
|
||||
AllocationType::EXTERNAL_HOST_PTR, hostPtr, size, 0, MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
|
||||
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[0]->getGmmHelper();
|
||||
auto canonizedGpuAddress = gmmHelper->canonize(castToUint64(hostPtr));
|
||||
auto temporaryAllocation = std::make_unique<MemoryAllocation>(0, AllocationType::EXTERNAL_HOST_PTR, hostPtr, size, 0,
|
||||
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount, canonizedGpuAddress);
|
||||
auto allocationPtr = temporaryAllocation.get();
|
||||
temporaryAllocation->updateTaskCount(10u, 0u);
|
||||
commandStreamReceiver->getInternalAllocationStorage()->storeAllocation(std::move(temporaryAllocation), TEMPORARY_ALLOCATION);
|
||||
|
||||
@@ -21,7 +21,7 @@ using namespace NEO;
|
||||
TEST(MultiGraphicsAllocationTest, whenCreatingMultiGraphicsAllocationThenTheAllocationIsObtainableAsADefault) {
|
||||
GraphicsAllocation graphicsAllocation(1, // rootDeviceIndex
|
||||
AllocationType::BUFFER,
|
||||
nullptr, 0, 0, MemoryPool::System4KBPages, 0);
|
||||
nullptr, 0, 0, MemoryPool::System4KBPages, 0, 0llu);
|
||||
|
||||
MockMultiGraphicsAllocation multiGraphicsAllocation(1);
|
||||
EXPECT_EQ(2u, multiGraphicsAllocation.graphicsAllocations.size());
|
||||
@@ -37,10 +37,10 @@ TEST(MultiGraphicsAllocationTest, whenCreatingMultiGraphicsAllocationThenTheAllo
|
||||
TEST(MultiGraphicsAllocationTest, givenMultiGraphicsAllocationWhenAddingMultipleGraphicsAllocationsThenTheyAreObtainableByRootDeviceIndex) {
|
||||
GraphicsAllocation graphicsAllocation0(0, // rootDeviceIndex
|
||||
AllocationType::BUFFER,
|
||||
nullptr, 0, 0, MemoryPool::System4KBPages, 0);
|
||||
nullptr, 0, 0, MemoryPool::System4KBPages, 0, 0llu);
|
||||
GraphicsAllocation graphicsAllocation1(1, // rootDeviceIndex
|
||||
AllocationType::BUFFER,
|
||||
nullptr, 0, 0, MemoryPool::System4KBPages, 0);
|
||||
nullptr, 0, 0, MemoryPool::System4KBPages, 0, 0llu);
|
||||
|
||||
MockMultiGraphicsAllocation multiGraphicsAllocation(1);
|
||||
|
||||
@@ -56,7 +56,7 @@ TEST(MultiGraphicsAllocationTest, givenMultiGraphicsAllocationWhenGettingAllocat
|
||||
auto expectedAllocationType = AllocationType::BUFFER;
|
||||
GraphicsAllocation graphicsAllocation(1, // rootDeviceIndex
|
||||
expectedAllocationType,
|
||||
nullptr, 0, 0, MemoryPool::System4KBPages, 0);
|
||||
nullptr, 0, 0, MemoryPool::System4KBPages, 0, 0llu);
|
||||
|
||||
MockMultiGraphicsAllocation multiGraphicsAllocation(1);
|
||||
multiGraphicsAllocation.addAllocation(&graphicsAllocation);
|
||||
@@ -69,7 +69,7 @@ TEST(MultiGraphicsAllocationTest, givenMultiGraphicsAllocationWhenGettingCoheren
|
||||
auto expectedAllocationType = AllocationType::BUFFER;
|
||||
GraphicsAllocation graphicsAllocation(1, // rootDeviceIndex
|
||||
expectedAllocationType,
|
||||
nullptr, 0, 0, MemoryPool::System4KBPages, 0);
|
||||
nullptr, 0, 0, MemoryPool::System4KBPages, 0, 0llu);
|
||||
|
||||
MockMultiGraphicsAllocation multiGraphicsAllocation(1);
|
||||
multiGraphicsAllocation.addAllocation(&graphicsAllocation);
|
||||
@@ -90,7 +90,7 @@ TEST(MultiGraphicsAllocationTest, givenMultiGraphicsAllocationWhenRemovingGraphi
|
||||
uint32_t rootDeviceIndex = 1u;
|
||||
GraphicsAllocation graphicsAllocation(rootDeviceIndex,
|
||||
AllocationType::BUFFER,
|
||||
nullptr, 0, 0, MemoryPool::System4KBPages, 0);
|
||||
nullptr, 0, 0, MemoryPool::System4KBPages, 0, 0llu);
|
||||
|
||||
MockMultiGraphicsAllocation multiGraphicsAllocation(rootDeviceIndex);
|
||||
EXPECT_EQ(2u, multiGraphicsAllocation.graphicsAllocations.size());
|
||||
|
||||
@@ -443,7 +443,7 @@ TEST(AllocationTypeLogging, givenGraphicsAllocationTypeWhenConvertingToStringThe
|
||||
{AllocationType::SW_TAG_BUFFER, "SW_TAG_BUFFER"}}};
|
||||
|
||||
for (const auto &[type, str] : allocationTypeValues) {
|
||||
GraphicsAllocation graphicsAllocation(0, type, nullptr, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount);
|
||||
GraphicsAllocation graphicsAllocation(0, type, nullptr, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount, 0llu);
|
||||
auto result = getAllocationTypeString(&graphicsAllocation);
|
||||
|
||||
EXPECT_STREQ(result, str);
|
||||
@@ -455,7 +455,7 @@ TEST(AllocationTypeLoggingSingle, givenGraphicsAllocationTypeWhenConvertingToStr
|
||||
DebugVariables flags;
|
||||
FullyEnabledFileLogger fileLogger(testFile, flags);
|
||||
|
||||
GraphicsAllocation graphicsAllocation(0, static_cast<AllocationType>(999), nullptr, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount);
|
||||
GraphicsAllocation graphicsAllocation(0, static_cast<AllocationType>(999), nullptr, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount, 0llu);
|
||||
|
||||
auto result = getAllocationTypeString(&graphicsAllocation);
|
||||
|
||||
@@ -467,7 +467,7 @@ TEST(AllocationTypeLoggingSingle, givenAllocationTypeWhenConvertingToStringThenS
|
||||
DebugVariables flags;
|
||||
FullyEnabledFileLogger fileLogger(testFile, flags);
|
||||
|
||||
GraphicsAllocation graphicsAllocation(0, AllocationType::UNKNOWN, nullptr, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount);
|
||||
GraphicsAllocation graphicsAllocation(0, AllocationType::UNKNOWN, nullptr, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount, 0llu);
|
||||
|
||||
for (uint32_t i = 0; i < static_cast<uint32_t>(AllocationType::COUNT); i++) {
|
||||
graphicsAllocation.setAllocationType(static_cast<AllocationType>(i));
|
||||
@@ -485,7 +485,7 @@ TEST(AllocationTypeLoggingSingle, givenDebugVariableToCaptureAllocationTypeWhenF
|
||||
|
||||
FullyEnabledFileLogger fileLogger(testFile, flags);
|
||||
|
||||
GraphicsAllocation graphicsAllocation(0, AllocationType::COMMAND_BUFFER, nullptr, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount);
|
||||
GraphicsAllocation graphicsAllocation(0, AllocationType::COMMAND_BUFFER, nullptr, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount, 0llu);
|
||||
|
||||
testing::internal::CaptureStdout();
|
||||
fileLogger.logAllocation(&graphicsAllocation);
|
||||
@@ -503,7 +503,7 @@ TEST(AllocationTypeLoggingSingle, givenLogAllocationTypeWhenLoggingAllocationThe
|
||||
|
||||
FullyEnabledFileLogger fileLogger(testFile, flags);
|
||||
|
||||
GraphicsAllocation graphicsAllocation(0, AllocationType::COMMAND_BUFFER, nullptr, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount);
|
||||
GraphicsAllocation graphicsAllocation(0, AllocationType::COMMAND_BUFFER, nullptr, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount, 0llu);
|
||||
|
||||
// Log file not created
|
||||
bool logFileCreated = fileExists(fileLogger.getLogFileName());
|
||||
@@ -540,7 +540,7 @@ TEST(MemoryPoolLogging, givenGraphicsMemoryPoolWhenConvertingToStringThenCorrect
|
||||
{MemoryPool::SystemCpuInaccessible, "SystemCpuInaccessible"}}};
|
||||
|
||||
for (const auto &[pool, str] : memoryPoolValues) {
|
||||
GraphicsAllocation graphicsAllocation(0, AllocationType::UNKNOWN, nullptr, 0, 0, pool, MemoryManager::maxOsContextCount);
|
||||
GraphicsAllocation graphicsAllocation(0, AllocationType::UNKNOWN, nullptr, 0, 0, pool, MemoryManager::maxOsContextCount, 0llu);
|
||||
auto result = getMemoryPoolString(&graphicsAllocation);
|
||||
|
||||
EXPECT_STREQ(result, str);
|
||||
|
||||
Reference in New Issue
Block a user