Skip to main content

A high-performance programming framework for tile-centric computing

Project description

PyPTO

🔥最新动态

  • 2025/12:PyPTO项目首次上线。

🚀概述

PyPTO(发音:pai p-t-o)是一款面向AI加速器的高性能编程框架,旨在简化复杂融合算子乃至整个模型网络的开发流程,同时保持高性能计算能力。该框架采用创新的PTO(Parallel Tensor/Tile Operation)编程范式,以基于Tile的编程模型为核心设计理念,通过多层次的中间表示(IR)系统,将用户通过API构建的AI模型应用从高层次的Tensor图逐步编译成硬件指令,最终生成可在目标平台上高效执行的可执行代码。

核心特性

  • 基于 Tile 的编程模型:所有计算都基于Tile(硬件感知的数据块)进行,充分利用硬件并行计算能力和内存层次结构
  • 多层级计算图转换:通过编译Pass将Tensor Graph转换为Tile Graph、Block Graph和Execution Graph,每一步包括一系列Pass优化流程
  • 自动化代码生成:编译结果通过CodeGen生成底层PTO虚拟指令代码,再通过编译器将虚拟指令代码编译成目标平台的可执行代码
  • MPMD 执行调度:可执行代码被加载到设备侧,通过MPMD(Multiple Program Multiple Data)的方式调度到设备上的处理器核
  • 完整的工具链支持:全流程的编译中间产物和运行时性能数据可通过IDE集成的工具链可视化识别性能瓶颈,开发者也可以通过工具链控制编译和调度行为
  • Python 友好 API:提供直观的Tensor级别抽象,贴近算法开发者的思维模式,支持动态Shape和符号化编程
  • 分层抽象设计:对不同开发者暴露不同抽象层次,算法开发者使用Tensor层次,性能专家使用Tile层次,系统开发者使用Block层次

目标用户

  • 算法开发者:主要使用Tensor层次编程,快速实现和验证算法,专注于算法逻辑
  • 性能优化专家:可使用Tile或Block层次,进行深度性能调优,以实现极致性能
  • 系统开发者:可在Tensor/Tile/Block和PTO虚拟指令集层次上进行三方框架对接或集成,以及工具链开发

⚡️最佳实践样例

PyPTO提供了丰富的示例代码,涵盖从基础操作到复杂模型实现的多个层级。一些最佳实践样例参考:

大模型实现样例

学习路径

examples目录下,我们规划了多个层级的样例:

  • beginner/:基础操作示例,帮助初学者快速上手PyPTO编程
  • intermediate/:中级示例,包括自定义操作、神经网络模块等
  • advanced/:高级示例,包括复杂模式和多函数组合

models/目录下,我们提供了部分大模型实现样例,供快速移植和部署

这些示例可以帮助开发者学习如何编写PyPTO算子,从简单的Tensor操作到复杂的模型网络实现。

⚡️快速入门

若您希望快速体验PyPTO的使用和开发过程,请访问如下文档获取简易教程。

  • 环境部署:介绍项目基础环境的搭建,包括软件包和第三方依赖的获取和安装。
  • 编译安装:环境部署后,介绍如何快速获取或编译PyPTO软件包并安装。
  • 样例运行:安装PyPTO软件包后,介绍如何快速实现样例运行。

📖文档资源

若您希望深入体验项目功能并修改源码,请访问如下文档获取详细教程。

  • 文档中心 :当前发布版本的详细文档,包括编程指南、API参考,贡献指南等
  • 示例代码:丰富的示例代码,从基础到高级应用

🔍目录结构

关键目录如下:

├── docs/                       # 文档资源
│   ├── api/                    # API参考文档
│   ├── contribute/             # 贡献指南文档
│   └── tutorials/              # PyPTO编程指南
│
├── examples/                   # 示例代码
│   ├── 01_beginner/            # 初级示例
│   ├── 02_intermediate/        # 中级示例
│   └── 03_advanced/            # 高级示例
│
├── models/                     # 模型实现示例
│
├── python/                     # Python源码
│   ├── pypto/                  # Python包源码根目录
│   ├── src/                    # pybind11源码根目录
│   └── tests/                  # Python测试用例源码(UTest, STest)
│
├── framework/                  # C++源码根目录
│   ├── include/                # C++对外头文件
│   ├── src/                    # C++源码
│   │   ├── codegen/            # 代码生成模块
│   │   ├── passes/             # 编译Pass模块
│   │   └── ...
│   └── tests/                  # C++测试用例源码
│
├── tools/                      # 工具脚本
│
├── cmake/                      # 构建所需的CMake公共配置及脚本
├── build_ci.py                 # CI执行构建、执行UTest、执行STest辅助脚本
├── CMakeLists.txt              # 顶层CMakeLists.txt,定义所有对外公开编译开关
├── pyproject.toml              # Python编译工具配置文件
├── LICENSE                     # 许可证文件
└── setup.py                    # Python编译工具脚本文件(setuptools)

📝相关信息

联系我们

  • 问题反馈:通过GitCode【Issues】提交问题
  • 功能建议:通过GitCode【讨论】参与交流
  • 技术支持:参考文档或提交Issue

注意:本文档会持续更新,请关注最新版本。

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

pypto-0.1.2-cp312-cp312-manylinux2014_x86_64.whl (8.5 MB view details)

Uploaded CPython 3.12

pypto-0.1.2-cp312-cp312-manylinux2014_aarch64.whl (8.3 MB view details)

Uploaded CPython 3.12

pypto-0.1.2-cp311-cp311-manylinux2014_x86_64.whl (8.5 MB view details)

Uploaded CPython 3.11

pypto-0.1.2-cp311-cp311-manylinux2014_aarch64.whl (8.3 MB view details)

Uploaded CPython 3.11

pypto-0.1.2-cp310-cp310-manylinux2014_x86_64.whl (8.5 MB view details)

Uploaded CPython 3.10

pypto-0.1.2-cp310-cp310-manylinux2014_aarch64.whl (8.3 MB view details)

Uploaded CPython 3.10

pypto-0.1.2-cp39-cp39-manylinux2014_x86_64.whl (8.5 MB view details)

Uploaded CPython 3.9

pypto-0.1.2-cp39-cp39-manylinux2014_aarch64.whl (8.3 MB view details)

Uploaded CPython 3.9

File details

Details for the file pypto-0.1.2-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pypto-0.1.2-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ba3abfebc93bf085244844bcf6f7b416f1b8680b80f59f30417b86ee0f1a42d9
MD5 4261c214887d14ad1e040cd47138418c
BLAKE2b-256 f00b4be5d8991e424a1416a37a81a7ff218f9264b279e76ff62d7f420a26abad

See more details on using hashes here.

File details

Details for the file pypto-0.1.2-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pypto-0.1.2-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d81a7f38a93fc8a741bc4da976b13054005b8008da94c446dcc1145dfd60bc53
MD5 3bfad70e5ea34278020af8f03b2177e4
BLAKE2b-256 500b2214dafd0ebc2a70af8802253987d51223bb8cc99d947c27957604f7ac6e

See more details on using hashes here.

File details

Details for the file pypto-0.1.2-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pypto-0.1.2-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 aa993d2ccef07e1f16ce04527cd9f5c8d54d4e7bcfd40eaf3f95a7c1eb487a6d
MD5 d60d434e502d2423bf6d15886eb96aff
BLAKE2b-256 98202e8dba0e3c4209149fa0878d8cc64f004ab59f1b129c719d5d9df04e7286

See more details on using hashes here.

File details

Details for the file pypto-0.1.2-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pypto-0.1.2-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5116beed142fbcc8a4342bed0ce538d6375a5edb8c400ecb9fb97e0a68c4f860
MD5 71af22c6cb98c56e7ba62a1427dc46ec
BLAKE2b-256 5ecfaf30df598869e6652297cffbef1d82c4ea7cbfd21e039652f8849a309952

See more details on using hashes here.

File details

Details for the file pypto-0.1.2-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pypto-0.1.2-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c5f480633f23d62140533c8d9868980d40315f689a96b22ca8a329dea2c3dddd
MD5 9290d4cafb1753d17f8bf6761ed5a133
BLAKE2b-256 afe08a914be32930cfafa4bb9d8512a5b998dfc183bdc5b1657dd62f1c9b372c

See more details on using hashes here.

File details

Details for the file pypto-0.1.2-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pypto-0.1.2-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 92056f12ac6fa24b73ca4d023354a2d0e60ab3180c5d5117ca4ce94eb7f0641d
MD5 8ffa5016b7fea3687df4a0fc7ff41f98
BLAKE2b-256 339b037c6208a415f19f89ca21ff1d637d3a8a1e042271e0cd2051381147b38e

See more details on using hashes here.

File details

Details for the file pypto-0.1.2-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pypto-0.1.2-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 edca4b3bc557f252732778f91d1fc00a3cdf7f243aeacb07b796706cf48702bf
MD5 f490d6650e2d97b5ea66e7eb0eb18fc1
BLAKE2b-256 86475cc058261dcb0ebb02748162a087b26b91d72cbb62b2bc583ae9efecdd62

See more details on using hashes here.

File details

Details for the file pypto-0.1.2-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pypto-0.1.2-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3ffc781468b8c9014e14fcf2f931373f2e26174d30cbc9d23f2415cc4c70f768
MD5 d62fd0121eca0dd7e52536ba969dfe1e
BLAKE2b-256 959225981384d9c6960d00faad1a83eeae3431f2a980887e12be13399721873d

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