Skip to content

Report host_numa virtual memory as host-accessible - #2503

Merged
Andy-Jost merged 1 commit into
NVIDIA:mainfrom
LeSingh1:fix/vmm-host-numa-is-host-accessible
Aug 7, 2026
Merged

Report host_numa virtual memory as host-accessible#2503
Andy-Jost merged 1 commit into
NVIDIA:mainfrom
LeSingh1:fix/vmm-host-numa-is-host-accessible

Conversation

@LeSingh1

@LeSingh1 LeSingh1 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

A VirtualMemoryResource configured with location_type="host_numa" or "host_numa_current" reports is_host_accessible is False and is_device_accessible is False — it claims the memory is reachable from nowhere.

__init__ classifies host-located resources with a substring test:

# Matches ("host", "host_numa", "host_numa_current")
if "host" in self.config.location_type:
    self.device = None

but is_host_accessible used exact equality:

return self.config.location_type == "host"

Both were introduced in cec0efb (#2016) and disagreed from the start. The answer propagates to Buffer.is_host_accessible, which forwards straight to the memory resource, so anything choosing CPU vs GPU from a buffer — DLPack/StridedMemoryView device selection, copy validation — sees the wrong answer.

host_numa_current is a working configuration today: the driver ignores location.id for that type, so the resource allocates fine and only the reported accessibility is wrong.

The fix gives both sites a shared _HOST_LOCATION_TYPES frozenset so they cannot drift again. VirtualMemoryLocationType is a StrEnum, so membership behaves identically for raw strings and enum members. is_device_accessible is deliberately left alone.

On verification, plainly: I have no GPU and no cuda.bindings build here, so nothing under cuda_core/tests/ can even import and I did not run the new test. What I did run is the old and new expressions plus __init__'s classifier extracted against a verbatim copy of the enum — that reproduces both NUMA types returning False on both properties before the change, and agreement with __init__ for all four members after. The regression test is GPU-gated by construction and will fail on main for the two NUMA parameters.

NOTE: developed with the assistance of an AI coding agent. The new test carries @pytest.mark.agent_authored per AGENTS.md. I reviewed and verified the change before submitting.

`VirtualMemoryResource.__init__` classifies "host", "host_numa" and
"host_numa_current" all as host-located (it clears `self.device` for
each), but `is_host_accessible` compared with `== "host"`. A resource
configured with `location_type="host_numa"` or `"host_numa_current"`
therefore reported `is_host_accessible is False` *and*
`is_device_accessible is False` -- an impossible answer that propagates
to `Buffer.is_host_accessible`, which forwards to the memory resource.

Share a single `_HOST_LOCATION_TYPES` set between the constructor and
the property so the two classifications cannot drift again.
@copy-pr-bot

copy-pr-bot Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions Bot added the cuda.core Everything related to the cuda.core module label Aug 4, 2026
@mdboom
mdboom requested a review from Andy-Jost August 7, 2026 13:41
@Andy-Jost Andy-Jost self-assigned this Aug 7, 2026
@Andy-Jost Andy-Jost added bug Something isn't working P1 Medium priority - Should do labels Aug 7, 2026
@Andy-Jost Andy-Jost added this to the cuda.core 1.2.0 milestone Aug 7, 2026
@Andy-Jost

Copy link
Copy Markdown
Contributor

/ok to test 5da1f5e

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

@Andy-Jost
Andy-Jost merged commit 83b2de7 into NVIDIA:main Aug 7, 2026
212 of 216 checks passed
github-actions Bot pushed a commit that referenced this pull request Aug 8, 2026
Removed preview folders for the following PRs:
- PR #2455
- PR #2487
- PR #2495
- PR #2503
- PR #2518
- PR #2534
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working cuda.core Everything related to the cuda.core module P1 Medium priority - Should do

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants