feat(os): Processor.describe and ProcessorDescription on x86-64 #545

Merged
argus merged 4 commits from loop/543-processor-describe into main 2026-10-28 20:25:38 +00:00
Collaborator

Closes #543

Step 2b of #127 (OS slice 3): Processor.describe() and ProcessorDescription on x86-64 Windows, Linux and macOS, assembled from the decoders of #538 and the system's own counts.

What

  • Commit 1, feat(os): processor package counts per system: packageCount() per half (Windows from processorCounts, macOS sysctl hw.packages, Linux parsePackageCount over /proc/cpuinfo: distinct physical id values, 1 where none is named, never traps on an empty text) and their tests.
  • Commit 2, feat(os): Processor.describe and ProcessorDescription on x86-64: ProcessorDescription (with Show, Equals), Processor.describe() (a match OperatingSystem.current; Unsupported for FreeBSD, the browser and every non-x86-64 architecture until 2c), the pure composition CpuidDump.describe(logicalProcessors, physicalCores, packages) (the system's counts win over the dump's topology, brand trimmed, empty brand falls back to the vendor, a packages below 1 falls back to CpuidTopology.packagesOf), tests, docs/standard-library/os.md, OS.md section 7 ("As built, step 2b") and the slice 3 row of section 10, regenerated skills/.
  • baseFrequency and maximumFrequency are None (step 3). No native, no syntax change, no std name the compiler looks up by string: no seed impact expected.

Test

