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
I am struggling to find a way to parameterize a Triton kernel with a constexpr callable function. For instance, I have a function f that loads two tensors, applies an element-wise binary operation, and stores the result. I have several predefined binary operations, and I’d like to avoid duplicating code for each operation. However, the following approach results in an InternalTorchDynamoError: NotImplementedError: TritonKernelVariable():
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
I am struggling to find a way to parameterize a Triton kernel with a constexpr callable function. For instance, I have a function f that loads two tensors, applies an element-wise binary operation, and stores the result. I have several predefined binary operations, and I’d like to avoid duplicating code for each operation. However, the following approach results in an InternalTorchDynamoError: NotImplementedError: TritonKernelVariable():
The error is understandable here, but I don’t see why a compose-on-the-fly approach doesn’t work as well:
In this approach, we define kernel code specifically for the given binary_op function, but it still results in an error:
(The amusing part is that it’s just a warning, and the code executes something, but the output tensor contains garbage values.)
Am I missing something, or is it currently impossible to metaprogram Triton kernels in order to eliminate repetitive code?
Beta Was this translation helpful? Give feedback.
All reactions