Files
kdm-re/include/gk/core
ulw-execute 9f96ef8ffc feat(arch): portable-core seam + gk::fp dual-fidelity + i386-gated ABI + seam-symbol check
Introduce the core/platform/host header seam under include/gk/ (portable value
types in core/, Kinect/PE mirror layouts in platform/, the camera-elevation
service interface in host/); the existing include/gk/structs/* paths become
compatibility forwards so no definition is duplicated. Add include/gk/fp.h with
gk::fp::round32 (binary32 rounding barrier) and gk::fp::ExtendedAcc (long double
faithful / double portable), and a GK_FIDELITY=faithful|portable CMake knob
paired with -mfpmath; faithful stays the drop-in differential target. i386-gate
GK_CDECL/STDCALL/THISCALL so non-i386 GNU builds get empty macros (native
-Werror). Migrate the three proven slice functions onto the seam without
behaviour change: box_distance expresses FP through gk/fp.h while keeping the
volatile spill the differential pins; the bodies stay in src/game/*.cpp where
prove_t11.py compiles and greps them. Add tools/seam_symbol_check.py (G5) and
re/game/seam_symbols.json asserting each flagged seam RVA ships as a
non-inlined, addressable symbol.

Verified: prove_t11.py exit 0 / ALL DIFFERENTIALS PASS (faithful, exact-FP from
df1620e); native GK_FIDELITY=portable validity compile under -Werror; macro
cross-check; G5 tool reports all three seam symbols addressable.
2026-11-29 00:54:30 -05:00
..

Portable core

Value types and algorithm declarations live here. Each module's implementation stays in src/<module>/ (the committed differential harness compiles those sources directly) and consumes these headers. No target addresses, packed mirrors, or Windows headers cross this boundary. Already-needed service interfaces live in ../host/; ABI and binary-layout details live in ../platform/.

Configure CMake with -DGK_FIDELITY=faithful (the default) for the drop-in and exact differential target. It selects gk::fp::ExtendedAcc = long double, -mfpmath=387, -ffp-contract=off, and -fno-fast-math. The validity transform uses its disassembly-proven SSE2 binary64 arithmetic even in faithful mode.

-DGK_FIDELITY=portable selects ExtendedAcc = double, uses SSE2 on x86 and the compiler's native floating-point unit elsewhere, and retains explicit binary32 rounding barriers. Portable is not the drop-in/differential target.

For a native build of the complete slice and ABI adapters:

cmake -S . -B build/task6-portable -DGK_FIDELITY=portable
cmake --build build/task6-portable --target gamekdm_slice

Both modes compile the same sources. Direct compiler invocations default to faithful; -DGK_FIDELITY_PORTABLE=1 selects portable. Use gk::fp::round32 exactly where the original stores binary32; do not replace original binary64 arithmetic with extended accumulation.