Skip to content
Merged
Show file tree
Hide file tree
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
11 changes: 10 additions & 1 deletion ext/ReactantCUDAExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1489,7 +1489,16 @@ end
end
y = Reactant.ConcreteRArray([2.0]; client)
Reactant.Compiler.compile_mlir(square!, (y,); optimize=false)
finalize(y)

if y isa Reactant.ConcreteIFRTArray
Reactant.XLA.free_buffer(y.data.buffer)
y.data.buffer.buffer = C_NULL
else
for dat in y.data
Reactant.XLA.free_buffer(dat.buffer)
dat.buffer.buffer = C_NULL
end
end
end
end

Expand Down
20 changes: 18 additions & 2 deletions src/Precompile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,27 @@ if Reactant_jll.is_available()
@static if precompilation_supported()
x = ConcreteRNumber(2.0; client)
Reactant.compile(sin, (x,); client, optimize=:all)
finalize(x)
if x isa ConcreteIFRTNumber
XLA.free_buffer(x.data.buffer)
x.data.buffer.buffer = C_NULL
else
for dat in x.data
XLA.free_buffer(dat.buffer)
dat.buffer.buffer = C_NULL
end
end

y = ConcreteRArray([2.0]; client)
Reactant.compile(Base.sum, (y,); client, optimize=:all)
finalize(y)
if y isa ConcreteIFRTArray
XLA.free_buffer(y.data.buffer)
y.data.buffer.buffer = C_NULL
else
for dat in y.data
XLA.free_buffer(dat.buffer)
dat.buffer.buffer = C_NULL
end
end
end
end

Expand Down
Loading