mirror of
https://github.com/intel/compute-runtime.git
synced 2025-11-15 10:14:56 +08:00
Improve PrintUmdSharedMigration
Add size and timing data. Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
2942a48ce8
commit
db58e50564
@@ -56,10 +56,17 @@ void handleGpuDomainTransferForHwWithHints(NEO::PageFaultManager *pageFaultHandl
|
||||
}
|
||||
}
|
||||
if (migration) {
|
||||
if (NEO::DebugManager.flags.PrintUmdSharedMigration.get()) {
|
||||
printf("UMD transferring shared allocation %llx from GPU to CPU\n", reinterpret_cast<unsigned long long int>(allocPtr));
|
||||
}
|
||||
std::chrono::steady_clock::time_point start;
|
||||
std::chrono::steady_clock::time_point end;
|
||||
|
||||
start = std::chrono::steady_clock::now();
|
||||
pageFaultHandler->transferToCpu(allocPtr, pageFaultData.size, pageFaultData.cmdQ);
|
||||
end = std::chrono::steady_clock::now();
|
||||
long long elapsedTime = std::chrono::duration_cast<std::chrono::nanoseconds>(end - start).count();
|
||||
|
||||
if (NEO::DebugManager.flags.PrintUmdSharedMigration.get()) {
|
||||
printf("UMD transferred shared allocation %llx (%zu B) from GPU to CPU (%f us)\n", reinterpret_cast<unsigned long long int>(allocPtr), pageFaultData.size, elapsedTime / 1e3);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (migration) {
|
||||
|
||||
@@ -578,7 +578,7 @@ TEST_F(CommandListMemAdvisePageFault, givenValidPtrAndPageFaultHandlerAndGpuDoma
|
||||
|
||||
std::string output = testing::internal::GetCapturedStdout(); // stop capturing
|
||||
|
||||
std::string expectedString = "UMD transferring shared allocation";
|
||||
std::string expectedString = "UMD transferred shared allocation";
|
||||
uint32_t occurrences = 0u;
|
||||
uint32_t expectedOccurrences = 1u;
|
||||
size_t idx = output.find(expectedString);
|
||||
|
||||
@@ -71,10 +71,18 @@ void PageFaultManager::moveAllocationsWithinUMAllocsManagerToGpuDomain(SVMAllocs
|
||||
|
||||
inline void PageFaultManager::migrateStorageToGpuDomain(void *ptr, PageFaultData &pageFaultData) {
|
||||
if (pageFaultData.domain == AllocationDomain::Cpu) {
|
||||
if (DebugManager.flags.PrintUmdSharedMigration.get()) {
|
||||
printf("UMD transferring shared allocation %llx from CPU to GPU\n", reinterpret_cast<unsigned long long int>(ptr));
|
||||
}
|
||||
std::chrono::steady_clock::time_point start;
|
||||
std::chrono::steady_clock::time_point end;
|
||||
|
||||
start = std::chrono::steady_clock::now();
|
||||
this->transferToGpu(ptr, pageFaultData.cmdQ);
|
||||
end = std::chrono::steady_clock::now();
|
||||
long long elapsedTime = std::chrono::duration_cast<std::chrono::nanoseconds>(end - start).count();
|
||||
|
||||
if (DebugManager.flags.PrintUmdSharedMigration.get()) {
|
||||
printf("UMD transferred shared allocation %llx (%zu B) from CPU to GPU (%f us)\n", reinterpret_cast<unsigned long long int>(ptr), pageFaultData.size, elapsedTime / 1e3);
|
||||
}
|
||||
|
||||
this->protectCPUMemoryAccess(ptr, pageFaultData.size);
|
||||
}
|
||||
pageFaultData.domain = AllocationDomain::Gpu;
|
||||
@@ -110,10 +118,17 @@ void PageFaultManager::handleGpuDomainTransferForAubAndTbx(PageFaultManager *pag
|
||||
|
||||
inline void PageFaultManager::migrateStorageToCpuDomain(void *ptr, PageFaultData &pageFaultData) {
|
||||
if (pageFaultData.domain == AllocationDomain::Gpu) {
|
||||
if (DebugManager.flags.PrintUmdSharedMigration.get()) {
|
||||
printf("UMD transferring shared allocation %llx from GPU to CPU\n", reinterpret_cast<unsigned long long int>(ptr));
|
||||
}
|
||||
std::chrono::steady_clock::time_point start;
|
||||
std::chrono::steady_clock::time_point end;
|
||||
|
||||
start = std::chrono::steady_clock::now();
|
||||
this->transferToCpu(ptr, pageFaultData.size, pageFaultData.cmdQ);
|
||||
end = std::chrono::steady_clock::now();
|
||||
long long elapsedTime = std::chrono::duration_cast<std::chrono::nanoseconds>(end - start).count();
|
||||
|
||||
if (DebugManager.flags.PrintUmdSharedMigration.get()) {
|
||||
printf("UMD transferred shared allocation %llx (%zu B) from GPU to CPU (%f us)\n", reinterpret_cast<unsigned long long int>(ptr), pageFaultData.size, elapsedTime / 1e3);
|
||||
}
|
||||
pageFaultData.unifiedMemoryManager->nonGpuDomainAllocs.push_back(ptr);
|
||||
}
|
||||
pageFaultData.domain = AllocationDomain::Cpu;
|
||||
|
||||
@@ -195,7 +195,7 @@ TEST_F(PageFaultManagerTest, givenUnifiedMemoryAllocsWhenMovingToGpuDomainWithPr
|
||||
|
||||
std::string output = testing::internal::GetCapturedStdout(); // stop capturing
|
||||
|
||||
std::string expectedString = "UMD transferring shared allocation";
|
||||
std::string expectedString = "UMD transferred shared allocation";
|
||||
uint32_t occurrences = 0u;
|
||||
uint32_t expectedOccurrences = 1u;
|
||||
size_t idx = output.find(expectedString);
|
||||
@@ -290,7 +290,7 @@ TEST_F(PageFaultManagerTest, givenUnifiedMemoryAllocWhenMoveToGpuDomainWithPrint
|
||||
|
||||
std::string output = testing::internal::GetCapturedStdout(); // stop capturing
|
||||
|
||||
std::string expectedString = "UMD transferring shared allocation";
|
||||
std::string expectedString = "UMD transferred shared allocation";
|
||||
uint32_t occurrences = 0u;
|
||||
uint32_t expectedOccurrences = 1u;
|
||||
size_t idx = output.find(expectedString);
|
||||
@@ -488,7 +488,7 @@ TEST_F(PageFaultManagerTest, whenVerifyingPagefaultWithPrintUsmSharedMigrationDe
|
||||
EXPECT_EQ(pageFaultManager->accessAllowedSize, 10u);
|
||||
EXPECT_TRUE(pageFaultManager->isAubWritable);
|
||||
|
||||
std::string expectedString = "UMD transferring shared allocation";
|
||||
std::string expectedString = "UMD transferred shared allocation";
|
||||
uint32_t occurrences = 0u;
|
||||
uint32_t expectedOccurrences = 1u;
|
||||
size_t idx = output.find(expectedString);
|
||||
@@ -527,7 +527,7 @@ TEST_F(PageFaultManagerTest, givenTbxWhenVerifyingPagefaultWithPrintUsmSharedMig
|
||||
EXPECT_EQ(pageFaultManager->accessAllowedSize, 10u);
|
||||
EXPECT_TRUE(pageFaultManager->isAubWritable);
|
||||
|
||||
std::string expectedString = "UMD transferring shared allocation";
|
||||
std::string expectedString = "UMD transferred shared allocation";
|
||||
uint32_t occurrences = 0u;
|
||||
uint32_t expectedOccurrences = 1u;
|
||||
size_t idx = output.find(expectedString);
|
||||
|
||||
Reference in New Issue
Block a user