Replaced SpMV with SpMVOp in PDHG for double precision#1226
Conversation
…bnvjitlink-dev manually
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds CUDA 13.2+ cuSPARSE SpMVOp acceleration for PDLP: RAII wrappers and runtime probe, cusparse_view_t integration with SpMVOp workspace and plan creation, PDHG helpers that dispatch to plans or fall back, plus build and conda dependency updates. ChangescuSPARSE SpMVOp Acceleration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
🚥 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.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
dependencies.yaml (1)
670-676:⚠️ Potential issue | 🔴 Critical | ⚡ Quick winChange line 670 selector from
cuda: "13.2"tocuda: "13.1"to resolve conflicting CUDA version mappings.The matrix currently has duplicate entries for
cuda: "13.2"with conflicting package pins (13.1 and 13.2), which breaks dependency resolution for CUDA 13.2 environments.🔧 Proposed fix
- output_types: conda matrices: - - matrix: - cuda: "13.2" + - matrix: + cuda: "13.1" packages: - cuda-version=13.1 - matrix: cuda: "13.2" packages: - cuda-version=13.2🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@dependencies.yaml` around lines 670 - 676, Update the YAML matrix entry so the CUDA selector matches its package pin: change the first occurrence of the CUDA matrix key currently set as cuda: "13.2" (the block that lists packages: - cuda-version=13.1) to cuda: "13.1" so the selector and the pinned package agree; ensure you edit the matrix entry containing the keys "cuda" and "packages" (the block pairing cuda-version=13.1) rather than the block already pinned to cuda-version=13.2.
🧹 Nitpick comments (1)
cpp/src/pdlp/cusparse_view.hpp (1)
23-23: 💤 Low valueMacro naming should use
CUOPT_prefix.The macro
CUDA_VER_13_2_UPdoes not follow the project naming convention. As per coding guidelines, project macros should useSCREAMING_SNAKE_CASEwith aCUOPT_prefix.♻️ Suggested rename
-#define CUDA_VER_13_2_UP (CUDART_VERSION >= 13020) +#define CUOPT_CUDA_VER_13_2_UP (CUDART_VERSION >= 13020)Then update all uses of this macro in this file and dependent files.
As per coding guidelines, project macros should use
SCREAMING_SNAKE_CASEwithCUOPT_prefix.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cpp/src/pdlp/cusparse_view.hpp` at line 23, Rename the macro CUDA_VER_13_2_UP to follow project convention (e.g., CUOPT_CUDA_VER_13_2_UP) and update its definition in cusparse_view.hpp; then replace all references to CUDA_VER_13_2_UP in this file and any dependent files with the new symbol CUOPT_CUDA_VER_13_2_UP to keep naming consistent with project-wide macros.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@cpp/src/pdlp/cusparse_view.cu`:
- Around line 1280-1338: The method create_spmv_op_plans is templated on f_t but
always uses CUDA_R_64F, so add a compile-time guard to only instantiate the
double-precision path: wrap the existing CUDA_VER_13_2_UP body in an if
constexpr (std::is_same_v<f_t, double>) { ... } block so float instantiations
skip this code; ensure <type_traits> is available for std::is_same_v and
reference the symbols used (create_spmv_op_plans, f_t, CUDA_R_64F, A_T, A,
spmv_op_descr_A_t_, spmv_op_descr_A_, spmv_op_plan_A_t_, spmv_op_plan_A_) when
making the change.
In `@cpp/src/pdlp/pdhg.hpp`:
- Around line 98-101: Remove the unused dead declaration my_spmvop(f_t* alpha,
f_t* A, f_t* x, f_t* beta, f_t* y, f_t* result) from the pdhg.hpp header: delete
the entire method prototype so only the actual SPMV methods (spmvop_At_y and
spmvop_A_x) remain; ensure no other code references my_spmvop (rename or remove
any forward declarations) and recompile to verify no missing-symbol errors.
---
Outside diff comments:
In `@dependencies.yaml`:
- Around line 670-676: Update the YAML matrix entry so the CUDA selector matches
its package pin: change the first occurrence of the CUDA matrix key currently
set as cuda: "13.2" (the block that lists packages: - cuda-version=13.1) to
cuda: "13.1" so the selector and the pinned package agree; ensure you edit the
matrix entry containing the keys "cuda" and "packages" (the block pairing
cuda-version=13.1) rather than the block already pinned to cuda-version=13.2.
---
Nitpick comments:
In `@cpp/src/pdlp/cusparse_view.hpp`:
- Line 23: Rename the macro CUDA_VER_13_2_UP to follow project convention (e.g.,
CUOPT_CUDA_VER_13_2_UP) and update its definition in cusparse_view.hpp; then
replace all references to CUDA_VER_13_2_UP in this file and any dependent files
with the new symbol CUOPT_CUDA_VER_13_2_UP to keep naming consistent with
project-wide macros.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 189500be-24af-4f85-953b-6e3d3f4010f0
📒 Files selected for processing (7)
cpp/CMakeLists.txtcpp/src/pdlp/cusparse_view.cucpp/src/pdlp/cusparse_view.hppcpp/src/pdlp/pdhg.cucpp/src/pdlp/pdhg.hppcpp/src/pdlp/pdlp.cudependencies.yaml
|
/ok to test 1880f23 |
|
/ok to test 36c41ca |
|
/ok to test e1890ef |
|
/ok to test c907d93 |
|
/ok to test 99f455d |
|
/ok to test 45efb50 |
|
/ok to test 152fc19 |
|
/ok to test f08facd |
|
/ok to test 5cce25f |
|
/ok to test 5cce25f |
@Bubullzz, there was an error processing your request: See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/2/ |
|
/ok to test 1ebd68c |
Description
Replaced SpMV calls with SpMVOp calls in PDHG in order to accelerate compute. These changes are only available for double precision. Benchmarks on B200 full Mittleman dataset with concurrent strategy gave a 1.09x speedup.
follow-up on #989
Issue
closes #9