Repository navigation
Conversation
ce1a7d1 to
b11c29a
Compare
|
|
||
| // SSE2 is part of the x86-64 baseline, so it needs no extra compiler flags. | ||
| // Define ICEBERG_MUMBLING_SSE2=0 to force the portable scalar code. | ||
| #if !defined(ICEBERG_MUMBLING_SSE2) && (defined(__SSE2__) || defined(_M_X64)) && \ |
There was a problem hiding this comment.
Should we leverage https://github.com/xtensor-stack/xsimd or https://github.com/google/highway to make it more portable? Since I don't expect we will have more SIMD code in the near future, I'm fine to keep it simple for now.
There was a problem hiding this comment.
I think that would be a discussion to have. They are big dependency to pull in and I feel we can defer this decision to later when we have more SIMD code. We could probably extract a SIMD kernel library later and then see what can be benefited from re-using some of the existing library.
| // Compare 32 bytes at once when they are all inside the buffer (every | ||
| // container except those in the last 31 bytes of the bitmap). | ||
| if (containers_data_.size() - offset >= kDenseLength) { | ||
| #if ICEBERG_MUMBLING_SSE2 |
There was a problem hiding this comment.
Do you want to add a NEON equivalent?
There was a problem hiding this comment.
I don't have a NEON equivalent for now. Will need to setup new hardware for testing. Can we track that as a separate follow up? Probably at some point, we just going to extend the intrinsics to ARM.
Add an internal reader for the Mumbling bitmap format, which v4 manifest deletion vectors use (manifest_info.dv, tracking.deleted_positions and tracking.replaced_positions). The spec is still a draft, so the header is internal and not installed. MumblingBitmapView wraps the serialized bytes without copying them and supports Contains() and Cardinality(). Make() validates everything that memory safety depends on, so lookups never read out of bounds. Test: - New unit tests in util_test (mumbling_bitmap_internal_test.cc) cover the spec examples, Java-generated fixtures and malformed input. - The full test suite passes on both the SSE2 and the portable lookup path, and the new tests pass under ASan and UBSan. - New microbenchmarks in src/iceberg/benchmark (mumbling_bitmap_benchmark, built with -DICEBERG_BUILD_BENCHMARKS=ON).
Use KeepRunning() loops and an explicit main() in the benchmark (as in benchmark_smoke.cc), std::cmp_less for signed/unsigned comparisons, and std::array instead of a C array in the test.
Decode once before the timing loop in BM_PforDecode and BM_Make and call SkipWithError on failure, so a decode error can't show up as a speedup.
State that data and out must not overlap, and list the structural and range errors DecodePforBytes returns. Padding bits are ignored.
Only the header needs the internal suffix.
a4d65f0 to
5425423
Compare
Closes #1125. Part of #1107.
Adds an internal reader for the Mumbling bitmap format (a draft spec, apache/iceberg#16518), which v4 manifest deletion vectors use (
manifest_info.dv,tracking.deleted_positionsandtracking.replaced_positions). Because the spec is a draft, the header isutil/mumbling_bitmap_internal.hand isn't installed.MumblingBitmapView::Make()wraps the serialized bytes without copying them. In scan planning those bytes belong to the root manifest entry, which outlives the planning of its leaf manifest.Make()checks the header, the PFOR-encoded descriptor array (Appendix A), the descriptor types, and the container sizes against the buffer, soContains()never reads out of bounds. Like the Java reader, it doesn't validate container contents. Sparse-container lookups use SSE2 on x86-64 and a portable SWAR search elsewhere; no compiler flags are added.Tests cover the spec examples, malformed input (including the vectors from Java's
TestMumblingBitmap), and the Java-generated fixtures from apache/iceberg-go#1750.mumbling_bitmap_benchmark(built with-DICEBERG_BUILD_BENCHMARKS=ON) measures decoding and lookups.Benchmark against the Java reader on the same input bytes (Release; gcc-14 with Google Benchmark, JDK 17 with JMH; Xeon Platinum 8175M):
Make, 100,000 random positionsMake, all 2,097,152 positionsContains, 4,096 probes, 100,000 random positionsContains, 4,096 probes, all positionsTest:
the spec examples, Java-generated fixtures and malformed input.
path, and the new tests pass under ASan and UBSan.
(mumbling_bitmap_benchmark, built with -DICEBERG_BUILD_BENCHMARKS=ON).