|
| 1 | +## What is Antares: |
| 2 | + |
| 3 | +**Antares** (https://github.com/microsoft/antares) is an engine to auto generate optimized kernels for [Multi Backends](backends). It is a framework not only for ***Software developers*** to get backend-related code, but also for ***Hardware developers*** to extend new backends/hareware quickly and easily. Antares frontend is based on [Antares IR](AntaresIR.md) that follows "One Language Syntax for All Platforms". |
| 4 | + |
| 5 | +### How to Install: |
| 6 | + |
| 7 | +```sh |
| 8 | +python3 -m pip install --upgrade antares |
| 9 | +``` |
| 10 | + |
| 11 | +### Quick Test: |
| 12 | + |
| 13 | +```sh |
| 14 | +BACKEND=c-scpu antares |
| 15 | + |
| 16 | +# List Supported Backends |
| 17 | +antares backends |
| 18 | + |
| 19 | +# Help Information: |
| 20 | +antares help |
| 21 | +``` |
| 22 | + |
| 23 | +### Usage Examples (antares save/eval/compile): |
| 24 | + |
| 25 | +```sh |
| 26 | +# Quickly generate a multi-threaded CPU code: |
| 27 | +BACKEND=c-mcpu antares |
| 28 | + |
| 29 | +# Search an efficient multi-threaded CPU code and save best code to specified location: |
| 30 | +STEP=100 BACKEND=c-mcpu antares save ./kernel_example.cpp |
| 31 | + |
| 32 | +# Reproduce kernel evaluation based on an early saved source code: |
| 33 | +BACKEND=c-mcpu antares eval ./kernel_example.cpp |
| 34 | + |
| 35 | +# Freeze kernels and compiled into edge-side binaries: |
| 36 | +BACKEND=c-mcpu antares compile ./kernel_example.cpp ./output-dest/ |
| 37 | +# Build solution in destination directory: |
| 38 | +cd ./output-dest && make |
| 39 | +``` |
| 40 | + |
| 41 | +### Advanced Examples: |
| 42 | +```sh |
| 43 | +# Quickly generate a CUDA code with correctness checking: |
| 44 | +CHECK=1 BACKEND=c-cuda antares |
| 45 | + |
| 46 | +# Search an efficient multi-threaded CPU code showing progress bar only: |
| 47 | +PROGRESS=1 STEP=100 BACKEND=c-mcpu antares save ./kernel_example.cpp |
| 48 | + |
| 49 | +# Quickly generate a SHADER code for Windows 10/11's DirectX12: |
| 50 | +BACKEND=c-hlsl_win64 antares |
| 51 | + |
| 52 | +# Quickly generate an ROCm code for AMDGPU (requires ROCm SDK >= 4.2): |
| 53 | +BACKEND=c-rocm antares |
| 54 | + |
| 55 | +# Quickly generate a CUDA code for computing MatMul (512,512)x(512,512) based on [Antares IR](AntaresIR.md) for NVIDIA GPU (requires NVIDIA CUDA SDK >= 10.0): |
| 56 | +BACKEND=c-cuda COMPUTE_V1='- S = 512; einstein_v2(input_dict={"input0": {"dtype": "float32", "shape": [S, S]}, "input1": {"dtype": "float32", "shape": [S, S]}}, exprss="output0[N, M] +=! input0[N, K] * input1[K, M]")' antares |
| 57 | + |
| 58 | +# Search an efficient CUDA code for MatMul, using 2000 steps for trial: |
| 59 | +BACKEND=c-cuda STEP=2000 COMPUTE_V1='- S = 512; einstein_v2(input_dict={"input0": {"dtype": "float32", "shape": [S, S]}, "input1": {"dtype": "float32", "shape": [S, S]}}, exprss="output0[N, M] +=! input0[N, K] * input1[K, M]")' antares |
| 60 | + |
| 61 | +# Cleanup history caches: |
| 62 | +antares clean |
| 63 | + |
| 64 | +``` |
| 65 | + |
| 66 | +## Contributing |
| 67 | + |
| 68 | +This project welcomes contributions and suggestions. Most contributions require you to agree to a |
| 69 | +Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us |
| 70 | +the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com. |
| 71 | + |
| 72 | +When you submit a pull request, a CLA bot will automatically determine whether you need to provide |
| 73 | +a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions |
| 74 | +provided by the bot. You will only need to do this once across all repos using our CLA. |
| 75 | + |
| 76 | +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). |
| 77 | +For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or |
| 78 | +contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. |
| 79 | + |
| 80 | +## Trademarks |
| 81 | + |
| 82 | +This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft |
| 83 | +trademarks or logos is subject to and must follow |
| 84 | +[Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). |
| 85 | +Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. |
| 86 | +Any use of third-party trademarks or logos are subject to those third-party's policies. |
| 87 | + |
0 commit comments