arithmetic: addSymInt32Tensors / Sub twin swap the tensor arguments on the unequal-scale path
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 83/100
Research direction
Read src/arithmetic/Add.c and src/arithmetic/Sub.c at the cited lines, then check the argument order in Tensor.h:80 and the neighboring b call. Add the requested regression test with unequal-scale SYM_INT32 operands, comparing against the float reference and checking that aTensor is unchanged; run the relevant unit tests. Done when both callers use the documented order and the regression test passes.
Written by the indexing model from the issue text.
Description
Bug
On the unequal-scale (float fallback) path, addSymInt32Tensors and its Sub twin pass the tensor arguments of setTensorValuesForConversion in the wrong order for operand a:
src/arithmetic/Add.c:183:setTensorValuesForConversion(aFloatData, &floatQ, &aFloat, aTensor);src/arithmetic/Sub.c:170: same pattern.
The signature is (data, q, originalTensor, newTensor) (Tensor.h:80), and the b line right below it (Add.c:188) uses that order. With a swapped, the caller's aTensor is re-pointed at a stack buffer with FLOAT32 quantization, and aFloat is left uninitialised. The following convertTensor(aTensor, &aFloat, rs) then reads the wrong tensor.
Impact
addSymInt32Tensors / the Sub twin have no caller in src/ or examples/; only two unit tests call them. No training path is affected today. A future SYM merge (Add node, #329 follow-up) would land exactly on this branch, since a SYM Add almost always sees unequal scales.
Fix
Swap the two arguments on the a line in both files. Add a RED test with two SYM_INT32 operands of unequal scale, checked against the float reference, and assert the caller's aTensor is unchanged.
- Dominant language
- C
- Stars
- 2
- Forks
- 3
- Avg merge
- 13h 6m
- Merged PRs (30d)
- 9
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from es-ude/OnDeviceTraining
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
es-ude/OnDeviceTraining#549 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
es-ude/OnDeviceTraining#547 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
es-ude/OnDeviceTraining#478 ·
Maintainers usually reply within 1 day
-
bug documentation
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
es-ude/OnDeviceTraining#459 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
es-ude/OnDeviceTraining#258 ·
Maintainers usually reply within 1 day
All issues in es-ude/OnDeviceTraining
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 5 days
-
New firmware
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
MControlSuite/msi-ec#905 ·
-
riscv
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
intel/isa-l_crypto#181 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100