<div dir="ltr">indeed, its a *tool* that cut both ways, and needs to pay for itself with benchmarks! <div>part of why i'm pushing for the has_side_effects=True attribute in <a href="https://phabricator.haskell.org/D350">https://phabricator.haskell.org/D350</a></div><div>is because it'll help make it more predictable when the instruction will exactly fire, because using it effectively requires pretty precise understanding of application level memory pressure!</div><div><br></div><div>@greg, i'd love more code review if you dont mind :) </div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Nov 29, 2014 at 9:15 PM, Gregory Collins <span dir="ltr"><<a href="mailto:greg@gregorycollins.net" target="_blank">greg@gregorycollins.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span class=""><div>On Thu, Nov 27, 2014 at 1:36 AM, Simon Marlow <span dir="ltr"><<a href="mailto:marlowsd@gmail.com" target="_blank">marlowsd@gmail.com</a>></span> wrote:<br></div></span><div class="gmail_extra"><div class="gmail_quote"><span class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I haven't been watching this, but I have one question: does prefetching actually *work*?  Do you have benchmarks (or better still, actual library/application code) that show some improvement?  I admit to being slightly sceptical - when I've tried using prefetching in the GC it has always been a struggle to get something that shows an improvement, and even when I get things tuned on one machine it typically makes things slower on a different processor.  And that's in the GC, doing it at the Haskell level should be even harder.<br></blockquote><div><br></div></span><div>I've gotten some speedups (for some operations) from speculative prefetch for hash tables -- e.g. for cuckoo hash where you know the key can be in one of two buckets with p=0.5. Prefetching one while you search the other lets you squeeze out some instruction-level parallelism, at the expense of cache thrashing.<div><br></div><div>The cache thrashing issue means that whether prefetching works for you depends a lot on your inputs: it can help if your program can handle some additional cache pressure, and it might hurt you otherwise.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>G</div></font></span></div></div><span class="HOEnZb"><font color="#888888">-- <br><div>Gregory Collins <<a href="mailto:greg@gregorycollins.net" target="_blank">greg@gregorycollins.net</a>></div>
</font></span></div></div>
</blockquote></div><br></div>