Revert "rocr: SVMPrefetch to a particular numa node (#1063)" (#2792)

This reverts commit 0ba5a01baa.
This commit is contained in:
Danylo Lytovchenko
2026-01-22 17:26:19 +01:00
committed by GitHub
parent 9d84e31d23
commit 7f906ced10
2 changed files with 6 additions and 31 deletions
@@ -56,7 +56,6 @@
#include <sys/mman.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <numaif.h> // for move_pages
#else
#define debug_warning(__VA_ARGS__)
#endif
@@ -3355,29 +3354,12 @@ hsa_status_t Runtime::SvmPrefetch(void* ptr, size_t size, hsa_agent_t agent,
op->dep_signals[op->remaining_deps], HSA_SIGNAL_CONDITION_EQ, 0, signal_handler, arg);
return false;
}
Agent* dest = Runtime::runtime_singleton_->GetSVMPrefetchAgent(op->base, op->size);
if (dest == nullptr || dest->device_type() == Agent::kAmdGpuDevice) {
// Prefetch location is not valid for move_pages usecase.
HSA_SVM_ATTRIBUTE attrib;
attrib.type = HSA_SVM_ATTR_PREFETCH_LOC;
attrib.value = op->node_id;
HSAKMT_STATUS error = HSAKMT_CALL(hsaKmtSVMSetAttr(op->base, op->size, 1, &attrib));
assert(error == HSAKMT_STATUS_SUCCESS && "KFD Prefetch failed.");
} else {
// Migrate pages to the requested CPU NUMA node
void* base_ptr = op->base;
size_t num_pages = op->size / 4096;
std::vector<void*> pages(num_pages);
for (size_t i = 0; i < num_pages; ++i)
pages[i] = static_cast<uint8_t*>(base_ptr) + i * 4096;
std::vector<int> nodes(num_pages, op->node_id);
std::vector<int> status(num_pages, -1);
int ret = move_pages(0, num_pages, pages.data(), nodes.data(), status.data(), 0);
assert(ret == 0 && "move_pages failed");
}
HSA_SVM_ATTRIBUTE attrib;
attrib.type = HSA_SVM_ATTR_PREFETCH_LOC;
attrib.value = op->node_id;
HSAKMT_STATUS error = HSAKMT_CALL(hsaKmtSVMSetAttr(op->base, op->size, 1, &attrib));
assert(error == HSAKMT_STATUS_SUCCESS && "KFD Prefetch failed.");
removePrefetchRanges(op);