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
25 changes: 23 additions & 2 deletions src/GPUCompiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module GPUCompiler
using LLVM
using LLVM.Interop

using Tracy

using ExprTools: splitdef, combinedef

Expand All @@ -13,6 +12,26 @@ using Serialization
using Scratch: @get_scratch!
using Preferences

const ENABLE_TRACY = parse(Bool, @load_preference("tracy", "false"))

"""
enable_tracy!(state::Bool=true)

Activate tracy in the current environment.
You will need to restart your Julia environment for it to take effect.
"""
function enable_tracy!(state::Bool=true)
@set_preferences!("tracy"=>string(state))
end

if ENABLE_TRACY
using Tracy
else
macro tracepoint(name, expr)
return esc(expr)
end
end

const CC = Core.Compiler
using Core: MethodInstance, CodeInstance, CodeInfo

Expand Down Expand Up @@ -65,7 +84,9 @@ function __init__()
mkpath(dir)
global compile_cache = dir

Tracy.@register_tracepoints()
@static if ENABLE_TRACY
Tracy.@register_tracepoints()
end
register_deferred_codegen()
end

Expand Down
3 changes: 2 additions & 1 deletion test/aqua.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Aqua

Aqua.test_all(GPUCompiler)
Aqua.test_all(GPUCompiler;
stale_deps=(ignore=[:Tracy],),)
Loading