Skip to content

Define LU factorization for JLArray - #757

Draft
ChrisRackauckas-Claude wants to merge 1 commit into
JuliaGPU:mainfrom
ChrisRackauckas-Claude:agent/jlarray-lu
Draft

Define LU factorization for JLArray#757
ChrisRackauckas-Claude wants to merge 1 commit into
JuliaGPU:mainfrom
ChrisRackauckas-Claude:agent/jlarray-lu

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Contributor

Ignore this PR until reviewed by @ChrisRackauckas.\n\n## Summary\n\nJLArrays now defines LinearAlgebra.lu for JLArray matrices by explicitly copying to the host representation before calling host LU. Matching ldiv! methods copy right-hand sides through host memory so the returned factorization can be used by solver code without triggering JLArray to Ptr conversion.\n\nThis addresses the regression described in SciML/OrdinaryDiffEq.jl#4179. JLArrays 0.3.2 intentionally rejects implicit CPU pointer conversion, while the generic LinearAlgebra LU path still reaches LAPACK with a JLArray.\n\n## Verification\n\nBefore the fix, on the unmodified branch:\n\n julia --project=test --startup-file=no -e 'using JLArrays, LinearAlgebra; A = jl([2.0 1.0; 1.0 3.0]); lu(A; check = false)'\n\nfailed with:\n\n ERROR: Illegal conversion of a JLArray to a Ptr\n [3] getrf!(A::JLArray{Float64, 2}, ipiv::JLArray{Int64, 1}; check::Bool)\n @ LinearAlgebra.LAPACK .../LinearAlgebra/src/lapack.jl:587\n\nWith this patch:\n\n julia --project=test --startup-file=no test/jlarrays_lu.jl\n\npassed:\n\n Test Summary: | Pass Total Time\n JLArray LU | 3 3 1.3s\n\nThe OrdinaryDiffEq reproduction also passed for both TRBDF2 and Rodas5P:\n\n (SciMLBase.ReturnCode.Success, SciMLBase.ReturnCode.Success, [0.04713496106370036, 0.04713496106370036, 0.04713496106370036])\n\nThe full GPUArrays suite passed:\n\n Test Summary: | Pass Total Time\n Overall | 21022 21022 16m23.0s\n SUCCESS\n Testing GPUArrays tests passed\n\nAlso ran typos on the changed files and git diff --check. GPU-specific backends and downstream packages were not tested.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
@ChrisRackauckas

Copy link
Copy Markdown
Member

It was effectively doing this before the pointer conversion was removed

@kshyatt

kshyatt commented Aug 14, 2026

Copy link
Copy Markdown
Member

Brother what is this PR description

@ChrisRackauckas

Copy link
Copy Markdown
Member

ehh have your llm summarize it.

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.

3 participants