feat(hyvla): Hy-Embodied-0.5-VLA Orin SM87 — INT8 W8A8 + fused kernels - #168
feat(hyvla): Hy-Embodied-0.5-VLA Orin SM87 — INT8 W8A8 + fused kernels#168DXICM wants to merge 5 commits into
Conversation
Hy-Embodied-0.5-VLA (HunYuan MoT dual-tower + flow matching) on Jetson
Thor SM110 with runtime dynamic per-tensor FP8, fused megakernels, and
optional NVFP4 FFN.
New kernels (csrc/kernels/, SM110-gated):
- hyvla_fused_thor: RoPE+QK-Norm+KV-write megakernel (also SM87-portable)
- hyvla_vit_fuse: ViT residual-add + LayerNorm (also SM87-portable)
- hyvla_quant_fp8_thor: single-CTA dynamic FP8 quantize (graph-safe)
- hyvla_ffn_fp8_thor: FFN gate/up+SiLU and down+residual fused GEMM
Architecture (per docs/adding_new_model.md):
- models/hyvla/pipeline_thor.py — Thor compute path
- frontends/torch/hyvla_thor.py — HyVLATorchFrontendThor
- frontends/torch/_hyvla_thor_spec.py — declarative weight spec
- _PIPELINE_MAP: ("hyvla","torch","thor") one-to-one
- load_model(config="hyvla") dispatches through the standard VLA path
Performance (real image, Thor SM110):
- E2E predict: 159.6 ms (vs reference eager ~930 ms, ~5.8x)
- Action cosine vs reference: 0.999706
Docs: docs/hyvla05_thor_sm110.md (English), docs/stable_api.md updated.
|
Thank you for following the Thor work with a separate HyVLA Orin implementation. Keeping the Orin frontend and pipeline as an additive layer over #167 is the right general dependency shape, and the Orin-only diff does not modify the Thor runtime implementation. Codex reviewed the current head against FlashRT's long-term maintenance standards. The following items should be addressed before merge. Required changes
Pre-merge checklist
Please refer to the repository's PR Review Checklist and Adding a New Model guides. This is a Codex-assisted maintainability review. The Orin separation is directionally good; the build isolation inherited from #167, hardware enforcement, precision contract, and missing reproducibility gates need to be completed before merge. |
Address review feedback: Build isolation: - New FLASHRT_ENABLE_HYVLA CMake option (OFF by default). Both arch blocks (SM110 full set, SM87 portable shared kernels) now require the option together with the matching GPU_ARCH; sources, compile definitions, and pybind symbols gate together. HyVLA OFF leaves the default SM87/SM110 build and symbol surface unchanged. FP4 routing correctness: - load_model(config="hyvla", use_fp4=True) previously dropped use_fp4 before constructing the frontend. A dedicated _hyvla_fp4 flag now carries the route and the hyvla kwarg branch passes use_fp4=True explicitly; the validated fp8 production tier selects use_fused=True and use_autotune when the frontend accepts them. Hardware fail-fast and safe loading: - HyVLATorchFrontendThor validates torch.cuda capability (11,0) before loading weights or allocating CUDA state; a documented FLASHRT_HYVLA_FORCE_ARCH env override skips the probe for development only. The check is inheritable by the Orin subclass. - Tokenizer loading no longer uses trust_remote_code — checkpoint- provided Python code is never executed during model loading. Public input contracts (deterministic under python -O): - predict_actions: missing-prompt assert replaced with RuntimeError; state wider than max_state_dim and wrong-element-count noise raise ValueError before any graph lookup or copy. - All five fused-kernel pybind APIs validate their launch contract (positive dims, hd==128, off+S<=S_tot, eps>0, kv_rep>=1, K%16 and N/Nout%32 alignment) and raise ValueError instead of launching invalid grids. Reproducible in-tree validation: - tests/test_hyvla_thor_dispatch.py — registration one-to-one gate - tests/test_hyvla_arch_gate.py — mocked-capability fail-fast tests - tests/test_hyvla_fp4_routing.py — proves use_fp4/use_fused reach the frontend (stubbed construction, mocked flash_rt_fp4) - tests/test_hyvla_kernel_contracts.py — negative-dimension contract tests for all five kernels - tests/test_hyvla_thor_graphsafe.py — graph==eager + replay stability gate with deterministic seed-0 inputs (checkpoint via env var) - docs/hyvla05_thor_sm110.md updated to reference only committed tests and document the build option.
Production validation on Orin SM87 found the routing tests failed with
kwargs={'num_views': 2}: load_model feature-detects accepted kwargs via
inspect.signature(pipe_cls), and the recording stub declared only
**kwargs, so use_fp4/use_fp8/use_fused were never forwarded. The real
routing path is unaffected (HyVLATorchFrontendThor declares all named
parameters).
- Stub now mirrors the real HyVLATorchFrontendThor constructor
signature exactly.
- Orin FP4 fallback test stubs HyVLATorchFrontendOrin as well so it
validates the warning and the dropped use_fp4 without touching a
checkpoint (skips only where the Orin frontend is not importable).
Jetson Orin SM87 port using INT8 W8A8 quantization with the shared
fused RoPE+QK-Norm+KV-write megakernel from the Thor path.
- frontends/torch/hyvla_orin.py — HyVLATorchFrontendOrin (subclasses
the Thor frontend, overrides quantization and GEMM dispatch)
- models/hyvla/pipeline_orin.py — Orin compute path (INT8 GEMM via
cutlass_sm80_int8_rowwise, BF16 fallback for unquantized ops)
- _PIPELINE_MAP: ("hyvla","torch","rtx_sm87") + _SM87_ALLOWED entry
- docs/hyvla05_orin_sm87.md (English), docs/stable_api.md updated
- tests/test_orin_hyvla05_dispatch.py — dispatch resolution smoke test
Performance (real image, Orin SM87): 277.5 ms E2E (~11.3x vs reference
eager). Action cosine vs reference: >= 0.999.
…ommitted gates Address the flashrt-project#168 maintainability review: - HyVLATorchFrontendOrin now enforces SM87 via the inherited _require_arch() gate (_REQUIRED_CAPABILITY=(8,7), documented FLASHRT_HYVLA_FORCE_ARCH dev override), failing before checkpoint loading and CUDA allocation on non-Orin devices. - Precision contract consistency: use_int8_vlm_ffn / use_int8_exp are the validated default tier (cosine >= 0.999, re-verified on production Orin at 0.999162); use_int8_vlm / use_int8_vit remain clearly labeled below-gate opt-ins, matching the doc. - Orin predict_actions inherits the full Thor input contract: stable RuntimeError for missing prompt, oversized-state rejection, noise element-count validation. - Commit the gates the doc references: fixed-noise BF16-vs-INT8 cosine gate + input boundaries (test_orin_hyvla05_e2e_check.py), graph-vs- eager / replay-stability / fused-vs-unfused (test_orin_hyvla05_graphsafe.py), hardware fail-fast + FP4 rejection (test_orin_hyvla05_arch_gate.py). - Doc build snippet now passes -DFLASHRT_ENABLE_HYVLA=ON; verification section points at the committed pytest gates. - Rebased onto the corrected flashrt-project#167 head so the SM87 shared kernels are gated behind FLASHRT_ENABLE_HYVLA; removed the EOF blank line in hyvla_orin.py.
|
Thanks for the review. The Orin delta has been corrected and rebased onto the fixed #167 head (1eea7f1); once #167 merges, this PR will be rebased onto 1. Stacking — done as above; the branch now carries #167's corrected commits plus one Orin fix commit. 2. SM87 shared kernels behind the HyVLA option — inherited from the corrected #167: 3. SM87 fail-fast — 4. Precision contract consistency — one authoritative contract now: 5. Committed tests — the gates the doc references are now versioned:
6. Inherited contracts and patch hygiene — the Orin Production Orin re-test of this branch is queued (pull + |
Summary
Adds Jetson Orin SM87 port of Hy-Embodied-0.5-VLA using INT8 W8A8 quantization. Depends on #167 (Thor port with shared kernels).
Orin-specific additions:
frontends/torch/hyvla_orin.py—HyVLATorchFrontendOrin(subclasses Thor frontend, overrides quantization and GEMM dispatch for SM87)models/hyvla/pipeline_orin.py— Orin compute path (INT8 GEMM viacutlass_sm80_int8_rowwise, BF16 fallback)_PIPELINE_MAP:("hyvla","torch","rtx_sm87")+_SM87_ALLOWEDentrytests/test_orin_hyvla05_dispatch.py— dispatch resolution smoke test (pure pytest, no GPU/checkpoint needed)Shared kernels reused from #167 (compiled for SM87 via
FLASHRT_HAVE_HYVLA_ORIN):hyvla_fused_thor.cu— fused RoPE+QK-Norm+KV-write megakernel (plain CUDA, no SM110-only instructions)hyvla_vit_fuse.cu— ViT residual-add + LayerNormPerformance (real image, Orin SM87):
Quantization approach: INT8 W8A8 with per-row dynamic scales. Orin SM87 has no native FP4/FP8 tensor cores, so INT8 integer GEMMs (hardware I2F dequant) are the optimal low-precision tier.
What is not changed
Test plan
python -m pytest tests/test_orin_hyvla05_dispatch.py -qcmake -B build -S . -DGPU_ARCH=87 && cmake --build build -j$(nproc) --target flash_rt_kernelspython -c "from flash_rt.hardware import resolve_pipeline_class; print(resolve_pipeline_class('hyvla','torch','rtx_sm87'))"