Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unittest: add MLA test cases where kv_len is evenly divided by page_size. #861

Merged
merged 2 commits into from
Feb 17, 2025

Conversation

foreverlms
Copy link
Contributor

@yzh119 PLZ take a look for this test. It will fail when kv_len is not multiple of page_size. I checked the kernel but had no clue. If I was not wrong, some bound check in mla kernel was wrong?

head_dim_ckv = 512
head_dim_kpe = 64
q_nope = torch.randn(
batch_size * qo_len, num_heads, head_dim_ckv, dtype=torch.half, device="cuda"
)
q_pe = torch.randn(
batch_size * qo_len, num_heads, head_dim_kpe, dtype=torch.half, device="cuda"
)
)
pages_num = math.ceil(kv_len // page_size)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pages_num = math.ceil(kv_len // page_size)
pages_num = math.ceil(kv_len / page_size)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After this fix, all unittests passed.

Copy link
Collaborator

@yzh119 yzh119 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution, the issues you mentioned could be fixed by fixing ceil_div in the unittests.

@yzh119 yzh119 changed the title Test of kv_len not evenly divided by page_size. unittest: add MLA test cases where kv_len is evenly divided by page_size. Feb 17, 2025
@yzh119 yzh119 merged commit 7cd000b into flashinfer-ai:main Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants