Skip to main content

Auto Round Kernel binary package

Project description

What is AutoRound Kernel?

AutoRound Kernel is a low-bit acceleration library for Intel platform.

The kernels are optimized for the following CPUs:

  • Intel Xeon Scalable processor (formerly Sapphire Rapids, and Emerald Rapids)
  • Intel Xeon 6 processors (formerly Sierra Forest and Granite Rapids)

The kernels are optimized for the following GPUs:

  • Intel Arc B-Series Graphics and Intel Arc Pro B-Series Graphics (formerly Battlemage)

Key Features

AutoRound Kernel provides weight-only linear computational capabilities for LLM inference. Specifically, the weight-only-quantization configs we support are given in the table below:

CPU

Weight dtype Compute dtype Scale dtype Algorithm[1]
INT8 INT8[2] / BF16 / FP32 BF16 / FP32 sym / asym
INT4 INT8 / BF16 / FP32 BF16 / FP32 sym / asym
INT3 INT8 / BF16 / FP32 BF16 / FP32 sym / asym
INT2 INT8 / BF16 / FP32 BF16 / FP32 sym / asym
INT5 INT8 / BF16 / FP32 BF16 / FP32 sym / asym
INT6 INT8 / BF16 / FP32 BF16 / FP32 sym / asym
INT7 INT8 / BF16 / FP32 BF16 / FP32 sym / asym
INT1 INT8 / BF16 / FP32 BF16 / FP32 sym / asym
FP8 (E4M3, E5M2) BF16 / FP32 FP32 / FP8 (E8M0) NA
FP4 (E2M1) BF16 / FP32 BF16 / FP32 NA

XPU

Weight dtype Compute dtype Scale dtype Algorithm
INT8 INT8 / FP16 FP16 sym
INT4 INT8 / FP16 FP16 sym
FP8 (E4M3, E5M2) FP16 FP16 / FP8 (E8M0) NA

[1]: Quantization algorithms for integer types: symmetric or asymmetric.
[2]: Includes dynamic activation quantization; results are dequantized to floating-point formats.

Installation

1. Install via pip

pip install auto-round-lib

2. Install from Source

pip install . --no-build-isolation
# or
python setup.py bdist_wheel;pip install dist/*

Validated Hardware Environment

CPU based on Intel 64 architecture or compatible processors:

  • Intel Xeon Scalable processor (Granite Rapids)

GPU built on Intel's Xe architecture:

  • Intel Arc B-Series Graphics (Battlemage)

Resources

QuantLinear API

ARK exposes a unified weight-only linear interface through QuantLinear, QuantLinearGPTQ, QuantLinearAWQ, and QuantLinearFP8. Please refer to the QLinear for more integration details.

The expected lifecycle is: create the module, load quantized tensors from the checkpoint, call post_init() once to repack weights into the ARK-friendly layout, and then call forward() during inference.

Minimal usage:

from auto_round_kernel.qlinear import QuantLinear

qlinear = QuantLinear(
    bits=4,
    group_size=128,
    sym=True,
    in_features=in_features,
    out_features=out_features,
    bias=bias is not None,
    weight_dtype=weight_dtype,
)
# Load qweight, qzeros, scales, and bias from checkpoint.
qlinear.post_init()

# Run inference
y = qlinear(x)

A Weight-Only Example

A runnable end-to-end example is available in test_weightonly.py. It demonstrates how to prepare quantized weights and scales, call repack_quantized_weight to build ARK-packed weights, verify correctness with unpack_weight, and run woqgemm on CPU and XPU.

Replace torch SDPA and run lm-eval

ARK also exposes an XPU SDPA kernel through ARK.sdpa(...). If you want to replace torch.nn.functional.scaled_dot_product_attention globally for evaluation without editing model code, use the helper launcher in tools/lm_eval_with_ark_sdpa.py.

Example:

cd /path/to/auto_round_extension/ark
PYTHONPATH=$PWD python tools/lm_eval_with_ark_sdpa.py \
  --model hf \
  --model_args pretrained=/path/to/model,trust_remote_code=True,dtype=bfloat16 \
  --tasks hellaswag,piqa,winogrande \
  --device xpu:0 \
  --batch_size 1

Notes:

  • The patch only routes calls to ARK on XPU when the inputs match ARK kernel constraints; otherwise it falls back to the original torch SDPA.
  • Supported Q/K/V dtypes are FP16 and BF16.
  • Supported head dimensions are 64, 96, 128, and 192.
  • dropout_p must be 0.0 for the ARK path.
  • Additive masks are supported when they can be normalized to [B, 1, Sq, Skv]; boolean masks fall back to torch.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

auto_round_lib-0.13.2.tar.gz (362.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

auto_round_lib-0.13.2-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (17.6 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

auto_round_lib-0.13.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (17.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

auto_round_lib-0.13.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (17.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

auto_round_lib-0.13.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (17.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

auto_round_lib-0.13.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (17.6 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

File details

Details for the file auto_round_lib-0.13.2.tar.gz.

File metadata

  • Download URL: auto_round_lib-0.13.2.tar.gz
  • Upload date:
  • Size: 362.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for auto_round_lib-0.13.2.tar.gz
Algorithm Hash digest
SHA256 0d16e0f78fd4b79d3eb538d99e24cbadca22bd6871a817c21a4c621b4c19adb3
MD5 0548699dcada8e2de90d3a06bc1b9325
BLAKE2b-256 2588ba48801b63be4e650be65269c601e40af4794f5a428287293ba9f5db8fad

See more details on using hashes here.

File details

Details for the file auto_round_lib-0.13.2-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for auto_round_lib-0.13.2-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 754c5fac57fbee4168131b99ff5c8431fb3f2af03ac771e57e911eb728775b72
MD5 900b120416c3fa13f2fcc7c955f44fc7
BLAKE2b-256 1aa76b7934c5035162b3c688e5e4309f2c1d254fb24d272adb2de578f41dc3fc

See more details on using hashes here.

File details

Details for the file auto_round_lib-0.13.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for auto_round_lib-0.13.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 09f0e29ce558487948fd3e55ff26a288b5b296f9d40a4716d1d36acf0770a8b1
MD5 b79e22c3476bcbe155903e29bd6097b9
BLAKE2b-256 cf0fc732930a472f89210a345abf6bef1c7cdc176bf8677e720204d748fa8bca

See more details on using hashes here.

File details

Details for the file auto_round_lib-0.13.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for auto_round_lib-0.13.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 dbe99acc4c3d8dfe5f93ceaf8208e4fe9216f86df7b6feeb0e5d474c1e3d9ac8
MD5 44d6f5e0b9e283f045017f1823baabb8
BLAKE2b-256 a68ad9f8be471e7f8a2300b54d7b6f1f4f808c4f653f8a1e96b95079a4cfbc29

See more details on using hashes here.

File details

Details for the file auto_round_lib-0.13.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for auto_round_lib-0.13.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 731b53381215368d1506c813d289d98ea705226ad5ed46e3a3d15bd08a4b3e09
MD5 07f9c9c3dcef17e0917294838fe6f385
BLAKE2b-256 5528202c97059810d929254c0f5bf8444c1b1e4fa97326b1face1c692a7145f8

See more details on using hashes here.

File details

Details for the file auto_round_lib-0.13.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for auto_round_lib-0.13.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 96adb51217b0cab2dc03852186b39091754bfc8dc90ac6a337f33e9cee449f4c
MD5 7ba0b1b6ab90c346379ac5b6b59ca0fe
BLAKE2b-256 43e4ac13320c6e161076fdfb78f13f8d6d0efebc0d8dd99953419dff995f2399

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page