Skip to content

Commit df38505

Browse files
authored
[ConSan] Use -Ofc mid for ConSan compilation (#9394)
I tested a variety of `ptxas` flags and found the following (using `01-attention-forward.py`) ``` compile (sec) execution (sec) -O0 19 81 -O1 49 22 -O3 52 21 -Ofc max 19 82 -Ofc mid 21 9 -Ofc min 21 9 -Ofc 0 19 21 ``` Shockingly, `-Ofc mid|min` yield best total compilation+execution times for consan.
1 parent 97c02ff commit df38505

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

third_party/nvidia/backend/compiler.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,10 @@ def make_cubin(self, src, metadata, opt, capability):
498498
# Accept more ptxas options if provided
499499
ptx_extra_options = opt.ptx_options.split(" ") if opt.ptx_options else []
500500

501+
# Use -Ofc mid to compile ConSan code, if nothing else is specified.
502+
if "consan" in knobs.compilation.instrumentation_mode:
503+
ptx_extra_options += ["-Ofc", "mid"]
504+
501505
# Add --regAllocOptLevel=2 to work around ptxas 13.x bug
502506
reg_alloc = ['--regAllocOptLevel=2']
503507

0 commit comments

Comments
 (0)