Skip to content

Task: add runtime-dispatched AVX2 merkle hashing #27

Description

@metaphorics

Parent

#16

What to build

Process independent SHA-256d merkle pairs in 8-way AVX2 batches on supported x86-64 hosts, with the current scalar path as the general tail and unsupported-host implementation. Preserve Bitcoin's exact odd-node duplication and mutated-tree result.

Use current upstream bitcoin_hashes and Bitcoin Core source as the API and algorithm authority before deciding whether project code is necessary. Do not add a dependency or a second abstraction when the standard library intrinsics and the existing merkle interface suffice.

Blocked by

Acceptance criteria

  • Runtime feature detection selects AVX2 safely; non-AVX2 builds and hosts use a scalar fallback with no illegal instruction risk.
  • Scalar and AVX2 outputs are byte-identical for one leaf, every batch tail, odd levels, duplicate adjacent hashes, and the Bitcoin mutated-pair rule.
  • Corpus-wide parity covers every merkle level in blocks 0→150,000 and preserves the accepted stop hash.
  • The hot path performs no per-node heap allocation, avoids needless copies, and batches homogeneous 64-byte pair inputs.
  • A microbenchmark records the hash-kernel gain, but promotion depends on three interleaved full-replay control/candidate pairs under the Task: calibrate allocator parity and freeze the matched 0-150k baseline #24 custody packet.
  • Run the full-replay gate with fjall, rocksdb, and redb to catch contention or backend interaction.
  • Promote only if one whole-process primary axis clears 1.05× and the other axis plus RSS do not materially regress. Otherwise revert and record the falsifier.

Metadata

Metadata

Assignees

Labels

wayfinder:taskPrerequisite task for a decision

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions