diff --git a/src/GPUCompiler.jl b/src/GPUCompiler.jl index ec33e9a7..72bf0855 100644 --- a/src/GPUCompiler.jl +++ b/src/GPUCompiler.jl @@ -3,7 +3,6 @@ module GPUCompiler using LLVM using LLVM.Interop -using Tracy using ExprTools: splitdef, combinedef @@ -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 @@ -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 diff --git a/test/aqua.jl b/test/aqua.jl index 08cd9b51..54c6510d 100644 --- a/test/aqua.jl +++ b/test/aqua.jl @@ -1,3 +1,4 @@ using Aqua -Aqua.test_all(GPUCompiler) +Aqua.test_all(GPUCompiler; + stale_deps=(ignore=[:Tracy],),)