Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ Without `rtrash` on `PATH`, `clean` and `uninstall` refuse and remove nothing un
## Other commands

- `eb-local check FILE...` prints a binary's loader, `RPATH` or `RUNPATH`, and where each library it needs resolves, ignoring `LD_LIBRARY_PATH`.
- `eb-local audit-isa PATH --target TARGET` disassembles the ELF files under PATH and reports every instruction that needs a CPU feature the EESSI target lacks, per file with counts.
- `eb-local rpath-wrappers` writes RPATH wrappers for the compilers and linkers on `PATH` and prints the lines that put them first.
- `eb-local lmod-cache` writes Lmod's spider cache and a timestamp one second older, so new modules show in `module avail`: [Refresh the Lmod spider cache](docs/howto/refresh-the-module-cache.md).
- `eb-local modulerc` writes the defaults, aliases and hidden versions you name to a module tree's `.modulerc.lua`: [Set module defaults and aliases](docs/howto/set-module-defaults-and-aliases.md).
Expand Down
1 change: 1 addition & 0 deletions changelog.d/+audit-isa.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`eb-local audit-isa PATH --target TARGET` runs `objdump` on the ELF files under PATH. It reports each instruction that needs a CPU feature the EESSI target lacks, per file with counts. It covers x86-64 (AVX-512, AMX) and aarch64 (SVE, SVE2, BF16, I8MM). Packages that choose their instruction set at run time print as dispatch and do not fail the audit; `--allow FILE` replaces that list. Exit 0 means clean, 1 means an instruction exceeds the target, and 2 means a usage or tool error.
52 changes: 50 additions & 2 deletions docs/orgmode/reference/cli.org
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ eb-local [OPTION]... leave
eb-local rpath-wrappers [--for FAMILY | --unwrapped]
eb-local check [--recursive] [--quiet] [--json] FILE...
eb-local check (--module NAME/VERSION... | --dev | --prefix DIR) [--recursive] [--quiet] [--json]
eb-local audit-isa PATH --target TARGET [--json] [--allow FILE] [--objdump PATH]
eb-local [OPTION]... submit [--on NAME,...] [--print] <easyconfig> [eb options]
eb-local [OPTION]... list [--json | --missing] [NAME[/VERSION]...]
eb-local [OPTION]... doctor [--json] [--strict] [--workspace PATH] [--cvmfs] [--cvmfs-parallel N] [--mpi] [--profiling]
Expand Down Expand Up @@ -97,6 +98,13 @@ directory you own.
the same for every ELF file in those installations,
the dev tree, or DIR; a file that is not ELF is skipped.
--quiet prints a file only when it has a problem
eb-local audit-isa PATH --target TARGET [--json] [--allow FILE] [--objdump PATH]
every instruction under PATH that needs a CPU feature
TARGET, an EESSI subdirectory such as x86_64/amd/zen3
or aarch64/neoverse_n1, lacks, per ELF file, with counts;
exit 1 when there is one. --allow FILE replaces the list
of packages with run-time dispatch; --objdump names the
disassembler
eb-local submit [--on NAME,...] [--print] <easyconfig> [eb options]
one batch job per node type the site file lists
in build.node_types, each building the recipe for
Expand Down Expand Up @@ -457,6 +465,46 @@ It exits 0 when there are no problems, 1 when there are, and 2 when a named file
A file that is not ELF is not a failure of a tree audit.
With =--json=, these codes are unchanged; only the summary on stdout is JSON.

** audit-isa

For each ELF file under =PATH=, an installed software prefix or one file, run =objdump= on it and print every instruction that needs a CPU feature the =TARGET= does not have, per file and feature, with a count, the address of the first one and its text.
=TARGET= is an EESSI software subdirectory: =x86_64/generic=, =x86_64/amd/zen2= to =zen5=, =x86_64/intel/haswell=, =skylake_avx512=, =cascadelake=, =icelake=, =sapphirerapids=, =aarch64/generic=, =neoverse_n1=, =neoverse_v1=, =neoverse_v2=, =a64fx=, =nvidia/grace=, =google/axion= and =aws/graviton2= to =graviton4=.
A trailing part of a subdirectory that only one ends with, such as =zen3= or =intel/icelake=, names it too.

#+begin_example
$ eb-local audit-isa /apps/software/GROMACS/2025.4 --target x86_64/amd/zen3
eb-local audit-isa: target x86_64/amd/zen3, 14 ELF files, 3790170 instructions
violation: avx512f x139682 in /apps/software/GROMACS/2025.4/lib64/libgromacs.so, first at 0x1a2b40: vaddps zmm0,zmm1,zmm2
eb-local audit-isa: 139682 zmm instructions
eb-local audit-isa: 139682 instruction(s) beyond x86_64/amd/zen3 in 1 file(s)
#+end_example

