Skip to content

TracedToTypes fixes #1306

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 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions src/Tracing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,10 @@ Base.@nospecializeinfer function traced_type_inner(
}
end
error("Unsupported runtime $runtime")
elseif mode == TracedTrack || mode == NoStopTracedTrack || mode == TracedSetPath
elseif mode == TracedTrack ||
mode == NoStopTracedTrack ||
mode == TracedSetPath ||
mode == TracedToTypes
return T
else
throw("Abstract RArray cannot be made concrete in mode $mode")
Expand Down Expand Up @@ -444,7 +447,10 @@ Base.@nospecializeinfer function traced_type_inner(
}
end
error("Unsupported runtime $runtime")
elseif mode == TracedTrack || mode == NoStopTracedTrack || mode == TracedSetPath
elseif mode == TracedTrack ||
mode == NoStopTracedTrack ||
mode == TracedSetPath ||
mode == TracedToTypes
return T
else
throw("Abstract RNumber cannot be made concrete in mode $mode")
Expand Down Expand Up @@ -1279,7 +1285,14 @@ Base.@nospecializeinfer function make_tracer(
throw("Cannot trace existing trace type")
end
if mode == TracedToTypes
push!(path, MLIR.IR.type(prev.mlir_data))
# for TracedRArrays, we check for objectid equality because make_mlir_fn gets rid of duplicate TracedRArrays.
# i.e. (a, a) should hash differently than (a, b) when a and b are different TracedRArrays.
if haskey(seen, objectid(prev))
push!(path, seen[objectid(prev)])
else
push!(path, MLIR.IR.type(prev.mlir_data))
seen[objectid(prev)] = VisitedObject(length(seen) + 1)
end
return nothing
end
if mode == TracedTrack
Expand Down Expand Up @@ -1357,7 +1370,14 @@ Base.@nospecializeinfer function make_tracer(
throw("Cannot trace existing trace type")
end
if mode == TracedToTypes
push!(path, MLIR.IR.type(prev.mlir_data))
# for TracedRArrays, we check for objectid equality because make_mlir_fn gets rid of duplicate TracedRArrays.
# i.e. (a, a) should hash differently than (a, b) when a and b are different TracedRArrays.
if haskey(seen, objectid(prev))
push!(path, seen[objectid(prev)])
else
push!(path, MLIR.IR.type(prev.mlir_data))
seen[objectid(prev)] = VisitedObject(length(seen) + 1)
end
return nothing
end
if mode == TracedTrack
Expand Down
Loading