You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enable LLVM AddressSanitizer for triton-shared (#294)
Implemented support for debugging Triton programs with sanitizers:
- New MLIR pass added to triton-shared-opt: --add-debug-info, appending
missing #di attributes for useful error logs
- New LLVM pass ran using opt: --sanitizer-attributes, appending missing
sanitizer attributes to functions in LLVM IR
- Adding -fsanitize flags during compilation + linking. Doing so
required changing llc and g++ to clang++
- Introducing environment variable SANITIZER_TYPE to enable the
sanitizers during JIT compilation
- 3 scripts to facilitate simple build, runtime setup, and running a
Triton program with sanitizers enabled (see usage)
Usage for anyone who wants to debug a Triton program they have written:
1. /triton_shared/scripts/build_triton_shared_for_sanitizers.sh: one
time build script. Sets up a virtual environment, installs a custom LLVM
with compiler-rt, openmp, clang, and mlir. Then builds triton_shared
using this custom LLVM
2. source /triton_shared/scripts/setup_runtime_for_sanitizers.sh: after
installation, prepare the runtime once to activate the virtual
environment and set environment variables. Should be called with source
when a new terminal is used
3. /triton_shared/scripts/run_triton.sh [asan|tsan] python
triton_program.py: executes the Triton program with ASan or TSan
enabled, with the required environment variables
---------
Co-authored-by: Tim Lu <t-timlu@microsoft.com>
0 commit comments