Fixed-width storage code generation repair
This amendment to bridge draft #71 supersedes the storage implementation in
d7d024590eb33e8f6d6d5576fbff00dba3d11085. The earlier typed-view receipt and
logs remain historical records of that revision; they have not been rewritten.
Defect and repair
GemmEx reported that the byte assembly/disassembly loops emitted by o_get and
o_put were not unrolled by GCC 13.3 at -O2 on AArch64: a constant-width ulong
load became eight byte loads/shifts/ORs, not one scalar load. Its supplied minimal
source was /tmp/og.c; the same helper/caller pattern is now a regression test.
The reported failure and timings were accepted as ground truth, not re-run here
merely to confirm them.
The repair uses direct byte access for width 8, fixed-size alias-safe
__builtin_memcpy with uint16_t/uint32_t temporaries for widths 16/32, and an
8-byte builtin copy for width 64. The existing little-endian compilation guard
makes these copies equivalent to the old byte assembly. Sub-byte widths retain
the old no-memory-access behavior. Bounds checks, narrowing validation, signed
extension, float raw bits and all checked ABI rules are unchanged.
Source SHA-256:
src/toc.om:b8f41bf19e8cf3f60842198e1f771dcbec03ce9d61272b95ab781690d481ad95.tests/seeded_views.py:e7682d4820888c0df2a22600c34641b4d50b2e0ef64f15713439bbea51831058.tools/bridge-seeded: unchanged,65778db0d82c994f8606f6b868645f7b89c0a5062a1f23d1eccc65690f1b55d0.
No native generator, native compiler pin, freestanding profile, FMA/literal core
or CUDApp source was changed. docs/CAPABILITIES.md now describes fixed-width
copies instead of byte loops.
Deterministic regression and semantics
tests/seeded_views.py extracts the actual emitted width/value/norm/get/put
helpers and compiles dynamic-pointer/count/index callers at constant element
types with the real CC -O2 -S. On this host, cc -dumpfullversion -dumpversion
returned 13.3.0 and cc -dumpmachine returned aarch64-linux-gnu.
The test requires one correctly sized scalar load/store, with no byte load/store loop, for each 16/32/64-bit caller. A mutant restoring the reported load byte loop must fail that assembly contract. Non-AArch64 C compilers explicitly report this architecture-specific assertion NOT_RUN; they do not masquerade as AArch64 proof. The ordinary executable differentials remain independent of that assertion.
Observed typed-views-storage-views-final.log:
PASS fixed-width GCC -O2 loads/stores; byte-loop codegen mutant killed
PASS exhaustive-u16=65536 random-u32-f32=1048576 edge-bits=15
PASS x86 emulated C identical on complete typed-view and fsqrt stream
PASS killed ushort-load
PASS killed uint-store
PASS killed f32-store
PASS killed fsqrt
...
SEEDED-VIEWS PASS
The three storage mutation sites were adapted to the new copies without changing the required native/C comparison or refusal expectations. The test still exercises per-type out-of-range refusals, global arrays, runtime bounds/count/null/alias/ overlap/recovery, typed float scalars and killed float ABI mutants.
Commands and execution boundary
Exact argv, environment, source digests, rc and final lines for this amendment
are in typed-views-storage-commands.json, with adjacent typed-views-storage-*.log
files. Each build/test command uses the literal device-free wrapper:
bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 <command>
The initial views invocation returned 1 because the source-fingerprint guard
correctly refused the stale converter with inner status 65, `rebuild required:
tools/build.sh. That failed attempt remains filed. sh tools/build.sh` then
returned 0; the final typed-view invocation returned 0, SEEDED-VIEWS PASS.
The serialized command record also covers the baseline converter suites, seeded,
seeded-float, freest and candidate-next regressions for the repaired source.
| Command after that wrapper | rc | Final line |
|---|---|---|
sh tools/build.sh | 0 | no stdout/stderr |
python3 tests/seeded_views.py | 0 | SEEDED-VIEWS PASS |
sh tools/test.sh | 0 | ALL SUITES RC=0 |
python3 tests/seeded.py | 0 | SEEDED CONVERTER differential C/Python/native/x86 and pin/arithmetic/ABI controls PASS; device NOT_RUN |
python3 tests/seeded_float.py | 0 | PASS seeded binary32/binary64 byte differential (native/C/x86, 132 constants vs exact oracle, one-ulp mutant detected); baseline/Python/f64-array/converter refusals |
python3 tests/freest.py | 0 | PASS direct structural converter refusals independently of frontend, including recursive call graph |
python3 tests/seeded_next.py | 0 | SEEDED-NEXT PASS |
The previously recorded native-only ABI/kinds/x86 results and the known native-v2 FAIL 1 belong to unchanged native sources; they are not claimed as rerun by this storage amendment. No gate or expectation was weakened.
GemmEx separately reported its full consumer benchmark (three interleaved runs, 623 cases, sum of per-case medians): old converter 820.2 ms, original #71 1273.7 ms, patched helpers 642.6 ms. These are peer-reported measurements, not measurements performed by BridgeViews, and no speed ratio is derived here. This lane's proof is the executable bit differential and deterministic instruction-shape control; consumer benchmark and CUDApp acceptance remain GemmEx-owned.
IMPLEMENTED and CPU-EXERCISED only. Physical x86, GPU/chip qualification, merge and deployment are NOT_RUN. The contribution remains draft and requires Drake's approval to merge.