| Option | Meaning |
|------------------+-----------------------------------------------------------------------------------------------------------------------------------|
| =--target= | The CPU target to audit against. Required. |
| =--json= | One line of JSON with =schema_version= 1 and =kind= =audit-isa=. The shape is in [[file:json/audit-isa.schema.json][audit-isa.schema.json]]. |
| =--allow FILE= | Replace the list of packages with run-time dispatch. One =PACKAGE feature[,feature...]= per line; =#= starts a comment. |
| =--objdump PATH= | The disassembler, a name on =PATH= or a path. Without it, the first candidate for the file's architecture that reads it. |

Each instruction's mnemonic, encoding (legacy, VEX, EVEX or XOP) and the widest vector register it names select the CPU features it needs from a table generated from the iced-x86 instruction database.
On aarch64 the table is a list of mnemonic and operand rules for SVE, SVE2, BF16, I8MM, dot product, atomics, crypto, half-precision and pointer authentication outside the hint space.
The features of each target come from archspec's =microarchitectures.json= and, for x86-64, from the features GCC's =-march= option enables for the same CPU.
The sources and their versions are in the header of =src/isa/targets.tsv=; =tools/isa_tables/gen.py= writes the tables.
The shadow-stack instructions =RDSSP= and =INCSSP=, which run as no-operations without a shadow stack, are not violations.
A feature the tables cannot judge, and a vector mnemonic they do not list, are printed as =unclassified= and never fail the audit.

Code that selects its instruction set at run time holds wider instructions behind a CPU check.
A violation on a listed feature in a file under =/software/PACKAGE/= is printed as =dispatch=, counted apart, and does not fail the audit.
The default list, from audits of EESSI trees, names TBB and libomp (RTM, WAITPKG), FFmpeg and x264 (FMA4, XOP), zlib's zlib-ng kernels (AVX-512), OpenSSL, libfabric's DSA provider, NumPy's dispatch kernels and others; =--allow= replaces it.

The audit reads which instructions the file holds, not the vector length an SVE program runs with.
It decodes executable sections linearly, so data inside one can show as an instruction.
It needs an =objdump= that reads the file's architecture: binutils' =objdump= (=objdump -i= lists =elf64-x86-64= or =elf64-littleaarch64=), =aarch64-linux-gnu-objdump=, or =llvm-objdump=.
Files of the other architecture, files that are not ELF, and symbolic links are skipped.

It exits 0 when no instruction exceeds the target, 1 when one does, and 2 when the command line is wrong, no disassembler reads the architecture, or =objdump= fails on a file.
With =--json= the codes are the same.

** submit

Send one batch job for each node type in =build.node_types=, each running this eb-local with the same easyconfig, options and configuration.
Expand Down Expand Up @@ -700,8 +748,8 @@ A value with a quote, a backslash or a control character is refused.
| Status | Meaning |
|---------+-------------------------------------------------------------------------------------------------------------------------------------------------|
| 0 | Done, or nothing to do. |
| 1 | =check= found a problem; =doctor= printed a =FAIL=; =config --check= could not read a secret or use the project directory; =lmod-cache --verify= failed or =lmod-cache --prefix= found no target; =modulerc --check= would update the file; =overlay materialize --check= would update the outputs; =clean= or =uninstall= had something to remove and no way to, or =clean= failed to remove some items or build workspaces; =rpath-wrappers= found nothing to wrap; =submit=: =sbatch= refused a job. |
| 2 | Refused, with the reason on stderr after =eb-local:=, or the command line was wrong; a build outside a Slurm job; =check= could not read a file. |
| 1 | =check= found a problem; =doctor= printed a =FAIL=; =config --check= could not read a secret or use the project directory; =lmod-cache --verify= failed or =lmod-cache --prefix= found no target; =modulerc --check= would update the file; =overlay materialize --check= would update the outputs; =clean= or =uninstall= had something to remove and no way to, or =clean= failed to remove some items or build workspaces; =audit-isa= found an instruction beyond the target; =rpath-wrappers= found nothing to wrap; =submit=: =sbatch= refused a job. |
| 2 | Refused, with the reason on stderr after =eb-local:=, or the command line was wrong; a build outside a Slurm job; =check= could not read a file; =audit-isa= found no disassembler for the architecture or =objdump= failed. |
| 3 | =eb= or =--explain eb=: more than one install variable is set. |
| N | A build or =eb=: =eb= exited N. |

Expand Down
70 changes: 70 additions & 0 deletions docs/orgmode/reference/json/audit-isa.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "eb-local audit-isa --json",
"type": "object",
"required": ["schema_version", "kind", "target", "arch", "files_audited", "files_skipped", "instructions", "zmm", "violation_count", "dispatch_count", "failed", "files", "unclassified", "errors"],
"properties": {
"schema_version": { "const": 1 },
"kind": { "const": "audit-isa" },
"target": { "type": "string" },
"arch": { "enum": ["x86_64", "aarch64"] },
"files_audited": { "type": "integer", "minimum": 0 },
"files_skipped": { "type": "integer", "minimum": 0 },
"instructions": { "type": "integer", "minimum": 0 },
"zmm": { "type": "integer", "minimum": 0 },
"violation_count": { "type": "integer", "minimum": 0 },
"dispatch_count": { "type": "integer", "minimum": 0 },
"failed": { "type": "boolean" },
"files": {
"type": "array",
"items": {
"type": "object",
"required": ["path", "instructions", "zmm", "findings"],
"properties": {
"path": { "type": "string" },
"instructions": { "type": "integer", "minimum": 0 },
"zmm": { "type": "integer", "minimum": 0 },
"findings": {
"type": "array",
"items": {
"type": "object",
"required": ["feature", "count", "address", "instruction", "dispatch"],
"properties": {
"feature": { "type": "string" },
"count": { "type": "integer", "minimum": 1 },
"address": { "type": "string" },
"instruction": { "type": "string" },
"dispatch": { "type": "boolean" }
},
"additionalProperties": false
}
}
},
"additionalProperties": false
}
},
"unclassified": {
"type": "array",
"items": {
"type": "object",
"required": ["name", "kind", "count"],
"properties": {
"name": { "type": "string" },
"kind": { "enum": ["feature", "mnemonic"] },
"count": { "type": "integer", "minimum": 1 }
},
"additionalProperties": false
}
},
"errors": {
"type": "array",
"items": {
"type": "object",
"required": ["path", "message"],
"properties": { "path": { "type": "string" }, "message": { "type": "string" } },
"additionalProperties": false
}
}
},
"additionalProperties": false
}
52 changes: 50 additions & 2 deletions docs/reference/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ eb-local [OPTION]... leave
eb-local rpath-wrappers [--for FAMILY | --unwrapped]
eb-local check [--recursive] [--quiet] [--json] FILE...
eb-local check (--module NAME/VERSION... | --dev | --prefix DIR) [--recursive] [--quiet] [--json]
eb-local audit-isa PATH --target TARGET [--json] [--allow FILE] [--objdump PATH]
eb-local [OPTION]... submit [--on NAME,...] [--print] <easyconfig> [eb options]
eb-local [OPTION]... list [--json | --missing] [NAME[/VERSION]...]
eb-local [OPTION]... doctor [--json] [--strict] [--workspace PATH] [--cvmfs] [--cvmfs-parallel N] [--mpi] [--profiling]
Expand Down Expand Up @@ -99,6 +100,13 @@ directory you own.
the same for every ELF file in those installations,
the dev tree, or DIR; a file that is not ELF is skipped.
--quiet prints a file only when it has a problem
eb-local audit-isa PATH --target TARGET [--json] [--allow FILE] [--objdump PATH]
every instruction under PATH that needs a CPU feature
TARGET, an EESSI subdirectory such as x86_64/amd/zen3
or aarch64/neoverse_n1, lacks, per ELF file, with counts;
exit 1 when there is one. --allow FILE replaces the list
of packages with run-time dispatch; --objdump names the
disassembler
eb-local submit [--on NAME,...] [--print] <easyconfig> [eb options]
one batch job per node type the site file lists
in build.node_types, each building the recipe for
Expand Down Expand Up @@ -461,6 +469,46 @@ It exits 0 when there are no problems, 1 when there are, and 2 when a named file
A file that is not ELF is not a failure of a tree audit.
With `--json`, these codes are unchanged; only the summary on stdout is JSON.

### audit-isa

For each ELF file under `PATH`, an installed software prefix or one file, run `objdump` on it and print every instruction that needs a CPU feature the `TARGET` does not have, per file and feature, with a count, the address of the first one and its text.
`TARGET` is an EESSI software subdirectory: `x86_64/generic`, `x86_64/amd/zen2` to `zen5`, `x86_64/intel/haswell`, `skylake_avx512`, `cascadelake`, `icelake`, `sapphirerapids`, `aarch64/generic`, `neoverse_n1`, `neoverse_v1`, `neoverse_v2`, `a64fx`, `nvidia/grace`, `google/axion` and `aws/graviton2` to `graviton4`.
A trailing part of a subdirectory that only one ends with, such as `zen3` or `intel/icelake`, names it too.

