uschindler commented on PR #15341: URL: https://github.com/apache/lucene/pull/15341#issuecomment-3718477721
> I [asked Claude](https://claude.ai/share/87a3a62c-94d3-488e-b9ff-4d2fd846cb2b) if there's any way to query the local CPU to ask it how much it cares about virtual memory pointer alignment for its SIMD implementations -- it gave lots of interesting ideas, but no smoking gun / simple API. > > It did say we could use `perf stat -e alignment-faults ./your_program` which is cool -- I didn't know perf counts misaligned access! Sheesh. Hmm, but it is a "[Software event](https://perfwiki.github.io/main/tutorial/)" -- not sure if misaligned SIMD counts? ([Gemini thinks so](https://share.google/aimode/pwhof7l30nrQeMxmv)). And you can apparently ask Linux kernel to become brittle (give you a `SIGBUS`, like the good old Sparcstation days!) when your program does this, [according to Gemini](https://share.google/aimode/pwhof7l30nrQeMxmv): > > ``` > Performance Impact: Alignment faults can involve thousands of extra instructions for the kernel to resolve, leading to a substantial slowdown. If performance is critical, you should investigate and correct the source of the unaligned accesses in your code, likely involving ensuring proper data structure packing or using the prctl(PR_UNALIGN_SIGBUS) setting to generate a SIGBUS signal for easier debugging. > ``` You can also change the type declarations at beginning of MemorySegmentIndexInput to disallow unaligned accesses to memory segments (of course this is like the kernel not for SIMD, but to ensure long accesses only on long aligned addresses). If you enable this in MMAP for us, no test ever passes :-) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
