Skip to content

Commit

Permalink
[FRONTEND] Adds useful assert messages for static_range (#4393)
Browse files Browse the repository at this point in the history
  • Loading branch information
zahimoud committed Jul 25, 2024
1 parent 7455b4a commit a51de76
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions python/triton/language/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2497,17 +2497,17 @@ def kernel(...):
"""

def __init__(self, arg1, arg2=None, step=None):
assert isinstance(arg1, constexpr)
assert isinstance(arg1, constexpr), f"{arg1} used as tl.static_range start value is not a constexpr"
if step is None:
self.step = constexpr(1)
else:
assert isinstance(step, constexpr)
assert isinstance(step, constexpr), f"{step} used as tl.static_range step value is not a constexpr"
self.step = step
if arg2 is None:
self.start = constexpr(0)
self.end = arg1
else:
assert isinstance(arg2, constexpr)
assert isinstance(arg2, constexpr), f"{arg2} used as tl.static_range end value is not a constexpr"
self.start = arg1
self.end = arg2

Expand Down

0 comments on commit a51de76

Please sign in to comment.