Metadata-Version: 2.2
Name: pto-kernels
Version: 0.1.4
Summary: PTO kernels
Author: HUAWEI Computing Systems Lab
Maintainer: Anastasios Zouzias, Gioele Gottardo, Aleksandros Sobczyk, Jiawei Zhuang
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Python: >=3.10
Requires-Dist: pybind11==3.0.1
Requires-Dist: numpy==1.26.4
Requires-Dist: scipy==1.13.1
Requires-Dist: decorator==5.1.1
Requires-Dist: psutil==6.1.0
Requires-Dist: PyYAML==6.0.2
Requires-Dist: attrs==24.2.0
Provides-Extra: torch
Requires-Dist: torch-npu==2.10.0; extra == "torch"
Description-Content-Type: text/markdown

# pto-kernels

A collection of high-performance custom kernels for **Ascend NPUs**, built on top of [pto-isa](https://github.com/PTO-ISA/pto-isa) — the Parallel Tile Operation virtual instruction set architecture designed by Ascend CANN.

PTO focuses on tile-level operations, enabling efficient, composable kernel development targeting Huawei's Ascend AI processors.

---

## Prerequisites

- A configured **torch-npu** environment
- Ascend toolkit installed at `/usr/local/Ascend/ascend-toolkit`

Run the one-time setup before building:

```bash
make setup_once
```

## Install repository using pip

The repository is "pip installable", i.e.,

```bash
export CMAKE_GENERATOR="Unix Makefiles" && pip install -v git+https://github.com/huawei-csl/pto-kernels.git
```
---

## Build

```bash
source /usr/local/Ascend/ascend-toolkit/set_env.sh
pip3 install -r requirements.txt
make wheel
```

This produces an installable Python wheel:

```
pto_kernels-X.Y.Z-*.whl
```

---

## Installation

```bash
pip install --force-reinstall pto_kernels-*.whl
```

---

## Testing

```bash
make test
```

---

## Repository Structure

```
pto-kernels/
├── csrc/                  # C++ kernel source files
├── python/pto_kernels/    # Python bindings and utilities
├── examples/jit_cpp/      # JIT compilation examples
├── tests/                 # Test suite
├── scripts/               # Helper scripts
├── doxygen/               # API documentation config
└── CMakeLists.txt         # CMake build configuration
```

---

## Contributing

Contributions are welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) before opening a pull request.

---

## License

BSD-3-Clause-Clear — see [LICENSE](LICENSE) for details.
