[Openmp-commits] [PATCH] D19878: Use C++11 atomics for ticket locks implementation

Paul Osmialowski via Openmp-commits openmp-commits at lists.llvm.org
Sat May 7 10:55:20 PDT 2016


pawosm01 added a comment.

In http://reviews.llvm.org/D19878#420844, @jcownie wrote:

> I have only made a top-level scan, so this needs more review. However, 
>  __kmp_baker_check should look like this
>
>   static kmp_uint32
>   __kmp_bakery_check(void *value, kmp_uint32 checker)
>   {
>       return (std::atomic_load( (std::atomic<unsigned> *)value ) == checker);
>   }
>
>
> Rather than having a test then returning TRUE or FALSE!


Yeah, I'd rather focused on removing this funny loop above return FALSE and didn't spot that loop removal caused whole 'if' became pointless. To be fixed.

> It would also be nice to reduce some of the code replication (e.g. kmp_wait_yield_4_ptr is identical to kmp_wait_yield_4 apart from the argument type [MIssing leading underscores since they cause underlining!] ). Either we should use a template (if we accept that this code is really C++ now), or even a macro for the whole function that is invoked with the function name and type is better than having the whole code duplicated.


Note that all those functions are within 'extern "C" { .... }' block so templates aren't welcome there. The questioned slight code replication seems to be better solution for now than preparing ugly macro. This code yields for the further refactor but that is not the point of this patch which is to make tasking work on more architectures.


Repository:
  rL LLVM

http://reviews.llvm.org/D19878





More information about the Openmp-commits mailing list