Skip to content

Commit

Permalink
[Frontend] Add TRITON_DEV_MODE for easier debugging of frontend errors
Browse files Browse the repository at this point in the history
Currently triton filters out parts of the stack trace that come from
inside the compiler itself which is great for not confusing users.
However this adds the ability to disable it by setting
TRITON_DEV_MODE="1" in the environment.
  • Loading branch information
peterbell10 committed Sep 9, 2024
1 parent e192dba commit e717fb3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion python/triton/compiler/code_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,7 @@ def visit(self, node):
except Exception as e:
# Wrap the error in a CompilationError which contains the source
# of the @jit function.
raise CompilationError(self.jit_fn.src, self.cur_node, repr(e)) from None
raise CompilationError(self.jit_fn.src, self.cur_node, repr(e)) from e

# Reset the location to the last one before the visit
if last_loc:
Expand Down
3 changes: 3 additions & 0 deletions python/triton/compiler/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ def filter_traceback(e: BaseException):
These are uninteresting to the user -- "just show me *my* code!"
"""
if os.getenv("TRITON_DEV_MODE", "0") == "1":
return

if e.__cause__ is not None:
filter_traceback(e.__cause__)
if e.__context__ is not None:
Expand Down

0 comments on commit e717fb3

Please sign in to comment.