es-ude / es-ude/OnDeviceTraining
norms: op-entry output-count gates + permuted-loss audit (all arms, OOB class from PR5 review)
- Dominant language
- C
- Stars
- 1
- Forks
- 3
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 8
Description
Follow-up from BFP epic PR5 (#435, review ledger "known deferrals" 1+2). Both items are the same hazard family in the same region, so one issue / one PR.
## 1. Output/rawOut element-count gates are missing across ALL norm arms
LayerNorm/GroupNorm kernels validate their *input* geometry, but no arm (FLOAT32, SYM_INT32, ARITH_BFP; forward and backward) checks that the output / funnel `rawOut` buffer has the element count the kernel is about to write. A mis-sized output tensor (user error, or a future allocator regression) is a silent OOB heap **write**. Pre-existing, not BFP-specific.
Scope: a uniform op-entry gate (count derived from the input-side geometry the kernel already validated) in both norms, all arms, plus death tests per arm.
## 2. FLOAT32/SYM backward arms: audit for the count-equal-permuted-loss class
PR5 Finding 2 (fixed for the BFP arm in #435): GroupNorm's dbeta derived B/T from the never-shape-validated `loss` tensor while offsetting with `cfg->numChannels` — a count-equal, shape-permuted loss passed every gate and read OOB. The FLOAT32 and SYM_INT32 backward arms of both norms were not audited for the same pattern (stay-in-lane during PR5).
Scope: audit all non-BFP norm backward arms; where the pattern is confirmed, hoist the same `*ValidateInputShape(cfg, loss)` gate + RED-first death test (the #435 fix is the template).
Part of the #410 epic hygiene trail.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Contributor guide
Research direction
Start with the LayerNorm and GroupNorm op-entry paths and the #435 BFP fix/template; trace input-side geometry validation across every FLOAT32, SYM_INT32, and ARITH_BFP forward and backward arm. Add the requested output/rawOut count checks and audit the non-BFP backward loss handling. Done means all arms have coverage from per-arm death tests, including the count-equal permuted-loss case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- embedded-iot, security, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100