es-ude / es-ude/OnDeviceTraining
bfp stretch: native BFP losses (CE via I-BERT log-exp, MSE) -- optional, epic #410
- Dominant language
- C
- Stars
- 1
- Forks
- 3
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 8
Description
Spec-mandated stretch issue (BFP epic spec §9 / §5 MSE-CrossEntropy row: "file as follow-up issue when PR6 lands"; ratified D4: losses fake-quant in core, native CE/MSE = optional stretch — "nice to have, not required").
## Scope
Native BFP arms for the loss functions, replacing today's fake-quant (dequant-to-float) arms:
- **CrossEntropy**: couple to the PR6 I-BERT machinery — an integer log-exp (i-log of the i-exp pipeline, I-BERT §3.5 anchor) over block mantissas; the fused `(p−y)` CE+Softmax seed path stays the loop contract.
- **MSE**: per-element `2(o−l)` over block mantissas with int32 products + exact `2^E` folds (GEMM-family contract), one OUT_WRITE pack.
## Context from PR6 (prerequisites shipped)
- `bfpIExpQ` + `bfpShiftRightRounded` + the fixed 2^-14 work grid with compile-time constants (src/arithmetic/BfpSoftmaxExp.{h,c}) are reusable substrate; the adaptation contract and its error analysis live in docs/conventions/arithmetic-bfp.md §5.9 + §11.
- Loss fake-quant arms and their count gates were hardened in the epic (PR4 + #430); the fused CE seed works on BFP wires today via the fake-quant path.
Priority per Leo: optional stretch — schedule only if a sweep shows the loss layer's float bridge is a measurable accuracy/cost factor.
Part of #410.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Contributor guide
Research direction
Start with the BFP epic specification sections §9 and §5, then read src/arithmetic/BfpSoftmaxExp.h and src/arithmetic/BfpSoftmaxExp.c plus docs/conventions/arithmetic-bfp.md sections §5.9 and §11. Review the existing loss fake-quant arms and PR6 substrate before scoping native CrossEntropy and MSE. Done means native BFP arms replace the float bridge while preserving the stated CE seed and MSE packing contracts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100