Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions auto_round_extension/ark/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
## What is AutoRound Kernel?
[TODO]

## Key Features
[TODO]

## Installation
### Recommended to Install via Script

```bash
curl -fsSL https://raw.githubusercontent.com/intel/auto-round/main/auto_round_extension/ark/install_kernel.py
python3 install_kernel.py
```

<details>
<summary>Other Installation Methods</summary>

### Install via pip
```bash
# install the latest auto-round-kernel version and this cmd will update your local pytorch version if needed
pip install auto-round-kernel
# or install together with your pytorch version, e.g., for torch 2.8.x
pip install torch~=2.8.0 auto-round-kernel
```
### Install via auto_round
```bash
pip install auto-round
auto-round-kernel-install
```

</details>

### Versioning Scheme
The version number of auto-round-kernel follows the format:
`{auto-round major version}.{auto-round minor version}.{oneAPI version}.{kernel version}`

**For example: v0.9.1.1**
- The first two digits (0.9) correspond to the major and minor version of the auto_round framework.
- The third digit (1) represents the major version of Intel oneAPI and PyTorch version: `1` indicate support for oneAPI 2025.1 and torch 2.8, `2` indicate support for oneAPI 2025.2 and torch 2.9.
- The final digit (1) is the patch version of auto-round-kernel, reflecting updates, bug fixes, or improvements to the kernel package itself.


60 changes: 60 additions & 0 deletions auto_round_extension/ark/install_kernel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Copyright (c) 2026 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import re
import subprocess
import sys


def get_torch_minor():
try:
import torch

m = re.match(r"^(\d+)\.(\d+)", torch.__version__)
return f"{m.group(1)}.{m.group(2)}" if m else None
except ImportError:
return None


def get_auto_round_minor():
try:
import auto_round

m = re.match(r"^(\d+)\.(\d+)", auto_round.__version__)
return f"{m.group(1)}.{m.group(2)}" if m else None
except ImportError:
return None


# Map torch minor version to kernel version
auto_round_minor = "0.9" if get_auto_round_minor() is None else get_auto_round_minor()
KERNEL_MAP = {
"2.8": f"auto-round-kernel~={auto_round_minor}.1.0",
"2.9": f"auto-round-kernel~={auto_round_minor}.2.0",
}


def main():
torch_minor = get_torch_minor()
if torch_minor and torch_minor in KERNEL_MAP:
pkg = KERNEL_MAP[torch_minor]
print(f"Detected torch {torch_minor}, installing {pkg} ...")
subprocess.check_call([sys.executable, "-m", "pip", "install", pkg, "--upgrade-strategy", "only-if-needed"])
else:
print("torch not found or no mapping for your version. Installing the latest auto-round-kernel ...")
subprocess.check_call([sys.executable, "-m", "pip", "install", "auto-round-kernel"])


if __name__ == "__main__":
main()
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ console_scripts =
auto_round_best = auto_round.__main__:run_best
auto-round-light = auto_round.__main__:run_light
auto_round_light = auto_round.__main__:run_light
auto-round-kernel-install = auto_round_extension.ark.install_kernel:main

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def fetch_requirements(path):
),
"install_requires": fetch_requirements("requirements.txt"),
# auto-round[cpu] is deprecated, will be removed from v1.0.0
"extras_require": {"cpu": fetch_requirements("requirements-cpu.txt"), "kernel": ["auto-round-kernel"]},
"extras_require": {"cpu": fetch_requirements("requirements-cpu.txt")},
}

###############################################################################
Expand Down
Loading