Migrate PTO 0.57 tile kernels into SuperNPUBench - #22
Conversation
Import nine source-backed PTO-Kernel cases across memory, elementwise, GEMM, and attention. Keep their active data paths tile-only, isolate the imported support surface, and publish complete generated source pages. Constraint: Migrated kernels must remain within the LinxISA PTO 0.57 allowlist and the one-level website profile. Rejected: Import scalar fallback implementations | they would weaken the benchmark's tile-only programming contract. Confidence: high Scope-risk: moderate Directive: Update migration.json provenance and support-header digests whenever imported code changes. Tested: 9 Linx LLVM builds and disassemblies; 9 host smoke runs; nonzero add/TMATMUL_ACC oracle; 62 manifest dry-runs; strict MkDocs build; golden-manual and link verification. Not-tested: Direct bare-ELF QEMU execution because no qemu-linx runner is installed in this checkout.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4be0d7fb5e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const int32_t a = static_cast<int32_t>(lhs.words[a_idx]); | ||
| const int32_t b = static_cast<int32_t>(rhs.words[b_idx]); | ||
| acc += static_cast<int64_t>(a) * static_cast<int64_t>(b); |
There was a problem hiding this comment.
Honor floating-point dtypes in host GEMM
When PTO_HOST_SIM is enabled for the FP32 migrated GEMMs (pto_gemm_basic, pto_gemm_demo, and pto_gemm_performance), TLOAD stores raw IEEE float bits in RawTile, but this host TMATMUL path casts those words to int32_t and multiplies the bit patterns. A simple all-ones FP32 GEMM therefore produces zero/nonsense instead of the expected sum, so the advertised host smoke/oracle cannot validate these kernels unless the operands are decoded by dtype and the result is re-quantized for floating-point tiles.
Useful? React with 👍 / 👎.
| static_assert(SizeCode >= 5u && SizeCode <= 8u, | ||
| "PTO Linx canonical v0.57: size_code must be in [5,8]"); | ||
| #if defined(PTO_HOST_SIM) | ||
| (void)Layout; |
There was a problem hiding this comment.
Respect tile load layout in the host simulator
When PTO_HOST_SIM loads RHS tiles for the migrated GEMM/attention kernels, those tensors are declared ColMajor, but the host path discards Layout and then reads every tile as rows with contiguous columns. Any non-uniform column-major RHS is loaded with the wrong elements, so integer host-simulation oracles can pass only degenerate inputs; the host load path needs to apply the layout/stride mapping instead of ignoring it.
Useful? React with 👍 / 👎.
Summary
LinxISA/PTO-Kernelat pinned revision0eb72cb20b0de99326d984a9a27ddb815e6e4c24Migrated cases
pto_tload_storepto_addpto_gemm,pto_gemm_basic,pto_gemm_demo,pto_gemm_performance,pto_mamulb,pto_tmatmul_accpto_flash_attentionVerification
BSTART.T*blocks, includingBSTART.TMATMUL.ACCTMATMUL_ACChost oracleKnown gap
Direct bare-ELF QEMU execution was not run because this checkout has system-emulator binaries but no
qemu-linxrunner expected by the benchmark Makefile.