• Advertisement
Sign in to follow this  

How does one fix a structural hazard?

This topic is 1491 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement


Now for the more important part of my answer: How does this relate to game programming? You seem to be using this board as some general tool to enrich your learning about CS, but that's not what it is for, so please stop doing it.

This is the "General Programming" forum, so the question isn't off-topic.

 

It is however hopelessly vague. I'd much prefer it if more specific questions were asked...

Share this post


Link to post
Share on other sites

It's kind of programming, if you're writing assembly on certain processors (PPC ones spring to mind) you will want to avoid structural hazards as they tend to cause pipeline stalls.

 

Avoiding them is usually best left to the compiler though, the comments in this bit of code explain one way to avoid them. https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_22/lib/Target/PowerPC/PPCHazardRecognizers.cpp

Share this post


Link to post
Share on other sites
Broadly speaking, you avoid structural hazards by intermixing memory, integer, and floating point code in inner loops, instead of having separate loops for each. But this is very much a micro-optimization.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement