Repository navigation
Record who else was on the machine, and say the platform out loud - #8
Merged
Merged
Conversation
Three things that came out of the 7800X3D investigation, in one commit because they came out of one conversation. `interference` in the document: kernel pressure numbers, the load average, and the runnable processes at the start and the end of a run. A cell moved by a factor of three on one machine, and I cleared the run of interference on the strength of a load average that the benchmark was producing itself — the cell used eight threads, and eight threads for two and a half seconds every twenty-nine accounts for most of the 1.15 I logged as "flat". A load average taken during a run is a poor instrument for "was anything else here"; PSI is the kernel's answer to that question and costs two reads. It samples at the two ends of a run, so it cannot see a process that arrived between two cells and left, and the README says that rather than implying more. The CPU index in `/proc/<pid>/stat` took three attempts to get right and deserves its place in the commit message: field 37 is the processor, and the field before it is `exit_signal`, which is 17 on every ordinary process on Linux. My first two attempts both read a plausible CPU number. Verified by hand with `taskset -c 5` and `taskset -c 9`, which report 5 and 9, and pinned afterwards by a test. The test that pins the thread and waits for the kernel to catch up is not in here: it passed alone and failed in a full-suite run, which is a red light that depends on what ran before it. `compile_error!` for anything that is not Linux, and a Platform section in the README. membench does not build for macOS, and `cargo check --target aarch64-apple-darwin` explains that as fourteen unresolved `libc` names — `sched_setaffinity`, `cpu_set_t`, `MAP_HUGETLB` — which all point back to three decisions about where detection reads and how buffers are asked for. One sentence says it better. CI gains an AArch64 clippy pass over `--all-targets` before the existing cross build. That is what noticed the two dead-code warnings on the previous branch; without it, cfg drift in AArch64 test code and dead code that only exists on one architecture both pass review.
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.
Three things came out of the 7800X3D thread and they are in one branch because they came out of one conversation.
1.
interferencein the exported documentKernel pressure numbers, load average, and the runnable processes at the start and end of a run:
It exists because of a specific mistake I made: I cleared a run of interference on the strength of a load average of 1.15, taken while the benchmark was producing that load itself. The L3 cell uses eight threads, and eight threads for two and a half seconds out of every twenty-nine accounts for most of the 1.15. A load average taken during a run is a poor instrument for "was anything else here", so the document now carries the kernel's own answer (PSI
some avg10) alongside it rather than leaving the reader with only the number I got wrong.This would not have caught the thing that motivated it, and the README says so. Two
yesprocesses spinning on this twelve-core box leavecpu someat0.0— measured, not reasoned — because nothing is waiting for a core. The warning fires on stalls, not on how many things are awake, because as far as the kernel is concerned a machine with spare cores is not contended. So the field is an instrument, not a verdict: the list of runnable processes is there for a human to weigh, and the thresholds deliberately do not pretend to have judged it.Two samples, at either end of the run, before and after the last measurement. It cannot see a process that arrived between two cells and left, and PSI is a rolling ten-second average, so "coarse" is the right word for it.
The CPU number in
/proc/<pid>/stattook me three attempts and belongs in the record. It is the thirty-seventh field after the comm, and the one before it isexit_signal, which is 17 for every ordinary process on Linux, so both my wrong attempts printed a plausible CPU number on a twelve-CPU machine instead of failing. What settled it wastaskset: a process pinned to CPU 5 reports 5 there and pinned to 9 reports 9. The test that pins a thread and waits for the kernel to catch up is not in this branch — it passed on its own and failed inside a full-suite run, which is a red light that depends on what ran before it, and I am not adding one of those.schema_versionstays at 2. The field is#[serde(default)], so a document written before it existed loads withNoneand the old runs stay comparable; a version bump would have thrown away exactly the comparisons this is for.Cost, measured against the binary from before this change, five identical
--level l1 --only read --trials 1 --duration-ms 20runs on a box with 115 processes: 680 ms before, 667 ms after. That is the two/procwalks disappearing into noise, not a speed-up claim.2. Platform: Linux, said once
cargo check --target aarch64-apple-darwinfails with fourteen unresolved names —sched_setaffinity,cpu_set_t,sched_getcpu,sched_setscheduler,MAP_HUGETLB,MADV_HUGEPAGEand friends. They are all the same three decisions: detection reads/procand/sys, threads are pinned withsched_setaffinity, buffers ask the kernel for huge pages. The measured loops are not the platform-specific part; a port is an operating-system project. So there is now acompile_error!that says that in one sentence, and a Platform note at the top of Build.3. CI now lints the AArch64 tests
scripts/ci.shgainedcargo clippy --target aarch64-unknown-linux-gnu --workspace --all-targets -- -D warningsahead of the existing cross build. That step is what found two dead-code warnings on the previous branch — cfg drift in code that only exists on one architecture, and#[cfg(test)]blocks the host gates never compile, because there is no ARM runner and there isn't going to be one for this. The cross build stays: clippy stops short of codegen, and codegen is the only thing that parses inline asm.scripts/ci.shis green end to end including the new step: 116 core + 23 binary tests, both debug and release. The report-only external comparison still reports its five cells over the gate, unchanged, on a loaded host.