es-ude / es-ude/OnDeviceTraining
test: shared goldgen Python module + C tensor-builder helper lib + remove dead MORE_SOURCES
- Dominant language
- C
- Stars
- 1
- Forks
- 3
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 8
Description
## Problem
1. The quantize/round/emit helpers are copy-pasted verbatim between `test/unit/layer/generate_expected_layernorm_sym.py` and `test/unit/layer/generate_expected_layernorm_sym_bwd.py`; the requant gold generator (#192, M1) is the third consumer — the CONVENTIONS "3+ copies" extraction threshold is met.
2. No shared C test helpers exist; tensor-construction boilerplate (shape backing arrays, qconfig init, data buffers) is hand-rolled across the SYM unit-test files.
3. `MORE_SOURCES` in `test/unit/unit_test.cmake` is dead code: parsed but never added to the executable, and the no-value fallback assigns a misspelled variable (`arg__MORE_SOURCES`, double underscore — unit_test.cmake:24). Tests must not use it; it silently does nothing.
## Proposed work
- `test/unit/goldgen/sym_gold.py` exporting `round_half_away`, `quantize_sym`, `stable_dequant`, `emit_float_array`, `emit_int32_array`, `emit_float_scalar`, `emit_int32_scalar`; generators import it via a sys.path bootstrap relative to the script. The module itself is CREATED in #192 M1 with the requant generator as first consumer — THIS issue tracks migrating the two LayerNorm generators onto it.
- Small static C helper lib for tensor builders, linked into tests via the normal `MORE_LIBS` path.
- Remove `MORE_SOURCES` (preferred over implementing it — `MORE_LIBS` covers the use case).
## Relations
#192 (creates the module), #148 (owns the LayerNorm generators being migrated).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Contributor guide
Assessment
This issue has not been assessed yet.