Skip to content

Run Laya encoder and decision layers on CUDA - #49

Draft
linear3735 wants to merge 26 commits into
ThinkFlowLab:mainfrom
linear3735:codex/laya-encoder
Draft

linear3735 wants to merge 26 commits into
ThinkFlowLab:mainfrom
linear3735:codex/laya-encoder

Conversation

@linear3735

@linear3735 linear3735 commented Sep 30, 2026 •

Copy link
Copy Markdown

Purpose

Run Laya's 28 encoder layers and two decision transformer layers from Rust. Validate the checkpoint and kernel bundle before loading, then leave hidden states on the GPU for the scorer.

Part of #14. Depends on #48 and the existing Hopper kernel build. Uses original RoPE and eager execution. Scorer, HTTP and CUDA Graph integration are separate steps.

Kept in draft until #48 merges. The diff against main currently includes its dependencies. Review this increment: 419 core/configuration lines for encoder execution.

Tests now live under the repository-root tests/ directory. Cargo target names and test coverage are unchanged.

Test Plan

cargo fmt --all --check
cargo clippy --workspace --locked --all-targets -- -D warnings
cargo test --workspace --locked
cargo build --workspace --release --locked

Compare with official Laya 0.3.20 on H800: 13 real request cases, including 16 distinct rows at 16×512. Check intermediate and final hidden states, reverse request order, and repeat each workspace without intermediate readbacks. Reproduction commands are in src/models/laya/README.md.

System1-Omni Version / Commit: ff4d8fa; incremental base 2f5ff4b. GPU run: 684470a. The later change adds pre-load rotary-size validation and device selection in the test; model execution and kernels are unchanged.

Test Result

fmt, strict Clippy, release build passed locally; 45 CPU tests passed and 8 checkpoint/GPU tests were skipped. The earlier GPU validation below is separate; encoder and CUDA source are unchanged by this test-directory update.

All 208 valid-token comparisons had zero measured error. Repeated runs produced identical output bytes. Candidate outputs were finite; empty-key padding was excluded from equality checks. These checks validate implementation parity.

Rust CI, Docs build and benchmark harness tests passed for this update.

Self-review

Before marking this PR ready for review or requesting maintainer review, complete
the self-review checklist.
Keep the PR in draft while this work is incomplete.
For agent assistance, use the optional precheck-pr skill.

  • I have reviewed the full diff and addressed the issues I found.
  • I have checked that the change follows the project's architecture and stays focused on the stated purpose.
  • I have run the checks appropriate to this change and reported commands, results, and anything I could not verify above.
  • I have checked that the PR description, documentation, and any accuracy or performance claims match the implementation and available evidence.

linear3735 and others added 12 commits September 28, 2026 15:45
The inventory mismatch reported only that the sets were unequal, so the
most likely failure -- pointing the engine at a checkpoint that is not the
frozen one -- said nothing about which tensor was wrong or in which
direction. Both sets were already in scope.

Report the expected-only names as "missing" and the checkpoint-only names
as "unexpected", sorted, so the message is deterministic. The neighbouring
errors already name their tensor (duplicate expected tensor, shape mismatch,
unsupported dtype); this was the one that did not.

Adds a CPU test over the synthetic safetensors fixture that asserts both
directions and the ordering.

fmt, clippy -D warnings, and the workspace tests pass; the checkpoint test
that exercises this path still passes against the frozen checkpoint.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant