Repository navigation
Commit 4cfab49
authored
Test the floordiv.int and mod.int division identity in prim ops (#25317)
### Summary
Follow-up to #25213, covering the test gaps raised in its review.
`TestFloordivRoundsTowardNegativeInfinity` gets `{0, -8, 0}` and `{16,
-8, -2}`, where the signs differ but the remainder is zero, so the `quot
- 1` correction must not apply. A new test,
`TestFloordivAndModIntSatisfyDivisionIdentity`, checks `floordiv.int(a,
b) * b + mod.int(a, b) == a` now that #25076 and #25213 are both in.
`floordiv.int` is added to the wrong-argument-count block, which already
covered `floordiv.Scalar`, `mod.int` and `mod.Scalar`.
Tests only, no change to the ops.
### Test plan
Built with `-DEXECUTORCH_BUILD_TESTS=ON`:
```
cmake --build cmake-out --target kernels_prim_ops_test
./cmake-out/kernels/prim_ops/test/kernels_prim_ops_test
```
26 tests pass on this branch. With `register_prim_ops.cpp` from e559e66
(before #25213), the two floordiv tests fail.
I used Claude to help with this PR.
cc @nil-is-all @JakeStevens1 parent e3b3e86 commit 4cfab49
1 file changed
Lines changed: 32 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
355 | 355 | | |
356 | 356 | | |
357 | 357 | | |
| 358 | + | |
| 359 | + | |
358 | 360 | | |
359 | 361 | | |
360 | 362 | | |
| |||
368 | 370 | | |
369 | 371 | | |
370 | 372 | | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
371 | 397 | | |
372 | 398 | | |
373 | 399 | | |
| |||
907 | 933 | | |
908 | 934 | | |
909 | 935 | | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
910 | 942 | | |
911 | 943 | | |
912 | 944 | | |
| |||
0 commit comments