Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
192 commits
Select commit Hold shift + click to select a range
97cbb4b
feat: add vpto backend
Apr 12, 2026
cd451b4
clarify block query docs and trim conversion section
WenboCodes Apr 10, 2026
a34c04c
docs(isa): clarify get_buf/rls_buf usage and mode parameter
Apr 11, 2026
46f1a8a
fix: correct event ID explanation in comparison table
Apr 11, 2026
3df56a7
fix: clarify event ID management in comparison table
Apr 11, 2026
31540f2
fix: simplify event ID explanation and drain example
Apr 11, 2026
440925c
fix: correct set_flag/wait_flag count in quick example
Apr 11, 2026
a7e5451
fix: add concrete 1:N example for loop peeling comparison
Apr 11, 2026
4d5dac8
fix: show get_buf/rls_buf inside scf loop for 1:N example
Apr 11, 2026
dcd8586
refactor vpto llvm emiter
Apr 11, 2026
227da17
add online softmax (q * k is ready) case
Apr 12, 2026
dbfe96b
docs: add VPTO spec v0.3 release draft
WenboCodes Apr 12, 2026
a77c8b2
add PTO-Gym submodule
Apr 12, 2026
949a928
feat: add PTO-Gym guide skill
Apr 12, 2026
495a02c
Add tilelang dsl implementation
Zhendong404 Apr 3, 2026
f5ee676
Update openspec
Zhendong404 Apr 3, 2026
47a102f
Support more syntax in tilelang dsl
Zhendong404 Apr 3, 2026
5ac3dba
Update openspec
Zhendong404 Apr 3, 2026
0fdf4d3
tilelang dsl first working version
Zhendong404 Apr 4, 2026
0d8e71e
Update openspec
Zhendong404 Apr 4, 2026
5d96301
Support more dsl syntax
Zhendong404 Apr 7, 2026
0945be0
Amend
Zhendong404 Apr 7, 2026
bd86d21
Update docs
Zhendong404 Apr 7, 2026
11bc085
docs: add TileOp expand design and demo
Apr 7, 2026
b424d21
feat(transforms): add Tile→Vector template lowering pipeline
Apr 7, 2026
f640129
brough back the lost pass and pto op after rebase
Apr 12, 2026
40b2c93
feat: tile lang dsl
Zhendong404 Apr 7, 2026
203ea91
Update DSL user guide
Zhendong404 Apr 11, 2026
51112bb
Support more tile attributes
Zhendong404 Apr 11, 2026
30dd61a
Support more event IDs
Zhendong404 Apr 11, 2026
2e63819
Align copy_ubuf_to_ubuf
Zhendong404 Apr 11, 2026
f0aeccb
Support more load/store ops
Zhendong404 Apr 11, 2026
17f2268
Support colmajor indexing syntax
Zhendong404 Apr 11, 2026
59368d7
Enhance Tile indexing syntax documentation to clarify restrictions on…
Zhendong404 Apr 11, 2026
cad7e7f
Update openspec
Zhendong404 Apr 11, 2026
5d7ec5a
Support more predicate ops
Zhendong404 Apr 11, 2026
70026b1
Support keyword arguments for vdup and vci operations in TileLang DSL
Zhendong404 Apr 11, 2026
64b295b
Support more dma operations
Zhendong404 Apr 13, 2026
c3111af
Align DSL interface with VPTO v0.3
Zhendong404 Apr 13, 2026
0523127
Add more memory op support
Zhendong404 Apr 13, 2026
5364861
Fix failed lit case
Zhendong404 Apr 13, 2026
e464210
Dump source location for DSL frontend errors
Zhendong404 Apr 13, 2026
0d1961b
Fix inline_proc codegen
Zhendong404 Apr 13, 2026
5e14184
Support optional RoundMode/SatMode/Part arguments in vcvt op
Zhendong404 Apr 13, 2026
48192c2
Fix tile attribute extraction
Zhendong404 Apr 14, 2026
4157241
support expand tload/tstore to tile lib in ptoas
Apr 10, 2026
fc1da2f
Fix TileLang ST ptoas invocation
Apr 11, 2026
fa4a4b5
Fold TileLang dead branches after intrinsic folding
Apr 11, 2026
22fc03b
Fix tilelang ST tadd simulator flow
Apr 11, 2026
6b40947
fixup ptr normalize
Apr 13, 2026
1eefa5b
Refactor tilelang ST framework and document full execution flow
Apr 13, 2026
4dc3c6d
Add local tilelang ST test common header
Apr 13, 2026
a57b62a
resolve confilct
Apr 14, 2026
1f9afec
update ptoas option
Apr 14, 2026
edf07f4
Support scalar mod operation in DSL
Zhendong404 Apr 14, 2026
1c9b329
Support custom tile padding value
Zhendong404 Apr 14, 2026
9c06560
Fix missing valid_shape/padvalue info when expand tileop
Zhendong404 Apr 14, 2026
ef243ec
Use pad_value.eval() instead of pad_value.value
Zhendong404 Apr 14, 2026
7986fc4
Fix semantics of vdup op
Zhendong404 Apr 14, 2026
9baecde
Fix vecscope inference for inline_proc
Zhendong404 Apr 14, 2026
a0afcd3
Fix tshrs/tshls scalar type legality check
Zhendong404 Apr 14, 2026
6b82096
fix(dsl): extend scalar arithmetic/bitwise lowering and tests (#71)
Zhendong404 Apr 14, 2026
91a7926
fix(dsl): align vbitsort and vmrgsort4 with vpto (#67)
Zhendong404 Apr 14, 2026
caa47c3
[PTOAS] wire MLIR IR printing through ptoas pipelines
Zhendong404 Apr 14, 2026
dde7293
Use select_kernel for expand helper selection
Apr 14, 2026
b3091a9
Recover static view strides in ExpandTileOp
Apr 14, 2026
34d0378
Refine tilelang ST compare flow
Apr 14, 2026
d1c6fdd
fix(tilelang-dsl): enforce vcvt attrs by type pair and align vcvt low…
Zhendong404 Apr 15, 2026
69b154e
chore: drop trowargmax template from issue #63 PR
Zhendong404 Apr 15, 2026
1a4d808
fix(dsl): support module-level literal constants in kernels (#62)
Zhendong404 Apr 15, 2026
b9782ed
feat(dsl): allow inline_proc capture of module literal globals
Zhendong404 Apr 15, 2026
9c9ba5c
Update dsl user guide
Zhendong404 Apr 15, 2026
639498b
tilelang-dsl: support pass as frontend no-op
Zhendong404 Apr 15, 2026
708d79a
align(tilelang-dsl): support PartitionTensorView slice binding and docs
Zhendong404 Apr 15, 2026
bc501d2
udpate tload and tstore.
sundyCoder Apr 14, 2026
5fcbdd6
update tload, tstore and related ST.
sundyCoder Apr 15, 2026
e623e63
Add a skill to resolve DSL issue
Zhendong404 Apr 14, 2026
b962d93
fix(tilelang-dsl): emit stable float bit-pattern constants
Zhendong404 Apr 15, 2026
f98ed53
fix(tilelang-dsl): enforce explicit pointer surface for psts
Zhendong404 Apr 15, 2026
0798ead
fix(dsl): handle valid_shape subscript and guard unsupported tuple su…
Zhendong404 Apr 16, 2026
56ab058
support pto.set_mov_pad_val
Apr 15, 2026
aee050d
Add VPTO membar support
Apr 14, 2026
54cb093
warning the channel vsts
Apr 15, 2026
09ea911
update docs for channel vsts
Apr 15, 2026
905154f
fix(dsl): support explicit set_mov_pad_val for DMA padding
Zhendong404 Apr 16, 2026
e9932bb
fix: support unsigned dtypes in ExpandTileOp
Apr 15, 2026
3762b68
fix(tilelang-dsl): keep vbitsort and vmrgsort4 out of inferred vecscope
Apr 16, 2026
10dad24
feat(tilelang-dsl): add select_kernel diagnostics report
Zhendong404 Apr 16, 2026
e927a6d
specify dist of vsts/vlds
Apr 16, 2026
c652492
fix(dsl): materialize vtrc round mode in tilelang
Zhendong404 Apr 16, 2026
4a9c7f4
Add tcvt TileLib support and ST coverage
Apr 16, 2026
39e00c8
Add f16-to-f32 tcvt support
Apr 16, 2026
731865a
Add f32-to-f16 tcvt support
Apr 16, 2026
36dd795
let the dist of store op more flexiable
Apr 17, 2026
25dd553
fix(dsl): fix vecscope inference
Zhendong404 Apr 17, 2026
849e57b
support ctrl reg configure ops
Apr 19, 2026
51bcc3f
udpate tload and tstore, and add testcase.
Apr 20, 2026
d7b4524
feat(dsl): complete predicate ops and enforce PredicateDist enum
Zhendong404 Apr 17, 2026
a76956e
Add vbitcast implementation
Zhendong404 Apr 17, 2026
0e03404
Fix TileLang enum support for issue 131
Zhendong404 Apr 20, 2026
4d07cb3
Adding testing for TCI, assuring correctness
OmarZohir Apr 17, 2026
fbe08ce
test(tilelang_st): add self-hosted runner batch entrypoint
Zhendong404 Apr 20, 2026
236c8c7
fix(tilelang-dsl): emit signless arith constants for unsigned scalars…
Zhendong404 Apr 20, 2026
658e71e
Revert "Adding testing for TCI, assuring correctness"
Zhendong404 Apr 20, 2026
36e4d55
fix(tilelang-dsl): support i64 vregs in DSL v1 (#151)
Zhendong404 Apr 21, 2026
5090f58
bugfix: i8/i16 vcadd will widen the return type
Apr 20, 2026
67a7dc4
bugfix: i8/i16 vcadd res type
Apr 21, 2026
696fd6c
bugfix: update i8/i16 vcadd dsl docs
Apr 21, 2026
2d4647c
fix(tilelang-dsl): align f16->i32 vcvt contract (#152)
Zhendong404 Apr 21, 2026
d189016
Support bf16->f16 convert
Zhendong404 Apr 21, 2026
8caf583
Support materialize PadValue with eval(dtype) interface
Zhendong404 Apr 21, 2026
a500dc9
fix(dsl): allow PadValue.eval with static dtype bindings
Zhendong404 Apr 21, 2026
28fa87e
fix(tilelang-dsl): auto-cast mov pad scalars for issue 170 (#170)
Zhendong404 Apr 21, 2026
34af40a
fixup ci
Apr 21, 2026
3112fd8
fix(dsl): support integer string scalar literals (#174)
Zhendong404 Apr 21, 2026
d482a9a
feat: vpto ci
Apr 21, 2026
ed2b927
feat: ignore local workspace
Apr 22, 2026
6b1321e
feat: support tilelang dsl ci
Apr 22, 2026
0fa8bb7
remove the fork repo pr protects
Apr 22, 2026
f9c89fc
fix(vpto): normalize signed integer vector decls
Zhendong404 Apr 22, 2026
3b3959d
[WIP] feat: new dma load/store op (#141)
mouliangyu Apr 22, 2026
b9c00a7
Support packed vcvt part modes
Zhendong404 Apr 22, 2026
bda4063
Support p0/p1/p2/p3 vcvt part mode
Zhendong404 Apr 22, 2026
8fa8abf
Support the whole mem barrier types
Zhendong404 Apr 22, 2026
32eaa4d
chore(ci): fix license headers for pr199
Zhendong404 Apr 22, 2026
2938752
fix(expand-tileop): add cmp_mode attribute handling for TCmpOp and TC…
Zhendong404 Apr 22, 2026
fed07fa
feat: support dsl ut ci
Apr 22, 2026
cfee28c
feat(tilelang-dsl): add vscatter surface lowering
Zhendong404 Apr 22, 2026
72798b8
fix(dsl): require hex strings for integer bit patterns (#174)
Zhendong404 Apr 22, 2026
fb201c6
docs: add license headers to issue 174 updates
Zhendong404 Apr 22, 2026
1eac185
Add bitcast after arith.constant
Zhendong404 Apr 21, 2026
6a3c1c2
fix: handle type compatibility in tryCloneOpLibInlineBridgeOp
Zhendong404 Apr 21, 2026
4d4e23d
fix(dsl): align vexpdif surface with VPTO
Zhendong404 Apr 22, 2026
4b741bb
fix: avoid false A5 tprelu vec overflow in memory planning
FangRui0 Apr 22, 2026
f2ecaca
fix(dsl): unify type conversion logics in frontend
Zhendong404 Apr 22, 2026
304e186
fix(ptoas): make vpto backend own tile op expansion (#162)
Zhendong404 Apr 21, 2026
d1f5033
feat: support pto.pbitcast op
Apr 23, 2026
398beb5
fix(dsl): fix the order mode lowering of pto.vci
Zhendong404 Apr 23, 2026
bf4dc9a
feat: support copy_ubuf_to_ubuf / dma_copy lowering
Apr 23, 2026
555c921
fix(vpto): align vrelu i32 support (#220)
Zhendong404 Apr 23, 2026
d58d89c
Fix DSL frontend vecscope auto inference
Zhendong404 Apr 23, 2026
b2e071b
feat(tilelang-dsl): support constructor calls on static dtype bindings
Zhendong404 Apr 22, 2026
dd3759b
fix(dsl): fix DSL frontend punpack lowering
Zhendong404 Apr 23, 2026
7ea5b6f
bugfix: vbr/cmps with vreg<i8> accepts i16 as scalar operand
Apr 23, 2026
c1d7dce
feat: vci support si8/si16/si32/f16/f32
Apr 23, 2026
ec226ed
feat: remove dead code
Apr 23, 2026
d6634cd
feat: dsl supports for trems
Apr 23, 2026
b6e09ac
align(tilelang-dsl): require enum dist for vlds/vsts
Zhendong404 Apr 24, 2026
3b22970
chore(tileops): add missing license header for tcvt template
Zhendong404 Apr 24, 2026
8b59232
Add a mixed Tile/VPTO online softmax kernel
Apr 23, 2026
a2fafdd
Refine mixed Tile/VPTO softmax kernels and CI fixes
Apr 24, 2026
bc85fea
fix(pto): avoid false A5 trowarg vec overflow (#558)
Zhendong404 Apr 23, 2026
69e6dcd
Fix tcolarg verifier element width constraints
Zhendong404 Apr 23, 2026
d05c68f
feat(tileop): Add unary tileop templates (#168)
liggest Apr 24, 2026
f7447e3
feat(vpto): add vmatmal op and dependent copy op
FangRui0 Apr 21, 2026
3b03da3
feature dma remove sid (#243)
mouliangyu Apr 24, 2026
8e5b7d8
fix(dsl): forward trandom rounds in tile expansion (#245) (#250)
Zhendong404 Apr 24, 2026
3b60e53
Add OP for TPartAdd & TPartMul (#213)
erhsh Apr 25, 2026
6c45966
Add OP for TPartMin & TPartMax (#230)
erhsh Apr 25, 2026
31a863a
fix(vpto): legalize integer cast ops after VPTO lowering (#240)
Zhendong404 Apr 24, 2026
980e6f5
fix(vpto): restore byte-scalar vdup HIVM ABI
Zhendong404 Apr 25, 2026
677395e
feat: cancel ci on update (#260)
mouliangyu Apr 25, 2026
2d289c8
fix(vpto): normalize scalar memref access before llvm emit (#247)
Zhendong404 Apr 25, 2026
4317477
feat: disable vpto ci
Apr 25, 2026
9c09a83
docs(vpto): add Cluster Programming Model section to Part I
Apr 25, 2026
55f1921
docs(vpto): add ASCII cluster topology diagram to Cluster Programming…
Apr 25, 2026
ca28119
docs(vpto): fix SC semaphore layout in cluster diagram
Apr 25, 2026
f8592d9
[feat] add rowsum rowmin rowmax rowargmax rowargmin (#255)
lwwangcgz Apr 25, 2026
5312763
add tcolmax tcolmin tileops lib implementation (#221)
ChaoyangJi Apr 25, 2026
9c73d05
Add scalar ops (#191)
LLMZhangYC Apr 25, 2026
8466ce4
feat: improve the func call in dsl. and support vdiv/vmod func
Apr 25, 2026
c3797c3
add texpand/tfillpad/tfillpad_inplace/tfillpad_expand op (#167)
kangjiaming1 Apr 25, 2026
b5f9e97
bugfix: vprelu should accept mask operand (#266)
mouliangyu Apr 25, 2026
499e9d7
ST tests for TReLU, TLReLU , TPrelu, Tsel and Tselsand operators have…
yuqiha Apr 25, 2026
4597cd1
add trowexpand op (#149)
pbbb205 Apr 25, 2026
e2f991f
feat: enable vpto sim
Apr 26, 2026
d71462b
fix(dsl): allow integer vdiv vector types
Zhendong404 Apr 25, 2026
0923963
feat: support vmrgsort4 emit
Apr 25, 2026
6135d61
feat: support 64bits dma op
Apr 25, 2026
0d03772
add tcolexpand series op (#169)
bingmeiyou Apr 27, 2026
38cc246
[Add] tadd tsub tmul tdiv tmax tmin tshl tshr tor tand txor tcmp trem…
Apr 27, 2026
454b061
[Add] tcmp trem tfmod
Apr 27, 2026
c515dbe
[Delete] tcmp tfmod trem
Apr 27, 2026
e707c7d
[Delete] tcmp tfmod trem
Apr 27, 2026
9a4df37
[Fix] pass CI
Apr 27, 2026
1a6b535
[Fix] delete tcmp tfmod trem in Cmakelists
Apr 27, 2026
2ed48b0
[Fix] CI error in tmin
Apr 27, 2026
4662a3e
Fix VPTO vcvt and vaxpy mask lowering
Zhendong404 Apr 27, 2026
690e8bc
Fix installed TileLang resources and disable wheel CI
Zhendong404 Apr 25, 2026
9324eab
Fix TileLang soft-math helper lookup in installed layout
Zhendong404 Apr 27, 2026
352427a
bugfix: fixup the mask lack (#291)
mouliangyu Apr 27, 2026
d210f31
Optimize CI validation time
Zhendong404 Apr 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
86 changes: 86 additions & 0 deletions .codex/skills/generate-vpto-release-doc/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
name: generate-vpto-release-doc
description: Generate or refresh `docs/release/vpto-spec-v*.md` by merging `docs/vpto-spec.md` with `docs/isa/*.md`, following the release-doc naming and layout. Use when the user asks to create or update a merged VPTO release spec, inline ISA Markdown into one release document, add TOC and version bullets, move `Quick Reference by Category` to the end, or strip update, appendix, and correspondence content from the merged release doc.
---

# Generate VPTO Release Doc

Use this skill when the task is specifically about:
- creating a new merged release document under `docs/release/`
- refreshing an existing `vpto-spec-v*.md` release doc from `docs/vpto-spec.md` and `docs/isa/*.md`
- keeping the merged release doc aligned with the naming and structure used in `docs/release/vpto-spec-v0.1.md`

## Canonical Workflow

1. Pick the target version and output path.

Default output path:

```bash
docs/release/vpto-spec-v<version>.md
```

2. Run the bundled generator script.

```bash
python3 .codex/skills/generate-vpto-release-doc/scripts/generate_release_vpto_spec.py --version 0.2
```

If you need an explicit note for the new version bullet:

```bash
python3 .codex/skills/generate-vpto-release-doc/scripts/generate_release_vpto_spec.py \
--version 0.2 \
--version-note 'Merge `docs/vpto-spec.md` with `docs/isa/*.md`; add TOC; move `Quick Reference by Category` to the end; remove update, appendix, and correspondence content'
```

3. Review the generated file before finalizing.

Check these invariants:
- exactly one `#` level title in the whole file
- `[toc]` is present near the top
- the top version bullet for the requested version was added
- `## Quick Reference by Category` is the final top-level section
- no `Updated:` / review-status boilerplate remains at the beginning
- no appendix sections remain
- no `## Correspondence Categories` section remains
- no `CCE correspondence` / builtin-mapping blocks remain

4. If the user wants extra release-note wording, patch only the version bullets or other small wording around the generated content. Prefer rerunning the script over hand-merging large sections.

## Source Mapping

Use `docs/vpto-spec.md` for:
- `Part I: Architecture Overview`
- `Part II: Notation Convention`
- `C-Style Semantics Convention`
- `Template Placeholder Conventions`
- `Instruction Groups`
- `Supported Data Types`
- `Common Patterns`
- `Quick Reference by Category`

Use `docs/isa/*.md` for:
- the inlined `Detailed ISA Group Reference`

## Merge Rules

The merged release document should:
- keep the release-doc title and version-bullet style
- preserve the `Instruction Groups` summary table
- inline `docs/isa/*.md` under `Detailed ISA Group Reference`
- convert `docs/isa/*.md` links into in-document anchors like `#isa-03-vector-load-store`
- demote the inlined ISA headings by two levels so the merged TOC stays stable
- place `Quick Reference by Category` at the end

The merged release document must remove:
- beginning-of-file update/review metadata from `docs/vpto-spec.md`
- `## Correspondence Categories`
- all `CCE correspondence` blocks and related builtin/token mapping lines
- the sentence `For detailed semantics, C-style pseudocode, and CCE mappings, see the individual group documentation files.`
- appendix sections

## Notes

- The script assumes the source headings in `docs/vpto-spec.md` keep their current names. If extraction fails, inspect the heading names there before patching the script.
- The script is deterministic and is the preferred path for regenerating large merged release docs.
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
#!/usr/bin/env python3
# Copyright (c) 2026 Huawei Technologies Co., Ltd.
# This program is free software, you can redistribute it and/or modify it under the terms and conditions of
# CANN Open Software License Agreement Version 2.0 (the "License").
# Please refer to the License for details. You may not use this file except in compliance with the License.
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
# See LICENSE in the root of the software repository for the full text of the License.

"""Generate merged VPTO release spec from docs/vpto-spec.md and docs/isa/*.md."""

from __future__ import annotations

import argparse
import re
from pathlib import Path


ROOT = Path(__file__).resolve().parents[4]
DOCS_DIR = ROOT / "docs"
SOURCE_SPEC = DOCS_DIR / "vpto-spec.md"
ISA_DIR = DOCS_DIR / "isa"
RELEASE_DIR = DOCS_DIR / "release"

TITLE = "# PTO micro Instruction Spec \u2014 Draft (A5)"
DEFAULT_VERSION_NOTES = {
"0.1": "Doc Init",
"0.2": "Update micro Instruction latency and throughput",
"0.3": "Refresh VPTO ISA specification",
}

KEEP_SECTIONS = [
"## Part I: Architecture Overview",
"## Part II: Notation Convention",
"## Instruction Groups",
"## Supported Data Types",
"## Common Patterns",
"## Quick Reference by Category",
]

ISA_LINK_RE = re.compile(r"\[([^\]]+)\]\((?:\.\./)?(?:isa/)?([0-9]{2}-[A-Za-z0-9-]+)\.md\)")


def extract_sections(markdown: str) -> dict[str, str]:
headings = list(re.finditer(r"^## .*$", markdown, flags=re.MULTILINE))
sections: dict[str, str] = {}
for index, match in enumerate(headings):
heading = match.group(0).strip()
start = match.start()
end = headings[index + 1].start() if index + 1 < len(headings) else len(markdown)
sections[heading] = markdown[start:end].strip() + "\n"
return sections


def rewrite_isa_links(text: str) -> str:
return ISA_LINK_RE.sub(lambda m: f"[{m.group(1)}](#isa-{m.group(2).lower()})", text)


def trim_trailing_rule(text: str) -> str:
return re.sub(r"\n---\s*\Z", "\n", text.strip() + "\n").rstrip()


def strip_unwanted_lines(text: str) -> str:
lines = text.splitlines()
kept: list[str] = []
skip_correspondence = False
for line in lines:
if re.match(r"^## Correspondence Categories\b", line):
skip_correspondence = True
continue
if skip_correspondence:
if re.match(r"^## ", line):
skip_correspondence = False
else:
continue
if line.startswith("> **Status:**") or line.startswith("> **Base:**") or line.startswith("> **Additions from:**") or line.startswith("> **Updated:**"):
continue
if "For detailed semantics, C-style pseudocode, and CCE mappings" in line:
continue
if "CCE correspondence" in line or "builtin mapping" in line.lower():
continue
kept.append(line)
text = "\n".join(kept).strip() + "\n"
text = re.sub(r"\n## Appendix [A-Z]:.*\Z", "\n", text, flags=re.DOTALL)
return text


def demote_headings(text: str, levels: int = 2) -> str:
def replace(match: re.Match[str]) -> str:
hashes = match.group(1)
heading = match.group(2)
new_level = min(6, len(hashes) + levels)
return f"{'#' * new_level} {heading}"

return re.sub(r"^(#{1,6})\s+(.*)$", replace, text, flags=re.MULTILINE)


def render_version_bullets(version: str, version_note: str | None) -> str:
notes = dict(DEFAULT_VERSION_NOTES)
if version_note:
notes[version] = version_note
elif version not in notes:
notes[version] = "Release refresh"

def key_fn(item: str) -> tuple[int, ...]:
return tuple(int(part) for part in item.split("."))

lines = [f"- v{ver}: {notes[ver]}" for ver in sorted(notes, key=key_fn, reverse=True)]
return "\n".join(lines)


def build_release_doc(version: str, version_note: str | None) -> str:
source_text = strip_unwanted_lines(SOURCE_SPEC.read_text())
sections = extract_sections(source_text)

missing = [name for name in KEEP_SECTIONS if name not in sections]
if missing:
raise SystemExit(f"missing expected headings in docs/vpto-spec.md: {missing}")

content_sections = [trim_trailing_rule(rewrite_isa_links(sections[name])) for name in KEEP_SECTIONS[:-1]]

isa_blocks: list[str] = ["## Detailed ISA Group Reference"]
for isa_path in sorted(ISA_DIR.glob("*.md")):
isa_text = rewrite_isa_links(isa_path.read_text().strip() + "\n")
isa_blocks.append(trim_trailing_rule(demote_headings(isa_text)))

quick_reference = trim_trailing_rule(rewrite_isa_links(sections["## Quick Reference by Category"]))

parts = [
TITLE,
"",
render_version_bullets(version, version_note),
"",
"[toc]",
"",
"---",
"",
"\n\n".join(content_sections),
"\n\n".join(isa_blocks),
quick_reference,
"",
]
return "\n".join(part for part in parts if part is not None)


def validate_release_doc(text: str) -> None:
if text.count("# PTO micro Instruction Spec") != 1:
raise SystemExit("expected exactly one top-level title")
if "\n[toc]\n" not in text:
raise SystemExit("missing [toc] near top")
if re.search(r"^## Quick Reference by Category\b", text, flags=re.MULTILINE) is None:
raise SystemExit("missing Quick Reference by Category")
if re.search(r"^## Quick Reference by Category\b[\s\S]*\Z", text, flags=re.MULTILINE) is None:
raise SystemExit("Quick Reference by Category must be present at end")
if re.search(r"^## Appendix\b", text, flags=re.MULTILINE):
raise SystemExit("appendix content must not remain")
if "Updated:" in text or "review" in text.splitlines()[:8]:
raise SystemExit("beginning metadata must not remain")
if "## Correspondence Categories" in text or "CCE correspondence" in text:
raise SystemExit("correspondence content must not remain")


def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument("--version", required=True, help="Release version, e.g. 0.2")
parser.add_argument("--version-note", help="Version bullet text for the requested version")
parser.add_argument("--output", help="Explicit output path")
args = parser.parse_args()

output = Path(args.output) if args.output else RELEASE_DIR / f"vpto-spec-v{args.version}.md"
output.parent.mkdir(parents=True, exist_ok=True)

text = build_release_doc(args.version, args.version_note)
validate_release_doc(text)
output.write_text(text)


if __name__ == "__main__":
main()
16 changes: 16 additions & 0 deletions .codex/skills/llvm-test-tool-fallback/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: llvm-test-tool-fallback
description: When `lit` or `FileCheck` is missing from the current shell, look for the corresponding LLVM test tools in the environment or existing LLVM workspace before treating it as a repo issue.
---

# LLVM Test Tool Fallback

Use this skill when:
- `python3 -m lit` fails because `lit` is missing
- `FileCheck` is not in `PATH`
- a test command fails only because LLVM test tools are not available in the current shell

Rule:
- do not stop at `command not found`
- first try to find `lit` / `FileCheck` from the environment's LLVM toolchain or an existing LLVM workspace
- treat missing `lit` / `FileCheck` as an environment-tool issue, not as a PTOAS regression
Loading
Loading