Skip to content

Commit

Permalink
Tiny change: Added/Improved error message in visit_For (#4171)
Browse files Browse the repository at this point in the history
While developing a kernel, I was given the error message
"AssertionError()" without much helpful context on how to proceed with
debugging. I could only solve it by understanding that part of the
triton source code and spending half a day.

That's why I'm (1) adding an error message to this part of the code, and
(2) making the error message above it clearer (like it is in
visit_While).

This should allow the end user to debug this error without the need to
dive into the triton source code.
  • Loading branch information
UmerHA authored Jun 20, 2024
1 parent f04df24 commit a5b3783
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/triton/compiler/code_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -969,8 +969,8 @@ def visit_For(self, node):
names = []
for name in self.local_defs:
if name in liveins:
assert _is_triton_tensor(self.local_defs[name]), f'{name} is not tensor'
assert _is_triton_tensor(liveins[name])
assert _is_triton_tensor(self.local_defs[name]), f'cannot reassign constxpr {name} in the loop'
assert _is_triton_tensor(liveins[name]), f'cannot reassign constxpr {name} in the loop'
assert self.local_defs[name].type == liveins[name].type, \
f'Loop-carried variable {name} has initial type {liveins[name].type} '\
f'but is re-assigned to {self.local_defs[name].type} in loop! '\
Expand Down

0 comments on commit a5b3783

Please sign in to comment.