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.3-cp312-cp312-manylinux2014_x86_64.whl (8.6 MB view details)

Uploaded CPython 3.12

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

Uploaded CPython 3.12

pypto-0.1.3-cp311-cp311-manylinux2014_x86_64.whl (8.6 MB view details)

Uploaded CPython 3.11

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

Uploaded CPython 3.11

pypto-0.1.3-cp310-cp310-manylinux2014_x86_64.whl (8.6 MB view details)

Uploaded CPython 3.10

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

Uploaded CPython 3.10

pypto-0.1.3-cp39-cp39-manylinux2014_x86_64.whl (8.6 MB view details)

Uploaded CPython 3.9

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

Uploaded CPython 3.9

File details

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

File metadata

File hashes

Hashes for pypto-0.1.3-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 59b5c52fad210adb1b6fc04cd18f9bf2c72cca3e811b3c2956b498777fb3849d
MD5 ecfac49b0628f9b11a0e03d8a0e39a24
BLAKE2b-256 fd2aee388cd2bb83e2bafb4c7568d46eddc9425ccb04513a455f27dd633dfb50

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pypto-0.1.3-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ece0573b5ca560749396b4858e7d5bf43b0a391638bd52f6b7805a1e58bd4bcf
MD5 6194502a6020ba114c951c939c86c67a
BLAKE2b-256 928ad941b324b00d44992ec18573e3767d6a3554082af6fdfd46f49c82352927

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pypto-0.1.3-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 393d88a7a8b69d31e217b81f28efcf8d4e20749f42580a47db2d73311841b043
MD5 b47eb1820302f17c13b4011bb97cd3a1
BLAKE2b-256 2bbeef7c634fba028bdefec1970924a242455c66ba2dd8680cd45c996aacc960

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pypto-0.1.3-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 360e5fb82bef6a673c1c1f17dab4e38a918baa0eacf152f4f1b68b4bbf44a2c3
MD5 d2d13038024852a92e40e0044acc2a39
BLAKE2b-256 8776c1bfeefb206ad2a4662468aa41d7c5ea04e9aa40fa96037a5fd8526ba431

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pypto-0.1.3-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1e3407e041c0c5f2a41caa9f5acb3d3a6935974cb6b68ee50cb173fa849dc9af
MD5 92e3138be2086f3610e516d269c2cb79
BLAKE2b-256 033022ce39fd8a8514c1064d6ab595c7c6ac70d40927e9d29cc6d8bd1b9702ba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pypto-0.1.3-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5ad7a9cc4f4ff1103ed88df5a66439734773ee7e382daa68c51eb6f9fa36b4af
MD5 e9b3e6067466dd1b661c1c771aac3db6
BLAKE2b-256 7c369a4f787de0a359d97851d1105d6d50b965d31520942bcdccebd42caa0c2a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pypto-0.1.3-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cfc5cd2fcefb786a738c677acd65fc5f945a1633905af7d06269f36584124670
MD5 29f4546106198da43a220aaa55513935
BLAKE2b-256 b4e42e9ca3ef695e0cb523d9e99ea43489fa20af066f69cac1cc504bd4ef5150

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pypto-0.1.3-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 48f85d23ba8fe57c41326785595bb3df2b14649e81e88b87c18eedd9ab94d8d8
MD5 28c4080229fe67330af0acb8dd258f1f
BLAKE2b-256 361bba401cfd3f5b2346d3f92b9c9de4b24163907637cfb92d78e7d1ed9b63f3

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