Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
makslevental committed Jul 18, 2023
1 parent 6d9143e commit d291460
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ jobs:
-f https://github.com/makslevental/mlir-wheels/releases/expanded_assets/latest \
-f https://llvm.github.io/torch-mlir/package-index/
if [ ${{ matrix.os }} == 'windows-2022' ]; then
# configure-mlir-utils.exe -y torch_mlir
# configure-mlir-python-utils.exe -y torch_mlir
pushd /tmp && python -m mlir_utils._configuration -y torch_mlir && popd
else
configure-mlir-utils -y torch_mlir
configure-mlir-python-utils -y torch_mlir
fi
- name: Test
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# mlir-utils
# mlir-python-utils

The missing pieces (as far as boilerplate reduction goes) of the upstream MLIR python bindings.

Expand All @@ -8,15 +8,16 @@ The missing pieces (as far as boilerplate reduction goes) of the upstream MLIR p

```shell
$ pip install .[mlir] -f https://github.com/makslevental/mlir-wheels/releases/expanded_assets/latest
$ configure-mlir-utils mlir
$ configure-mlir-python-utils mlir
```

or for maximum convenience

```shell
$ pip install mlir-python-utils[mlir] \
-f https://github.com/makslevental/mlir-wheels/releases/expanded_assets/latest
-f https://github.com/makslevental/mlir-wheels/releases/expanded_assets/latest
$ configure-mlir-utils mlir
-f https://github.com/makslevental/mlir-python-utils/releases/expanded_assets/latest
$ configure-mlir-python-utils mlir
```

### Details
Expand All @@ -25,9 +26,9 @@ This package is meant to work in concert with the upstream bindings.
Practically speaking that means you need to have *some* package installed that includes mlir python bindings.
In addition, you have to do one of two things to **configure this package** (after installing it):

1. `$ configure-mlir-utils -y <MLIR_PYTHON_PACKAGE_PREFIX>`, where `MLIR_PYTHON_PACKAGE_PREFIX` is (as it says) the
1. `$ configure-mlir-python-utils -y <MLIR_PYTHON_PACKAGE_PREFIX>`, where `MLIR_PYTHON_PACKAGE_PREFIX` is (as it says) the
package prefix for your chosen upstream bindings. So for example, for `torch-mlir`, you would
execute `configure-mlir-utils torch_mlir`, since `torch-mlir`'s bindings are the root of the `torch-mlir` python
execute `configure-mlir-python-utils torch_mlir`, since `torch-mlir`'s bindings are the root of the `torch-mlir` python
package. **When in doubt about this prefix**, it is everything up until `ir` (e.g., as
in `from torch_mlir import ir`).
2. `$ export MLIR_PYTHON_PACKAGE_PREFIX=<MLIR_PYTHON_PACKAGE_PREFIX>`, i.e., you can set this string as an environment
Expand Down
8 changes: 4 additions & 4 deletions mlir_utils/_configuration/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,19 @@ def alias_upstream_bindings():
)
return True
elif not (
sys.argv[0].endswith("configure-mlir-utils")
sys.argv[0].endswith("configure-mlir-python-utils")
or ("-m" in sys.orig_argv and __package__ in sys.orig_argv)
):
raise Exception(
"mlir-utils not configured and MLIR_PYTHON_PACKAGE_PREFIX env variable not set"
"mlir-python-utils not configured and MLIR_PYTHON_PACKAGE_PREFIX env variable not set"
)
return False


def configure_host_bindings():
parser = argparse.ArgumentParser(
prog="configure-mlir-utils",
description="Configure mlir-utils",
prog="configure-mlir-python-utils",
description="Configure mlir-python-utils",
)
parser.add_argument("-y", "--yes", action="store_true", default=False)
parser.add_argument("mlir_python_package_prefix")
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ mlir-test = ["pytest", "mlir-python-bindings", "mlir-native-tools"]
mlir = ["mlir-python-bindings"]

[project.scripts]
configure-mlir-utils = "mlir_utils:_configuration.configuration.configure_host_bindings"
configure-mlir-python-utils = "mlir_utils:_configuration.configuration.configure_host_bindings"
generate-trampolines = "mlir_utils:_configuration.generate_trampolines.generate_trampolines"

[build-system]
Expand Down

0 comments on commit d291460

Please sign in to comment.