Open void-main opened 1 year ago
I know this is really slow
How slow it is comparing to the original implementation?
I know this is really slow
How slow it is comparing to the original implementation?
Hi @Jokeren , I commented out this mask, and the performance boosts by approx. 30%+.
So seems this part of code is the bottleneck.
@void-main any new progress?
Hi community, I'm building a triton kernel which first loads some discontinuous indexes from one tensor, and loads actual data with these indexes from another tensor. I'm trying to implement PagedAttention with triton if it helps.
I'm loading K blocks from KV Cache tensor. But since the K blocks are divided into pages, I need to load offsets in KV cache page by page. I should also take the block offsets into consideration during computing the K indexes.
For example, assume the block table content be:
And the block size be 8, the expected offsets should be:
I need to update the index tensor page by page.
I tried
tl.view
, but the result seems to be wrong. And to update only part of the Index, all I could come up with is use a global memory tensor, andtl.store
withmask
to update only part of the index, andtl.load
immediately after all store.Here's my kernel code:
I know this is really slow, but how could I optimize this kernel?