Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
5bcf524
docs: add Pi0.5 native IO contract
LiangSu8899 Jul 9, 2026
a236bae
feat: add Pi0.5 prompt formatter
LiangSu8899 Jul 9, 2026
cc5db63
feat: add text embedding gather
LiangSu8899 Jul 9, 2026
35040f7
feat: add native text tokenizer hook
LiangSu8899 Jul 9, 2026
b21b504
feat: add Pi0.5 prompt embedding staging
LiangSu8899 Jul 9, 2026
cca4ef0
feat: wire Pi0.5 prompt staging runtime
LiangSu8899 Jul 9, 2026
c65a590
feat: support Pi0.5 prompt runtime overlay
LiangSu8899 Jul 9, 2026
436e6fe
feat: add device text embedding staging
LiangSu8899 Jul 9, 2026
d286fcc
feat: support Pi0.5 state prompt staging
LiangSu8899 Jul 9, 2026
76cc752
feat: add Pi0.5 native v2 runtime schema
LiangSu8899 Jul 9, 2026
058a83c
fix: tighten Pi0.5 image input contract
LiangSu8899 Jul 9, 2026
7fe0279
feat: expose Pi0.5 native v2 raw actions
LiangSu8899 Jul 9, 2026
5853428
feat: add Pi0.5 native open gate
LiangSu8899 Jul 9, 2026
6b712cb
feat: validate Pi0.5 native checkpoint metadata
LiangSu8899 Jul 9, 2026
4fa3b3a
feat: validate Pi0.5 native norm assets
LiangSu8899 Jul 9, 2026
d965a52
feat: tighten Pi0.5 native asset sanity checks
LiangSu8899 Jul 9, 2026
295c100
test: cover Pi0.5 native asset rejection
LiangSu8899 Jul 9, 2026
fd992d4
feat: validate Pi0.5 native core weights
LiangSu8899 Jul 9, 2026
319e7ef
feat: add native safetensors mmap loader
LiangSu8899 Jul 9, 2026
bd43c4f
fix: preallocate Pi0.5 hot staging
LiangSu8899 Jul 9, 2026
bd64507
feat: validate complete Pi0.5 weight inventory
LiangSu8899 Jul 9, 2026
7354d64
feat: add Pi0.5 native weight transforms
LiangSu8899 Jul 9, 2026
96e8e2d
feat: add Pi0.5 device weight store
LiangSu8899 Jul 9, 2026
bc3d565
feat: materialize Pi0.5 encoder weights
LiangSu8899 Jul 9, 2026
53de52c
feat: materialize Pi0.5 decoder weights
LiangSu8899 Jul 9, 2026
413f762
feat: materialize Pi0.5 vision weights
LiangSu8899 Jul 9, 2026
10bd2ba
feat: materialize Pi0.5 global weights
LiangSu8899 Jul 9, 2026
47a3eee
feat: support typed Pi0.5 device weights
LiangSu8899 Jul 9, 2026
be97bd2
feat: add Pi0.5 native weight quantization
LiangSu8899 Jul 9, 2026
93d3dab
feat: pack Pi0.5 low-precision weights
LiangSu8899 Jul 9, 2026
c4afdbb
feat: assemble complete Pi0.5 BF16 weights
LiangSu8899 Jul 9, 2026
e259a2e
feat: assemble Pi0.5 precision stores
LiangSu8899 Jul 9, 2026
fd18aae
feat: add Pi0.5 native kernel capture driver
LiangSu8899 Jul 9, 2026
dcf83f5
feat: add Pi0.5 native workspace
LiangSu8899 Jul 9, 2026
f9284bc
feat: initialize Pi0.5 native workspace
LiangSu8899 Jul 9, 2026
d71923d
feat: precompute Pi0.5 decoder styles
LiangSu8899 Jul 9, 2026
ed0d905
feat: own Pi0.5 RTX attention buffers
LiangSu8899 Jul 9, 2026
ad1c798
feat: add native Pi0.5 FA2 driver
LiangSu8899 Jul 9, 2026
7ae1fed
feat: expose Pi0.5 native forward primitives
LiangSu8899 Jul 9, 2026
6621107
feat: compose Pi0.5 native encoder QKV
LiangSu8899 Jul 9, 2026
ca60085
feat: compose Pi0.5 native encoder layer
LiangSu8899 Jul 9, 2026
4cdc69a
feat: compose Pi0.5 native encoder
LiangSu8899 Jul 9, 2026
8f4b4c2
feat: compose Pi0.5 native vision
LiangSu8899 Jul 9, 2026
85b76ad
feat: compose Pi0.5 native diffusion
LiangSu8899 Jul 9, 2026
6fbd85e
feat: capture Pi0.5 native full graph
LiangSu8899 Jul 9, 2026
a37307e
feat: open Pi0.5 native runtime
LiangSu8899 Jul 9, 2026
5e6b9cd
test: gate Pi0.5 native E2E
LiangSu8899 Jul 9, 2026
1d02f9c
test: close Pi0.5 native validation gates
LiangSu8899 Jul 10, 2026
e913a2d
fix: enforce Pi0.5 hot IO contracts
LiangSu8899 Jul 10, 2026
ac47577
test: pin model runtime identity rules
LiangSu8899 Jul 10, 2026
1079126
fix: align Pi0.5 action port payloads
LiangSu8899 Jul 10, 2026
43282a7
fix: align staged action payload contracts
LiangSu8899 Jul 10, 2026
38fd606
fix: align native v2 producer schemas
LiangSu8899 Jul 10, 2026
f97fd84
fix(pi05): preserve reference image normalization
LiangSu8899 Jul 11, 2026
c67aef5
fix(runtime): enforce staged verb declarations
LiangSu8899 Jul 11, 2026
b915efb
fix(runtime): remove host hot-path allocations
LiangSu8899 Jul 11, 2026
431c1da
fix(pi05): preserve legacy image format support
LiangSu8899 Jul 11, 2026
86a93b3
docs(pi05): clarify native runtime migration
LiangSu8899 Jul 11, 2026
89a955f
test(pi05): profile the complete hot service loop
LiangSu8899 Jul 11, 2026
924c7c6
fix(runtime): harden native producer contracts
LiangSu8899 Jul 11, 2026
62ee550
docs(runtime): define native producer review standards
LiangSu8899 Jul 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## Summary

