文件最后提交记录最后更新时间
merge br_schedule 12 天前
!2135 merge gpu into br_schedule [scheduler] fixed cpu and gpu compile pipeline Created-by: corleoneliu Commit-by: liuchao Merged-by: corleoneliu Description: <!-- Thanks for sending a pull request! Here are some tips for you: If this is your first time, please read our contributor guidelines: https://github.com/mindspore-ai/mindspore/blob/master/CONTRIBUTING.md --> **What type of PR is this?** > Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line: > /kind bug</br> > /kind task</br> > /kind feature</br> **What does this PR do / why do we need it**: fixed cpu and gpu compile pipeline and clean code **Which issue(s) this PR fixes**: <!-- *Automatically closes linked issue when PR is merged. Usage: Fixes #<issue number>, or Fixes (paste link of issue). --> Fixes [#417](https://gitcode.com/mindspore/akg/issues/417) **Special notes for your reviewers**: See merge request: mindspore/akg!21359 天前
fixed cpu and gpu compile pipeline 9 天前
merge br_schedule 12 天前
[AKG-Schedule] Delete vbrc when use is elementwise. 12 天前
merge br_schedule 12 天前
update ascendnpu-ir 5 个月前
merge br_schedule 12 天前
merge br_schedule 12 天前
clean code for build.sh 6 个月前
merge br_schedule 12 天前
refactor mlir driver and clean code 11 天前
README.md

akg-mlir

基于MLIR的自动算子生成器(Auto kernel generator(AKG) based on MLIR)

依赖组件

编译和安装

使用 build.sh 脚本构建

cd PATH_TO_AKG_MLIR_ROOT_PATH

print usage by -h (bash build.sh -h):
Usage:
bash build.sh [-e cpu|gpu|ascend|all] [-j[n]] [-t] [-b] [-u] [-s path] [-c] [-h]

Options:
    -b enable binds python (Default: disable)
    -c Clean built files, default: off
    -d Debug mode
    -e Hardware environment: cpu, gpu, ascend or all
    -h Print usage
    -j[n] Set the threads when building (Default: the number of cpu)
    -s Specifies the source path of third-party, default: none
    -t Enable unit test (Default: disable)
    -u Enable auto tune (Default: disable)

Options:
    -h Print usage
    -c Clean built files, default: off
    -d Enable debug mode, default: off
    -t Unit test: on or off, default: off
    -m Compile mode: akg-mlir-only or all, default: all
    -e Hardware environment: cpu, gpu, ascend or all
    -s Specifies the source path of third-party, default: none \n\tllvm-project
    -u Enable auto tune
    -j[n] Set the threads when building, Default: -j8

Command Example:
    # First time build, full compile
    bash build.sh -e ascend -j32 -s /path/to/llvm

构建llvm

# build llvm/mlir
cmake ../llvm \
    -G Ninja  \
    -DPython3_FIND_STRATEGY=LOCATION \
    -DLLVM_BUILD_EXAMPLES=ON \
    -DLLVM_ENABLE_PROJECTS="llvm;mlir;clang;openmp" \
    -DLLVM_ENABLE_RUNTIMES="compiler-rt" \
    -DLLVM_OPTIMIZED_TABLEGEN=ON \
    -DLLVM_ENABLE_OCAMLDOC=OFF \
    -DLLVM_ENABLE_BINDINGS=OFF \
    -DLLVM_INSTALL_UTILS=ON \
    -DCMAKE_BUILD_TYPE="Release" \
    -DLLVM_ENABLE_RTTI=ON \
    -DCMAKE_C_COMPILER=${C_COMPILER_PATH} \
    -DCMAKE_CXX_COMPILER=${CXX_COMPILER_PATH} \
    -DMLIR_ENABLE_BINDINGS_PYTHON=ON

export PATH_TO_BUILT_LLVM=${PWD}
cmake --build . --config Release -j32

说明:GPU后端需要 -DLLVM_TARGETS_TO_BUILD=NVPTX,SymEngine项目需要 -DLLVM_ENABLE_RTTI=ON

运行示例

cd compile/lib/test/
PATH_TO_BUILD/bin/akg-opt akg_loop_tiling.mlir -allow-unregistered-dialect -split-input-file -akg-affine-loop-tile="tile-size=2" | FileCheck akg_loop_tiling.mlir

代码格式化

git diff -U0 HEAD^ | ./third-party/llvm-project/clang/tools/clang-format/clang-format-diff.py -i -p1