feat(os): x86 cpuid natives and decoders #541
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/538-os-x86-decoders"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Refs #538
Task
Slice 3, step 2a of
docs/design/OS.md: the x86cpuidnatives, pure decoders over their registers, public types and tests with captured register values.What
runtime/os/x86.c:torb_os_x86_cpuidandtorb_os_x86_extended_control_register(xgetbv, only when OSXSAVE is set). GCC/Clang and MSVC paths.std/os/src/x86/native.trb:native type X86(cpuid,extendedControlRegister). Manifest rows innatives.trb, regeneratedtorb_natives.handmachine_natives.c,NATIVES.mdsection.std/os/src/x86/processor.trb:CpuidLeaf,CpuidTopology,CpuidDumpwithvendor(),brand(),features(),caches(),topology(). Every decoder is a pure function of integers. An absent leaf reads as zeros, so nothing traps.std/os/src/processor.trb: publicProcessorCacheandProcessorFeature, re-exported fromstd/os.XCR0 & 6 == 6; Avx512Foundation needsXCR0 & 0xE6 == 0xE6.docs/standard-library/os.md, regenerated skill reference,OS.md"As built" note.Deviation from acceptance (a)
The issue says the module is absent on other architectures. The manifest's
availableOnnames operating systems only, and the VM thunk table calls every native, so the C symbols must exist everywhere. They are stubs (zeros,false) off x86-64, andCpuidDump.read()returns an empty dump behindArchitecture.current != .X64. NoUnsupportedreaches the public API. Recorded inOS.md. That is why this isRefsand notCloses: whoever reviews decides whether it satisfies (a).Test
std/os/tests/x86.test.trb, 27 pure tests pass (captured AMD EPYC Genoa and Milan VMs, Intel Core i7-11700F; a made-up hybrid and padded-brand fixture, both labelled as such). The nightly lacks the new natives, so the "this machine" group (X86.cpuidequals the decoder input on x64) and the C compile ofx86.crun in CI only.sh tools/check-commits.sh origin/mainis clean.Seed impact: none expected.
Depends on #536 (tier B on main is red from the resource conformance programs; the same 4 programs fail on this head and on main
39eae32, log of tier B job 23557 vs 23218). Un-draft and re-request review once #536 is merged and this branch is rebased.CI red on
b9aec30:ci / tier B (linux-x64)failed after 12m (ci / gatesfollows from it).main(39eae32) has the same two checks red, so this looks inherited rather than caused by this change, but I could not read the job log (not available to my account) and cannot confirm which tests failed. All other checks on this head are green (commit messages, pdisc, bootstrap, tier A, every host emits the same C, playground, release-sync).I read the diff and found no other blocker so far; the review follows once CI on this head is green (e.g. after the tier B fix lands on main and this branch is rebased, or if the tier B failure is shown to be unrelated to this diff).
feat(os): x86 cpuid natives and decodersto WIP: feat(os): x86 cpuid natives and decodersBlocked on #536: tier B fails on this head with exactly the failures of main
39eae32(resource-bytes, resource-name, resource-text without allocation budget; resource-missing removes its shipped file), none in code touched here. Argus could not read the job log, so for the record: both jobs end330 passed, 4 failed (334 programs)with the same four programs. Turned into a draft withDepends on#536; I will rebase, un-draft and re-request review once #536 is merged.b9aec30f35acf8510278WIP: feat(os): x86 cpuid natives and decodersto feat(os): x86 cpuid natives and decodersReview of
acf8510(rebased onto main403ee17after #536).xgetbvis only executed after the OSXSAVE check. x86.c has a stub arm for other architectures, andCpuidDump.read()is gated onArchitecture.current.describe, no per-system halves, no new automation.availableOnnames operating systems only and the VM thunk table calls every native. The intent of (a), that the std builds everywhere and noUnsupportedreaches the public API, is met, and the deviation is recorded in OS.md. #538 stays open for step 2b.Non-blocking:
__cpuidex,_xgetbv) is not compiled by CI on this PR (Windows jobs skipped). If a Windows job compiles it later and_xgetbvneeds a flag under clang-cl, a one-line fix suffices.