Skip to content

perf: AVX2 queries + bit_view const_cast elimination - #3

Merged
LessUp merged 1 commit into
masterfrom
optimize-avx2-queries-and-hardening
Jul 1, 2026
Merged

perf: AVX2 queries + bit_view const_cast elimination#3
LessUp merged 1 commit into
masterfrom
optimize-avx2-queries-and-hardening

Conversation

@LessUp

@LessUp LessUp commented Jul 1, 2026

Copy link
Copy Markdown
Owner

AVX2-accelerate popcount/is_zero/equals (4-word chunks, scalar tail, constexpr preserved). Eliminate bit_view const_cast by decoupling from const_bit_view inheritance. Add deterministic matrices for bit_or/xor/andnot, shift(0) no-op test, constexpr query static_assert.

Test plan: Release build + ctest passed, ASan+UBSan clean, strict warnings clean.

Generated with Devin

…view const_cast

Route popcount, is_zero, and equals through the AVX2 dispatch seam at
runtime (4-word chunks with scalar tail) while preserving the scalar
constexpr path via if consteval. popcount uses a LUT + _mm256_sad_epu8
strategy; is_zero uses _mm256_testz_si256; equals uses _mm256_cmpeq_epi64
+ _mm256_testc_si256.

Eliminate the bit_view::data() const_cast by decoupling bit_view from
const_bit_view inheritance. bit_view now stores uint64_t* directly and
provides an implicit conversion to const_bit_view, keeping the mutable
pointer type honest without runtime cost.

Add deterministic matrices for bit_or, bit_xor, and bit_andnot (128-bit),
a shift(0) no-op regression test, and a constexpr static_assert covering
popcount/is_zero/equals to guard the if consteval scalar path.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@LessUp
LessUp merged commit 2bff636 into master Jul 1, 2026
2 checks passed
@LessUp
LessUp deleted the optimize-avx2-queries-and-hardening branch July 1, 2026 11:08
LessUp added a commit that referenced this pull request Jul 11, 2026
…ed detail

Resolve merge between local peripheral-cut + detail-collapse and remote PR #3
(AVX2-accelerate popcount/is_zero/equals, eliminate bit_view const_cast).

- bit_view.hpp: take remote version (standard const/non-const data() overload
  pair) over local single-const-returning-mutable variant.
- word_ops.hpp: keep local 3-file collapse (scalar_impl + x64_dispatch merged
  in), but port remote's popcount_x64/is_zero_x64/equals_x64/popcount_bytes_avx2
  into the single header so the auto-merged if-consteval wrappers resolve.
- CHANGELOG.md: merge both [未发布] sections into one Chinese block (single-
  language policy), fold remote perf/test entries.
- CHANGELOG.zh-CN.md + x64_dispatch.hpp: stay deleted (single-lang + collapse).
- tests: accept remote auto-merged additions (or/xor/andnot matrices, shift(0)
  regression, constexpr static_asserts).

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant