- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am looking at the documenation of the compiler flag "-qopt-prefetch" and I am wondering two things:
- Is there a drawback to always have it on? i.e. could the compiler make bad pre-fetching choices and create slower code if I switch it on?
- Is that flag part of any of the meta-flags like -O2?
Thanks for your advice!
- Tags:
- compiler
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Matthieu,
Thank you for reaching out to us.
Prefetching optimization will totally depend on your use-case. Based on your use-case you will experience the benefits and drawbacks of it.
Suppose your use-case has some small array streams, small irregular memory address patterns, and L1 cache miss reduction operations, then there will be a more chance of positive impact using Prefetching.
Because arrays and some recursive data structure accesses can be easily predicted and will have a positive impact over software prefetching. However, data structures like hashing are much harder to prefetch effectively.
Or Suppose in your use-case when the number of instructions in a loop is extremely small, it can be challenging to insert software prefetching instructions to provide timely prefetching requests because there are no enough computations between prefetching instructions.
So depending on your use-case you can take the advantage of prefetching, you can also set the levels of prefetching (-qopt-prefetch[=n]) or can disable it (-qno-opt-prefetch), depending on the scenario or you can also add the prefetching intrinsic (_mm_prefetch()) if you fill compiler is creating overhead while prefetching.
For more details please refer below link:
The O2 optimization may enable data prefetching depending on the application. Whereas if you specify O3 level optimization, it will enable more aggressive prefetching.
Hope the above details will give you insights about the use of prefetch.
Warm Regards,
Abhishek
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Please give us an update if your issue is resolved.
If you still have some issues related to this thread please post us.
Thank You,
Abhishek
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
We are assuming that the provided solution helped you. So we will stop monitoring this thread
Please post a new thread if you have any other issues.
Thank You
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page