diff --git a/BUGS.md b/BUGS.md index 55231c5..deb82fc 100644 --- a/BUGS.md +++ b/BUGS.md @@ -6,8 +6,8 @@ gotip, "1.27.3" is the release toolchain loopvec is tested against. | Issue | Status | Affects | loopvec's answer | |---|---|---|---| -| [#80657](https://github.com/golang/go/issues/80657) simd in a method: internal compiler error | fixed on tip (CL 839405), still crashes on 1.27.3 | `-methods` | methods are skipped unless `-methods` is passed | -| [#80835](https://github.com/golang/go/issues/80835) legacy SSE encodings in functions using simd cause AVX-SSE transition penalties | open, fix pending (CLs 825145, 825146, in tip) | speed of any scalar float code that runs after a rewritten loop, in the same function or another | none; the portable `simd` package has no `ClearAVXUpperBits` | +| [#80657](https://github.com/golang/go/issues/80657) simd in a method: internal compiler error | closed, fixed on tip (CL 839405), still crashes on 1.27.3 | `-methods` | methods are skipped unless `-methods` is passed | +| [#80835](https://github.com/golang/go/issues/80835) legacy SSE encodings in functions using simd cause AVX-SSE transition penalties | open, fix pending (CLs 825145, 825146, in tip) | speed of any scalar float code that runs after a rewritten loop, in the same function or another | none yet; the portable `simd` package has no `ClearAVXUpperBits` | | [#81844](https://github.com/golang/go/issues/81844) blank identifier parameters rejected | fixed on tip (CL 841145) | every rewrite of a function with a `_` parameter | the generated file renames them `_p0`, `_p1`, ... | | [#81845](https://github.com/golang/go/issues/81845) calls left unresolved when inlined into a package initializer | closed as a duplicate of [#80689](https://github.com/golang/go/issues/80689), which is open | loops in package-level `var x = func() {...}()` | not rewritten (the generated initializer fails to link), see `package_initializer_no_rewrite.txt` and `toolexec_package_initializer.txt` | | [#81846](https://github.com/golang/go/issues/81846) `Float32s.Neg` rebuilds its sign constant every iteration | open | speed of negation loops | none; the loop is correct, only slower than it should be | @@ -42,8 +42,21 @@ vector loop still wins and one that is mostly scalar float code around it can lo `simd/archsimd` (amd64) has `ClearAVXUpperBits`, not the portable `simd`, so loopvec has no portable way to clear the state. When comparing a function before and after a rewrite, benchmark the whole function, not the loop. This is separate from #81847: it reproduces with -async preemption off. One machine and no performance counters, so the size of the effect on -Intel, where the penalty works differently, is unknown. +async preemption off. + +Two more things from loopvec's runs, also on the 9950X3D. `GOAMD64=v3` does not remove the +penalty: the compiler still emits legacy SSE for scalar float code, except where it fuses a +multiply-add into a VEX `VFMADD231SD`. And `ClearAVXUpperBits()` costs nothing measurable +after a loop that stays in vectors (4096 `float32` adds, 255.3 against 254.0 ns). On real +code, one rewritten `work[i] = 1` fill in gonum's `Dlantb` made the scalar loops after it 7x +slower (420 to 2917 us), and the clear brought it back to 409 us. + +Others have measured Intel in the issue thread: Skylake-X pays 2x to 3x on scalar code after +an AVX-512 kernel, and on Sapphire Rapids and Granite Rapids a kernel that reloads with +legacy SSE loses about 15 points of peak until the clear is added. The same thread reports +`ClearAVXUpperBits()` at the return of every short leaf function costing about 0.8 ns per +call, so inserting it unconditionally is not free. loopvec does not emit it yet; it is +amd64-only and would need an arch-tagged helper. ## #81844: blank identifier parameters