|
|
Log in / Subscribe / Register

Intel Skylake/Kaby Lake processors: broken hyper-threading

Intel Skylake/Kaby Lake processors: broken hyper-threading

Posted Jun 27, 2017 1:48 UTC (Tue) by areilly (guest, #87829)
In reply to: Intel Skylake/Kaby Lake processors: broken hyper-threading by k8to
Parent article: Intel Skylake/Kaby Lake processors: broken hyper-threading

When you think about the nature of the issue (mixed byte and word access specifically involving the high byte of the four registers that have one, in a tight loop), it seems very unlikely that there will be much compiled code that has this particular pattern in it. Indeed, I couldn't find any on a quick scan over my system. On modern x86_64, compilers will be using the %[abcd]l registers if they ever want bytes, because those correspond to the only available byte-chunks of the %r[8-15]l registers. A write to one of the %...h bytes in a tight loop. Can't think of a use-case, myself. Makes me wonder what the OCaml folk were doing with it, to find the pattern.


to post comments

Intel Skylake/Kaby Lake processors: broken hyper-threading

Posted Jun 27, 2017 4:36 UTC (Tue) by eru (subscriber, #2753) [Link] (2 responses)

Would it not be a reasonable translation of char b = i >> 8? (with no other usage of the value i >> 8 nearby).

Intel Skylake/Kaby Lake processors: broken hyper-threading

Posted Jun 27, 2017 5:11 UTC (Tue) by areilly (guest, #87829) [Link]

Yes, and I've just verified that clang (at least) will generate movb %dh, 0(%rax) in at least one test case. Put it in a loop though and it'll happily vectorise it into shifts and shuffles.

That use doesn't feel like one that would upset a modern (threaded) pipeline though, because there is no chance of a write-after-read style problem. I think that the issue is much more likely to involve writing to one of the [abcd]h registers, which would need to be unpacked into a read-modify-update sequence of micro-ops. For "make an int from left-shifted bytes" style code, I've only seen the compiler generate byte loads followed by left-shifts, rather than loading byte values directly into high reg bytes.

Intel Skylake/Kaby Lake processors: broken hyper-threading

Posted Jun 27, 2017 17:46 UTC (Tue) by pbonzini (subscriber, #60935) [Link]

Yes, but the compiler likely would only generate it at -Os (optimize for size).


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds