build: support building on POWER/ppc64 and other non-x86 targets - #331
build: support building on POWER/ppc64 and other non-x86 targets#331Scottcjn wants to merge 1 commit into
Conversation
The GNU/Clang path always added -march=native, which POWER gcc rejects (it uses -mcpu=native). Probe both with check_cxx_compiler_flag and use whichever the compiler accepts; x86 and aarch64 are unaffected. PMP_Multilinear uses x86 SSE intrinsics and x86 inline asm, so it only builds on x86 (and the existing arm path). It was excluded for aarch64 but not for other non-x86 targets, so ppc64 fell through to the x86 asm and failed to compile. Restrict it to x86/arm in CMakeLists and main.cpp so it is skipped elsewhere. Builds and runs on native big-endian ppc64 (POWER8).
|
I like that. But first the windows compiler needs to be bumped. |
|
Sounds good, thanks. I will wait on the Windows compiler bump. If it helps, I can re-run the big-endian verification on real PowerPC hardware once it lands. |
|
Na, too busy. Will fix windows later |
|
On the Windows compiler bump, I dug into it so you do not have to. It is not caused by this PR. The runner image has been re-provisioned. The job log's Runner Image block says: So - run: cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=Release .CMake stops at It is already red on master for the same reason: run 28703089508 on a27c3a5 has windows failing and the other seven jobs green. This PR shows the identical pattern, windows red and everything else green including aarch64 and armv7. The fix I would suggest is dropping the pin rather than moving it to 18: - run: cmake -A x64 -DCMAKE_BUILD_TYPE=Release .CMake then selects the newest Visual Studio actually installed, so it survives the next image change too instead of trading a hardcoded 17 for a hardcoded 18. Do you want me to push that into this PR, or keep CI changes out of it and let you take it separately? Either is fine, just say which. Nothing else needs doing on the PR side: neither One correction to what I offered in June. I said I could re-run the big-endian verification on real PowerPC once the Windows side landed. The POWER8 box is powered down at the moment, so I cannot re-run it today. The results in the description stand as recorded from the original run, and I will re-confirm when the machine is back up if you want that before merging. |
SMHasher does not currently build on POWER (ppc64 / ppc64le) or other non-x86 targets. Two issues:
The GNU/Clang path unconditionally adds
-march=native. POWER gcc rejects that flag (it uses-mcpu=native), so the flag is injected and every compile fails. This now probes both withcheck_cxx_compiler_flagand uses whichever the compiler accepts. x86 and aarch64 are unaffected (they accept-march=nativeas before).PMP_Multilinearuses x86 SSE intrinsics and x86 inline asm. It was excluded for aarch64 but not for other non-x86 targets, so on ppc64 it fell through to the x86 path and failed to compile (unknown register name 'edx' in 'asm'). It is now restricted to x86 (and the existing 32-bit arm path). So the CMake source decision and themain.cppregistration can never disagree, CMake defines-DHAVE_PMPMLwhen the sources are compiled andmain.cppgates the table entry on that single macro.Testing
Built and tested on real POWER8 hardware, both endiannesses:
sumhash,BadHash,sumhash32and the rest verify the same as on x86.x86_64 is unchanged: it still uses
-march=nativeand still builds and registersPMP_Multilinear.Side note from the big-endian run: a number of hashes that read or write multi-byte values in native byte order fail verification on big-endian (their verification value comes out byte-reversed). That is a separate correctness issue and I will open it with a fix; this PR only makes the project build on these targets.