Skip to content

test(#496): Add FPGA stub backend validating vtable pluggability#505

Merged
justinjoy merged 4 commits intomainfrom
feat/496-fpga-stub-backend
Apr 15, 2026
Merged

test(#496): Add FPGA stub backend validating vtable pluggability#505
justinjoy merged 4 commits intomainfrom
feat/496-fpga-stub-backend

Conversation

@justinjoy
Copy link
Copy Markdown
Collaborator

Summary

  • Add test-only naive row-store FPGA stub backend to validate wl_compute_backend_t vtable is truly pluggable
  • Implement all 7 vtable slots with wl_fpga_session_t embedding wl_session_t base as first field
  • Row-store evaluator handles all 9 universal operators (0-8), skips columnar-specific ops (9-11)
  • Fixed-point iteration for recursive strata with delta tracking
  • 11 test cases covering lifecycle, queries (passthrough, join, filter, TC), delta callbacks, and backend-specific op handling
  • Interface gap findings documented in fpga_backend.c header comment

Key validation results

  • Session embedding contract (C11 struct casting): works cleanly
  • Intern sharing via plan->intern: works across backends
  • Delta naming convention ($d$): backend-agnostic
  • Plan-gen coupling: exec_plan_gen.c unconditionally emits K_FUSION/LFTJ/EXCHANGE (documented as finding)
  • wl_easy.h hardcodes columnar backend (documented as finding)

Files (all test-only, no changes to wirelog/)

  • tests/fpga_backend.h — header
  • tests/fpga_backend.c — implementation (~1130 LOC)
  • tests/test_fpga_backend.c — 11 tests
  • tests/meson.build — test registration

Closes #496

Test plan

  • 135/135 tests pass (134 existing + 1 new FPGA test)
  • FPGA lifecycle: create/destroy/insert/remove(-1)/snapshot-empty
  • Simple passthrough, join, filter queries produce correct results
  • Transitive closure reaches fixed point via semi-naive iteration
  • Delta callback fires with diff=+1 for new tuples
  • Backend-specific ops (K_FUSION/LFTJ/EXCHANGE) skipped without crash
  • Zero modifications to wirelog/ source files

Declare wl_backend_fpga() getter and include backend.h for the
wl_compute_backend_t vtable type used by the test-only FPGA backend.
Naive row-store backend implementing the full wl_compute_backend_t vtable:
- fpga_session_create/destroy with dynamic relation storage
- fpga_session_insert appending rows into named relations
- fpga_session_remove returns -1 (unsupported)
- Universal operator evaluator (VARIABLE, MAP, FILTER, JOIN, ANTIJOIN,
  REDUCE, CONCAT, CONSOLIDATE, SEMIJOIN) with postfix expression engine
- Fixed-point iteration for recursive strata with delta tracking
- Backend-specific ops (K_FUSION, LFTJ, EXCHANGE) safely skipped
- Interface gap findings documented in top-of-file comment block
Test suite validating the FPGA backend vtable is fully pluggable:
- Lifecycle: backend name, create/destroy, insert, remove (-1), snapshot
- Plan interpretation: passthrough, join, filter, transitive closure,
  delta callback with diff=+1, backend-specific ops don't crash
- Build integration in tests/meson.build following test_plan_gen pattern
Cast operands to uint64_t and clamp shift amount to [0,63] to avoid
C11 UB on left-shift of negative int64_t values.
@justinjoy justinjoy merged commit df6a761 into main Apr 15, 2026
7 checks passed
@justinjoy justinjoy deleted the feat/496-fpga-stub-backend branch April 15, 2026 10:19
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.

test: Verify backend abstraction with second backend implementation

1 participant