microsoft / microsoft/onnxruntime
CUDA Cross-attention kernel
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 21.9k
- Forks
- 4.2k
- Avg merge
- 4d 8h
- Merged PRs (30d)
- 179
Description
Is your feature request related to a problem? Please describe.
I'm able to use the onnxruntime.transformers codebase to optimize Tranformer-based model using self-attention, however it's not possible to use the self-attention kernel for cross-attention.
System information
- ONNX Runtime version (you are using): 1.10.0
Describe the solution you'd like
I would like to know if the implementation of a CUDA kernel for cross-attention is something you've considered adding to ONNXRuntime - or simply a modification of the current self-attention kernel to take in one input for queries and one input for keys and values.
Describe alternatives you've considered
For generative models I think the self-attention kernel can be used after a first pass, as we can simply reuse past keys and values. However that is not the case more generally, when you only perform one inference on a given pair of input.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in the onnxruntime.transformers codebase by tracing the existing self-attention kernel and how it handles queries, keys, values, and cached state. Done would mean defining and validating a CUDA cross-attention path that supports separate query and key/value inputs for one-shot inference.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- machine-learning, performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100