From a5b3783491a42a61ed5b8cb32a1178eb08e7b085 Mon Sep 17 00:00:00 2001 From: UmerHA <40663591+UmerHA@users.noreply.github.com> Date: Thu, 20 Jun 2024 04:00:38 +0200 Subject: [PATCH] Tiny change: Added/Improved error message in visit_For (#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. --- python/triton/compiler/code_generator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/triton/compiler/code_generator.py b/python/triton/compiler/code_generator.py index 9e8c53919b..a1444f9324 100644 --- a/python/triton/compiler/code_generator.py +++ b/python/triton/compiler/code_generator.py @@ -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! '\