Skip to content

Add forward rules for dense linear solves#3106

Open
jlperla wants to merge 1 commit into
EnzymeAD:mainfrom
jlperla:dense-linsolve-rules
Open

Add forward rules for dense linear solves#3106
jlperla wants to merge 1 commit into
EnzymeAD:mainfrom
jlperla:dense-linsolve-rules

Conversation

@jlperla

@jlperla jlperla commented May 15, 2026

Copy link
Copy Markdown

Summary

  • add forward-mode support for dense A \ b and A \ B
  • reuse the existing compute_lu_cache path used by the reverse rule
  • support active or constant RHS, active square A, and batched forward mode
  • keep active rectangular solves unsupported for now

Tests

  • julia --project=test test/runtests.jl --verbose rules/internal_rules/linear_algebra_rules

@jlperla

jlperla commented May 15, 2026

Copy link
Copy Markdown
Author

@wsmoses This one I felt more confident implementing. Seems to pass tests/runic/etc. and I think it follows the patterns of others in that file.

Let me know if you want anything changed.

@codecov

codecov Bot commented May 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 26.66667% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.39%. Comparing base (51a2569) to head (a13965e).

Files with missing lines Patch % Lines
src/internal_rules/linalg.jl 26.66% 22 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3106      +/-   ##
==========================================
- Coverage   70.04%   67.39%   -2.65%     
==========================================
  Files          66       66              
  Lines       21840    21803      -37     
==========================================
- Hits        15297    14694     -603     
- Misses       6543     7109     +566     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@wsmoses wsmoses force-pushed the dense-linsolve-rules branch from 6c20f43 to a13965e Compare May 16, 2026 16:21
@wsmoses

wsmoses commented May 16, 2026

Copy link
Copy Markdown
Member

same comment of fine for now, but we should tablegen likely here

@jlperla

jlperla commented May 16, 2026

Copy link
Copy Markdown
Author

Yes on tablegen. I asked an AI to come up with tablegen but it ended up looking very complicated because of managing the pivots. But it got the dense LU stuff working and passing tests. Happy to post that up as a PR for you guys to look at and suggest changes/take it over. But not sure it is worth your time.

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.

2 participants