Skip to content

Insert call instructions (without any caching) #1276

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
wants to merge 29 commits into
base: main
Choose a base branch
from
Open

Conversation

jumerckx
Copy link
Collaborator

No description provided.

jumerckx added 13 commits May 5, 2025 09:23

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
….fill` instead of creating an uninitialized TracedRArray

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
…urse through the object.

This is useful for constructing a new traced object without altering the paths.
It checks the contents of the generated MLIR which is different when call operations are generated.
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

JuliaFormatter

[JuliaFormatter] reported by reviewdog 🐶

Reactant.jl/src/utils.jl

Lines 1105 to 1113 in 68e7079

traced_result = push_inst!(Expr(
:call,
GlobalRef(Core, :_apply_iterate),
Base.iterate,
call_epilogue,
push_inst!(Expr(:call, GlobalRef(Core, :tuple), fn_args[1], push_inst!(Expr(:call, GlobalRef(Core, :tuple), fn_args[2:end]...)))),
push_inst!(Expr(:call, GlobalRef(Core, :tuple), traced_result)),
push_inst!(Expr(:call, GlobalRef(Reactant, :get_args_from_finalize_function), finalize_function_result)),
))


[JuliaFormatter] reported by reviewdog 🐶

Reactant.jl/src/utils.jl

Lines 1117 to 1122 in 68e7079

push_inst!(Expr(
:call,
GlobalRef(Base, :setindex!),
GlobalRef(Reactant, :TRACE_CALLS),
should_trace_call,
))


[JuliaFormatter] reported by reviewdog 🐶

Reactant.jl/src/utils.jl

Lines 1125 to 1130 in 68e7079

push_inst!(Expr(
:call,
GlobalRef(Base, :setindex!),
GlobalRef(Reactant, :TRACE_CALLS),
TRACE_CALLS[],
))

jumerckx added 4 commits May 13, 2025 09:49
… call operation for blacklisted operations but not for the functions called within them.
jumerckx added 4 commits May 13, 2025 15:06
This reverts commit 7c732dc.
@jumerckx
Copy link
Collaborator Author

jumerckx commented May 14, 2025

Status:

Test Summary:           | Pass  Fail  Error  Broken  Total      Time
Reactant.jl Tests       | 1480     5     27       1   1513  45m55.8s

(https://github.com/EnzymeAD/Reactant.jl/actions/runs/15022467542/job/42214855196?pr=1276#step:10:6661)

…oadcastFunction
jumerckx added 2 commits May 17, 2025 22:20
…en calling `make_tracer` on the `AnyTracedRArray`.
jumerckx added 3 commits May 21, 2025 16:20
@jumerckx jumerckx marked this pull request as ready for review May 21, 2025 15:00
@@ -675,14 +675,14 @@ function Base.similar(
::Broadcasted{AbstractReactantArrayStyle{N}}, ::Type{T}, dims
) where {T<:Reactant.ReactantPrimitive,N}
@assert N isa Int
return TracedRArray{T,length(dims)}((), nothing, map(length, dims))
return Ops.fill(zero(unwrapped_eltype(T)), dims)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor, but could we make a smaller PR with some of these utilities to get that in first (and confirm everything works)

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.

None yet

2 participants