Skip to content

Comments

add make_tracer rule for Memory#2427

Open
mofeing wants to merge 4 commits intomainfrom
ss/make_tracer-memory
Open

add make_tracer rule for Memory#2427
mofeing wants to merge 4 commits intomainfrom
ss/make_tracer-memory

Conversation

@mofeing
Copy link
Collaborator

@mofeing mofeing commented Feb 12, 2026

fixes #2301

@wsmoses i have doubts about the behavior it should have on different modes:

  • on ArrayToConcrete, it maps to ConcreteRArray{T,1}.
  • on ConcreteToTraced and other modes, i think it should map to itself.

also, unless we return itself always, I think we need a traced_type_inner rule.

@wsmoses
Copy link
Member

wsmoses commented Feb 12, 2026

yeah we'll also need traced_type_inner, but the specific error from the issue was the missing make_tracer

@wsmoses
Copy link
Member

wsmoses commented Feb 12, 2026

concretetotraced we should do the same thing as array [aka if its a memory{T} we will recur on memory(make_tracer(T)), to handle things like memory{concreterarray} but leave alone memory{uint}

@mofeing mofeing force-pushed the ss/make_tracer-memory branch from 5df790f to b07d231 Compare February 13, 2026 18:20
]

if isdefined(Core, :Memory)
push!(testsuite, (Memory{UInt8}, Memory{UInt8}, Memory{TracedRNumber{UInt8}}))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@wsmoses in the other PR, I think you said that converting here to TracedRNumber needs to be discussed because it seems a too edgy case. If so, I agree, but right now it feels awkward that we treat Memory the same as Array except for this point.

return T isa Core.TypeVar ? UnionAll(traced_T, A´´) : A´´
else
if mode == ArrayToConcrete && T <: ReactantPrimitive
runtime isa Val{:PJRT} && return ConcretePJRTArray{T,1,_unwrap_val(ndevices)}
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
runtime isa Val{:PJRT} && return ConcretePJRTArray{T,1,_unwrap_val(ndevices)}
runtime isa Val{:PJRT} &&
return ConcretePJRTArray{T,1,_unwrap_val(ndevices)}


if isdefined(Core, :Memory)
push!(testsuite, (Memory{UInt8}, Memory{UInt8}, Memory{TracedRNumber{UInt8}}))
push!(testsuite, (Memory{ConcreteRArray{Float64,1}}, Memory{TracedRArray{Float64,1}}, Memory{TracedRArray{Float64,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!(testsuite, (Memory{ConcreteRArray{Float64,1}}, Memory{TracedRArray{Float64,1}}, Memory{TracedRArray{Float64,1}}))
push!(
testsuite,
(
Memory{ConcreteRArray{Float64,1}},
Memory{TracedRArray{Float64,1}},
Memory{TracedRArray{Float64,1}},
),
)

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.

Memory{T} causes TypeError in @compile / make_tracer_unknown

2 participants