Commit d612ca4
authored
Compare against a float threshold in sdpa_bitwise_mask_gen
Summary:
The float path compares each mask element against the `double` threshold the
op schema declares. `DLA_V130_1p0v2` has a single-precision FPU but no
double-precision hardware, so every element promoted through two soft-float
library calls:
call8 __extendsfdf2 # float -> double
call8 __ltdf2 # double < double
Sixteen library calls per output byte, for a comparison the core can do in one
`olt.s`. Rounding the threshold to float once outside the loop leaves eight
`olt.s` in the loop body and nothing else.
Rounding to nearest can only move the boundary for a threshold that is not
exactly representable in float. Both producers pass `0.0`, which is exact, and
the HiFi TIE kernel already rounds the same way, so the packed bytes are
unchanged and the two kernels stay byte-compatible. The signature is untouched.
This version answers review feedback on the benchmark this change ships. The
16 KB snapshot buffer moves off the stack to the heap, since these cores cannot
be relied on to have that much task stack; the speedup division guards a zero
cycle count; and the three-quarter regression bound is computed in 64-bit
instead of truncating twice, which is the same bound arithmetically, so the
guard still fires exactly where it did. Two comments that claimed more than
they covered are corrected: the causal mask yields one mixed output byte per
row rather than a mixed byte everywhere, and the byte-for-byte check holds
because the threshold is exactly representable, not because rounding is neutral
in general. The kernel comment now states that precondition and its limit
rather than only the conclusion. No behaviour change; the ISS figures below are
from a rerun on the edited benchmark and move by under 1%.
The test plan's reproduction steps are corrected in this version too. They
described a stack that no longer exists -- D120841844 and D121265174 have
landed, and D120855219 is not being landed -- and they invoked a
`compare_op_etdump` binary that ships with D120855219 and so will not exist. The
baseline arm is now master plus D120855874, and the ETDump comparison is
described rather than delegated to that tool. No measurement changes.
Reviewed By: mcremon-meta
Differential Revision: D120937330
Pull Request resolved: pytorch#231651 parent 674a7ea commit d612ca4
1 file changed
Lines changed: 11 additions & 1 deletion
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
72 | 82 | | |
73 | 83 | | |
74 | 84 | | |
75 | | - | |
| 85 | + | |
76 | 86 | | |
77 | 87 | | |
78 | 88 | | |
| |||
0 commit comments