Skip to content

Routing DataModel: store-then-build (defer device construction to solve)#1556

Draft
ramakrishnap-nv wants to merge 3 commits into
mainfrom
routing-cpu-api-phase2
Draft

Routing DataModel: store-then-build (defer device construction to solve)#1556
ramakrishnap-nv wants to merge 3 commits into
mainfrom
routing-cpu-api-phase2

Conversation

@ramakrishnap-nv

@ramakrishnap-nv ramakrishnap-nv commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Routing DataModel now records its setter calls and builds the device model lazily at solve, instead of pushing each input to the GPU as it is set. This keeps inputs host-resident while a problem is assembled and is the foundation for host-only (remote / gRPC) problem construction.

Behavior-preserving, except that C++ validation and dtype-cast warnings now surface at solve time rather than at the setter call. Full routing suite passes.

🤖 Generated with Claude Code

The public DataModel no longer inherits the Cython wrapper and no longer
pushes each input to the GPU as it is set. Instead it records the setter
calls and materializes the device (Cython) data model lazily -- when a solve
runs or a getter is queried -- by replaying the recorded calls onto the
wrapper. Size scalars are answered directly from the constructor args so
setter-time validation does not trigger a build.

This keeps the user's inputs host-resident while a problem is being assembled
and exposes the recorded inputs for host-only problem construction (remote /
gRPC serialization). Behavior is preserved except that wrapper/C++ validation
and dtype-cast warnings now surface at build/solve time rather than at the
setter call; two tests are updated to reflect this deferral.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Ramakrishna Prabhu <ramakrishnap@nvidia.com>
@copy-pr-bot

copy-pr-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@ramakrishnap-nv ramakrishnap-nv added this to the 26.08 milestone Jul 10, 2026
@ramakrishnap-nv ramakrishnap-nv added breaking Introduces a breaking change improvement Improves an existing functionality labels Jul 10, 2026
@ramakrishnap-nv ramakrishnap-nv self-assigned this Jul 10, 2026
ramakrishnap-nv and others added 2 commits July 10, 2026 15:25
The recorder/delegator methods were enumerated in _SETTERS/_GETTERS name
lists, a second copy of the DataModel method surface that would silently
drift when a setter/getter is added to the wrapper. Install them by
introspecting the wrapper's method surface instead, so the wrapper stays the
single source of truth and adding a method needs no change here. Explicit
overrides (matrix setters, size scalars) are skipped by the auto-install.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Ramakrishna Prabhu <ramakrishnap@nvidia.com>
The matrix setters kept a shadow dict (self.costs / self.transit_times)
solely for the public duplicate-vehicle-type guard, which meant a future
setter needing a set-time "already set?" check would silently need its own
shadow. Drop the shadows: the matrix setters now auto-record like every other
setter, and the guard reads the recorded calls via _recorded().

Add test_recording_covers_wrapper_surface so a new wrapper method that the
recording layer does not handle (e.g. a mutator not named set_*/add_*) fails
loudly instead of silently dropping its data.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Ramakrishna Prabhu <ramakrishnap@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Introduces a breaking change improvement Improves an existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant