How can I write a pallas kernel with no pure out-arguments? #23272
-
Hi, Suppose I want to write a Pallas matmul kernel that does
This means that I leave I am able to get around this by creating a dummy "pure out argument" like this:
and then everything works totally fine. However, this seems like a very hacky workaround. What is the proper way to do this? Thanks so much! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
One possible solution is to initialize the output to C, and then do A @ B inside the kernel. It will look something like this:
|
Beta Was this translation helpful? Give feedback.
One possible solution is to initialize the output to C, and then do A @ B inside the kernel.
You can initialize the output using input/output aliasing, which allows us to reuse input buffers for outputs.
It will look something like this: