Skip to content

Commit 029dcdf

Browse files
authored
Add preference to enable Tracy and disable by default (#745)
1 parent 531dccd commit 029dcdf

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

src/GPUCompiler.jl

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ module GPUCompiler
33
using LLVM
44
using LLVM.Interop
55

6-
using Tracy
76

87
using ExprTools: splitdef, combinedef
98

@@ -13,6 +12,26 @@ using Serialization
1312
using Scratch: @get_scratch!
1413
using Preferences
1514

15+
const ENABLE_TRACY = parse(Bool, @load_preference("tracy", "false"))
16+
17+
"""
18+
enable_tracy!(state::Bool=true)
19+
20+
Activate tracy in the current environment.
21+
You will need to restart your Julia environment for it to take effect.
22+
"""
23+
function enable_tracy!(state::Bool=true)
24+
@set_preferences!("tracy"=>string(state))
25+
end
26+
27+
if ENABLE_TRACY
28+
using Tracy
29+
else
30+
macro tracepoint(name, expr)
31+
return esc(expr)
32+
end
33+
end
34+
1635
const CC = Core.Compiler
1736
using Core: MethodInstance, CodeInstance, CodeInfo
1837

@@ -65,7 +84,9 @@ function __init__()
6584
mkpath(dir)
6685
global compile_cache = dir
6786

68-
Tracy.@register_tracepoints()
87+
@static if ENABLE_TRACY
88+
Tracy.@register_tracepoints()
89+
end
6990
register_deferred_codegen()
7091
end
7192

test/aqua.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
using Aqua
22

3-
Aqua.test_all(GPUCompiler)
3+
Aqua.test_all(GPUCompiler;
4+
stale_deps=(ignore=[:Tracy],),)

0 commit comments

Comments
 (0)