Repository navigation
feat :: audit-isa reports instructions a CPU target cannot run - #450
Merged
Merged
Conversation
tools/isa_tables/gen.py writes the x86-64 mnemonic-to-feature table from iced-x86, the aarch64 mnemonic rules, and the feature set of each EESSI CPU target from archspec-json plus the GCC -march macros. The default allow list of runtime-dispatch packages ships beside them.
… a CPU target src/isa_audit.zig runs objdump on each ELF file under a prefix, maps each mnemonic, encoding and vector width to the features it needs, and reports the features the EESSI target lacks per file with counts. Runtime-dispatch packages in the allow list are reported as dispatch. Exit 0 when clean, 1 for a violation, 2 on usage or tool errors.
…fer, and report work-directory errors by name
cli.md links json/audit-isa.schema.json, as it links the other schemas, but only the org source tree had the file, so the pages build stopped on a missing cross-reference target.
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.
feat :: audit-isa reports instructions a CPU target cannot run
eb-local audit-isa PATH --target TARGET [--json] [--allow FILE] [--objdump PATH]runsobjdumpon every ELF file under PATH and prints, per file and feature, each instruction that needs a CPU feature the TARGET lacks, with a count and the first address.x86_64/generic,x86_64/amd/zen2tozen5,x86_64/intel/{haswell,skylake_avx512,cascadelake,icelake,sapphirerapids},aarch64/{generic,neoverse_n1,neoverse_v1,neoverse_v2,a64fx},aarch64/nvidia/grace,aarch64/google/axion,aarch64/aws/graviton{2,3,4}. A unique trailing part (zen3) works too.objdumpfailure.--jsonkeeps the codes.tools/isa_tables/gen.py). The report counts zmm instructions.RDSSPandINCSSPare not violations.microarchitectures.jsonplus, for x86-64, the features GCC's-marchenables for the same CPU. Sources and versions are in the header ofsrc/isa/targets.tsv.src/isa/dispatch-allow.txt. A violation on a listed feature under/software/PACKAGE/prints asdispatchand does not fail.--allow FILEreplaces the list.unclassifiedand never fails.The code is in
src/isa_audit.zig;main.zigonly dispatches. Docs: theaudit-isasection of the command reference,audit-isa.schema.json, a README line and a changelog entry.Evidence
zig build unit): mnemonic to feature for x86-64 (EVEX zmm against ymm, VEX, XOP, BMI, assembler aliases) and aarch64 (SVE, SVE2, BF16, I8MM, LSE, FP16, hint-space PAC), target sets (zen3 has no AVX-512; zen4 has AVX-512 and BF16 but not VP2INTERSECT or FP16; icelake lacks BF16 and CLZERO, zen4 lacks SGX), objdump line parsing for both architectures, the allow list.tests/test_audit_isa.py: recorded disassembly through a stand-inobjdumpfor exit codes, per-feature counts, dispatch,--allow,--jsonagainst the schema, skipped architectures andobjdumpfailure; and objects built withzig cc(-mcpu=znver4 -mprefer-vector-width=512andznver3,neoverse_v1SVE andneoverse_n1) audited with the hostobjdump, with exit 2 and the named reason where the hostobjdumpcannot read the architecture.znver4object failsx86_64/amd/zen3with AVX512F and passesx86_64/amd/zen4; aznver3object passes both.x86_64/amd/zen3: AVX-512 families in all three, XOP and FMA4 in libavcodec and libcrypto (their CPU-dispatch code).The command line is the one a CPU-target build step can call after a masked build:
eb-local audit-isa <prefix> --target <target>, nonzero exit on failure.Stack
Base:
develop. This is the first of three PRs that merge in this order:feat/isa-audit(this one),feat/cpu-target,feat/cpu-target-vm. Each later branch contains this one anddevelop, so the three merge without conflicts. This PR contains nothing from the other two.avx512f,avx512bw,avx512dq,avx512vlandavx512vnni: zlib 2.3 is zlib-ng, whosefunctable.candarch/x86/x86_features.cpick AVX-512 adler32, crc32, chunkset, compare256 and slide_hash kernels from a CPUID check at first use. A zen3-masked build ofzlib-2.3.2-GCCcore-15.2.0passes its audit withdispatchlines.End-to-end evidence (Zen 5 host, EESSI 2026.06,
audit-isabuilt from this branch)zlib-2.3.2-GCCcore-15.2.0, built under thex86_64/amd/zen3mask, audited againstx86_64/amd/zen3: exit 0,dispatch: avx512f x204,avx512bw x81,avx512vl x73,avx512dq x9,avx512vnni x6inlibz.so.1.3.1.zlib-ng, thenno instruction beyond x86_64/amd/zen3. The zen4-built tree against zen3: exit 0 with the same five features asdispatch.-march=native(ebl-vec): the zen3-built tree passes against zen3 and zen4 (exit 0, 79 instructions); the zen4-built tree againstx86_64/amd/zen3exits 1 withviolation: avx512f x2,avx512dq x2,avx512vl x3,avx512vpopcntdq x2; against zen4 it exits 0.bzip2-1.0.8-GCCcore-15.2.0(no run-time dispatch): the zen4-builtbunzip2andbzcatfail against zen3 withavx512f x486,avx512bw x113,avx512vl x307,avx512dq x46,avx512vbmi x4(exit 1); the zen3-built tree passes against zen3 and zen4.zig build unit: 189 tests pass.zig build -Dtest-ops=true test: the same 43 failure lines asdevelopon this host, none new. CI: zig and shellcheck green (runs 45916897576 and 45916897568).