Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/misc fixes #25

Closed
wants to merge 171 commits into from
Closed

Feature/misc fixes #25

wants to merge 171 commits into from

Conversation

mgehre-amd
Copy link
Collaborator

Uses: Xilinx/llvm-project#35

To build:

python3.8 -m venv .venv
source .venv/bin/activate
pip install -U pip
pip install -r requirements.txt

cmake -GNinja -Bbuild \
  -DCMAKE_BUILD_TYPE=Release \
  -DPython3_FIND_VIRTUALENV=ONLY \
  -DLLVM_ENABLE_PROJECTS=mlir \
  -DLLVM_EXTERNAL_PROJECTS="torch-mlir;torch-mlir-dialects" \
  -DLLVM_EXTERNAL_TORCH_MLIR_SOURCE_DIR="$PWD" \
  -DLLVM_EXTERNAL_TORCH_MLIR_DIALECTS_SOURCE_DIR="$PWD"/externals/llvm-external-projects/torch-mlir-dialects \
  -DMLIR_ENABLE_BINDINGS_PYTHON=ON \
  -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
  -DLLVM_TARGETS_TO_BUILD=host  \
  -DCMAKE_C_COMPILER=clang-15 -DCMAKE_CXX_COMPILER=clang++-15 \
  -DLLVM_ENABLE_ASSERTIONS=ON \
  -DCMAKE_EXE_LINKER_FLAGS_INIT="-fuse-ld=lld" -DCMAKE_MODULE_LINKER_FLAGS_INIT="-fuse-ld=lld" -DCMAKE_SHARED_LINKER_FLAGS_INIT="-fuse-ld=lld" \
  externals/llvm-project/llvm

cmake --build build --target tools/torch-mlir/all

To run a script with this torch-mlir version:

export PYTHONPATH=$PWD/build/tools/torch-mlir/python_packages/torch_mlir
python some_model.py

Run a single test with tosa backend:

./tools/e2e_test.sh --filter Quantize -v -s -c tosa

Run all tests:

cmake --build build --target check-torch-mlir-all

echo ":::: Check that update_abstract_interp_lib.sh has been run"
./build_tools/update_abstract_interp_lib.sh

echo ":::: Check that update_torch_ods.sh has been run"
./build_tools/update_torch_ods.sh

echo ":::: Run Linalg e2e integration tests"
./tools/e2e_test.sh --config=linalg -v

echo ":::: Run MHLO e2e integration tests"
./tools/e2e_test.sh --config=mhlo -v

echo ":::: Run TOSA e2e integration tests"
./tools/e2e_test.sh --config=tosa -v

echo ":::: Run Lazy Tensor Core e2e integration tests"
./tools/e2e_test.sh --config=lazy_tensor_core -v

echo ":::: Run TorchDynamo e2e integration tests"
./tools/e2e_test.sh --config=torchdynamo -v

How to release a package:

How to install torch-mlir from a github release:

# This will also install an exact torch nightly version as required by torch-mlir
pip install <path-to-wheel.whl> -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html

Maximilian Bartel and others added 30 commits April 12, 2023 08:55
Lowering torch operations that allow different compatible data types
in its operands to tosa end up generating invalid tosa IR with mixed
data types. In tosa spec, certain operations (generally element-wise
operations) require all operands to have the same data type.

Add wrapper functions for those element-wise tosa ops to perform op
creation with type conversion if necessary.
mgehre-amd and others added 28 commits June 9, 2023 15:52
* Support for group convolutions in TOSA.

* TorchToTosa: Fix result type for Conv1D operations.
@mgehre-amd
Copy link
Collaborator Author

Has been integrated into #105

@mgehre-amd mgehre-amd closed this Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants