Re:Why do RET instructions have a REPZ prepended on x86?
by onan_barbarian on Monday August 26, 2013 @07:56PM
(#6280651)
You are overgeneralizing. Being front-end bound is true for some code but not for others.
We see our gotchas typically in terms of not being able to issue instructions due to data dependencies and filling up the RS with things that can't make progress (informally, a big tree of "ORs" where one source for everything has missed L1 and held everyone else up).
Other people will be hopelessly bound on cache or memory bandwidth, or floating point multiply, or whatever. Or disk access :-)
If one is curious about whether this applies to one's own code, you don't have to speculate - just bust out the Optimization Guide (http://www.intel.com/content/www/us/en/architecture-and-tech...) and go figure out where your bottlenecks are by looking at counters. VTune can do some of this stuff for you.
Re:Why do RET instructions have a REPZ prepended on x86?
by rayiner on Monday August 26, 2013 @09:55PM
(#6281013)
I'm speaking from an architectural design standpoint. Exceeding the ability of the OOO engine to cover cache misses isn't a "gotcha" it's a design limit of the hardware. Being able to only predict three branches in a 16-byte fetch group, even though more than 3 branches can fit in a 16-byte stretch of code, is a gotcha. Being able to execute only 3 SSE operations per cycle is a design limit. Not being able to hit 3 SSE operations per cycle depending on which registers you use and how many prefix bytes they require to encode is a gotcha.
Re:Why do RET instructions have a REPZ prepended on x86?
by pbsd on Monday August 26, 2013 @08:13PM
(#6280705)
Modern Intels also cache decoded uops to alleviate this. So if your (say) main loop is less than about 1500 uops, decoding performance becomes less relevant. This is particularly important for SIMD instructions, which are often quite large (> 5 bytes) and thus can easily bottleneck on the decoding step.
- Fetches 16-32 bytes
- Finds instruction boundaries (because of variable-length encoding)
- Branch predicts any branches in the fetch group
- Decodes 3-4 instructions in the fetch group
- Issues 3-4 decoded operations to the rest of the pipeline
This whole process has to happen every cycle (though it's pipelined over 3-5 cycles in the front end), and the performance of this process gates the rest of the pipeline. As a result, many of the micro-architectural "gotchas" in modern x86 processors tends to be in the fetch/decode phase.