Skip to content

feat: integrate synTagma CoordSpace — structural enumeration replaces Vec-based expansion (#40) - #41

Merged
metasmile merged 11 commits into
mainfrom
40-syntagma-integration
Jul 19, 2026
Merged

feat: integrate synTagma CoordSpace — structural enumeration replaces Vec-based expansion (#40)#41
metasmile merged 11 commits into
mainfrom
40-syntagma-integration

Conversation

@metasmile

Copy link
Copy Markdown
Contributor

Summary

Replace ev's Vec<Combination>-based domain expansion and evaluation pipeline with synTagma's structural coordinate space. StructuralEnum generates only structurally valid combinations by encoding constraints into the enumeration space itself, eliminating all runtime constraint evaluation for cross, oneof, range, and bitmask constraints.

Closes #40.

Performance

Fixture Raw space evaluate (old) struct_enum (new) Speedup
Small 27 3.26 µs 2.73 µs 1.2x
Medium 32,768 6.58 ms 3.11 ms 2.1x
Ibex RV32IMCB 524,288 3.63 s 49.5 ms 73x
CVA6 XIF R4 2,097,152 1.43 s 1.69 ms 846x
CVA6 XIF full 33,554,432 ~32 s ~32 ms ~1000x

Changes

Core: structural enumeration

  • structural_filters(): Parse constraints (cross, oneof, range, bitmask) into per-field allowed values + cross-value mapping. Structural constraints are encoded into the enumeration space, requiring zero runtime evaluation.
  • StructuralEnum: Iterator that generates only structurally valid combinations. Cross-constrained fields skip invalid values via an inner loop. Implements Iterator<Item = Combination>.
  • coords_to_coord_vec(): Convert coordinate slice to Vec<Coord> for DynCoordSpace indexing.
  • validate_into_space(): Uses StructuralEnum + runtime-only checks (eq, neq, lt, gt, le, ge, even) to build a DynCoordSpace<()> containing only valid combinations.
  • build_runtime_checks(): Filters constraints to runtime-only types before building checks, avoiding unnecessary check construction.

New constraint types (from PR #39, already merged)

  • bitmask: field & mask == value — bit-level field conditions
  • enable_set: Like enable_mask but sets fields to specified values

Benchmark infrastructure

  • benches/bench.rs: 24 benchmark functions across 4 fixture sizes, organized by speed class (coordspace ns-scale: sample_size=1000, expand ms-scale: 100, eval_light µs-ms: 100, eval_heavy seconds-scale: 10)
  • Cargo.toml: tagma-core git dependency + criterion dev-dependency
  • run.sh: structural enum benchmark integrated into CI pipeline

Dependencies

tagma-core = { git = "https://github.com/ssccsorg/tagma", package = "tagma-core" }

Apache 2.0, no_std compatible, identical license to ev.

Test coverage: 87 tests (73 lib + 14 CLI), 0 failed

Area Tests
coords_to_coord_vec basic, out-of-range, empty
structural_filters oneof, bitmask, cross mapping
StructuralEnum without cross, with oneof, cross matching
build_runtime_checks excludes structural types
validate_into_space matches evaluate_all valid count
constraint types bitmask_constraint, expand_enable_set

metasmile added 10 commits July 18, 2026 11:56
…n enumeration (#40)

- Add tagma-core as git dependency (Coord, CoordPath types)
- Add coords_to_path() conversion utility
- Add EnumerateIter: lazy Iterator<Item=Combination>, zero Vec allocation
- Integrates enable_mask/enable_set processing in iterator
- Existing expand_all() preserved for downstream compatibility
- All 77 tests pass, 0 failed
…40)

- Add validate_into_space() to evaluate.rs: builds DynCoordSpace<()>
  containing only valid combinations using EnumerateIter
- Invalid combinations are structurally absent (vacant slot)
- Add coords_to_coord_vec() for dynamic-depth Coord path conversion
- Add validate_into_space_matches_evaluate_all unit test
- All 78 tests pass, 0 failed
- Existing evaluate_all() preserved for reporter compatibility
)

- Raise MAX_COMBINATIONS from 34M to 1B (CoordSpace removes Vec allocation)
- Add benches/bench.rs with criterion benchmarks:
  - expand vs enumerate: small(27), medium(32K), ibex(524K), cva6_r4(2M)
  - evaluate vs validate: same four fixture sizes
  - coordspace lookup: valid vs invalid
  - constraint check: single combo
- Add criterion dev-dependency and [[bench]] target to Cargo.toml
- All 78 tests pass, 0 failed
…ombos (#40)

- Add StructuralEnum: generates only structurally valid combinations
  by encoding cross, oneof, range, bitmask constraints into the
  enumeration space. Invalid combinations are never generated.
- Add structural_filters(): parses constraints into per-field
  allowed values + cross mapping for dependent iteration.
- Rewrite validate_into_space() to use StructuralEnum + runtime-only
  checks (eq, neq, lt, gt, le, ge, even) — structural constraints
  require zero runtime evaluation.
- Add build_runtime_checks() to separate structural from runtime.
- Update benchmarks with struct_enum/* variants.

Performance: ibex 524K space
  evaluate: 3.67s (524K combos, all constraint checks)
  struct_enum: 50ms (92K combos, zero structural checks) = 73x faster
- Add cargo bench to code_checks in run.sh (struct_enum/ibex)
- Add structural enumeration bench to verify_large_fixtures
- CI now tracks structural enumeration performance on every run
- Bench results printed as CI output (not assertion, informational)
- Remove redundant FieldSpec.allows() check in structural_filters()
  (field domain already filtered by def.expand())
- Document total_combinations() upper bound limitation
  (cross constraints not reflected in per-field value counts)
- Increase bench sample_size from 10 to 30 for better precision
- Rewrite build_runtime_checks() to filter constraints before building,
  avoiding unnecessary check construction for structural constraints
- All 78 tests pass, 0 failed
- coordspace (ns scale): sample_size=1000 for tight confidence intervals
- expand (ms scale): sample_size=100
- eval_light (µs-ms scale): sample_size=100
- eval_heavy (seconds scale): sample_size=10 (ibex eval 36s, cva6 eval 14s)
- Total bench suite: ~3 minutes, practical for CI
… pass

- Update verify_cva6_xif_ref_r4 ignore comment (2M, medium)
- Update verify_cva6_xif_ref ignore comment (33M, CLI pending struct_enum)
- tests remain ignored because CLI ev verify still uses old pipeline
- struct_enum handles both scales in ms — pending CLI integration
…s, StructuralEnum, build_runtime_checks

- coords_to_coord_vec: basic, out-of-range, empty (3 tests)
- structural_filters: oneof, bitmask, cross mapping (3 tests)
- StructuralEnum: without cross (matches expand_all), with oneof (2 tests)
- build_runtime_checks: excludes structural types (1 test)
- Total: 87 tests (73 lib + 14 CLI), 0 failed
@metasmile metasmile self-assigned this Jul 18, 2026
@metasmile
metasmile merged commit fbef704 into main Jul 19, 2026
2 checks passed
@metasmile
metasmile deleted the 40-syntagma-integration branch July 19, 2026 04:27
metasmile added a commit that referenced this pull request Jul 20, 2026
…vs evaluate)

- Add cva6_full_spec() to benches/bench.rs
- Add bench_structural_enum_cva6_full to eval_heavy group
- Result: struct_enum/cva6_full_33M = 28.8ms (vs ~32s evaluate = ~1100x)
- Previous estimate of ~32ms was conservative; actual is 28.8ms
- Branch rebased onto latest main (PR #41 merged)
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.

Integrate synTagma CoordSpace: replace Vec-based domain expansion with structural coordinate space

1 participant