What Is PTOAS
Overview
ptoas is the main compilation entry point for PTO programs. It is responsible for checking whether the .pto text is valid input and ultimately generating callable output code.
From the user's perspective, ptoas is not primarily "a library function" but a combination of three types of capabilities:
- Command-line compilation tool
- Compilation support for
PTO ISA - Python binding and scripted construction entry point
What Is PTOAS
ptoas can be understood as a complete toolchain organized around PTO ISA. Its main responsibilities include:
- Parsing
.pto. - Verifying the structure, type, and target-related constraints of PTO ISA.
- Handling layout, address, and synchronization issues based on the options selected by the user.
- Outputting callable code for subsequent use.
It is located between the following layers:
- Upstream PTO program construction layer
- Downstream target-related code generation layer
It serves as the primary structured compilation entry point for PTO programs.
Inputs and Outputs Most Frequently Used by Users
Input
.pto: PTO text
Output
Depending on the usage, the common outputs of ptoas include:
- Intermediate representation for inspection or troubleshooting
- Final output code
Usage
The most direct usage is to feed .pto into ptoas to generate code output in a typical form:
ptoas input.pto -o output.cppCommon parameters include:
--pto-arch=a3|a5: specifies the target architecture.- Switch parameters related to target, layout, and synchronization
Frequently Asked Questions
What Is the Relationship Between ptoas and PTO ISA?
PTO ISAis the object model and ISA semantics.ptoasis the toolchain that runs around this object model.
Without PTO ISA, ptoas lacks a unified compilation object; without ptoas, PTO ISA remains only a static definition and cannot form a complete usage process.
What Can ptoas Do for Me?
In the common usage path, ptoas helps users complete the following:
- Input check
- Target-related constraint check
- Processing of layout, address, and synchronization issues according to options
- Output code generation
Minimal User Path
For new users, the minimal usage path is typically as follows:
- Prepare a
.ptofile or generate a.ptofile using Python. - Use
ptoasto complete parsing and validation. - Add target parameters and output parameters to generate a
.cppfile. - Check the generated result with
test/samplesor a validation script.
Design Goals
The design goal of PTOAS is to stably map the abstract semantics of PTO into a structured representation that is checkable, usable, and code-generatable.
The current toolchain focuses on the following objectives:
- Maintaining a stable PTO semantic boundary across different target paths, rather than exposing implementation details to the frontend.
- Treating tile, valid region, position, layout, and synchronization as first-class concepts.
- Serving both the Auto and Manual responsibility models.
- Establishing a stable bridge between PTO input and output code.
- Enabling the compiler to explicitly understand PTO objects, rather than relying on post-hoc semantic recovery.
Target Users
PTOAS is not intended for a single user group, but for multiple types of developers across the chain of writing, generating, verifying, and integrating PTO programs.
The primary users include:
- Kernel and operator developers: write or inspect PTO programs, and verify tile, synchronization, Pipe, and code generation behavior.
- Toolchain integrators: integrate
ptoasor the generation path into higher-level build and runtime systems.