You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would it be feasible to add this functionality? I'm guessing it would be possible to check if both args are constexpr in the function's implementation.
This could be useful for performing more advanced reshaping operations in TorchInductor. We would like to convert 1D tensor shape into an ND one, which could be expressed with tl.minimum. However, calling tl.minimum seems to drop the constexpr property of its inputs. See pytorch/pytorch#125077 for some additional context.
As an alternative, there might be a way to support similar functionality in constexprs using python builtins, such as min(x,y) = x * (x <= y) + y * (y < x). But tl.minimum(x,y) would be more concise.
The text was updated successfully, but these errors were encountered:
blaine-rister
changed the title
Add tl.minimum and tl.maximum to constexpr?
Propagate constexpr through tl.minimum and tl.maximum?
May 2, 2024
I noticed that
tl.minimum
andtl.maximum
do not seem to propagate constexprs.https://github.com/openai/triton/blob/22af8d80458ee4e6269779dae0a3c34b755aade2/python/triton/language/core.py#L569
Would it be feasible to add this functionality? I'm guessing it would be possible to check if both args are constexpr in the function's implementation.
This could be useful for performing more advanced reshaping operations in TorchInductor. We would like to convert 1D tensor shape into an ND one, which could be expressed with
tl.minimum
. However, callingtl.minimum
seems to drop theconstexpr
property of its inputs. See pytorch/pytorch#125077 for some additional context.As an alternative, there might be a way to support similar functionality in constexprs using python builtins, such as
min(x,y) = x * (x <= y) + y * (y < x)
. Buttl.minimum(x,y)
would be more concise.The text was updated successfully, but these errors were encountered: