Skip to content
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

Interp2 #365

Merged
merged 79 commits into from
Dec 14, 2024
Merged

Interp2 #365

merged 79 commits into from
Dec 14, 2024

Conversation

wsmoses
Copy link
Member

@wsmoses wsmoses commented Dec 11, 2024

No description provided.

import ..ancestor
import ReactantCore
import ..TracedUtils: materialize_traced_array
import GPUArraysCore
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
import GPUArraysCore
using GPUArraysCore: GPUArraysCore

get_ancestor_indices(::TracedRArray, indices...) = indices
function get_ancestor_indices(x::WrappedTracedRArray, indices...)
return get_ancestor_indices(parent(x), Base.reindex(parentindices(x), indices)...)
end

Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change


function Base.getindex(
a::TracedRArray{T,N}, index::Vararg{Union{Int,TracedRNumber{Int}},N}
) where {T,N}
GPUArraysCore.assertscalar("getindex(::TracedRArray, ::Vararg{Int, N})")

start_indices = [promote_to(TracedRNumber{Int}, i - 1).mlir_data for i in index]
start_indices = [TracedUtils.promote_to(TracedRNumber{Int}, i - 1).mlir_data for i in index]
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
start_indices = [TracedUtils.promote_to(TracedRNumber{Int}, i - 1).mlir_data for i in index]
start_indices = [
TracedUtils.promote_to(TracedRNumber{Int}, i - 1).mlir_data for i in index
]

Comment on lines 110 to 111
(TracedUtils.promote_to(TracedRNumber{Int}, i isa Colon ? 1 : first(i)) - 1).mlir_data for
i in indices
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
(TracedUtils.promote_to(TracedRNumber{Int}, i isa Colon ? 1 : first(i)) - 1).mlir_data for
i in indices
(
TracedUtils.promote_to(TracedRNumber{Int}, i isa Colon ? 1 : first(i)) - 1
).mlir_data for i in indices

return traced2_result
end
TracedUtils.promote_to(::Type{TracedRArray{T,N}}, rhs) where {T,N} = TracedRArray{T,N}(rhs)
TracedUtils.promote_to(::TracedRArray{T,N}, rhs) where {T,N} = TracedUtils.promote_to(TracedRArray{T,N}, rhs)
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
TracedUtils.promote_to(::TracedRArray{T,N}, rhs) where {T,N} = TracedUtils.promote_to(TracedRArray{T,N}, rhs)
function TracedUtils.promote_to(::TracedRArray{T,N}, rhs) where {T,N}
return TracedUtils.promote_to(TracedRArray{T,N}, rhs)
end

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 🐶

end

Base.float(x::TracedRNumber{T}) where {T} = promote_to(TracedRNumber{float(T)}, x)
Base.float(x::TracedRNumber{T}) where {T} = TracedUtils.promote_to(TracedRNumber{float(T)}, x)
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
Base.float(x::TracedRNumber{T}) where {T} = TracedUtils.promote_to(TracedRNumber{float(T)}, x)
function Base.float(x::TracedRNumber{T}) where {T}
return TracedUtils.promote_to(TracedRNumber{float(T)}, x)
end


struct TypeCast{T<:ReactantPrimitive} <: Function end

(::TypeCast{T})(x::TracedRNumber{T2}) where {T,T2} = TracedUtils.promote_to(TracedRNumber{T}, x)
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
(::TypeCast{T})(x::TracedRNumber{T2}) where {T,T2} = TracedUtils.promote_to(TracedRNumber{T}, x)
function (::TypeCast{T})(x::TracedRNumber{T2}) where {T,T2}
return TracedUtils.promote_to(TracedRNumber{T}, x)
end

end

seen_results = OrderedIdDict()
traced2_result = Reactant.make_tracer(seen_results, result, (), Reactant.TracedSetPath; tobatch=OutShape)
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
traced2_result = Reactant.make_tracer(seen_results, result, (), Reactant.TracedSetPath; tobatch=OutShape)
traced2_result = Reactant.make_tracer(
seen_results, result, (), Reactant.TracedSetPath; tobatch=OutShape
)

@@ -153,15 +153,15 @@ function trace_for(mod, expr)

all_syms = Expr(:tuple, counter, external_syms...)
args_init = Expr(
:tuple, :(Reactant.promote_to(Reactant.TracedRNumber{Int}, 0)), external_syms...
:tuple, :(Reactant.TracedUtils.promote_to(Reactant.TracedRNumber{Int}, 0)), external_syms...
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
:tuple, :(Reactant.TracedUtils.promote_to(Reactant.TracedRNumber{Int}, 0)), external_syms...
:tuple,
:(Reactant.TracedUtils.promote_to(Reactant.TracedRNumber{Int}, 0)),
external_syms...,

Comment on lines 11 to 14
using ..TracedUtils:
get_mlir_data,
materialize_traced_array,
set_mlir_data!
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
using ..TracedUtils:
get_mlir_data,
materialize_traced_array,
set_mlir_data!
using ..TracedUtils: get_mlir_data, materialize_traced_array, set_mlir_data!

@@ -329,7 +332,7 @@ function NNlib.gather!(dst::TracedRArray, src::AnyTracedRArray, idxs::AbstractAr
start_sizes = ntuple(i -> size(src, i), dims)
results = map(CartesianIndices(idxs)) do k
res = @allowscalar src[colons..., Tuple(idxs[k])...]
res isa TracedRNumber && (res = Reactant.broadcast_to_size(res, (1,)))
res isa TracedRNumber && (res = Reactant.TracedUtils.broadcast_to_size(res, (1,)))
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
res isa TracedRNumber && (res = Reactant.TracedUtils.broadcast_to_size(res, (1,)))
res isa TracedRNumber &&
(res = Reactant.TracedUtils.broadcast_to_size(res, (1,)))

src/Tracing.jl Outdated
@@ -498,14 +498,14 @@ function make_tracer(
return ConcreteRNumber(prev)
else
if mode == TracedTrack
res = TracedRNumber{RT}((path,), broadcast_to_size(prev, ()).mlir_data)
res = TracedRNumber{RT}((path,), TracedUtils.broadcast_to_size(prev, ()).mlir_data)
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
res = TracedRNumber{RT}((path,), TracedUtils.broadcast_to_size(prev, ()).mlir_data)
res = TracedRNumber{RT}(
(path,), TracedUtils.broadcast_to_size(prev, ()).mlir_data
)

src/Tracing.jl Outdated
if !haskey(seen, prev)
return seen[prev] = res
end
return res
elseif mode == TracedSetPath
haskey(seen, prev) && return seen[prev]
res = TracedRNumber{RT}((path,), broadcast_to_size(prev, ()).mlir_data)
res = TracedRNumber{RT}((path,), TracedUtils.broadcast_to_size(prev, ()).mlir_data)
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
res = TracedRNumber{RT}((path,), TracedUtils.broadcast_to_size(prev, ()).mlir_data)
res = TracedRNumber{RT}(
(path,), TracedUtils.broadcast_to_size(prev, ()).mlir_data
)

@@ -61,7 +80,7 @@ end
function LinearAlgebra.triu!(@nospecialize(X::TracedRArray{T,2}), k::Integer) where {T}
iota_1 = Ops.iota(Int64, [size(X)...]; iota_dimension=1)
iota_2 = Ops.subtract(
Ops.iota(Int64, [size(X)...]; iota_dimension=2), broadcast_to_size(k, size(X))
Ops.iota(Int64, [size(X)...]; iota_dimension=2), TracedUtils.broadcast_to_size(k, size(X))
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
Ops.iota(Int64, [size(X)...]; iota_dimension=2), TracedUtils.broadcast_to_size(k, size(X))
Ops.iota(Int64, [size(X)...]; iota_dimension=2),
TracedUtils.broadcast_to_size(k, size(X)),

@@ -71,7 +90,7 @@ end
function LinearAlgebra.tril!(@nospecialize(X::TracedRArray{T,2}), k::Integer) where {T}
iota_1 = Ops.iota(Int64, [size(X)...]; iota_dimension=1)
iota_2 = Ops.subtract(
Ops.iota(Int64, [size(X)...]; iota_dimension=2), broadcast_to_size(k, size(X))
Ops.iota(Int64, [size(X)...]; iota_dimension=2), TracedUtils.broadcast_to_size(k, size(X))
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
Ops.iota(Int64, [size(X)...]; iota_dimension=2), TracedUtils.broadcast_to_size(k, size(X))
Ops.iota(Int64, [size(X)...]; iota_dimension=2),
TracedUtils.broadcast_to_size(k, size(X)),

@@ -115,7 +134,7 @@ function LinearAlgebra.diag(x::AnyTracedRArray{T,2}, k::Integer=0) where {T}
)
#! format: on

slice_sizes = get_mlir_data(Reactant.promote_to(TracedRArray{Int,1}, [1, 1]))
slice_sizes = get_mlir_data(Reactant.TracedUtils.promote_to(TracedRArray{Int,1}, [1, 1]))
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
slice_sizes = get_mlir_data(Reactant.TracedUtils.promote_to(TracedRArray{Int,1}, [1, 1]))
slice_sizes = get_mlir_data(
Reactant.TracedUtils.promote_to(TracedRArray{Int,1}, [1, 1])
)

@@ -139,6 +158,8 @@ function LinearAlgebra.diagm(m::Integer, n::Integer, v::AnyTracedRArray{T,1}) wh

mat = (v .+ zero(v)') .* diag_indicator
return Ops.pad(
mat, promote_to(TracedRNumber{T}, 0); high=[m - length(v), n - length(v)]
mat, TracedUtils.promote_to(TracedRNumber{T}, 0); high=[m - length(v), n - length(v)]
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
mat, TracedUtils.promote_to(TracedRNumber{T}, 0); high=[m - length(v), n - length(v)]
mat,
TracedUtils.promote_to(TracedRNumber{T}, 0);
high=[m - length(v), n - length(v)],

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 510 to 513 in 70c3951

push!(
overdubbed_code,
Core.ReturnNode(Core.SSAValue(length(overdubbed_code)))
)


[JuliaFormatter] reported by reviewdog 🐶

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 🐶

iter_args = min(n_actual_args, n_method_args-1)


[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶

push!(overdubbed_code, Expr(:call, safe_print, "fn arg["*string(length(fn_args))*"]", fn_args[end]))


[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶

Reactant.jl/src/utils.jl

Lines 470 to 472 in f839a0b

push!(
overdubbed_code, trailing_arguments
)


[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶

push!(overdubbed_code, Expr(:call, safe_print, "fn arg["*string(length(fn_args))*"]", fn_args[end]))


[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶

res = Core._call_in_world_total(world, make_oc, octup, rt, src, ocnargs, ocva, args[1].instance)::Core.OpaqueClosure


[JuliaFormatter] reported by reviewdog 🐶

Reactant.jl/src/utils.jl

Lines 504 to 514 in f839a0b

push!(overdubbed_code,
Expr(:call,
make_oc,
octup,
rt,
src,
ocnargs,
ocva,
farg
)
)


[JuliaFormatter] reported by reviewdog 🐶

Reactant.jl/src/utils.jl

Lines 519 to 526 in f839a0b

push!(
overdubbed_code,
Expr(
:(call),
oc,
fn_args[2:end]...
),
)


[JuliaFormatter] reported by reviewdog 🐶

Reactant.jl/src/utils.jl

Lines 530 to 533 in f839a0b

push!(
overdubbed_code,
Core.ReturnNode(Core.SSAValue(length(overdubbed_code)))
)


[JuliaFormatter] reported by reviewdog 🐶

rdims = Int64[]

if dims == (:)
for i in 0:(N-1)
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
for i in 0:(N-1)
for i in 0:(N - 1)

else
Int64[i - 1 for i in dims]
for i in dims
push!(rdims, i-1)
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
push!(rdims, i-1)
push!(rdims, i - 1)

toonedims = Int[]
outdims = Int[]
for i in 1:N
tmp = if in(i-1, rdims)
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
tmp = if in(i-1, rdims)
tmp = if in(i - 1, rdims)

@@ -471,19 +283,19 @@ function Base.mapreducedim!(
@nospecialize(R::TracedRArray),
A::Base.AbstractArrayOrBroadcasted,
)
tmp = broadcast_to_size(Base.mapreduce(f, op, A; dims=1), (1, size(R)[2:end]...))
tmp = TracedUtils.broadcast_to_size(Base.mapreduce(f, op, A; dims=1), (1, size(R)[2:end]...))
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
tmp = TracedUtils.broadcast_to_size(Base.mapreduce(f, op, A; dims=1), (1, size(R)[2:end]...))
tmp = TracedUtils.broadcast_to_size(
Base.mapreduce(f, op, A; dims=1), (1, size(R)[2:end]...)
)

A.mlir_data = bcast.mlir_data
return A
end

function Base.fill!(A::TracedRArray{T,N}, x::TracedRNumber{T2}) where {T,N,T2}
bcast = broadcast_to_size(promote_to(TracedRNumber{T}, x), size(A))
bcast = TracedUtils.broadcast_to_size(TracedUtils.promote_to(TracedRNumber{T}, x), size(A))
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
bcast = TracedUtils.broadcast_to_size(TracedUtils.promote_to(TracedRNumber{T}, x), size(A))
bcast = TracedUtils.broadcast_to_size(
TracedUtils.promote_to(TracedRNumber{T}, x), size(A)
)

src/utils.jl Outdated
Comment on lines 264 to 266
mi = ccall(:jl_specializations_get_linfo, Ref{Core.MethodInstance},
(Any, Any, Any), match.method, match.spec_types, match.sparams)

Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
mi = ccall(:jl_specializations_get_linfo, Ref{Core.MethodInstance},
(Any, Any, Any), match.method, match.spec_types, match.sparams)
mi = ccall(
:jl_specializations_get_linfo,
Ref{Core.MethodInstance},
(Any, Any, Any),
match.method,
match.spec_types,
match.sparams,
)

src/utils.jl Outdated
src = copy(ci)
src.slotnames = Any[:call_with_reactant, REDUB_ARGUMENTS_NAME]

src.edges = Any[ccall(:jl_method_table_for, Any, (Any,), sig)::Core.MethodTable, sig]
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
src.edges = Any[ccall(:jl_method_table_for, Any, (Any,), sig)::Core.MethodTable, sig]
src.edges = Any[
ccall(:jl_method_table_for, Any, (Any,), sig)::Core.MethodTable, sig
]

src/utils.jl Outdated

expr_fn = Core.SSAValue(length(overdubbed_code))


Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change

src/utils.jl Outdated
Comment on lines 287 to 288

push!(overdubbed_code, :(2:$expr_lastindex))
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
push!(overdubbed_code, :(2:$expr_lastindex))
push!(overdubbed_code, :(2:($expr_lastindex)))

src/utils.jl Outdated
Comment on lines 306 to 309
push!(
overdubbed_code,
Core.ReturnNode(Core.SSAValue(length(overdubbed_code)))
)
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
push!(
overdubbed_code,
Core.ReturnNode(Core.SSAValue(length(overdubbed_code)))
)
push!(overdubbed_code, Core.ReturnNode(Core.SSAValue(length(overdubbed_code))))

src/utils.jl Outdated
Core.Compiler.ipo_dataflow_analysis!(interp, ir, caller)
end
end

Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change

src/utils.jl Outdated
end
end

Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change

src/utils.jl Outdated
body=MLIR.IR.Region(),
sym_visibility,
src = Core.Compiler.ir_to_codeinf!(opt)

Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change

src/utils.jl Outdated
n_actual_args = length(redub_arguments)

tys = []

Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change

src/utils.jl Outdated

iter_args = n_actual_args
if method.isva
iter_args = min(n_actual_args, n_method_args-1)
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
iter_args = min(n_actual_args, n_method_args-1)
iter_args = min(n_actual_args, n_method_args - 1)

src/utils.jl Outdated
# Opaque closures also require takign the function argument. We can work around the latter
# if the function is stateless. But regardless, to work around this we sadly create/compile the opaque closure
oc = if false && Base.issingletontype(args[1])
res = Core._call_in_world_total(world, make_oc, octup, rt, src, ocnargs, ocva, args[1].instance)::Core.OpaqueClosure
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
res = Core._call_in_world_total(world, make_oc, octup, rt, src, ocnargs, ocva, args[1].instance)::Core.OpaqueClosure
res = Core._call_in_world_total(
world, make_oc, octup, rt, src, ocnargs, ocva, args[1].instance
)::Core.OpaqueClosure

src/utils.jl Outdated
Comment on lines 504 to 514
push!(overdubbed_code,
Expr(:call,
make_oc,
octup,
rt,
src,
ocnargs,
ocva,
farg
)
)
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
push!(overdubbed_code,
Expr(:call,
make_oc,
octup,
rt,
src,
ocnargs,
ocva,
farg
)
)
push!(overdubbed_code, Expr(:call, make_oc, octup, rt, src, ocnargs, ocva, farg))

src/utils.jl Outdated
Comment on lines 519 to 526
push!(
overdubbed_code,
Expr(
:(call),
oc,
fn_args[2:end]...
),
)
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
push!(
overdubbed_code,
Expr(
:(call),
oc,
fn_args[2:end]...
),
)
push!(overdubbed_code, Expr(:(call), oc, fn_args[2:end]...))

src/utils.jl Outdated
Comment on lines 530 to 533
push!(
overdubbed_code,
Core.ReturnNode(Core.SSAValue(length(overdubbed_code)))
)
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
push!(
overdubbed_code,
Core.ReturnNode(Core.SSAValue(length(overdubbed_code)))
)
push!(overdubbed_code, Core.ReturnNode(Core.SSAValue(length(overdubbed_code))))

src/utils.jl Outdated
code_info.codelocs = overdubbed_codelocs
code_info.ssavaluetypes = length(overdubbed_code)
code_info.ssaflags = [0x00 for _ in 1:length(overdubbed_code)] # XXX we need to copy flags that are set for the original code

Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change

@wsmoses wsmoses merged commit 65e9976 into main Dec 14, 2024
22 of 46 checks passed
@wsmoses wsmoses deleted the interp2 branch December 14, 2024 20:05
jumerckx added a commit to jumerckx/Reactant.jl that referenced this pull request Dec 16, 2024
commit 65e9976
Author: William Moses <[email protected]>
Date:   Sat Dec 14 14:05:03 2024 -0600

    Interp2 (EnzymeAD#365)

    * WIP: kernels

    * more files

    * fix

    * wip

    * wqtmp

    * wip

    * inc

    * continuing

    * wip

    * more work

    * inf rec

    * fix

    * overload working

    * continuing

    * continuing

    * push

    * fix `call_with_reactant_generator` for Julia 1.11 (EnzymeAD#359)

    * conversion

    * continuing

    * Cleanup

    * Apply suggestions from code review

    Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

    * Delete test/cuda.jl

    * fixup

    * Apply suggestions from code review

    Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

    * fix apply

    * indep of change

    * minor fix in name

    * Update utils.jl

    * Interp take 2

    * continuing adentures

    * delcode

    * fix

    * tmp

    * make

    * fix

    * cleanup

    * continuing

    * more working

    * further simplify

    * fx

    * more improvements

    * minus show

    * less prints

    * even fewer

    * confusion

    * tmp

    * force clean

    * force oc

    * clean

    * Rewrite

    * fixup

    * fix

    * fix

    * fix

    * fixup

    * fix

    * wip

    * safe prints

    * fix

    * fix

    * stackoverflow

    * cleanup

    * dyindex

    * rt

    * continue

    * clean

    * fix

    * fix

    * fix

    * fix

    * fixup

    * fix

    * fix

    * capture oc

    * compile perf

    * v1.11 fix

    * other way 'round

    * formatting

    ---------

    Co-authored-by: William Moses <[email protected]>
    Co-authored-by: jumerckx <[email protected]>
    Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
    Co-authored-by: jumerckx <[email protected]>

commit 73899f5
Author: Avik Pal <[email protected]>
Date:   Sat Dec 14 14:58:47 2024 +0530

    fix: include files if they end with .jl (EnzymeAD#377)

commit 9f96c09
Author: Sergio Sánchez Ramírez <[email protected]>
Date:   Fri Dec 13 23:12:43 2024 +0100

    Run CI on aarch64 (EnzymeAD#350)

    * Run CI on aarch64

    * use julia pipeline for aarch64-linux

    * fix var

    * exclude aarch64-linux jobs from github ci

commit b56e661
Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Date:   Fri Dec 13 08:58:51 2024 +0530

    chore: format code (EnzymeAD#371)

    Co-authored-by: mofeing <[email protected]>

commit 311498b
Author: Anton Oresten <[email protected]>
Date:   Thu Dec 12 05:41:39 2024 +0100

    feat: define outer `repeat` method for `TracedRArray` (EnzymeAD#361)

    * Add repeat method

    * Add repeat tests

    * Update test/basic.jl

    * Update src/TracedRArray.jl

commit 8b90501
Author: Avik Pal <[email protected]>
Date:   Thu Dec 12 10:11:00 2024 +0530

    fix: ensure printing of wrapped ConcreteRArrays goes through our show (EnzymeAD#367)

    * fix: ensure printing of wrapped ConcreteRArrays goes through our show

    * fix: allow wrapped arrays in mapreduce

commit ea97be3
Author: Sergio Sánchez Ramírez <[email protected]>
Date:   Wed Dec 11 22:02:14 2024 +0100

    Ignore versioned manifests
jumerckx added a commit to jumerckx/Reactant.jl that referenced this pull request Dec 16, 2024
commit 65e9976
Author: William Moses <[email protected]>
Date:   Sat Dec 14 14:05:03 2024 -0600

    Interp2 (EnzymeAD#365)

    * WIP: kernels

    * more files

    * fix

    * wip

    * wqtmp

    * wip

    * inc

    * continuing

    * wip

    * more work

    * inf rec

    * fix

    * overload working

    * continuing

    * continuing

    * push

    * fix `call_with_reactant_generator` for Julia 1.11 (EnzymeAD#359)

    * conversion

    * continuing

    * Cleanup

    * Apply suggestions from code review

    Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

    * Delete test/cuda.jl

    * fixup

    * Apply suggestions from code review

    Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

    * fix apply

    * indep of change

    * minor fix in name

    * Update utils.jl

    * Interp take 2

    * continuing adentures

    * delcode

    * fix

    * tmp

    * make

    * fix

    * cleanup

    * continuing

    * more working

    * further simplify

    * fx

    * more improvements

    * minus show

    * less prints

    * even fewer

    * confusion

    * tmp

    * force clean

    * force oc

    * clean

    * Rewrite

    * fixup

    * fix

    * fix

    * fix

    * fixup

    * fix

    * wip

    * safe prints

    * fix

    * fix

    * stackoverflow

    * cleanup

    * dyindex

    * rt

    * continue

    * clean

    * fix

    * fix

    * fix

    * fix

    * fixup

    * fix

    * fix

    * capture oc

    * compile perf

    * v1.11 fix

    * other way 'round

    * formatting

    ---------

    Co-authored-by: William Moses <[email protected]>
    Co-authored-by: jumerckx <[email protected]>
    Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
    Co-authored-by: jumerckx <[email protected]>

commit 73899f5
Author: Avik Pal <[email protected]>
Date:   Sat Dec 14 14:58:47 2024 +0530

    fix: include files if they end with .jl (EnzymeAD#377)

commit 9f96c09
Author: Sergio Sánchez Ramírez <[email protected]>
Date:   Fri Dec 13 23:12:43 2024 +0100

    Run CI on aarch64 (EnzymeAD#350)

    * Run CI on aarch64

    * use julia pipeline for aarch64-linux

    * fix var

    * exclude aarch64-linux jobs from github ci

commit b56e661
Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Date:   Fri Dec 13 08:58:51 2024 +0530

    chore: format code (EnzymeAD#371)

    Co-authored-by: mofeing <[email protected]>

commit 311498b
Author: Anton Oresten <[email protected]>
Date:   Thu Dec 12 05:41:39 2024 +0100

    feat: define outer `repeat` method for `TracedRArray` (EnzymeAD#361)

    * Add repeat method

    * Add repeat tests

    * Update test/basic.jl

    * Update src/TracedRArray.jl

commit 8b90501
Author: Avik Pal <[email protected]>
Date:   Thu Dec 12 10:11:00 2024 +0530

    fix: ensure printing of wrapped ConcreteRArrays goes through our show (EnzymeAD#367)

    * fix: ensure printing of wrapped ConcreteRArrays goes through our show

    * fix: allow wrapped arrays in mapreduce

commit ea97be3
Author: Sergio Sánchez Ramírez <[email protected]>
Date:   Wed Dec 11 22:02:14 2024 +0100

    Ignore versioned manifests
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.

2 participants