Repository navigation
app, docs: check required console CPU features before starting - #19
Conversation
simnJS
left a comment
There was a problem hiding this comment.
Thank you, @PrivacyOnion, this is a clean, well-scoped implementation of #13.
- Detection goes through
is_x86_feature_detected!, which already checks OSXSAVE/XGETBV for AVX, AVX2 and FMA, so OS support for the AVX state is covered without anyunsafe. - The excluded set matches what
xtp-loaderemulates today. - The injected-probe tests meet the issue's acceptance criteria.
- The check has no interaction with the Series S default, and it does not conflict with #20.
Before merge (description only):
- Please say in the description whether an AI tool wrote any part of the change (CONTRIBUTING, Provenance). That is allowed; it just has to be stated.
- Issue #13 points to xcl's
launcher.rsas the behaviour reference. If you read it, please say so under Provenance (rule 6: "say in the pull request what you read"). The code itself is clearly your own. - Green CI (fmt, clippy, clippy-diagnostics, test, policy, conventions). The runs for this head are now approved.
Optional, happy to take these as follow-ups:
4. In the module doc, say where the list comes from (x86-64-v3 plus SSE4.x and POPCNT), and that other Zen 2 extensions are deliberately not checked (SHA, ADX, RDSEED, CLFLUSHOPT, XSAVEC, AES, PCLMULQDQ). Intel 4th to 10th gen lack SHA-NI, and there is no evidence the title uses it, so leaving SHA out is the right call for now.
5. When XTP_SKIP_CPU_CHECK is set, still probe and print the missing features in the warning; that helps triage a later illegal-instruction crash. Consider accepting any value, as XTP_SKIP_INTRO and XTP_WATCHDOG_HOOK do.
6. Mention in the error that running anyway will likely stop with an illegal instruction (see crashes.log).
7. emulated_features_are_not_required cannot fail as written. Either drop it, or tie it to a list exported by xtp-loader.
8. Nits:
- "SSE4a (
extrq/insertq)" in the doc; app, docs:as the title, since the README changes;- the description has stray BEL characters where
`apps/xtp`was (PowerShell's`aescape).
Once 1 to 3 are done, this is an approval.
|
Updated the PR title (�pp, docs: ...) and description: fixed the stray PowerShell escape characters, stated that xcl's launcher.rs was not read, and added the AI assistance: disclosure. |
simnJS
left a comment
There was a problem hiding this comment.
Thanks for the update: the description now states the AI assistance and what was read, and CI is green on b65624d (fmt, both clippy runs, tests, policy, conventions). Approving and merging. The optional items (module doc on where the feature list comes from, probing even when the check is skipped, the error hint, the test that cannot fail) are welcome as a follow-up.
What and why
Check that the host CPU supports the required baseline console ISA features (
SSE4.1,SSE4.2,POPCNT,AVX,AVX2,FMA,F16C,BMI1,BMI2,LZCNT,MOVBE) beforextp run --executestarts a title. If any are missing, stop early with a clear message listing them and explaining how to override the check withXTP_SKIP_CPU_CHECK=1.Console-only instructions that
xtp-loaderalready emulates (CLZERO,MONITORX/MWAITX,RDPRU,RDPID,CLWB,SSE4a) are excluded from the check.Fixes: #13
Depends on: none
Area
apps/xtp(apps/xtp/src/preflight.rs,apps/xtp/src/run.rs,apps/xtp/src/main.rs)README.md(documentXTP_SKIP_CPU_CHECK=1)Tests
cargo xtask pr-checkpasses on my machineUnit tests in
apps/xtp/src/preflight.rsinject a feature probe to verify:AVX2fails with a message namingAVX2andXTP_SKIP_CPU_CHECK;skip = truebypasses missing features;xtp-loaderare not in the required list.Provenance
Written from scratch for XTP using
crates/xtp-loader/src/crash.rs/insn.rsand standard Ruststd::arch::is_x86_feature_detected!. I did not read xcl'slauncher.rs.AI assistance: Antigravity assisted with implementation and unit tests; all changes were reviewed and verified locally with
cargo xtask pr-check.Checklist
<area>: <summary>; one topic; under 400 changed lines, or the reason is above