Skip to content

Cpufj cut bursts#12

Closed
aliceb-nv wants to merge 9 commits into
mainfrom
cpufj_cut_bursts
Closed

Cpufj cut bursts#12
aliceb-nv wants to merge 9 commits into
mainfrom
cpufj_cut_bursts

Conversation

@aliceb-nv
Copy link
Copy Markdown
Owner

Dummy PR to get coderabbit to perform a review.

Description

Issue

Checklist

  • I am familiar with the Contributing Guidelines.
  • Testing
    • New or existing tests cover these changes
    • Added tests
    • Created an issue to follow-up
    • NA
  • Documentation
    • The documentation is up to date with these changes
    • Added new documentation
    • NA

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 5, 2026

Warning

Rate limit exceeded

@aliceb-nv has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 43 minutes and 23 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: def9f77f-3c96-4ddb-bd7d-f736eaf52b2b

📥 Commits

Reviewing files that changed from the base of the PR and between 45c8154 and 64ba333.

📒 Files selected for processing (2)
  • cpp/src/branch_and_bound/branch_and_bound.cpp
  • cpp/src/mip_heuristics/feasibility_jump/fj_cpu.cu
📝 Walkthrough

Walkthrough

The pull request integrates CPU feasibility-jump (CPUFJ) support into the branch-and-bound root cut-passes phase. It introduces task-oriented APIs to create and run CPUFJ from host-level linear programs, refactors the root cut-pass loop to execute CPUFJ concurrently with cut passes, and adds work-unit limiting and improved callback context capture.

Changes

Root CPUFJ Integration

Layer / File(s) Summary
Task Definition
cpp/src/mip_heuristics/feasibility_jump/cpu_fj_thread.cuh
Introduces cpu_fj_thread_t worker-thread class with lifecycle hooks and result access, fj_cpu_task_t task struct with preemption flag and custom deleter, and declares make_fj_cpu_task_from_host_lp, run_fj_cpu_task, and stop_fj_cpu_task APIs.
Header Reorganization
cpp/src/mip_heuristics/feasibility_jump/fj_cpu.cuh
Removes duplicate cpu_fj_thread_t declaration and updates includes to reference cpu_fj_thread.cuh; standalone initialization remains.
Task Implementation
cpp/src/mip_heuristics/feasibility_jump/fj_cpu.cu
Adds host LP initialization (finalize_fj_cpu_host_initialization, init_fj_cpu_from_host_lp), extends cpufj_solve_loop with work_unit_limit parameter, implements task-oriented APIs (make_fj_cpu_task_from_host_lp, run_fj_cpu_task, stop_fj_cpu_task), and instantiates templates for float/double.
Root Cut Loop Refactoring
cpp/src/branch_and_bound/branch_and_bound.cpp
Adds includes for cpu_fj_thread.cuh and scope_guard.hpp; introduces root CPUFJ task plumbing with improvement callback and scope-guarded cleanup; refactors cut-pass loop to use do_cut_pass lambda returning structured actions (BREAK/RETURN/CONTINUE); enables concurrent CPUFJ execution during cut passes and post-loop deterministic/time-limited CPUFJ runs.
Callback Context
cpp/src/mip_heuristics/local_search/local_search.cu
Captures this in addition to population in the improvement callback for correct context access.

Estimated Code Review Effort

🎯 4 (Complex) | ⏱️ ~60 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is a placeholder mentioning 'Dummy PR to get coderabbit to perform a review' with an empty implementation section, which is unrelated to the substantial technical changes in the changeset. Replace the placeholder description with a substantive summary of the CPUFJ cut-burst integration, including motivation, key changes, and testing approach.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Cpufj cut bursts' directly relates to the main change: integrating CPU feasibility-jump (CPUFJ) support into the root cut-passes phase of branch-and-bound.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cpufj_cut_bursts

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
cpp/src/mip_heuristics/local_search/local_search.cu (1)

127-136: ⚡ Quick win

Keep this scratch callback self-contained.

This background callback only needs context.problem_ptr, but it now captures this. That adds an avoidable lifetime dependency on local_search_t during shutdown; the sibling scratch callback in this file already uses the safer by-value problem_ptr capture.

♻️ Suggested change
-  scratch_cpu_fj_on_lp_opt.fj_cpu->improvement_callback =
-    [&population, this](f_t obj, const std::vector<f_t>& h_vec, double /*work_units*/) {
+  scratch_cpu_fj_on_lp_opt.fj_cpu->improvement_callback =
+    [&population, problem_ptr = context.problem_ptr](
+      f_t obj, const std::vector<f_t>& h_vec, double /*work_units*/) {
       population.add_external_solution(h_vec, obj, solution_origin_t::CPUFJ);
       if (obj < local_search_best_obj) {
         CUOPT_LOG_DEBUG("******* New local search best obj %g, best overall %g",
-                        context.problem_ptr->get_user_obj_from_solver_obj(obj),
-                        context.problem_ptr->get_user_obj_from_solver_obj(
+                        problem_ptr->get_user_obj_from_solver_obj(obj),
+                        problem_ptr->get_user_obj_from_solver_obj(
                           population.is_feasible() ? population.best_feasible().get_objective()
                                                    : std::numeric_limits<f_t>::max()));
         local_search_best_obj = obj;
       }
     };
🤖 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/mip_heuristics/local_search/local_search.cu` around lines 127 - 136,
Change the lambda capture to avoid capturing this; capture only the needed
symbols explicitly: capture population by reference (&population), capture
local_search_best_obj by reference (&local_search_best_obj) if you need to
update it (or capture a pointer to it), and capture problem_ptr by value
(problem_ptr = context.problem_ptr) so the callback no longer depends on the
local_search_t lifetime; update the capture list for the lambda assigned to
scratch_cpu_fj_on_lp_opt.fj_cpu->improvement_callback accordingly.
🤖 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/branch_and_bound/branch_and_bound.cpp`:
- Around line 2231-2237: The callback root_cut_cpufj_improvement_callback is
passing a solver-space prefix directly into set_new_solution by slicing
assignment with original_problem_.num_cols; instead translate the solver-space
CPUFJ solution back to the user-space layout used by set_new_solution (use the
existing uncrush_primal_solution mapping that was used to produce the CPUFJ
vector) and then call set_new_solution with that translated user_assignment, or
alternatively add a solver-space ingestion path (e.g. a new
set_new_solution_from_solver or similar) and use it here so the incumbent is
validated/updated against the correct assignment.

In `@cpp/src/mip_heuristics/feasibility_jump/fj_cpu.cu`:
- Around line 1456-1460: The tolerances struct used for the host-LP CPUFJ path
is missing initialization of relative_tolerance, causing
get_corrected_tolerance() (used in the CPUFJ loop) to enforce different
thresholds than problem_t/fj_cpu.view.pb; set tolerances.relative_tolerance =
settings.relative_tol (or the appropriate settings field for relative tolerance)
alongside the existing assignments so the full tolerance mapping matches the
regular path and scaled rows use the same feasibility threshold.

---

Nitpick comments:
In `@cpp/src/mip_heuristics/local_search/local_search.cu`:
- Around line 127-136: Change the lambda capture to avoid capturing this;
capture only the needed symbols explicitly: capture population by reference
(&population), capture local_search_best_obj by reference
(&local_search_best_obj) if you need to update it (or capture a pointer to it),
and capture problem_ptr by value (problem_ptr = context.problem_ptr) so the
callback no longer depends on the local_search_t lifetime; update the capture
list for the lambda assigned to
scratch_cpu_fj_on_lp_opt.fj_cpu->improvement_callback accordingly.
🪄 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: Pro

Run ID: 21466f26-3d91-490f-8100-8fe0859b7bab

📥 Commits

Reviewing files that changed from the base of the PR and between a4de253 and 45c8154.

📒 Files selected for processing (5)
  • cpp/src/branch_and_bound/branch_and_bound.cpp
  • cpp/src/mip_heuristics/feasibility_jump/cpu_fj_thread.cuh
  • cpp/src/mip_heuristics/feasibility_jump/fj_cpu.cu
  • cpp/src/mip_heuristics/feasibility_jump/fj_cpu.cuh
  • cpp/src/mip_heuristics/local_search/local_search.cu

Comment thread cpp/src/branch_and_bound/branch_and_bound.cpp
Comment thread cpp/src/mip_heuristics/feasibility_jump/fj_cpu.cu
@aliceb-nv aliceb-nv closed this May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant