microsoft / microsoft/MInference

[Question]: Potential chance for better attention kernel

Open
#140 1 comment 2 reactions 1 assignee View on GitHub

@iofu728 is already working on this.

Since Apr 28, 2025.

question
Dominant language
Python
Stars
1.2k
Forks
82
Avg merge
1d 18h
Merged PRs (30d)
1

Description

Describe the issue

Thank you again for your work.

https://github.com/microsoft/MInference/blob/99d18c9070756794c0d6f77f8d3b12232fb45675/minference/modules/minference_forward.py#L640

I think kernel for each head is executed sequentially:

  1. single-head is hard to activate all performance of GPU
  2. inter-head warps miss the overlap chance, which is important for GPU SIMT

Have you thought about improve the kernel to realize the parallelism of heads. I think that the head loop is ok if the context length is super long enough (maybe). However, the speedup is limited when sequence is not super long, like 60k, as the baseline flash attention compute head in parallel.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.