Routing DataModel: store-then-build (defer device construction to solve)#1556
Draft
ramakrishnap-nv wants to merge 3 commits into
Draft
Routing DataModel: store-then-build (defer device construction to solve)#1556ramakrishnap-nv wants to merge 3 commits into
ramakrishnap-nv wants to merge 3 commits into
Conversation
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>
|
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. |
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>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Routing
DataModelnow 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