You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(cuda.core)!: drop int location shorthand from managed-memory ops (R6, R8)
Per Leo's review on PR #1775 (_managed_buffer.py:165) and Andy's
parallel question (line 144), drop the `int` shorthand for
prefetch/discard_prefetch/advise locations. The previous design
accepted `Device | Host | int` where `int >= 0` meant a device ordinal
and `-1` magically meant host. With first-class `Device` and `Host`,
the int form was redundant and the `-1 → Host` magic was surprising.
Public API change:
prefetch(buf, Device(0), stream=...) # was: prefetch(buf, 0, stream=...)
prefetch(buf, Host(), stream=...) # was: prefetch(buf, -1, stream=...)
This also resolves an inconsistency: ManagedBuffer.preferred_location
already accepted only Device | Host | None, but prefetch() and
discard_prefetch() accepted int. Now uniformly Device | Host.
Pre-1.0 breaking change. Anyone using the int shorthand should switch
to the explicit Device(N) / Host() form.
Files touched:
- _managed_location.py: drop the int branch from _coerce_location;
TypeError now reads "Device, Host, or None"
- _managed_buffer.py: type signatures `Device | Host | int` → `Device | Host`
- _managed_memory_ops.pyx: docstring updates (3 occurrences)
- tests/memory/test_managed_ops.py: replace int call sites with
Host()/Device(N); collapse three int-branch tests into one
test_int_rejected
- 1.0.0-notes.rst: drop the "int values are also accepted" sentence
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments