-
Notifications
You must be signed in to change notification settings - Fork 19
fix(memory/topology): Fallback to NVML for GPU NUMA node when sysfs reports -1 #119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nirandaperera
wants to merge
3
commits into
NVIDIA:main
Choose a base branch
from
nirandaperera:topology-gpu-numa-node-fix
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+63
−18
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -182,6 +182,37 @@ TEST_CASE("Topology Discovery default uses strictest verification", "[hw_topolog | |||||||||||||||||||||||
| REQUIRE(topo_default.network_devices.size() == topo_explicit.network_devices.size()); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| // Regression test for the bug where GPU NUMA node was reported as -1 on hosts whose ACPI | ||||||||||||||||||||||||
| // SRAT/SLIT tables do not publish PCIe-to-NUMA affinity data. The previous implementation | ||||||||||||||||||||||||
| // read /sys/bus/pci/devices/<pci>/numa_node, which returns -1 in that case; | ||||||||||||||||||||||||
| // topology_discovery now resolves the NUMA node via nvmlDeviceGetMemoryAffinity, which | ||||||||||||||||||||||||
| // walks the GPU driver's PCI bridge topology and is unaffected by firmware quirks. | ||||||||||||||||||||||||
| // | ||||||||||||||||||||||||
| // Invariant: when the host advertises NUMA topology and GPUs are present, every discovered | ||||||||||||||||||||||||
| // GPU must resolve to a valid NUMA node. This test would catch a regression that | ||||||||||||||||||||||||
| // re-introduced the -1 leak. | ||||||||||||||||||||||||
|
Comment on lines
+185
to
+193
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't care about details of the previous implementation. Only the expected behavior, which is what being tested, matters. |
||||||||||||||||||||||||
| TEST_CASE("Topology Discovery resolves GPU NUMA node on NUMA-aware hosts", "[hw_topology]") | ||||||||||||||||||||||||
| { | ||||||||||||||||||||||||
| topology_discovery discovery; | ||||||||||||||||||||||||
| REQUIRE(discovery.discover()); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| auto const& topology = discovery.get_topology(); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| if (topology.num_gpus == 0) { | ||||||||||||||||||||||||
| SUCCEED("Skipped: requires at least one GPU"); | ||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| for (auto const& gpu : topology.gpus) { | ||||||||||||||||||||||||
| INFO("GPU " << gpu.id << " (" << gpu.name << " @ " << gpu.pci_bus_id << ")"); | ||||||||||||||||||||||||
|
pentschev marked this conversation as resolved.
|
||||||||||||||||||||||||
| REQUIRE(gpu.numa_node >= 0); | ||||||||||||||||||||||||
| REQUIRE(gpu.numa_node < topology.num_numa_nodes); | ||||||||||||||||||||||||
| // memory_binding is populated from numa_node whenever the latter is known. | ||||||||||||||||||||||||
| REQUIRE(!gpu.memory_binding.empty()); | ||||||||||||||||||||||||
| REQUIRE(gpu.memory_binding.front() == gpu.numa_node); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| TEST_CASE("Topology Discovery rejects out-of-range CUDA_VISIBLE_DEVICES", "[hw_topology]") | ||||||||||||||||||||||||
| { | ||||||||||||||||||||||||
| ScopedEnvVar env("CUDA_VISIBLE_DEVICES", "99999999"); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, we don't care about the previous implementations.