Path B pivot + Phase 0-3 closed with first baseline numbers
This is a from-scratch initial commit on a fresh .git. The original
scaffold commit (7510b56) and the earlier session's working-tree
docs were lost in a 2026-05-18 10:25 working-tree wipe; the corrupted
.git is preserved at .git-broken-2026-05-18/ (gitignored) for
forensic inspection.
Scope re-anchored from Path A (custom VPU firmware on VC7 scalar
cores; blocked by BCM2712 silicon-RoT mask-ROM signature check)
to Path B (QPU compute kernels via Mesa v3d / Vulkan compute or
direct DRM, on stock signed Pi 5 / CM5). See README.md and
docs/phase0.md for the substrate audit that closed Path A.
Phases closed:
Phase 0 — substrate audit; Path A blocked, Path B open;
codec-back-end-fits-QPU finding (docs/phase0.md)
Phase 1 — first kernel locked (VP9 / AV1 8x8 inverse DCT) with
publish-before-measure R = M2/M3 decision rules
(docs/phase1.md)
Phase 2 — reference impls mapped; FFmpeg n7.1.3 source vendored
under external/ffmpeg-snapshot/ (PROVENANCE.md pins
commit f46e514 + per-file SHA-256s) (docs/phase2.md)
Phase 3 — real baseline measurements on hertz (docs/phase3.md):
M1 bit-exact 100.0000 % (10000/10000)
M3 NEON IDCT8 single 8.171 Mblock/s (122.4 ns/block)
M5a empty Vulkan submit 22.66 us
M5b 1-WG noop dispatch 55.60 us
M5 delta 32.95 us/dispatch
=> per-dispatch overhead is ~455x per-NEON-block cost;
Phase 4 must batch at frame level or close to it.
Build harness in place: CMakeLists.txt + tests/{bench_neon_idct.c,
vp9_idct8_ref.c, bench_vulkan_dispatch.c, shaders/noop.comp} +
external/ffmpeg-snapshot/config.h shim (7 defines + EXTERN_ASM).
Builds clean on Debian Trixie aarch64 with cmake 3.31, ninja 1.12,
libvulkan-dev 1.4.309, glslang-tools 15.1.0. Vendored FFmpeg .S
assembles via the config.h shim.
Next: Phase 4 (plan first QPU IDCT kernel under the M5 batching
constraint) -> Phase 5 second-model review -> Phase 6 implement.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+103
@@ -0,0 +1,103 @@
|
||||
# daedalus-fourier — Phase 3 baseline + (later) Phase 6 implementation.
|
||||
#
|
||||
# Builds:
|
||||
# bench_neon_idct — NEON throughput baseline (Phase 3 M3) +
|
||||
# bit-exact correctness gate (Phase 1 M1).
|
||||
# bench_vulkan_dispatch — Vulkan compute dispatch-overhead baseline (M5).
|
||||
#
|
||||
# Linkage note: bench_neon_idct statically links the vendored
|
||||
# FFmpeg n7.1.3 NEON snapshot (LGPL-2.1+); see
|
||||
# external/ffmpeg-snapshot/PROVENANCE.md.
|
||||
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
project(daedalus-fourier C ASM)
|
||||
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
endif()
|
||||
|
||||
if (NOT CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
|
||||
message(FATAL_ERROR
|
||||
"daedalus-fourier targets aarch64 (Pi 5 / BCM2712). "
|
||||
"Cross-compile not yet wired.")
|
||||
endif()
|
||||
|
||||
add_compile_options(-Wall -Wextra -Wno-unused-parameter)
|
||||
|
||||
# ---- Vendored FFmpeg snapshot (LGPL-2.1+) -----------------------------------
|
||||
|
||||
set(FFSNAP ${CMAKE_SOURCE_DIR}/external/ffmpeg-snapshot)
|
||||
|
||||
# Assembly preamble (config.h shim + FFmpeg's asm helpers) used by the
|
||||
# vendored .S file. -I flags expose:
|
||||
# - FFSNAP/ so `#include "config.h"` finds our shim
|
||||
# - FFSNAP/libavcodec/aarch64/ so `#include "neon.S"` finds the helper
|
||||
# - FFSNAP/ so `#include "libavutil/aarch64/asm.S"`
|
||||
# resolves against the vendored copy
|
||||
set(FFASM_FLAGS
|
||||
-I${FFSNAP}
|
||||
-I${FFSNAP}/libavcodec/aarch64
|
||||
-I${FFSNAP}
|
||||
)
|
||||
|
||||
set(FFASM_SOURCES
|
||||
${FFSNAP}/libavcodec/aarch64/vp9itxfm_neon.S
|
||||
)
|
||||
|
||||
# Tell CMake/gas to preprocess .S sources.
|
||||
set_source_files_properties(${FFASM_SOURCES} PROPERTIES
|
||||
COMPILE_OPTIONS "${FFASM_FLAGS}"
|
||||
LANGUAGE ASM)
|
||||
|
||||
# ---- NEON baseline microbench ----------------------------------------------
|
||||
|
||||
add_executable(bench_neon_idct
|
||||
tests/bench_neon_idct.c
|
||||
tests/vp9_idct8_ref.c
|
||||
${FFASM_SOURCES}
|
||||
)
|
||||
target_compile_options(bench_neon_idct PRIVATE -O3 -march=armv8-a+simd)
|
||||
# bench_neon_idct doesn't need vulkan/drm — pure CPU baseline.
|
||||
|
||||
# ---- Vulkan dispatch-overhead microbench (next chunk) ----------------------
|
||||
# Stub: written in a follow-up step. Toggle ON with -DDAEDALUS_BUILD_VULKAN=ON
|
||||
# once tests/bench_vulkan_dispatch.c exists.
|
||||
|
||||
option(DAEDALUS_BUILD_VULKAN "Build Vulkan compute-dispatch microbench" ON)
|
||||
|
||||
if (DAEDALUS_BUILD_VULKAN)
|
||||
find_package(Vulkan REQUIRED)
|
||||
|
||||
# Compile GLSL compute shaders to SPIR-V via glslangValidator.
|
||||
# The binary loads them at runtime from the build dir (cwd-relative).
|
||||
find_program(GLSLANG_VALIDATOR
|
||||
NAMES glslangValidator glslang
|
||||
REQUIRED)
|
||||
|
||||
set(NOOP_SPV ${CMAKE_BINARY_DIR}/noop.spv)
|
||||
add_custom_command(
|
||||
OUTPUT ${NOOP_SPV}
|
||||
COMMAND ${GLSLANG_VALIDATOR} -V -o ${NOOP_SPV}
|
||||
${CMAKE_SOURCE_DIR}/tests/shaders/noop.comp
|
||||
DEPENDS ${CMAKE_SOURCE_DIR}/tests/shaders/noop.comp
|
||||
COMMENT "glslang: noop.comp -> noop.spv"
|
||||
VERBATIM
|
||||
)
|
||||
add_custom_target(daedalus_shaders ALL DEPENDS ${NOOP_SPV})
|
||||
|
||||
add_executable(bench_vulkan_dispatch tests/bench_vulkan_dispatch.c)
|
||||
add_dependencies(bench_vulkan_dispatch daedalus_shaders)
|
||||
target_link_libraries(bench_vulkan_dispatch PRIVATE Vulkan::Vulkan)
|
||||
target_compile_options(bench_vulkan_dispatch PRIVATE -O2)
|
||||
endif()
|
||||
|
||||
# ---- Summary ----------------------------------------------------------------
|
||||
|
||||
message(STATUS "daedalus-fourier build configured for ${CMAKE_SYSTEM_PROCESSOR}")
|
||||
message(STATUS " FFmpeg snapshot: ${FFSNAP}")
|
||||
message(STATUS " Build type: ${CMAKE_BUILD_TYPE}")
|
||||
message(STATUS " Targets: bench_neon_idct"
|
||||
"$<$<BOOL:${DAEDALUS_BUILD_VULKAN}>:; bench_vulkan_dispatch>")
|
||||
Reference in New Issue
Block a user