2 pass added to the pallas kernel - #2
Open
kesavanramakrishnan wants to merge 1 commit into
Open
Conversation
Owner
|
Awesome, thank you! Will review soon. |
marcelroed
requested changes
Jun 14, 2026
marcelroed
left a comment
Owner
There was a problem hiding this comment.
I'm sitting down with this to find a real criteria for optimality, since it still seems like this can be simplified quite a bit.
|
|
||
| D_i = D_ref[:] | ||
| # CHANGED (2-pass): B in closed form from the fused pass (was a second K pass). | ||
| B_i = r1_i - dD_i * r2_i - D_i * dD_i + r3_i |
Owner
There was a problem hiding this comment.
Indicates r1 and r3 can be collapsed into a single value.
| return B_i_acc | ||
| dD_i_acc += jnp.sum(ddS_ij * P_ij, axis=1) | ||
| r1_acc += jnp.sum(dPa_ij * P_ij, axis=1) | ||
| r2_acc += jnp.sum(dP_ij * P_ij, axis=1) |
Owner
There was a problem hiding this comment.
Is r2 not identical to D, which is precomputed?
Collaborator
Author
There was a problem hiding this comment.
yes! realized this earlier as well, I removed it but forgot to update this version, though perf is about the same
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.
modified the pallas kernel reduce to 2 passes (as referenced in the tk kernel), should be a free speedup (stage 1 is ~1.2x faster than 3 pass version and end to end is ~1.15x)
@marcelroed this should be an easy merge