Skip to content

Commit

Permalink
compact
Browse files Browse the repository at this point in the history
  • Loading branch information
glou-nes committed Dec 12, 2024
1 parent 636efb5 commit 483a52c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ NNlib = "872c559c-99b0-510c-b3b7-b6c96a88d5cd"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
YaoBlocks = "418bc28f-b43b-5e0b-a6e7-61bbc1a2c1df"

[sources]
ReactantCore = {path = "lib/ReactantCore"}
[sources.ReactantCore]
path = "lib/ReactantCore"

[extensions]
ReactantAbstractFFTsExt = "AbstractFFTs"
Expand Down
5 changes: 4 additions & 1 deletion src/Reactant.jl
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ function set_default_backend(backend::String)
return set_default_backend(XLA.backends[backend])
end

include("precompile.jl")
@static if !haskey(ENV, "REACTANT_TEST_GROUP")
@info "enable precompilation" gethostname() Base.active_project()
include("precompile.jl")
end

end # module
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 483a52c

Please sign in to comment.