ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator
Find a file
Qingnan Duan 80b56feb41
Implement FlashAttention for CPU (#20805)
### Description
Implement [FlashAttention](https://arxiv.org/pdf/2205.14135) and
[FlashAttention-2](https://arxiv.org/pdf/2307.08691) for
MultiHeadAttention on CPU.


### Motivation and Context
Accelerate the execution of MultiHeadAttention.

Current performance: 10ms vs 16ms (com.microsoft.MultiHeadAttention) on
my Linux machine and 10ms vs 38ms (com.microsoft.MultiHeadAttention) on
my Windows machine. May need further optimizations.

---------

Co-authored-by: Tianlei Wu <tlwu@microsoft.com>
Co-authored-by: Qingnan Duan <qiduan@microsoft.com>
2024-07-11 14:19:59 -07:00
.config
.devcontainer
.gdn
.github Fix lint C++ actions (#21303) 2024-07-11 09:46:41 +08:00
.pipelines Fix onebranch exception in code signing (#21088) 2024-06-19 12:07:17 +08:00
.vscode
cgmanifests Update absl (#21300) 2024-07-10 11:14:15 -07:00
cmake Implement FlashAttention for CPU (#20805) 2024-07-11 14:19:59 -07:00
csharp Fix typos - 1st Wave (#21278) 2024-07-11 13:35:08 +08:00
dockerfiles Update Dockerfile.cuda (#21042) 2024-06-13 23:50:03 -07:00
docs [CPU] SparseAttention op (#21110) 2024-07-03 21:51:57 -07:00
include/onnxruntime/core Fix typos - 1st Wave (#21278) 2024-07-11 13:35:08 +08:00
java Remove warning suppression from Java Packaging pipeline. (#21010) 2024-06-24 16:46:21 -07:00
js Fix typos - 1st Wave (#21278) 2024-07-11 13:35:08 +08:00
objectivec
onnxruntime Implement FlashAttention for CPU (#20805) 2024-07-11 14:19:59 -07:00
orttraining Fix typos - 1st Wave (#21278) 2024-07-11 13:35:08 +08:00
rust
samples
tools Enable Android CI build stages to run in parallel. (#21314) 2024-07-11 10:09:09 -07:00
winml Remove core/common/gsl.h (#20894) 2024-07-08 18:09:39 -07:00
.clang-format
.clang-tidy
.dockerignore
.gitattributes
.gitignore
.gitmodules [js/web] optimize module export and deployment (#20165) 2024-05-20 09:51:16 -07:00
.lintrunner.toml Make Flash Attention work on Windows (#21015) 2024-06-24 09:43:49 -07:00
build.bat
build.sh
build_arm64x.bat
CITATION.cff
CODEOWNERS
CONTRIBUTING.md
lgtm.yml
LICENSE
NuGet.config
ort.wprp Fully dynamic ETW controlled logging for ORT and QNN logs (#20537) 2024-06-06 21:11:14 -07:00
ORT_icon_for_light_bg.png
packages.config
pyproject.toml
README.md
requirements-dev.txt
requirements-doc.txt
requirements-lintrunner.txt
requirements-training.txt
requirements.txt Add compatibility for NumPy 2.0 (#21085) 2024-06-27 13:50:53 -07:00
SECURITY.md
setup.py onnxruntime shared lib inside python package (#21223) 2024-07-02 15:37:50 -07:00
ThirdPartyNotices.txt
VERSION_NUMBER

ONNX Runtime is a cross-platform inference and training machine-learning accelerator.

ONNX Runtime inference can enable faster customer experiences and lower costs, supporting models from deep learning frameworks such as PyTorch and TensorFlow/Keras as well as classical machine learning libraries such as scikit-learn, LightGBM, XGBoost, etc. ONNX Runtime is compatible with different hardware, drivers, and operating systems, and provides optimal performance by leveraging hardware accelerators where applicable alongside graph optimizations and transforms. Learn more →

ONNX Runtime training can accelerate the model training time on multi-node NVIDIA GPUs for transformer models with a one-line addition for existing PyTorch training scripts. Learn more →

Get Started & Resources

Builtin Pipeline Status

System Inference Training
Windows Build Status
Build Status
Build Status
Linux Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Mac Build Status
Android Build Status
iOS Build Status
Web Build Status
Other Build Status

Third-party Pipeline Status

System Inference Training
Linux Build Status

Data/Telemetry

Windows distributions of this project may collect usage data and send it to Microsoft to help improve our products and services. See the privacy statement for more details.

Contributions and Feedback

We welcome contributions! Please see the contribution guidelines.

For feature requests or bug reports, please file a GitHub Issue.

For general discussion or questions, please use GitHub Discussions.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

License

This project is licensed under the MIT License.