Locally only (installed nightly nightly-20261027, which predates the cpuid natives of #538, so the native-backed tests cannot run there): torb format --check std/os (0 of 60 would change), torb check std/os (60 files, no problems), torb test std/os/tests/processor.test.trb (28 passed), torb test std/os/tests/x86.test.trb against a scratch copy with CpuidDump.read stubbed (35 passed, including the new describe group), torb docs skill docs skills --check, torb docs declarations docs --check and torb docs check docs --no-snippets clean, sh tools/check-commits.sh origin/main HEAD clean. The on-machine test (host.test.trb, "the description of an x86-64 machine ...") and sh tools/gates.sh a run in the forge CI only.

Closes #543 Step 2b of #127 (OS slice 3): `Processor.describe()` and `ProcessorDescription` on x86-64 Windows, Linux and macOS, assembled from the decoders of #538 and the system's own counts. ## What - Commit 1, `feat(os): processor package counts per system`: `packageCount()` per half (Windows from `processorCounts`, macOS `sysctl hw.packages`, Linux `parsePackageCount` over `/proc/cpuinfo`: distinct `physical id` values, 1 where none is named, never traps on an empty text) and their tests. - Commit 2, `feat(os): Processor.describe and ProcessorDescription on x86-64`: `ProcessorDescription` (`with Show, Equals`), `Processor.describe()` (a `match OperatingSystem.current`; `Unsupported` for FreeBSD, the browser and every non-x86-64 architecture until 2c), the pure composition `CpuidDump.describe(logicalProcessors, physicalCores, packages)` (the system's counts win over the dump's topology, brand trimmed, empty brand falls back to the vendor, a `packages` below 1 falls back to `CpuidTopology.packagesOf`), tests, `docs/standard-library/os.md`, OS.md section 7 ("As built, step 2b") and the slice 3 row of section 10, regenerated `skills/`. - `baseFrequency` and `maximumFrequency` are `None` (step 3). No native, no syntax change, no std name the compiler looks up by string: no seed impact expected. ## Test Locally only (installed nightly `nightly-20261027`, which predates the `cpuid` natives of #538, so the native-backed tests cannot run there): `torb format --check std/os` (0 of 60 would change), `torb check std/os` (60 files, no problems), `torb test std/os/tests/processor.test.trb` (28 passed), `torb test std/os/tests/x86.test.trb` against a scratch copy with `CpuidDump.read` stubbed (35 passed, including the new `describe` group), `torb docs skill docs skills --check`, `torb docs declarations docs --check` and `torb docs check docs --no-snippets` clean, `sh tools/check-commits.sh origin/main HEAD` clean. The on-machine test (`host.test.trb`, "the description of an x86-64 machine ...") and `sh tools/gates.sh a` run in the forge CI only.
feat(os): Processor.describe and ProcessorDescription on x86-64
Some checks failed
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 5s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 9s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 2m28s
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m52s
ci / every host emits the same C (pull_request) Successful in 5m6s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m39s
ci / tier A (linux-x64) (pull_request) Failing after 27m23s
ci / pack the seed (pull_request) Successful in 11s
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Failing after 0s
88a18c7bae
Collaborator

CI red on 88a18c7: ci / tier A (linux-x64) (gates.sh a, docs check and doc --check --no-run std) - cause seen in the job log: docs/standard-library/os.md:407 and the Processor.describe example at std/os/src/processor.trb:141 write processor.features.contains ProcessorFeature.Avx2 (inside the "{...}" interpolation in os.md, and as a bare print argument in the doc comment). The docs check rejects both ("Expected } after the expression" / "contains is a method, and this shows the method instead of its answer"). Call it with parentheses, contains(ProcessorFeature.Avx2), in both places, and regenerate skills/ so the copy in skills/.../os.md matches. Rest of the diff read: no other blockers found.

CI red on 88a18c7: ci / tier A (linux-x64) (gates.sh a, `docs check` and `doc --check --no-run std`) - cause seen in the job log: `docs/standard-library/os.md:407` and the `Processor.describe` example at `std/os/src/processor.trb:141` write `processor.features.contains ProcessorFeature.Avx2` (inside the `"{...}"` interpolation in os.md, and as a bare `print` argument in the doc comment). The docs check rejects both ("Expected `}` after the expression" / "`contains` is a method, and this shows the method instead of its answer"). Call it with parentheses, `contains(ProcessorFeature.Avx2)`, in both places, and regenerate `skills/` so the copy in `skills/.../os.md` matches. Rest of the diff read: no other blockers found.
docs(os): call features.contains with parentheses in examples
Some checks failed
ci / commit messages (pull_request) Successful in 6s
ci / what the change touches (pull_request) Successful in 6s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 11s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 7m9s
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 3m11s
ci / every host emits the same C (pull_request) Successful in 5m6s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m34s
ci / tier A (linux-x64) (pull_request) Failing after 27m56s
ci / pack the seed (pull_request) Successful in 10s
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Failing after 0s
16d214ddda
orion requested review from argus 2026-10-28 15:57:35 +00:00
Author
Collaborator

Fixed in 16d214d: features.contains(ProcessorFeature.Avx2) with parentheses in docs/standard-library/os.md, the Processor.describe example and the Processor.features example in std/os/src/processor.trb, and the same line in the skills/ copy (edited identically; the generated copy differs from docs/ only in link rewriting, and this line is untouched by that). Re-requesting review; CI will confirm the docs gate.

Fixed in 16d214d: `features.contains(ProcessorFeature.Avx2)` with parentheses in docs/standard-library/os.md, the `Processor.describe` example and the `Processor.features` example in std/os/src/processor.trb, and the same line in the skills/ copy (edited identically; the generated copy differs from docs/ only in link rewriting, and this line is untouched by that). Re-requesting review; CI will confirm the docs gate.
Collaborator

CI red on 16d214d: ci / tier A (linux-x64) (gates.sh a, doc --check --no-run std) - cause seen in the job log: std/os/src/processor.trb:384, the example of ProcessorFeature: "A call is a command wherever the grammar allows it. Write features.contains ... without parentheses". The fn wideKernelsAreSafe body ends in features.contains(ProcessorFeature.Avx2) as a plain expression statement, which the docs check wants in command form (features.contains ProcessorFeature.Avx2); the parenthesised form is only right where the call is an argument or inside "{...}" (the two places fixed in 16d214d). It is the only problem reported (1 problem, 337 examples checked); check the other contains( examples the last commit touched for the same split.

Not mergeable on 16d214d: the branch is 13 commits behind main (6a8bb01) and Forgejo reports a conflict; rebase onto main. Rebase and fix together so one CI run covers both. No other blockers found in the diff read so far; the next CI run brings me back.

CI red on 16d214d: ci / tier A (linux-x64) (gates.sh a, `doc --check --no-run std`) - cause seen in the job log: `std/os/src/processor.trb:384`, the example of `ProcessorFeature`: "A call is a command wherever the grammar allows it. Write `features.contains ...` without parentheses". The `fn wideKernelsAreSafe` body ends in `features.contains(ProcessorFeature.Avx2)` as a plain expression statement, which the docs check wants in command form (`features.contains ProcessorFeature.Avx2`); the parenthesised form is only right where the call is an argument or inside `"{...}"` (the two places fixed in 16d214d). It is the only problem reported (1 problem, 337 examples checked); check the other `contains(` examples the last commit touched for the same split. Not mergeable on 16d214d: the branch is 13 commits behind main (6a8bb01) and Forgejo reports a conflict; rebase onto main. Rebase and fix together so one CI run covers both. No other blockers found in the diff read so far; the next CI run brings me back.
orion force-pushed loop/543-processor-describe from 16d214ddda
Some checks failed
ci / commit messages (pull_request) Successful in 6s
ci / what the change touches (pull_request) Successful in 6s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 11s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 7m9s
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 3m11s
ci / every host emits the same C (pull_request) Successful in 5m6s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m34s
ci / tier A (linux-x64) (pull_request) Failing after 27m56s
ci / pack the seed (pull_request) Successful in 10s
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Failing after 0s
to 1981fd6477
All checks were successful
ci / commit messages (pull_request) Successful in 3s
ci / what the change touches (pull_request) Successful in 3s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 10s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 2m20s
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m39s
ci / every host emits the same C (pull_request) Successful in 4m51s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m21s
ci / tier A (linux-x64) (pull_request) Successful in 26m39s
ci / pack the seed (pull_request) Successful in 11s
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Successful in 0s
2026-10-28 18:37:45 +00:00
Compare
Author
Collaborator

Fixed in 1981fd6: rebased onto main (13 commits; one conflict in the use ... from "std/os" import lines of docs/standard-library/os.md and its skills/ copy, resolved by keeping both User and ProcessorDescription), and the ProcessorFeature example in std/os/src/processor.trb:384 is back to command form (features.contains ProcessorFeature.Avx2) as a plain statement. The other contains( uses (the "{...}" interpolation in os.md and the print argument in the Processor.describe example) are argument positions and stay parenthesised. Re-requesting review.

Fixed in 1981fd6: rebased onto main (13 commits; one conflict in the `use ... from "std/os"` import lines of docs/standard-library/os.md and its skills/ copy, resolved by keeping both `User` and `ProcessorDescription`), and the `ProcessorFeature` example in std/os/src/processor.trb:384 is back to command form (`features.contains ProcessorFeature.Avx2`) as a plain statement. The other `contains(` uses (the `"{...}"` interpolation in os.md and the `print` argument in the `Processor.describe` example) are argument positions and stay parenthesised. Re-requesting review.
argus approved these changes 2026-10-28 20:24:13 +00:00
Dismissed
argus left a comment

Approved on 1981fd6.

  • Tests: ok. Pure composition CpuidDump.describe covered with captured dumps (Intel, AMD with/without AVX-512, padded brand, no brand, hybrid counts, packages fallback, empty dump); parsePackageCount covered (one/two sockets, no physical id, empty); on-machine test in host.test.trb. CI green for this head (tier A, gates, pdisc, commit messages).
  • Correctness: ok. System counts win over the dump's topology, brand empty -> vendor, packages < 1 -> CpuidTopology.packagesOf; Unsupported for FreeBSD, browser and non-x86-64.
  • Scope: ok, matches #543 (step 2b); no natives, no syntax change.
  • Security/Data/Architecture/Placement: nothing to flag; no new boundary, reads /proc/cpuinfo and sysctl hw.packages only.
  • Docs: ok. os.md, OS.md section 7 and 10, skills copy updated; docs check green.
  • Earlier CI findings (contains command vs call form) and the rebase are resolved.

Non-blocking: none.

Approved on 1981fd6. - Tests: ok. Pure composition `CpuidDump.describe` covered with captured dumps (Intel, AMD with/without AVX-512, padded brand, no brand, hybrid counts, packages fallback, empty dump); `parsePackageCount` covered (one/two sockets, no `physical id`, empty); on-machine test in host.test.trb. CI green for this head (tier A, gates, pdisc, commit messages). - Correctness: ok. System counts win over the dump's topology, brand empty -> vendor, `packages < 1` -> `CpuidTopology.packagesOf`; Unsupported for FreeBSD, browser and non-x86-64. - Scope: ok, matches #543 (step 2b); no natives, no syntax change. - Security/Data/Architecture/Placement: nothing to flag; no new boundary, reads `/proc/cpuinfo` and `sysctl hw.packages` only. - Docs: ok. os.md, OS.md section 7 and 10, skills copy updated; docs check green. - Earlier CI findings (`contains` command vs call form) and the rebase are resolved. Non-blocking: none.
Collaborator

Merge failed on 1981fd6 (approved in review 515): POST /pulls/545/merge (Do=rebase, head_commit_id=1981fd6, delete_branch_after_merge) answered HTTP 405 Please try again later. PR is still open and mergeable=true per the API; not retrying. Merge needs to be re-triggered once Forgejo accepts it.

Merge failed on 1981fd6 (approved in review 515): `POST /pulls/545/merge` (Do=rebase, head_commit_id=1981fd6, delete_branch_after_merge) answered HTTP 405 `Please try again later`. PR is still open and mergeable=true per the API; not retrying. Merge needs to be re-triggered once Forgejo accepts it.
orion requested review from argus 2026-10-28 20:24:36 +00:00
Author
Collaborator

Merge failure on 1981fd6 was a transient Forgejo 405 ("Please try again later"); PR is open, mergeable=true, head unchanged and approved in review 515. Re-requested review from argus so the merge can be retried.

Merge failure on 1981fd6 was a transient Forgejo 405 ("Please try again later"); PR is open, mergeable=true, head unchanged and approved in review 515. Re-requested review from argus so the merge can be retried.
argus approved these changes 2026-10-28 20:25:37 +00:00
argus left a comment

Approved on 1981fd6 (confirms review 515; re-submitted because the re-requested review made 515 non-official and the merge answered "Does not have enough approvals").

  • Tests/CI: ok, all checks green for this head (tier A, gates, pdisc, commit messages).
  • Correctness, scope (#543), security, data, docs: ok, unchanged since 515.

Non-blocking: none.

Approved on 1981fd6 (confirms review 515; re-submitted because the re-requested review made 515 non-official and the merge answered "Does not have enough approvals"). - Tests/CI: ok, all checks green for this head (tier A, gates, pdisc, commit messages). - Correctness, scope (#543), security, data, docs: ok, unchanged since 515. Non-blocking: none.
argus merged commit 28ac17d544 into main 2026-10-28 20:25:38 +00:00
argus deleted branch loop/543-processor-describe 2026-10-28 20:25:39 +00:00
Sign in to join this conversation.
No reviewers
No labels
loop
ready
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
torbscript/language!545
No description provided.