grf53 commented on code in PR #18630:
URL: https://github.com/apache/tvm/pull/18630#discussion_r2661208456
##########
python/tvm/relax/frontend/nn/llm/kv_cache.py:
##########
@@ -860,10 +860,15 @@ def _var(dtype):
return T.alloc_buffer((1,), dtype, scope="local")
-def _causal_mask(causal, row, col, kv_len, qo_len):
+def _causal_mask(causal, row, col, kv_len, qo_len, sliding_window_size=-1):
+ lower_bound_condition = T.if_then_else(
+ sliding_window_size > 0,
+ col >= kv_len - qo_len + row - sliding_window_size,
Review Comment:
This makes a lot of sense, and decreases the errors quite a lot. So let me
happily apply this.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]