2 # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
3 # See https://llvm.org/LICENSE.txt for license information.
4 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 # Updates the LinalgStructuredOps.yaml file based on the
7 # core_named_ops.py source of truth.
10 shopt -s inherit_errexit
12 mlir_source_dir
="@MLIR_SOURCE_DIR@"
13 python_exe
="@Python3_EXECUTABLE@"
14 mlir_binary_dir
="@MLIR_BINARY_DIR@"
15 python_package_dir
="$mlir_binary_dir/python_packages/mlir_core"
17 if ! [[ -d "$python_package_dir" ]]; then
18 echo "ERROR: Python bindings not found. Build with -DMLIR_ENABLE_BINDINGS_PYTHON=ON"
22 dest_file
="$mlir_source_dir/include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yaml"
23 echo "Updating ops in $dest_file"
25 export PYTHONPATH
="$python_package_dir"
27 echo "### AUTOGENERATED from core_named_ops.py" && \
28 echo "### To regenerate, run: bin/update_core_linalg_named_ops.sh" && \
29 "$python_exe" -m mlir.dialects.linalg.opdsl.dump_oplib .ops.core_named_ops \
31 echo "$OUTPUT" > "$dest_file"