rkuchumov / staccato

C++11 Work-Stealing Task Scheduler
MIT License
36 stars 2 forks source link

TBB Fibonacci #1

Open bretalfieri opened 6 years ago

bretalfieri commented 6 years ago

You should use continuation passing and scheduler bypassing in your TBB Fib benchmark. You'll still come out ahead, but it won't be as dramatic. https://software.intel.com/en-us/node/506107

rkuchumov commented 6 years ago

@bretalfieri Thanks, for your suggestion, but in this case the comparison would not be fair. When the bypassing is used, TBB executes the subtask immediately after it has been returned by the parent without adding it to the thread's pool. It would be the same as calling a() (in your example) before return. The same approach can be applied to both Cilk and my implementation and would result in better performance.

PS. It's based on my understanding of the source code of TBB of v.4.smth. I don't have it now at hand, but if you really want, I can point the lines to you.

bretalfieri commented 6 years ago

You are correct about the bypassing, however I would still suggest the continuation passing instead of waiting. Tbb is a child stealer so waiting can be unbounded, which is why it has the continuation mechanism. Cilk gets this for free since it's continuation stealing. It looks like you use leapfroging on wait, which is another good strategy for child stealing.