You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "masahi (via GitHub)" <gi...@apache.org> on 2023/04/17 22:50:28 UTC

[GitHub] [tvm] masahi commented on a diff in pull request #14649: [Unity][BYOC] Fuse attention pattern with `strided_slice`

masahi commented on code in PR #14649:
URL: https://github.com/apache/tvm/pull/14649#discussion_r1169333092


##########
tests/python/relax/test_codegen_cutlass.py:
##########
@@ -676,10 +676,23 @@ def get_relax_stacked_attention_module(qkv, b, s, n, h, h_v, bias=None, qk_scale
             if bias is not None:
                 bias = R.arg("bias", R.Tensor(bias.shape, dtype))
             with R.dataflow() as frame:
-                qkv_tuple = R.split(qkv, [n * h, n * h * 2], axis=2)
-                q = R.reshape(qkv_tuple[0], [b, s, n, h])
-                k = R.reshape(qkv_tuple[1], [b, s, n, h])
-                v = R.reshape(qkv_tuple[2], [b, s, n, h_v])
+                if op == "split":
+                    qkv_tuple = R.split(qkv, [n * h, n * h * 2], axis=2)
+                    q = R.reshape(qkv_tuple[0], [b, s, n, h])
+                    k = R.reshape(qkv_tuple[1], [b, s, n, h])
+                    v = R.reshape(qkv_tuple[2], [b, s, n, h_v])
+                elif op == "strided_slice":
+                    qkv_tuple = R.split(qkv, [n * h, n * h * 2], axis=2)

Review Comment:
   `qkv_tuple` not used (I was confused)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org