Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
GPU shifted solves and diagonal extraction still mix CPU and GPU storage, and the new paths lack tests.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds configurable vector storage to LBFGSData/LBFGSOperator for GPU backends and updates shifted-system dispatch.
Changes:
- Adds
Vstorage parameter and GPU-aware constructors. - Generalizes LBFGS operations and shifted-system methods.
- No GPU tests were added.
File summaries
| File | Description |
|---|---|
src/lbfgs.jl |
Adds configurable storage backend support. |
src/utilities.jl |
Updates shifted-system method dispatch. |
Review details
Suppressed comments (2)
src/lbfgs.jl:61
- Selecting a GPU
Vonly movesAxand the history vectors to the device; the shifted-system scratch buffers constructed immediately below remainMatrix{T}/Vector{T}on the CPU. Consequentlysolve_shifted_system!(..., B, b, σ)with CuVector inputs mixes CPU views with GPUb(and copies from GPU intoshifted_u), so the new generic method fails with scalar indexing disabled instead of solving. Allocate these temporaries on the same backend, or otherwise implement a device-compatible shifted solve, before advertising GPU support.
V(undef, n),
src/lbfgs.jl:119
- Changing
storage_typetoVmakes GPU operators advertise GPU storage, butdiag(op)still allocatesVector{T}later in this file. After any update,diag!combines that CPU destination withdata.a/data.bGPU arrays, which is incompatible withCUDA.allowscalar(false)and does not provide a usable GPU diagonal. Makediagallocate from the operator's storage backend (or require a backend-provided output) and cover this path.
storage_type(op::LBFGSOperator{T, I, F, Ft, Fct, V}) where {T, I, F, Ft, Fct, V} = V
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+34
to
+35
| ::Type{T}, | ||
| ::Type{V}, |
blegat
marked this pull request as ready for review
September 19, 2026 08:40
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.
Uh oh!
There was an error while loading. Please reload this page.