Skip to content

Commit

Permalink
Adjust to upcoming julia#54341 (#1511)
Browse files Browse the repository at this point in the history
Corresponding IRTools changes are in FluxML/IRTools.jl#125.
  • Loading branch information
Keno committed May 8, 2024
1 parent c0daccd commit 2beaa07
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/compiler/interface2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,13 @@ if VERSION >= v"1.10.0-DEV.873"

function _pullback_generator(world::UInt, source, self, ctx, f, args)
ret = _generate_pullback(ctx, world, f, args...)
ret isa Core.CodeInfo && return ret
if ret isa Core.CodeInfo
if isdefined(Base, :__has_internal_change) && Base.__has_internal_change(v"1.12-alpha", :codeinfonargs)
ret.nargs = 4
ret.isva = true
end
return ret
end

stub = Core.GeneratedFunctionStub(identity, Core.svec(:methodinstance, :ctx, :f, :args), Core.svec())
stub(world, source, ret)
Expand All @@ -85,7 +91,13 @@ end

function _callable_pullback_generator(world::UInt, source, self, Δ)
ret = _generate_callable_pullback(self, world, Δ)
ret isa Core.CodeInfo && return ret
if ret isa Core.CodeInfo
if isdefined(Base, :__has_internal_change) && Base.__has_internal_change(v"1.12-alpha", :codeinfonargs)
ret.nargs = 2
ret.isva = false
end
return ret
end

stub = Core.GeneratedFunctionStub(identity, Core.svec(:methodinstance, ), Core.svec())
stub(world, source, ret)
Expand Down
5 changes: 5 additions & 0 deletions src/lib/literal_getproperty.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ function _generate_literal_getproperty(ctx, world, x, ::Type{Val{f}}) where f
ci.edges = Core.MethodInstance[mi, mi_pb_getproperty, mi_getproperty, mi_rrule]
# XXX: on 1.10, we should also set metadata like min-world and max-world

if isdefined(Base, :__has_internal_change) && Base.__has_internal_change(v"1.12-alpha", :codeinfonargs)
ci.nargs = 5
ci.isva = false
end

return ci
else
# nothing to optimize here, need to recurse into `getproperty`
Expand Down

0 comments on commit 2beaa07

Please sign in to comment.