Commit d764b37
committed
Round-8 review fixes: merge_add double-consume, tensor zero-child regression
Round 8 (adversarial probe of the round-7 delta) confirmed two
regressions introduced by the round-7 negation probe in merge_add:
- Double-consume (wrong value): when the lhs held an exact {t, -t}
pair, t consumed the rhs child -t via the negation probe and then -t
direct-matched the same rhs child again — (5x-5x) + (y-5x) evaluated
to y-10x. Matches are now gated on the used-set in both probe paths.
The enabler is closed too: child insertion in merge_add and
merge_and_finish now goes through add_insert_signed, which combines
an entry with an existing exact match or exact negation until no
collision remains and zero-filters the result, so an add can no
longer hold an exact {t, -t} pair at all ((2x-5x)+3x now collapses
to the zero singleton at construction).
- Tensor zero child: the shared merge_add gained cancellation power in
round 7, but only the scalar/t2s dispatch site got the zero filter —
the tensor caller inserted fully-cancelled combines as literal 0{2}
children ((A+B)+(C-A) -> "0{2}+B+C", breaking identity and
round-trip cancellation). The tensor site now passes the
is_same<tensor_zero> filter and collapses degenerate results the
same way the scalar path does; the filter-less merge_add overload is
gone so no caller can opt out silently.
Regression tests in CoreBugFixTest (RoundEightReview suite).
Refs #340.
Signed-off-by: petlenz <peterlenz89.pl@gmail.com>1 parent 001164d commit d764b37
4 files changed
Lines changed: 94 additions & 13 deletions
File tree
- include/numsim_cas
- core/simplifier
- src/numsim_cas/tensor/simplifier
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
325 | 325 | | |
326 | 326 | | |
327 | 327 | | |
328 | | - | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
329 | 333 | | |
330 | 334 | | |
331 | 335 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
9 | 37 | | |
10 | 38 | | |
11 | 39 | | |
12 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
13 | 44 | | |
14 | 45 | | |
15 | 46 | | |
| |||
30 | 61 | | |
31 | 62 | | |
32 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
33 | 67 | | |
34 | 68 | | |
35 | 69 | | |
36 | 70 | | |
37 | | - | |
| 71 | + | |
| 72 | + | |
38 | 73 | | |
39 | 74 | | |
40 | 75 | | |
41 | 76 | | |
42 | 77 | | |
43 | 78 | | |
44 | 79 | | |
45 | | - | |
| 80 | + | |
46 | 81 | | |
47 | 82 | | |
48 | | - | |
| 83 | + | |
49 | 84 | | |
50 | 85 | | |
51 | 86 | | |
52 | 87 | | |
53 | 88 | | |
54 | | - | |
| 89 | + | |
55 | 90 | | |
56 | 91 | | |
57 | 92 | | |
58 | 93 | | |
59 | 94 | | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | 95 | | |
68 | 96 | | |
69 | 97 | | |
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
78 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
79 | 89 | | |
80 | 90 | | |
81 | 91 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1446 | 1446 | | |
1447 | 1447 | | |
1448 | 1448 | | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
1449 | 1488 | | |
1450 | 1489 | | |
1451 | 1490 | | |
0 commit comments