Build `MLIR.NVGPU` and play with toy - yiliu30/yiliu30 GitHub Wiki

  • Build MLIR.NVGPU
cmake -G Ninja ../llvm \
        -DLLVM_ENABLE_PROJECTS="mlir;clang;openmp" \
        -DLLVM_TARGETS_TO_BUILD="host;NVPTX" \
        -DLLVM_ENABLE_ASSERTIONS=ON \
        -DOPENMP_ENABLE_LIBOMPTARGET=OFF \
        -DCMAKE_BUILD_TYPE=RELEASE \
        -DMLIR_ENABLE_CUDA_RUNNER=ON \
        -DMLIR_ENABLE_BINDINGS_PYTHON=ON \
        -DPython3_EXECUTABLE=$(which python)
  • Add mlir into PYTHONPATH
export PYTHONPATH=path/to/build/tools/mlir/python_packages/mlir_core:$PYTHONPATH
  • set mlir_cuda_runtime as supported lib
SUPPORT_LIB=./build/lib/libmlir_cuda_runtime.so  python ./mlir/test/Examples/NVGPU/Ch4.py

Ref: