Retire the PTO brand names, and hold the line with a hook - #2021
Merged
Merged
Conversation
`.claude/rules/codestyle.md` rule 10 said the retirement was complete and that "there is no backlog to work through". Two of its three claims held: no `PTO2` *identifier* is left, and a new one is a defect. The third was false — the rule's own grep, `PTO Runtime2?|PTO2|pto2_|pto_runtime2`, found 38 brand banners across 36 files in `src/`. The claim had been measured with `PTO2|pto2_`, which cannot see a brand name with a space in it. hw-native-sys#1980's title was "finish the PTO2 retirement" and it finished exactly that, verifiably — 62 remaining under its own pattern, reproducible today. The sentence generalised from "PTO2 identifiers" to "the retirement". ## What changed **The 38 banners**, following the style already in the tree — `orchestrator_core/orchestrator.cpp` opens `* host_build_graph orchestrator implementation`, so the runtime's directory name leads and the subsystem words are lower case, with type names keeping their case: * PTO Runtime2 - TensorMap Interface -> * host_build_graph TensorMap interface * PTO Runtime2 - Ring Buffer Data … -> * tensormap_and_ringbuffer ring buffer data … The four `PTO Runtime C API` banners are in the platform layer, which serves both runtimes, so they take the name the canonical header already uses for itself: `simpler host-runtime C API`. **Eighteen comments naming a `pto_*` that does not exist.** These are `doc-consistency.md` §3 defects rather than naming preferences — a reader who greps the name finds nothing: - `pto_submit_task` x16 -> `rt_submit_task`, the actual orchestration entry in `orchestration/orchestration_api.h`. - `pto_runtime_c_api` x2 -> `runtime_c_api`, the actual file name. `git grep -w` returning only comments is what established each was absent. **`tests/lint/check_retired_names.py`**, wired into pre-commit. Rule 10 already demanded that "the count only goes down"; nothing enforced it, and a count written into prose cannot stay true. The hook fails on any new `PTO Runtime`, `PTO Runtime2`, or bare `Runtime2`, so the rule can now point at it and drop the number it could not keep current. The hook is deliberately narrow, and the reason is the third population rule 10 lumped into one Tier A row. ## What is deliberately untouched **Every live `pto_cpu_sim_*` / `pto_sim_*` hook** — 33 occurrences, all left alone. `cpu_sim_context.cpp` exports them for "pto-isa via `dlsym(RTLD_DEFAULT)`", and `device_runner_base.cpp` fetches `pto_sim_register_hooks` by `dlsym`. Renaming one produces **no compile error** — just a hook that is never found at run time. That is the "handful of Tier-C names hiding in it" rule 10's no-sweep ban was written to protect, and it is real; it just hides in the lowercase `pto_*` namespace, not in the banner namespace. So the hook checks only the brand spellings, and rule 10's Tier A is split into A1 (brand prose, mechanically safe) and A2 (dangling `pto_*` references, grep first), with the `dlsym` trap named in Tier C. **Six mentions that named a retired variable only for history** — "the now-retired `PTO2_RING_*` environment variables", "the process-wide `PTO2_RING_*` env, since retired" — now state the current mechanism and what it enables instead. They explained a design by contrast with something the reader cannot find. (`per_task_runtime_env/README.md` also had "shared the process-wide process-wide", a duplicated line from hw-native-sys#1980's edit.) `PTO2_*` is deliberately left out of the hook, because what remains of that spelling is load-bearing in two ways the hook cannot distinguish: - Twelve occurrences belong to `warn_on_retired_ring_env()` in each `host/runtime_maker.cpp` — a `kRetired[]` array of env names and the comment explaining it — plus three doc sites that tell a reader what the warning they just saw means. The names cannot leave without the warning leaving, and that warning is one day old (hw-native-sys#1980, 2026-08-25); rule 10 holds it up as the model for retiring a knob rather than silently falling back. - Eight are `PTO2_MANUAL_MAX_SEQ`, pypto-lib's own variable, which the qwen READMEs tell a user to `export` literally. So banning the spelling would either delete a live diagnostic or break working instructions. ## Verification Comments and one new lint script; no declaration, signature or expression changes. - Full product build — both arches, sim and onboard, all four runtimes. - cpput 119/119. - The hook returns 0 over all 2294 tracked files, 1 on a probe containing `PTO Runtime2 - Something`, 1 on a bare `Runtime2`, and 0 on `codestyle.md` itself, which is exempt because a rule has to spell what it bans. - `clang-format --dry-run --Werror` clean on all 42 changed C++ files; every one of them is a matched a2a3/a5 pair. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Warning Review limit reachedNext included review available in 2 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (51)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.claude/rules/codestyle.mdrule 10 said the retirement was complete and that "there is no backlog to work through". Two of its three claims held. The third was false — the rule's own grep,PTO Runtime2?|PTO2|pto2_|pto_runtime2, found 38 brand banners across 36 files insrc/.The claim had been measured with
PTO2|pto2_, which cannot see a brand name with a space in it. #1980's title was "finish the PTO2 retirement" and it finished exactly that, verifiably — 62 remaining under its own pattern, reproducible today. The sentence it added generalised from "PTO2 identifiers" to "the retirement".What changed
The 38 banners
Following the style already in the tree —
orchestrator_core/orchestrator.cppopens* host_build_graph orchestrator implementation, so the runtime's directory name leads, subsystem words are lower case, type names keep their case:The four
PTO Runtime C APIbanners are in the platform layer, which serves both runtimes, so they take the name the canonical header already uses for itself:simpler host-runtime C API.Eighteen comments naming a
pto_*that does not existdoc-consistency.md§3 defects rather than naming preferences — a reader who greps the name finds nothing:pto_submit_taskrt_submit_task, inorchestration/orchestration_api.hpto_runtime_c_apiruntime_c_api, the file namegit grep -w <name>returning only comments is what established each was absent.Six mentions that named a retired variable only for history
"the now-retired
PTO2_RING_*environment variables", "the process-widePTO2_RING_*env, since retired" — these explained a design by contrast with something the reader cannot find. They now state the current mechanism and what it enables. (per_task_runtime_env/README.mdalso carried "shared the process-wide process-wide", a duplicated line from #1980's edit.)tests/lint/check_retired_names.py, wired into pre-commitRule 10 already demanded that "the count only goes down"; nothing enforced it, and a count written into prose cannot stay true — that is how this rotted. The hook fails on any new
PTO Runtime,PTO Runtime2, or bareRuntime2, so the rule can point at it and drop the number it could not keep current.Rule 10 itself
pto_*references (grep first — it is a §3 defect, and the namespace is shared with Tier C).dlsymtrap explicitly.What is deliberately untouched, and why
Every live
pto_cpu_sim_*/pto_sim_*hook — 33 occurrences, all left alone.cpu_sim_context.cppexports them for "pto-isa viadlsym(RTLD_DEFAULT)", anddevice_runner_base.cpp:863fetchespto_sim_register_hooksbydlsym. Renaming one produces no compile error — just a hook that is never found at run time.That is the "handful of Tier-C names hiding in it" rule 10's no-sweep ban was written to protect, and it is real. It just hides in the lowercase
pto_*namespace, not in the banner namespace — which is exactly why the hook checks only the brand spellings and why Tier A had to be split.PTO2_*is out of the hook's scope, because what remains of that spelling is load-bearing in two ways a regex cannot distinguish:warn_on_retired_ring_env()in eachhost/runtime_maker.cpp— akRetired[]array of env names plus the comment explaining it — and three doc sites that tell a reader what the warning they just saw means. The names cannot leave without the warning leaving, and that warning is one day old (Refactor: finish the PTO2 retirement, one identifier per commit #1980, 2026-08-25); rule 10 holds it up as the model for retiring a knob rather than silently falling back.PTO2_MANUAL_MAX_SEQ, pypto-lib's own variable, which the qwen READMEs tell a user toexportliterally.So banning the spelling would either delete a live diagnostic or break working instructions. Happy to remove the warning and its 15 mentions in a follow-up if the transition is considered over — that is a behaviour change, so it wants its own decision.
Testing
Comments, docs, and one new lint script. No declaration, signature or expression changed.
ctestcpput — 119/119--manual exclude) — green ona2a3simanda5simclang-format --dry-run --Werrorclean on all 42 changed C++ files; every one is a matched a2a3/a5 pairmarkdownlint-cli2clean on every changed docThe hook's own behaviour, verified four ways: 0 over all 2294 tracked files; 1 on a probe containing
PTO Runtime2 - Something; 1 on a bareRuntime2; 0 oncodestyle.md, which is exempt because a rule has to spell what it bans.🤖 Generated with Claude Code