Conversation
|
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. |
📝 WalkthroughWalkthroughThe change relocates the computation of Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
cpp/src/routing/ges/lexicographic_search/lexicographic_search.cu (1)
701-707: The fix correctly addresses the root cause by computingn_blocks_lexicoafterk_maxis finalized.The relocation of this computation ensures the grid launch parameter uses the final
k_maxvalue determined by the shared-memory adjustment loop.However, the PR description mentions adding a check: "If
n_blocks_lexico <= 0, return false and skip the kernel launch." This defensive check appears to be missing. While practically unlikely givenk_max >= 2at this point, adding the guard would prevent launching kernels with invalid grid dimensions in edge cases.🛡️ Suggested defensive check
// Compute n_blocks_lexico after k_max is finalized by the while-loop above i_t n_blocks_lexico = (solution_ptr->get_num_orders() + solution_ptr->get_n_routes() - solution_ptr->problem_ptr->order_info.depot_included_); if constexpr (REQUEST == request_t::PDP) { n_blocks_lexico *= max_neighbors<i_t, REQUEST>(k_max); } + + if (n_blocks_lexico <= 0) { return false; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@cpp/src/routing/ges/lexicographic_search/lexicographic_search.cu` around lines 701 - 707, The code now computes n_blocks_lexico after k_max is finalized but is missing the defensive guard promised in the PR; add a check after computing n_blocks_lexico that if n_blocks_lexico <= 0 then return false (skipping the kernel launch), ensuring this check applies for both generic REQUEST and the PDP branch (where n_blocks_lexico is multiplied by max_neighbors<i_t, REQUEST>(k_max)); reference the symbols n_blocks_lexico, k_max, max_neighbors, and request_t::PDP when adding the early-return guard to prevent invalid grid dimensions.
🤖 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/ges/lexicographic_search/lexicographic_search.cu`:
- Around line 701-707: The code now computes n_blocks_lexico after k_max is
finalized but is missing the defensive guard promised in the PR; add a check
after computing n_blocks_lexico that if n_blocks_lexico <= 0 then return false
(skipping the kernel launch), ensuring this check applies for both generic
REQUEST and the PDP branch (where n_blocks_lexico is multiplied by
max_neighbors<i_t, REQUEST>(k_max)); reference the symbols n_blocks_lexico,
k_max, max_neighbors, and request_t::PDP when adding the early-return guard to
prevent invalid grid dimensions.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 5a68901e-6066-4030-a060-a399f2352f77
📒 Files selected for processing (1)
cpp/src/routing/ges/lexicographic_search/lexicographic_search.cu
|
/merge |
Description
Fix GES lexicographic search cudaErrorInvalidValue (test_lex_smoke)
Summary
Fixes
cudaErrorInvalidValuein the guided ejection search (GES) lexicographic kernel for PDP routing. The failure was caused by launching with a block count computed for the initialk_maxwhile the loop could reducek_max(and thus the valid block range) before launch.Root cause
n_blocks_lexicowas set once using the initialk_max(e.g. 5).k_max(e.g. to 2–4) whenset_shmem_of_kernelfails.k_max = 5) but received the reducedk_max(e.g. 2).delivery_insertion_idx_in_permutation = blockIdx.x / n_lexico_positionsand expects the grid size to ben_lexico_positions * max_neighbors(k_max). With too many blocks,blockIdx.xwent out of the intended range and led to invalid behavior andcudaErrorInvalidValue.Changes
cpp/src/routing/ges/lexicographic_search/lexicographic_search.cun_lexico_positions) before the loop.n_blocks_lexico = n_lexico_positions * max_neighbors(k_max)using the finalk_maxso the launch config matches the kernel.n_blocks_lexico <= 0, returnfalseand skip the kernel launch.Testing
pytest python/cuopt/cuopt/tests/routing/test_warnings.py::test_lex_smokepasses after rebuilding libcuopt.Issue
Checklist