Repository navigation
fix(parquet/utils): make unpack32 NEON profiler-safe - #1300
Merged
Merged
Conversation
Signed-off-by: Matt Topol <[email protected]>
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.
Rationale for this change
Addresses the
_unpack32_neonpart of #983 following the regeneration approach outlined in #983 (comment).The previous assembly repurposed Go's reserved registers (R18 platform, R27 REGTMP, R28
g) and adjusted SP through opaqueWORDdirectives, so the assembler's pcsp tables were wrong andsigprofcould observe a clobberedg— truncated/invalid tracebacks, and a crash withCGO_ENABLED=0.What changes are included in this PR?
bit_packing_neon_arm64.sfrom_lib/bit_packing_neon.cwith-ffixed-x18 -ffixed-x27 -ffixed-x28 -fomit-frame-pointer(per the issue comment, plus omitting the frame). The result is a leaf function with zero stack usage and zero reserved-register usage: constants load viaVMOVQpseudo-instructions and every branch is a real Go branch instruction, so unwind state is always valid._lib/neon2goasm.py, which converts the compiled ELF object into the Go assembly and rejects any instruction touching SP or a reserved register, plus amake bit_packing_neon_arm64.srule (C_FLAGS_NEON_GOASM) so regeneration is reproducible.<string.h>include so the C compiles freestanding for cross-generation.BenchmarkUnpack32(from the issue) so the packed-decode fast path is exercised under-cpuprofile._lib/README.md.Verification
VMOVQconstants resolved and compared against.rodata) — no differences besides the parameter/return glue.go test ./parquet/internal/utils(native NEON),-race,-tags noasm, andgo test -tags assert ./parquet/...all pass on Apple Silicon.CGO_ENABLED=0 go test -bench BenchmarkUnpack32 -cpuprofileno longer crashes, and profiles now show full caller chains:BenchmarkUnpack32, Apple M4).Are there any user-facing changes?
No API changes. CPU profiles of workloads that hit the ARM64 packed decoder are now correct.
Note:
unpack_bool_neon_arm64.shas a smaller instance of the same pattern (oneWORD-encodedstpwith SP writeback); left for a follow-up to keep this reviewable.