jiangqucheng / torch-mlir-hwacc

Torch-MLIR to HWACC
Other
0 stars 0 forks source link

Env Setup #5

Open jiangqucheng opened 9 months ago

jiangqucheng commented 9 months ago

Env Setup Instruction

Follow the Official Development Env Setup Instruction to build the standard dev env.

TODO: End Users should not build from scratch. But we still need to compile our customized pass, the one that lowers linalg.matmul to hwacc lib call.

Some points need to be aware of:

1. Code repo changed

Check out this repo instead of https://github.com/llvm/torch-mlir.

2. PyVenv instruction missing part

Another package is required for setting up python env. Add the following command at the end.

python -m pip install torch_mlir

_TODO: Maybe no need anymore, have no idea. I was facing this issue before. But, eventually, you need to compile your own torch_mlir package anyway. Probably suspend this step until you face problems when running Python code._

3. Build method selection

I use the following configuration:

4. Py Env Activate

The following is my approach. FIle active_torch-mlir_venv

#!/usr/bin/env bash
__TORCH_MLIR_PATH__=~/work/final_grad_prj/torch-mlir
source $__TORCH_MLIR_PATH__/mlir_venv/bin/activate
export PYTHONPATH=$__TORCH_MLIR_PATH__/build/python_packages/torch_mlir:$__TORCH_MLIR_PATH__/projects/pt1/examples:$__TORCH_MLIR_PATH__/build/tools/torch-mlir/python_packages/torch_mlir
export TORCH_MLIR_PREFIX=$__TORCH_MLIR_PATH__/build/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$__TORCH_MLIR_PATH__/build/lib
echo "Use 'deactivate' to exit this venv"