Skip to content

Commit

Permalink
Client cannot handle FreeClient
Browse files Browse the repository at this point in the history
  • Loading branch information
glou-nes committed Dec 11, 2024
1 parent 636efb5 commit 565efd8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/XLA.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ mutable struct Client
function Client(client::Ptr{Cvoid})
@assert client != C_NULL
client = new(client)
finalizer(client) do client
@ccall MLIR.API.mlir_c.FreeClient(client.client::Ptr{Cvoid})::Cvoid
end
#TODO: Client are also constructed from MLIR.API.mlir_c.BufferToClient so the pointer cannot be free when Client is cleaned
#finalizer(client) do client
# @ccall MLIR.API.mlir_c.FreeClient(client.client::Ptr{Cvoid})::Cvoid
#end
return client
end
end
Expand Down
5 changes: 3 additions & 2 deletions src/precompile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ using PrecompileTools: @setup_workload, @compile_workload
@setup_workload begin
@compile_workload begin
Reactant.__init__()
interp = Reactant.ReactantInterpreter()
Base.code_ircode(sum, (Reactant.TracedRArray{Float64,2},); interp)
cpu = XLA.CPUClient()
x = Reactant.ConcreteRArray(randn(Float64, 2, 2); client=cpu)
@code_hlo optimize = false sum(x)
end
end

0 comments on commit 565efd8

Please sign in to comment.