<!-- Describe the behavior and ownership boundary changed by this PR. -->

## Design boundaries

<!-- State what remains model-, backend-, policy-, or mechanism-owned. -->

## Compatibility

<!-- Public API, payload, fingerprint, capsule, packaging, and migration impact. -->

## Validation

<!-- Use sanitized commands/results. Do not include private paths or environments. -->

- [ ] Focused tests cover success and rejection paths
- [ ] Affected CUDA-off/hardware configurations were checked or disclosed
- [ ] Numerical claims use a fixed, justified gate
- [ ] STAGED ports have real matching verbs
- [ ] Identity uses observed runtime facts and changes with contract changes
- [ ] Hot-path allocation/capture/rebind claims are measured at the right scope
- [ ] Documentation and migration notes are updated
- [ ] Diff contains no private paths, hosts, containers, credentials, or logs
- [ ] Shared kernel/CMake ownership and packaging were reviewed
39 changes: 29 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -767,8 +767,8 @@ if(ENABLE_NVFP4)
endif()

# ── Flash-Attention 2 vendored kernels (fp16 + bf16 fwd SM80) ──
# Built as an object library and linked into a SEPARATE pybind module
# flash_rt_fa2.so — same isolation pattern as flash_rt_fp4.so. The
# Built as an object library and linked into a Python-free raw library;
# flash_rt_fa2.so is a thin pybind adapter over that library. The
# main flash_rt_kernels.so stays small (~3.6 MB) and its rebuild no
# longer waits on FA2's heavy CUTLASS 3.x template codegen (~8 min).
#
Expand Down Expand Up @@ -831,9 +831,9 @@ if(ENABLE_FA2)
csrc/attention/fa2_causal_inst/flash_fwd_split_hdim256_bf16_sm80_causal.cu
)
endif()
if("bf16" IN_LIST FA2_DTYPES AND ("128" IN_LIST FA2_HDIMS OR "256" IN_LIST FA2_HDIMS))
list(APPEND FA2_SRCS csrc/attention/fa2_wrapper_causal.cu)
endif()
# Always emit the causal C entry. Builds without a causal hdim retain a
# stable raw-library symbol that fails clearly instead of an unresolved ABI.
list(APPEND FA2_SRCS csrc/attention/fa2_wrapper_causal.cu)

