triton-lang / triton

Development repository for the Triton language and compiler
https://triton-lang.org/
MIT License
13.38k stars 1.64k forks source link

jit issue when INTERPRETER=1 #5056

Open amosyou opened 1 week ago

amosyou commented 1 week ago

Versions:

I have a kernel where in one particular line I define a tensor of -inf. This is all in the body of a function decorated with triton.jit, so it's not clear to me why this triton.jit issue is raised.

@triton.jit
def _kernel_fwd(...):
    ...
    m_i = tl.zeros([BLOCK_M], dtype=tl.float32) - float("inf")                                                                                                                                                 
    ...

Error trace

    m_i = tl.zeros([BLOCK_M], dtype=tl.float32) - float("inf")                                                                                                                                                 
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                     
  File "/opt/conda/envs/triton/lib/python3.11/site-packages/triton/runtime/jit.py", line 801, in __call__                                                                                                          
    raise RuntimeError("Cannot call @triton.jit'd outside of the scope of a kernel")                                                                                                                                
RuntimeError: Cannot call @triton.jit'd outside of the scope of a kernel      
peterbell10 commented 1 week ago

Please provide a minimal complete reproducer