```text
$ eb-local audit-isa /apps/software/GROMACS/2025.4 --target x86_64/amd/zen3
eb-local audit-isa: target x86_64/amd/zen3, 14 ELF files, 3790170 instructions
violation: avx512f x139682 in /apps/software/GROMACS/2025.4/lib64/libgromacs.so, first at 0x1a2b40: vaddps zmm0,zmm1,zmm2
eb-local audit-isa: 139682 zmm instructions
eb-local audit-isa: 139682 instruction(s) beyond x86_64/amd/zen3 in 1 file(s)
```

| Option | Meaning |
|---|---|
| `--target` | The CPU target to audit against. Required. |
| `--json` | One line of JSON with `schema_version` 1 and `kind` `audit-isa`. The shape is in [audit-isa.schema.json](json/audit-isa.schema.json). |
| `--allow FILE` | Replace the list of packages with run-time dispatch. One `PACKAGE feature[,feature...]` per line; `#` starts a comment. |
| `--objdump PATH` | The disassembler, a name on `PATH` or a path. Without it, the first candidate for the file's architecture that reads it. |

Each instruction's mnemonic, encoding (legacy, VEX, EVEX or XOP) and the widest vector register it names select the CPU features it needs from a table generated from the iced-x86 instruction database.
On aarch64 the table is a list of mnemonic and operand rules for SVE, SVE2, BF16, I8MM, dot product, atomics, crypto, half-precision and pointer authentication outside the hint space.
The features of each target come from archspec's `microarchitectures.json` and, for x86-64, from the features GCC's `-march` option enables for the same CPU.
The sources and their versions are in the header of `src/isa/targets.tsv`; `tools/isa_tables/gen.py` writes the tables.
The shadow-stack instructions `RDSSP` and `INCSSP`, which run as no-operations without a shadow stack, are not violations.
A feature the tables cannot judge, and a vector mnemonic they do not list, are printed as `unclassified` and never fail the audit.

Code that selects its instruction set at run time holds wider instructions behind a CPU check.
A violation on a listed feature in a file under `/software/PACKAGE/` is printed as `dispatch`, counted apart, and does not fail the audit.
The default list, from audits of EESSI trees, names TBB and libomp (RTM, WAITPKG), FFmpeg and x264 (FMA4, XOP), zlib's zlib-ng kernels (AVX-512), OpenSSL, libfabric's DSA provider, NumPy's dispatch kernels and others; `--allow` replaces it.

The audit reads which instructions the file holds, not the vector length an SVE program runs with.
It decodes executable sections linearly, so data inside one can show as an instruction.
It needs an `objdump` that reads the file's architecture: binutils' `objdump` (`objdump -i` lists `elf64-x86-64` or `elf64-littleaarch64`), `aarch64-linux-gnu-objdump`, or `llvm-objdump`.
Files of the other architecture, files that are not ELF, and symbolic links are skipped.

It exits 0 when no instruction exceeds the target, 1 when one does, and 2 when the command line is wrong, no disassembler reads the architecture, or `objdump` fails on a file.
With `--json` the codes are the same.

### submit

Send one batch job for each node type in `build.node_types`, each running this eb-local with the same easyconfig, options and configuration.
Expand Down Expand Up @@ -704,8 +752,8 @@ A value with a quote, a backslash or a control character is refused.
| Status | Meaning |
|---|---|
| 0 | Done, or nothing to do. |
| 1 | `check` found a problem; `doctor` printed a `FAIL`; `config --check` could not read a secret or use the project directory; `lmod-cache --verify` failed or `lmod-cache --prefix` found no target; `modulerc --check` would update the file; `overlay materialize --check` would update the outputs; `clean` or `uninstall` had something to remove and no way to, or `clean` failed to remove some items or build workspaces; `rpath-wrappers` found nothing to wrap; `submit`: `sbatch` refused a job. |
| 2 | Refused, with the reason on stderr after `eb-local:`, or the command line was wrong; a build outside a Slurm job; `check` could not read a file. |
| 1 | `check` found a problem; `doctor` printed a `FAIL`; `config --check` could not read a secret or use the project directory; `lmod-cache --verify` failed or `lmod-cache --prefix` found no target; `modulerc --check` would update the file; `overlay materialize --check` would update the outputs; `clean` or `uninstall` had something to remove and no way to, or `clean` failed to remove some items or build workspaces; `audit-isa` found an instruction beyond the target; `rpath-wrappers` found nothing to wrap; `submit`: `sbatch` refused a job. |
| 2 | Refused, with the reason on stderr after `eb-local:`, or the command line was wrong; a build outside a Slurm job; `check` could not read a file; `audit-isa` found no disassembler for the architecture or `objdump` failed. |
| 3 | `eb` or `--explain eb`: more than one install variable is set. |
| N | A build or `eb`: `eb` exited N. |

Expand Down
Loading
Loading