Skip to content

Add forward rules for triangular linear solves#3107

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

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

Conversation

@jlperla

@jlperla jlperla commented May 15, 2026

Copy link
Copy Markdown

Summary

  • add forward-mode support for high-level triangular solves
  • cover vector and matrix RHS cases, including unit triangular and transposed triangular wrappers
  • reuse the existing _zero_unused_elements! handling for unit triangular structure
  • support batched forward mode

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 I added these in. I think this is a better place to fix some of those issues than the tablegen for now (and it is symmetric to the reverses-rules, so not coming out of nowhere).

@wsmoses

wsmoses commented May 16, 2026

Copy link
Copy Markdown
Member

This is fine for now, but I do think this may make sense to do as a tablegen rule. For regular matmul we saw substantial speed ups in doing so. Assuming this directly translates to the blas call [and not a combination of calls], I would expect similar here

@jlperla

jlperla commented May 16, 2026

Copy link
Copy Markdown
Author

Definitely. If you want any more work on the EnzymeAD/Enzyme#2825 just post comments or a code review and I will tell the AI to do its thing. But while I don't mind using AIs for patching, I am loathe to do so when I don't understand the code.

@codecov

codecov Bot commented May 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.95%. Comparing base (51a2569) to head (f2158ae).

Files with missing lines Patch % Lines
src/internal_rules/linalg.jl 0.00% 26 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3107      +/-   ##
==========================================
- Coverage   70.04%   69.95%   -0.09%     
==========================================
  Files          66       66              
  Lines       21840    21866      +26     
==========================================
  Hits        15297    15297              
- Misses       6543     6569      +26     

☔ 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 commented May 16, 2026

Copy link
Copy Markdown
Member

I think you still need to address the previous comments there, involving both splitting it up and also just changing the relefvant pieces?

@jlperla

jlperla commented May 16, 2026

Copy link
Copy Markdown
Author

@wsmoses Sorry, I think a question might have been lost on slack. To clarify, I wasn't sure if you wanted me to split EnzymeAD/Enzyme#2825 into 3 separate PRs for trsv, trsm, and potrs? Or something else?

@wsmoses

wsmoses commented May 16, 2026

Copy link
Copy Markdown
Member

yes that's correct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants