mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #1488] prefill.cpp: a GCC 10 build fails (std::atomic::wait is a GCC 11 library feature, with no guard and no documented minimum) #602
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#602
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @zhouxihong1 on GitHub (Oct 8, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/1488
Problem
Building the engine with GCC 10 fails in
src/prefill/prefill.cpp:std::atomic<T>::wait/notify_one/notify_all(C++20, P1135R6 — the synchronization library) is a library feature: libstdc++ ships it from GCC 11. GCC 10's<atomic>has no such member, so this is not something-std=can fix.It came in with #1057 ("let Stager threads sleep instead of yield-spinning"), whose notes say: "the ring wait uses C++20
std::atomic::wait, withnotify_allinissued_one()andfinish()". That work was measured on Ubuntu 24.04 (GCC 13), so GCC 10 was never tried. It is in 0.1.40.2 and 0.1.40.3.There is no compile-time guard, and the runtime switch cannot help:
STRATA_STAGER_SLEEP(prefill.cpp:124) is read withstd::getenv, so a GCC 10 build cannot get past the three call sites — the option only picks the spin path after the code compiles.Why I think this is a portability gap, not just a doc nit
CMakeLists.txt:51-53setsCMAKE_CXX_STANDARD 20+CMAKE_CXX_STANDARD_REQUIRED ON, and GCC 10 satisfies that — configure succeeds, so the failure reads like a code bug rather than a missing requirement.docs/INSTALL.md:69says the engine needs "a C++ compiler and git: build-essential" — no version.setup.py:2458printssudo apt install build-essential git— no version, and nothing checks one.CMakeLists.txt:1043-1045still documents GCC < 11 as a supported (if slower) configuration: "A compiler without them (GCC < 11, Clang < 12) builds the files without the copies."gcc-11for jammy and later only). Focal is still in ESM until 2030, and Debian 11 (bullseye) also has GCC 10 as the newest in its base repos. Anyone on those needs a third-party PPA (ppa:ubuntu-toolchain-r/test) before the tree compiles at all.So the effective minimum moved from GCC 10 to GCC 11 in 0.1.40.2 without a guard, a check, or a line of documentation.
Verified
--cuda 12,-DCMAKE_CUDA_ARCHITECTURES=89:g++-11builds,g++-10does not. Purely the compiler version.vmm.cppcase from #1071 is solved here too, thanks).--cuda 12,--layer-split 12,24,36.Suggested fixes (either is fine)
1. State the minimum. A check next to the existing
CMAKE_CUDA_ARCHITECTURESones, plus one line indocs/INSTALL.mdand in thebuild-essentialmessage. Then a GCC 10 user gets one clear message instead of three compile errors.2. Guard the three call sites with the standard feature-test macro and keep the
yieldspin where it is unavailable — that is exactly the pre-#1057 behaviour, andnotify_all()is redundant on the spin path:__cpp_lib_atomic_waitis the standard feature-test macro: GCC 11+ defines it and keeps today's behaviour unchanged; GCC 10 falls back to the spin. I applied this locally (6 insertions, one file,git apply --checkclean against v0.1.40.3) and the tree then builds with GCC 10 — but it is only a workaround for the missing version statement, which is why I would prefer fix 1 with 2 as well.Related: #1101 touches the same
Stagerwaits.@Niko1221 commented on GitHub (Oct 10, 2026):
Thank you, the fix you proposed is what went in: std::atomic::wait and notify_all in the Stager are used only where __cpp_lib_atomic_wait is defined (GCC 11 and newer, current MSVC); GCC 10 keeps the yield spin of before #1057. Output is the same either way. Not compiled with GCC 10 here; please tell us if the build still stops.