eri: specialize prim_g_root on the quartet shape - #20
Open
ZuseZ4 wants to merge 1 commit into
Open
Conversation
The angular momenta and the g-buffer strides never change inside a quartet's loops, but they were runtime values, so every index in the VRR/HRR recurrences and the gout contraction was computed with runtime multiplies. `Shape` collects them and `seg_body` is specialized on it, so in the specialized arms every loop bound, every branch and every stride is a compile-time constant. Also unrolls `for ax in 0..3` into three explicit calls (vrr_axis/hrr_axis). And there is a hard Enzyme cliff at 8 arms: the reverse SIGSEGVs at runtime with a garbage `gx` base pointer, so we only use 6 here. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Rust has better const support than C, so I wanted to try if we could use that.
Apparently the benefit here isn't on removing branching, but from doing more computations at comptime.
It didn't generate the change I asked for, but still worth testing if the claimed speedup is true (~35%).