add_library(fa2_vendor_obj OBJECT ${FA2_SRCS})
set_target_properties(fa2_vendor_obj PROPERTIES
Expand Down Expand Up @@ -954,19 +954,38 @@ if(ENABLE_FA2)
math(EXPR _FA2_NKERN "${_FA2_NSRC} - 1")
message(STATUS "FA2 vendor instantiations: hdim={${_FA2_H}} x dtype={${_FA2_D}} x {split,no-split} = ${_FA2_NKERN} kernel .cu files")

# Keep the raw C entries in a Python-free library. The native C++ runtime
# links this target directly; the pybind module below is only an adapter.
add_library(flashrt_fa2_raw SHARED)
target_sources(flashrt_fa2_raw PRIVATE $<TARGET_OBJECTS:fa2_vendor_obj>)
target_link_libraries(flashrt_fa2_raw PRIVATE CUDA::cudart)
if(NOT MSVC)
target_link_options(flashrt_fa2_raw PRIVATE
"LINKER:--no-undefined" -static-libstdc++ -static-libgcc)
endif()
set_target_properties(flashrt_fa2_raw PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/flash_rt
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/flash_rt
BUILD_RPATH "$ORIGIN"
INSTALL_RPATH "$ORIGIN")

# Independent pybind module. Caller side:
# from flash_rt import flash_rt_fa2 as fa2
# fa2.fwd_fp16(...) / fa2.fwd_bf16(...)
pybind11_add_module(flash_rt_fa2 csrc/fa2_bindings.cpp)
set_target_properties(flash_rt_fa2 PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/flash_rt
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/flash_rt)
target_sources(flash_rt_fa2 PRIVATE $<TARGET_OBJECTS:fa2_vendor_obj>)
target_include_directories(flash_rt_fa2 PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/csrc
)
target_link_libraries(flash_rt_fa2 PRIVATE CUDA::cudart)
install(TARGETS flash_rt_fa2 DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/flash_rt)
target_link_libraries(flash_rt_fa2 PRIVATE flashrt_fa2_raw CUDA::cudart)
set_target_properties(flash_rt_fa2 PROPERTIES
BUILD_RPATH "$ORIGIN"
INSTALL_RPATH "$ORIGIN"
BUILD_WITH_INSTALL_RPATH ON)
install(TARGETS flash_rt_fa2 flashrt_fa2_raw
DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/flash_rt)
message(STATUS "FA2 pybind module: flash_rt_fa2 (separate .so)")
endif()

Expand Down Expand Up @@ -1440,8 +1459,8 @@ if(FLASHRT_ENABLE_MOTUS AND GPU_ARCH STREQUAL "120")
ENABLE_TINYFP8_KERNELS=1)
endif()

# (ENABLE_FA2 object-lib is linked into flash_rt_fa2.so only — see
# the dedicated pybind11_add_module(flash_rt_fa2 ...) above. The main
# (ENABLE_FA2 object-lib is linked into libflashrt_fa2_raw.so only; the
# dedicated pybind module and native C++ runtime both consume it. The main
# flash_rt_kernels.so deliberately does NOT pull FA2 in, so rebuilds
# of our hand-written kernels don't re-trigger the FA2 codegen tax.)

Expand Down
18 changes: 16 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@ Before opening a PR:
- New model integration: [`docs/adding_new_model.md`](docs/adding_new_model.md)
- Kernel catalog: [`docs/kernel_catalog.md`](docs/kernel_catalog.md)
- Calibration contract: [`docs/calibration.md`](docs/calibration.md)
- Native model producers:
[`docs/native_model_runtime_producer.md`](docs/native_model_runtime_producer.md)
- PR review standard: [`docs/pr_review_checklist.md`](docs/pr_review_checklist.md)
2. Build the extension modules locally.
3. Run the smallest test set that covers your change.
4. Include the exact GPU, CUDA, command lines, and latency/precision numbers
in the PR description when the change touches runtime behavior.
4. Include sanitized, reproducible build/test commands and the relevant public
hardware capability and latency/precision results when runtime behavior
changes. Never include private paths, host names, container names, tokens,
checkpoint locations, or internal dataset identifiers.

## Development Setup

Expand Down Expand Up @@ -224,6 +229,13 @@ reviewers hold every PR to:
[`docs/subgraph_stage_plans.md`](docs/subgraph_stage_plans.md). A structural
cut is a re-ordering, not an approximation — split-vs-full replay must stay
bit-exact (`cpp/tests/gate_pi05_model_runtime_export.py` is the gate).
- All three C construction paths mechanically reject a STAGED input without
`set_input` or a STAGED output without `get_output`. Do not bypass this with
a published declaration-only object.
- Derive hardware identity from the active runtime device. A requested build
target or configuration string is not proof of the executing architecture.
- Schema shared by multiple producers needs checked-in canonical records;
every producer compares independently against that golden face.

### Calibration And Precision

Expand Down Expand Up @@ -354,6 +366,8 @@ Before requesting review:
- Mention unsupported hardware or missing local fixtures explicitly.
- Avoid committing generated build outputs, local checkpoints, logs, or
`third_party/cutlass`.
- Search the diff for private absolute paths, user/host/container names,
credentials, internal URLs, and environment dumps before pushing.

## Reporting Hardware Results

Expand Down
Loading