Skip to content

feat(aot-guard): add 5-input SHA-256 AOT cache guard and <4 MiB SRAM tail partitioner - #53

Merged
saariuslystoned merged 1 commit into
mainfrom
feat/aot-cache-guard-sram-partitioner
Dec 3, 2026
Merged

saariuslystoned merged 1 commit into
mainfrom
feat/aot-cache-guard-sram-partitioner

Conversation

@saariuslystoned

Copy link
Copy Markdown
Collaborator

Summary

Integrates the zero-dependency clean-room aot-guard/ C11 / C++17 module (freetpu::aot_guard) into freesilicon/freetpu under Apache-2.0:

  1. aot_cache_guard — 5-Input Content-Addressed AOT Cache Keyer & Envelope Validator
    • Computes a domain-separated (freetpu.aot.cache_key.v2), length-prefixed FIPS 180-4 SHA-256 cache key across all 5 compilation inputs: graph_digest[32], weights_digest[32], compiler_version, target_profile, and canonical compile_options (execution_preference, priority, flags, extra_options).
    • Provides constant-time digest comparison (ftpu_aot_digest_equal) and strict bounds/version/UTF-8 validation for v2 [uint32_le hdr_len][header_bytes][payload_bytes][metadata_bytes] containers.
  2. sram_partitioner — < 4 MiB On-Chip SRAM Subgraph Partitioner
    • Performs overflow-safe uint64_t tensor byte footprint math (INT8, FP16, BF16, INT32, FP32, INT64, FP64).
    • Enforces a strict < 4 MiB (4,194,304 B) working-set budget, cutting oversize tail operators (e.g. [1, 19206, 90] INT8 -> FP32 DEQUANTIZE, 6,914,160 B) and peeling immediately preceding CONCATENATION + LOGISTIC cascades to CPU/SME2 or CPU/NEON.
  3. CI & Documentation Wiring
    • Added aot-guard/ entry and Quickstart step in README.md.
    • Wired aot-guard CMake/CTest (-fno-exceptions included) and Make + ASan/UBSan checks into .github/workflows/ci.yml.
    • Added .github/workflows/public-roads-firewall.yml for aot-guard/ SPDX checks and PR diff hygiene.

Verification

  • make -C aot-guard test (Clang C11 / C++17 -Wall -Wextra -Werror -Wpedantic + -fno-exceptions smoke): 8/8 passed
  • make -C aot-guard test with -fsanitize=address,undefined -fno-omit-frame-pointer: 8/8 passed
  • cmake -S aot-guard -B build-aot-guard && ctest --test-dir build-aot-guard --output-on-failure: 2/2 passed (freetpu_aot_guard_tests, freetpu_aot_guard_no_exceptions_tests)
  • Existing host suites (libopenbuenos, freetile, llama-cpp-cloudtpu, libopentpu, Python ISA/ops/router self-tests) and clean-room audit: passed

@saariuslystoned
saariuslystoned merged commit a844e54 into main Dec 3, 2026
3 checks passed
@saariuslystoned
saariuslystoned deleted the feat/aot-cache-guard-sram-partitioner branch December 3, 2026 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant