Skip to content

Commit a5b3783

Browse files
authored
Tiny change: Added/Improved error message in visit_For (intel#4171)
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.
1 parent f04df24 commit a5b3783

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

python/triton/compiler/code_generator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -969,8 +969,8 @@ def visit_For(self, node):
969969
names = []
970970
for name in self.local_defs:
971971
if name in liveins:
972-
assert _is_triton_tensor(self.local_defs[name]), f'{name} is not tensor'
973-
assert _is_triton_tensor(liveins[name])
972+
assert _is_triton_tensor(self.local_defs[name]), f'cannot reassign constxpr {name} in the loop'
973+
assert _is_triton_tensor(liveins[name]), f'cannot reassign constxpr {name} in the loop'
974974
assert self.local_defs[name].type == liveins[name].type, \
975975
f'Loop-carried variable {name} has initial type {liveins[name].type} '\
976976
f'but is re-assigned to {self.local_defs[name].type} in loop! '\

0 commit comments

Comments
 (0)