-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix cpuId(0) return all zero in newer CPU, for example Intel i5-9600K #1
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1 +/- ##
==========================================
- Coverage 93.9% 93.35% -0.56%
==========================================
Files 6 6
Lines 361 361
==========================================
- Hits 339 337 -2
- Misses 13 15 +2
Partials 9 9
Continue to review full report at Codecov.
|
Thanks for the contribution and apologies for the delay - this one actually took some digging (without much luck) and is more convoluted than it seems. I can't merge the PR as is, primarily due to the changes in a23f8ad for quite obvious reasons I hope. I still want to fix the underlying issue, however. With what you proposed, when I ran into this myself (on older gen i7s). My temporary "fix" for this was the result of just debugging and doing this locally, in mfi, _, _, _ := cpuId(0)
mfi, _, _, _ = cpuId(0) To my surprise the second call to And while this does the trick on every platform I could test, I don't understand why the first call fails to begin with, let alone why the second one does not. More peculiarly, the issue does not seem to appear in I'd be willing to take either approach as a temporary fix, but both smell. If we could figure out where the actual issue lies, I'd be much happier with this. This has actually been blocking me from tagging a confident 1.0 and I never got around to dig into this |
- Includes a proper fix for #1; - Fixes incorrect mask checks causing false positives on CPUs without actual support for the SIMD sets we need; - Includes new test suite covering the detection routine; Other code (especially os/arch specific) may also get moved to the internal package to declutter the root package.
To touch back on this: d3f9e9e now includes a proper fix, over the bandaid that was applied previously. That said, I am still in the dark as to why the initial implementation worked in test builds, let alone why the bandaid "worked". |
In version 1.1.0, the bug is exists yet, but it is ok in branch master.
import (
"fmt"
"runtime"
)
var hasVectorSupport = func() bool {
if runtime.GOOS == "windows" {
_ = fmt.Sprint(cpuId(0)) // Disable optimization in Windows
}
mfi, _, _, _ := cpuId(0) // TODO(alcore) See: https://github.com/muyo/sno/pull/1
// other code ...
} And my CPU is:
|
Correct - I'm planning a 1.2.0 release within the next few days, which will include this. Most likely along with 1.0.1 and 1.1.1 bugfix backports. Glad |
No description provided.