-
Notifications
You must be signed in to change notification settings - Fork 24
feat: generalize loop raising passes to work with affine indexing #1668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
avik-pal
wants to merge
9
commits into
main
Choose a base branch
from
ap/generalize_to_affine_indexing
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,923
−897
Conversation
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
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EnzymeJAX Benchmarks
| Benchmark suite | Current: 858c436 | Previous: 8df9e47 | Ratio |
|---|---|---|---|
scatter_sum / JaX / cpu / Primal |
0.00000435670900005789 s |
0.000004262526800084742 s |
1.02 |
scatter_sum / JaXPipe / cpu / Primal |
0.000004330562999894028 s |
0.000004347323699948902 s |
1.00 |
scatter_sum / JaX / tpu / Primal |
0.0001417065681001 s |
0.0001549653354999 s |
0.91 |
scatter_sum / JaXPipe / tpu / Primal |
0.0001430293372002 s |
0.0001542208233999 s |
0.93 |
This comment was automatically generated by workflow using github-action-benchmark.
b426db5 to
6be8966
Compare
2 tasks
820ebf7 to
29a0b1a
Compare
Collaborator
Author
using Reactant
Reactant.Compiler.WHILE_UNROLL_THRESHOLD[] = 0
function negative_mul_indexing(x)
y = similar(x)
fill!(y, 0)
@trace for i in 1:2:6
@allowscalar y[2:6, 20 - 2i, 3:4] = cos.(x[1:5, 20 - 3i, 1:2])
end
return y
end
x = Reactant.to_rarray(rand(Float32, 6, 20, 5));
@code_hlo negative_mul_indexing(x)module {
func.func @main(%arg0: tensor<5x20x6xf32> {enzymexla.memory_effects = []}) -> tensor<5x20x6xf32> attributes {enzymexla.memory_effects = []} {
%c = stablehlo.constant dense<[[2, 17, 1], [2, 13, 1], [2, 9, 1]]> : tensor<3x3xi32>
%cst = stablehlo.constant dense<0.000000e+00> : tensor<5x20x6xf32>
%0 = stablehlo.slice %arg0 [0:2, 4:17:6, 0:5] : (tensor<5x20x6xf32>) -> tensor<2x3x5xf32>
%1 = stablehlo.reverse %0, dims = [1] : tensor<2x3x5xf32>
%2 = stablehlo.cosine %1 : tensor<2x3x5xf32>
%3 = "stablehlo.scatter"(%cst, %c, %2) <{indices_are_sorted = false, scatter_dimension_numbers = #stablehlo.scatter<update_window_dims = [0, 2], inserted_window_dims = [1], scatter_dims_to_operand_dims = [0, 1, 2], index_vector_dim = 1>, unique_indices = true}> ({
^bb0(%arg1: tensor<f32>, %arg2: tensor<f32>):
stablehlo.return %arg2 : tensor<f32>
}) : (tensor<5x20x6xf32>, tensor<3x3xi32>, tensor<2x3x5xf32>) -> tensor<5x20x6xf32>
return %3 : tensor<5x20x6xf32>
}
} |
3ffed93 to
a47b63c
Compare
avik-pal
commented
Dec 6, 2025
70a7f58 to
ae4ea37
Compare
ae4ea37 to
b1e11d2
Compare
b1e11d2 to
1a2288d
Compare
Member
|
the jax integration tests complain |
Collaborator
Author
|
looking into them |
668ede7 to
10f47ab
Compare
feat: generalize auto-batching to support affine indexing test: affine loop feat: support constant loop arguments feat: iota indexing with affine index refactor: cleanup while_is_copy_simplify feat: generalize while is copy fix: use correct APIs chore: run fmt fix: add check feat: step != 1 feat: generalize while is copy simplification pattern fix: add additional checks feat: support negative scale fix: infinite compile in dus_pad fix: test test: neg scale fix: assertion fix: transpose_reshape
10f47ab to
d598cd1
Compare
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.
fixes #1675