Repository navigation
Keccak-f[1600] on Intel Atom: utility scripts, round example and permutation sweep - #476
Draft
magistras42 wants to merge 9 commits into
Draft
magistras42 wants to merge 9 commits into
magistras42 wants to merge 9 commits into
Conversation
Co-authored-by: h2parson <haydenfparsons@icloud.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: h2parson <haydenfparsons@icloud.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: h2parson <haydenfparsons@icloud.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: h2parson <haydenfparsons@icloud.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: h2parson <haydenfparsons@icloud.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: h2parson <haydenfparsons@icloud.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: h2parson <haydenfparsons@icloud.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: h2parson <haydenfparsons@icloud.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: h2parson <haydenfparsons@icloud.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
PR 3 of 3, depending on #475.
These are the scripts we used to explore SLOTHY's split heuristic on Keccak-f[1600] for Intel Atom and to benchmark the results on hardware, plus one optimized round as an example. Following the project structure:
examples/misc/x86_64/, next toexamples/misc/gen_roots.py;examples/naive/x86_64/keccak/;examples/opt/x86_64/keccak/.This PR changes no SLOTHY code.
Changes (commit 1)
examples/naive/x86_64/keccak/x86_mKeccakRound_template.s: one Keccak round, with{iState},{oState},{rc},{lastRound}parameters. It is taken from the SUPERCOP x86_64 implementation by Ronny Van Keer (CC0).examples/naive/x86_64/keccak/x86_mKeccakPermutation_template.s: the full 24-round permutation, reusing the round macro unchanged (CC0, SUPERCOP).examples/misc/x86_64/keccak_round_ex_opts.py: sweeps macro parameters × split-heuristic settings. For each combination it optimizes the round, reruns SLOTHY in fixed order to count stalls, and writes the count at the top of the output file.logging.Handler(StallCounter), so no SLOTHY API change is needed.--memory-offset-constraint, which turns on PR 1's opt-in Atom constraint (intel_atom.memory_offset_constraint).examples/misc/x86_64/keccak_permutation_ex_opts.py: the same sweep over the full permutation. Its options are--rounds(for partial permutations),--max-configsand--output-dir. The per-round split settings are scaled by the number of rounds.examples/misc/x86_64/keccak_splitting.py: a single fixed pipeline: register allocation, then the split heuristic, then the stall count.examples/misc/x86_64/nanobench.py: runs code under nanoBench and parses its counters.to_nanobench_asm()uses the PR 2 translator to turn AT&T code (such as SLOTHY's x86_64 output) into the;-separated Intel string that nanoBench takes, so any SLOTHY output can be measured on hardware.examples/misc/x86_64/thrpt_lat.py: measures the inverse throughput and latency of each instruction form. The Bonnell results are in the "Bonnell measurements" table of #PR1's description; the Atom model was checked against them, andtest_atom_model.pyembeds them.nanoBench needs root and a real CPU, so only its output parsing is tested. Our Keccak benchmarking drivers and raw results stay in our fork. There's no script yet that compares SLOTHY's predicted stalls with measured cycles, but we will create the comparison script and add it in a follow-up PR, if desired.
Results and open questions
x(%rdi)and a load fromx(%rsp)within 8 cycles. The opt-in Atom constraint from PR 1 models this crudely.Tests (commit 2)
tests/naive/x86_64/test_keccak_utilities.py: covers template rendering (including a missing parameter and the full round template), nanoBench output parsing, the nanoBench command line, translation for nanoBench, and the stall counter.tests/naive/x86_64/test_keccak_permutation.py: checks that there are 24 rounds with the right constants, the buffer alternation, the last-round flag and partial permutations, and that the round macro is identical to the round template.example.py --dry-runCI matrix entry forslothy.targets.x86_64.intel_atom.Generated code (commit 3)
examples/naive/x86_64/keccak/keccak_round_rdi_rsp.sand_example.pyproduceexamples/opt/x86_64/keccak/keccak_round_rdi_rsp_opt_atom.s. This is one Keccak round (state inrdi, output to the stack), optimized for Atom with the split heuristic (factor 3, step 1/6, one repetition) and with the opt-in memory constraint on. These are the conditions of the sweep batch in which this setting measured fastest for non-final rounds; without the constraint it was among the slower settings.Commits
Co-authored by Hayden Parsons (@h2parson) and Maggie Simmons.