Repository navigation
Conversation
PTO-SPEC issue PTO-ISA/pto-spec#340 restores an independent lifetime decision for every B.IOT Local source. A source written with the `.reuse` suffix keeps its payload readable after the block; a source without it is the last architectural payload consumer for the participating PEs. The 32-bit encoding keeps every existing word: two-source `Func` 010/011/ 111 join the existing 100 to encode last/last, reuse/last, last/reuse and reuse/reuse, and one-source `Func=101` uses bit 26 (0=reuse, 1=last-use). `L` remains only the B.IOT stream terminator. - Add `Tile_TOS/UOS/MOS/NOS{1..16}_RU` register aliases and extend the tile source register classes so the `.reuse` spelling parses and prints. - Define the four two-source and two one-source B.IOT lifetime variants and select the concrete encoding from the source `.reuse` markers while the MC operand still carries the absolute vtag identity. - Mark each tile source's last use from block liveness before the operands are rewritten to relative offsets, so a value that is live out of its block, or read again later in the block, keeps `.reuse`. - Decode the reuse forms in the disassembler; the generated decoder only covers the non-lifetime variants, so the lifetime fallback has to build the MC operand list in the same order as the TableGen decoder. Verification: - `llvm-lit llvm/test/MC/LinxV5 llvm/test/CodeGen/LinxV5` - 41 failures at the base commit, 39 with this change; the difference is exactly the two B.IOT lifetime tests that this change repairs. The remaining failures are pre-existing SIMT/Block-C failures and tests that need an in-tree clang. - `llvm/test/MC/LinxV5/b.iot.s` and `llvm/test/CodeGen/LinxV5/reuse.ll` pass, and the new `b.iot-lifetime-decode.s` pins the decoded operand order for all six lifetime combinations. Refs: PTO-ISA/pto-spec#340 (cherry picked from commit 0358089)
203979f to
fa76e69
Compare
|
Independent exact-head re-review completed for |
Adds independent Local `B.IOT` and Shared `B.IOS` source lifetime markers for #340 and #347, reconciled with #373's independent PE execution. A first-finishing PE can no longer retire Shared data that another declared participant still needs; GMOV retires the selected source PE's Local generation. ## Contract and compatibility - Ordinary bare sources declare last-use; `.reuse` retains payload. The `L` bit remains the stream terminator. Existing binary words retain their old meaning; **reassembling legacy bare-source text changes behavior**. - Local retirement preserves descriptor, vtag, relative identity, and other PE banks. ExecutionMask carriers are excluded. `B.ASSEMBLE` continuation ParentRefs require reuse. - Shared occurrence records track the exact Core, invocation, origin, privilege, instruction site, selectors, generation, and participant mask. Retirement waits for all declared participants and outstanding occurrences; recovery invalidates only the affected PE's acknowledgement. Publication cannot overwrite a pinned generation. - GMOV captures immutable source-PE/index/generation selections, including repeated peers. Fault/retry and nonparticipant execution preserve payload. Zero-row cooperative TMATMUL acknowledges Shared completion without Local effects. - Amends ADR-BLOCK-0013 and ADR-BLOCK-0015 with the maintainer-approved participant-aware decision against baseline `f3fa24331df452248366550f71cd1be22e62aeb1`. Owning clauses include `PTO-ARCH-LOCAL-VTAG-LIFETIME-001`, `PTO-ARCH-SHARED-VTAG-LIFETIME-001`, and `PTO-B-SOURCE-LIFETIME-PE-COMPLETION-001`. The ASL owners, catalogs, decoder/AVS projections, bilingual instruction guides, strict layout census, and state inventories are reconciled together. Draft inventory: 105 Block forms and 572 encoded forms. Binary fingerprint: `905c5cae908ed320dd214dc700f08dcb8231dff52f5933a5b1346ac36b987455`. ## Validation Final head: `5b27cdab976fc648b899fecc8fd49a6dee76d4c5`; base: `f3fa24331df452248366550f71cd1be22e62aeb1`. - 29/29 focused ASL points passed on semantic commit `4b46edef2ccb490cbb0d8754deacc7713168d857`; subsequent commits change tooling, tests, and the census only. ASL and runner inputs are unchanged. - Red/green evidence covers premature Shared retirement, wrong-bank GMOV retirement, and zero-row TMATMUL acknowledgement. - Strict census mutation canaries reject wrong helper owners, added callers, and layout-bearing changes. - All 14 changed English/Chinese guide pairs have separate review and verification receipts. - `make pr-check`: 11/11 PASS, including the full Python suite. - `make repo-check`: 7/7 PASS, including 572-form binary closure. - Site typecheck and 14/14 unit tests PASS; English and Chinese production builds PASS with `NODE_OPTIONS=--max-old-space-size=16384` after the default heap ran out of memory. - `git diff --check` PASS. One independent reviewer approved this exact base/head/tree/diff with no findings; `scripts/prepare-pr --review` accepted the receipt. This receipt is local, unauthenticated review evidence, not GitHub approval. The suggested broad ASL matrix is not claimed as fully executed; the 29 focused points above are the executed subset. ## Downstream and release obligations Landing order remains PTO-SPEC → LLVM → ASL-MODEL → SuperScalarModel. Related implementation work: [LLVM #108](LinxISA/llvm-project#108) and [SuperScalarModel #846](LinxISA/SuperScalarModel#846). Downstream runtime and same-ELF independent-golden coverage remain development obligations. The nine added command forms are recorded as **missing/divergent** in historical executable-model comparison evidence; no execution or ABI acceptance is fabricated. Frozen 0.58.7 artifacts remain unchanged. Full exact-commit release validation is pending; this PR does not claim release readiness or close the full hosted ABI issue #150. --------- Co-authored-by: zhoubot <637081+zhoubot@users.noreply.github.com>
|
This PR is superseded by the implementation already present on The three changes are now in the target branch as:
The current branch also contains follow-up fixes for masked Tile/lifetime interaction ( Validation against the current target build (
Result: 9/9 PASS. No additional code from this historical PR should be merged; closing as superseded. |
Summary
Implements the compiler side of PTO-SPEC
B.IOTandB.IOSlast-use contracts(PTO-ISA/pto-spec#340) on the
linx_blockisa_llvm_muslrelease lineage (dev-llvm15_56).This supersedes #107, which targeted
dev-llvm15-v5-encoding. That branch is aWIP lineage that cannot compile the current SuperNPUBench corpus (it rejects the
BSTART.TLSU TLOADinline-asm operands used byLinxISA/Linx-TileOP-API), sothe change belongs here instead.
Every
B.IOTLocal source now carries an independent lifetime decision. A sourcewritten with the
.reusesuffix keeps its payload readable after the block; asource without it is the last architectural payload consumer for the
participating PEs. The encoding stays 32-bit and preserves every existing word.
Func(14:12)010last/last,011reuse/last,111last/reuse,100reuse/reuse (the previous encoding)Func=1010reuse (all pre-change words),1last-use; bits 31:27 stay zeroFunc=110L(19)Implementation
LinxV5RegisterInfo.td: newTile_{T,U,M,N}OS{1..16}_RUaliases (t#1.reuse, ...)and their entries in the tile source register classes so
.reuseparses and prints.LinxV5InstrInfo.td: four two-source and two one-source lifetime variants; thebare-source variants are the new defaults, matching "omission means last-use".
All existing
InstAliasforms are kept, including thetile_t1absolute spellings.LinxV5TRegToOffset.cpp:markTileLastUsesfreezes each tile source's last-usedecision from block liveness before operands are rewritten to relative offsets,
and rewrites retained sources to the
_RUalias. A source is last-use when thevalue is neither live out of its block nor read again later in that block.
LinxV5MCCodeEmitter.cpp/LinxV5TileOpExpand.*:normalizeBIOTLifetimeOpcodeselects the concrete encoding from the operand
.reusemarkers at emission time.LinxV5AsmParser.cpp: accepts the.reusetile-register suffix.LinxV5Disassembler.cpp: decodes the lifetime forms. The generated decoder onlycovers the non-lifetime variants, so the lifetime fallback rebuilds the operand
list in the same order and with the same operand decoders as the generated
decoder (
decodePEMode,decodeBIOTDstSizeCode,decodeUImmOperand<1>).Verification
Toolchain built exactly as
SuperNPUBench/README.mdprescribes:dev-llvm15_56plus
LinxISA/Linx-TileOP-API@linx, host-built clang-15 forlinx64v5-unknown-linux-musl.MC round trip (
llvm-mc -show-encoding+llvm-objdump -d), all six lifetimecombinations plus the pre-change words:
llvm/test/MC/LinxV5/b.iot.schecks both the encoding and the disassembly of allthose forms (plus the absolute
tile_*register spellings); both FileCheckprefixes pass.
End-to-end on the SuperScalarModel corpus: recompiled SuperNPUBench at revision
78ea4173(the revision pinned for the SSMrelease-ops-20260918-repackprebuiltELFs) with this toolchain.
kernel_matmul_matmul_reuseB_B1_M1024_N1024_K1024_tM128_tN128_tK128moves from
to
which is the point of the ISA change: without last-use markers the retained
payload window exhausts the 256 KiB Local pool.
Notes
-linxv5-reuse-markis not restored; marking is unconditional because themarker is required by the accepted encoding. With the hidden
-linxv5-enable-reg-to-offset=falseMCA mode the_RUrewrite does not run.SuperScalarModel Phase 2 timing model.
Corpus regeneration with this toolchain
Successive builds of the SuperNPUBench one-level corpus (revision
78ea4173,the input of the SSM
release-ops-20260918-repackprebuilt ELFs) with thistoolchain plus
LinxISA/Linx-TileOP-API @ 3be8652(the pin recorded in theSuperNPUBench
ops-20260918release notes) andlinx64v5-unknown-linux-musltarget:
The 14 repaired entries are the whole matmul family that used to abort with
Tile register is not enough for the simulator!; they now complete with sanecycle counts, e.g.
Remaining downstream gap
The 52 remaining FA failures are not caused by this change. The released
ops-20260918/ops-20260922FA binaries are model-compatible and pass on theunmodified SuperScalarModel, but they carry no last-use information, so the new
reuse/retain decode makes them exhaust the 256 KiB Local pool. Rebuilding FA with
this public branch tip changes the
BSTART.TEPLmacro shape (the tip emits anextra
BSTART.TEPL TROWEXPANDEXPDIFheader where the released compiler emits aBSTART.TEPL TMAXheader plus a 64-bitTROWEXPANDEXPDIFbody), which thecurrent timing model cannot bind sources to.
The released corpus was built from
llvm-project dev-llvm15_56 @ 1037cc1cd(recorded in the SuperNPUBench release notes and in the ELF
.comment). Thatcommit is no longer reachable in
LinxISA/llvm-project(the branch wasforce-pushed;
gh api .../commits/1037cc1cdreturns 422), so the exact FAcodegen cannot be reproduced from public sources. Restoring that revision (or
teaching the model the newer TEPL macro form) closes the FA gap; the B.IOT
markers themselves are already proven on the matmul family.
Shared B.IOS extension (PTO-SPEC llvm#347 / PR llvm#341)
Head:
1f113e161f48adc3507b53c4948feaaf048cbf66.Sxencodes bit 26 one (last-use); explicitSx.reuseencodes bit 26 zero (retained, every old binary word). Destination bit 26 one and bit 27 remain illegal.%S[Shared]: ordinary Shared inputs print.reuseconservatively, even when the whole INLINEASM operand is killed, because a placeholder may occur multiple times in one template.%Krequests one exact textual last-use occurrence and fails closed unless the operand is a killed pure input;%Rexplicitly retains a tied source. Generated pseudos still emit last-use automatically. Existing API wrappers have not been annotated with%K, so their Shared sources will remain retained until a call-site-safe API change; the regenerated corpus must be counted before performance claims.markTileLastUsesnow excludes INLINEASM regdef operands from kill mutation; assertions-on Clang previously crashed ontscatter_fp32_16x16, and the exact compile plus a minimal MIR regression now pass.%Krejection, and INLINEASM regdef. Clang integrated assembler passed;git diff --checkand changed-line clang-format passed. Broader LinxV5 suite before the final small crash fix: 150 PASS, 1 XFAIL, 31 pre-existing/tool-availability failures (not treated as a clean suite).e74884eusing assertions-on Clang at this exact head and the pinned Linx musl/libc++ sysroot: 614 unique ELF files (424 micro, 190 one-level), with all 5 micro and all 29 one-level build scripts attempted. Source-path list matches the prior 614 corpus exactly. Successful and failing family status is explicit in the report; not every source variant compiled successfully..reuseand zero last-use. This is correct fail-safe behavior for the unannotated public TileOp API inline-asm wrappers, but this corpus cannot measure Shared early-release benefit. Compiler-generated Shared pseudos and explicit%Kcan emit bit26=1, as the focused tests show. ELF list, SHA-256 manifest, per-family logs, and marker census:/Users/zhoubot/.codex/artifacts/bios-last-use-corpus-20260923/.