Skip to content

Add a qsort implementation to Mibench/qsort #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

nickwanninger
Copy link

@nickwanninger nickwanninger commented May 2, 2023

This PR adds an implementation of quicksort to the MiBench patches, as calling the libc implementation of quicksort isn't super interesting. I've inlined a version of qsort that DSWP is used, but gets no speedup (the non-expanded input_large.dat takes 3 seconds baseline while the noelle version takes 48 seconds). I am working on an enabler to allow llvm's tailcallelim pass to perform it's work w/o giving up.

The main reason llvm is giving up seems to be that they expect tailcalls to look like this:

   call qsort( ... )
   call qsort( ... )
   ret

where the return is immediately after a recursive call to the function. However, the frontend spits out this code:

another_block:
   br cleanup

recursive_block
   call qsort( ... )
   call qsort( ... )
   call llvm.lifetime.end( ... )
   br cleanup
cleanup:
   ret

and as such, the tailcallelim pass gives up.

@nickwanninger nickwanninger requested a review from edeiana May 8, 2023 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant