RAW hazards revisited (again)
By Darryl Gove-Oracle on Apr 07, 2014
In the article on RAW hazards there is some code that demonstrates various types of RAW hazard. One common situation is writing code to copy misaligned data into a buffer. The example code contains a test for this kind of copying, the results from this test, compiled with Solaris Studio 12.3, on my system look like:
Misaligned load v1 (bad) memcpy() Elapsed = 16.486042 ns Misaligned load v2 (bad) byte copy Elapsed = 9.176913 ns Misaligned load good Elapsed = 5.243858 ns
However, we've done some work in the compiler on better identification of potential RAW hazards. If I recompile using the 12.4 Beta compiler I get the following results:
Misaligned load v1 (bad) memcpy() Elapsed = 4.756911 ns Misaligned load v2 (bad) byte copy Elapsed = 5.005309 ns Misaligned load good Elapsed = 5.597687 ns
All three variants of the code produce the same performance - the RAW hazards have been eliminated!