Use fp64 for all node stack buffers and fix indexing in vehicle order match test#1137
Use fp64 for all node stack buffers and fix indexing in vehicle order match test#1137hlinsen wants to merge 3 commits intoNVIDIA:mainfrom
Conversation
📝 WalkthroughWalkthroughAdded stricter input validation in vehicle/order match methods, changed forward-feasibility buffer storage to double in the lexicographic node stack, and adjusted a test's constraint-removal sampling to compute vehicle index from Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
cpp/src/routing/data_model_view.cu (2)
302-304: Please confirm intended behavior for empty match lists.Line 302 and Line 322 now reject zero-length compatibility lists (
norders > 0,nvehicles > 0). If callers previously used empty lists to represent “no allowed matches,” this is a contract change. Please verify intent and, if intentional, update API docs accordingly.Also applies to: 322-324
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@cpp/src/routing/data_model_view.cu` around lines 302 - 304, The change rejects zero-length compatibility lists by asserting norders > 0 and nvehicles > 0 via cuopt_expects (the checks that emit "number of orders in vehicle_order_match must be positive" and similar for vehicles); confirm whether empty lists should mean “no allowed matches” or are invalid—if empty lists should be allowed, remove or relax these cuopt_expects checks in the vehicle_order_match validation code (and any other places using norders/nvehicles checks) to accept zero and handle it downstream; if the change is intentional, update the public API docs and function comments for vehicle_order_match (and the corresponding vehicle validation) to state that lists must be non-empty and include the rationale and examples.
307-310: Consider making deep range validation optional for bulk setup paths.These checks call
detail::check_min_max_values, which synchronizes the stream internally; repeated calls per vehicle/order can add avoidable setup latency on large instances. Avalidate_inputtoggle (or batched validation) would preserve safety while reducing sync overhead when inputs are prevalidated.As per coding guidelines: "Eliminate unnecessary host-device synchronization (cudaDeviceSynchronize) in hot paths that blocks GPU pipeline; use streams and events for async execution."
Also applies to: 327-330
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@cpp/src/routing/data_model_view.cu` around lines 307 - 310, The range-check calls using cuopt_expects(detail::check_min_max_values(...), ...) cause host-device syncs; add an optional boolean parameter (e.g., validate_input = true) to the API/function that contains these calls so callers can skip deep validation for bulk/prevalidated inputs, and wrap the cuopt_expects calls for orders and vehicles with if (validate_input) { ... } so check_min_max_values is only invoked when requested (preserve existing behavior by default). Use the same pattern for the other occurrence that currently calls detail::check_min_max_values with handle_ptr_->get_stream() to avoid repeated stream synchronizations in hot setup paths. Ensure the function signature and any calling sites propagate the new flag or provide an overload/default so behavior is opt-in and tests still exercise the validation path.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@cpp/src/routing/data_model_view.cu`:
- Around line 302-304: The change rejects zero-length compatibility lists by
asserting norders > 0 and nvehicles > 0 via cuopt_expects (the checks that emit
"number of orders in vehicle_order_match must be positive" and similar for
vehicles); confirm whether empty lists should mean “no allowed matches” or are
invalid—if empty lists should be allowed, remove or relax these cuopt_expects
checks in the vehicle_order_match validation code (and any other places using
norders/nvehicles checks) to accept zero and handle it downstream; if the change
is intentional, update the public API docs and function comments for
vehicle_order_match (and the corresponding vehicle validation) to state that
lists must be non-empty and include the rationale and examples.
- Around line 307-310: The range-check calls using
cuopt_expects(detail::check_min_max_values(...), ...) cause host-device syncs;
add an optional boolean parameter (e.g., validate_input = true) to the
API/function that contains these calls so callers can skip deep validation for
bulk/prevalidated inputs, and wrap the cuopt_expects calls for orders and
vehicles with if (validate_input) { ... } so check_min_max_values is only
invoked when requested (preserve existing behavior by default). Use the same
pattern for the other occurrence that currently calls
detail::check_min_max_values with handle_ptr_->get_stream() to avoid repeated
stream synchronizations in hot setup paths. Ensure the function signature and
any calling sites propagate the new flag or provide an overload/default so
behavior is opt-in and tests still exercise the validation path.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 865cbcf1-bfd9-4eb2-9f21-4ceeee4138f8
📒 Files selected for processing (2)
cpp/src/routing/data_model_view.cucpp/src/routing/ges/lexicographic_search/node_stack.cuh
🚧 Files skipped from review as they are similar to previous changes (1)
- cpp/src/routing/ges/lexicographic_search/node_stack.cuh
Fixes: