Page MenuHomePhabricator

[OpenMP] libomp: add atomic functions for new OpenMP 5.1 atomics.
ClosedPublic

Authored by AndreyChurbanov on Sep 20 2021, 2:51 PM.

Details

Summary

Added functions those implement "atomic compare".
Though clang does not use library interfaces to implement OpenMP atomics,
the functions added for consistency.

Also added missed functions for 80-bit floating min/max atomics.

Diff Detail

Event Timeline

AndreyChurbanov requested review of this revision.Sep 20 2021, 2:51 PM
This revision is now accepted and ready to land.Wed, Oct 13, 10:17 AM
kkwli0 added a subscriber: kkwli0.Thu, Oct 21, 7:06 AM

Is this patch only applicable to KMP_ARCH_X86 || KMP_ARCH_X86_64 arch? The newly added test cases fail on non-X86 platform due to undefined symbols. The __kmpc_atomic_*_cas_* prototypes got preprocessed out inside the extern "C" hence the names are mangled.

Why are the types in __kmpc_atomic_val_4_cas_cpt different from the types in __kmpc_atomic_val_4_cas? I think, all the functions should use fixed-size integer to respect the width suggested by the name of the function.

Is this patch only applicable to KMP_ARCH_X86 || KMP_ARCH_X86_64 arch? The newly added test cases fail on non-X86 platform due to undefined symbols. The __kmpc_atomic_*_cas_* prototypes got preprocessed out inside the extern "C" hence the names are mangled.

Thanks for comment. The implementation is indeed supposed to be applicable to KMP_ARCH_X86 || KMP_ARCH_X86_64 only.
I've fixed the tests in commit https://reviews.llvm.org/rG52f4922ebb7b. Library code fixed in https://reviews.llvm.org/D112261 to eliminate mangled symbols from the build on non-x86 architectures.

Why are the types in __kmpc_atomic_val_4_cas_cpt different from the types in __kmpc_atomic_val_4_cas? I think, all the functions should use fixed-size integer to respect the width suggested by the name of the function.

Sorry, Joachim, I haven't got your comment. Both functions deal with kmp_int32 that is 4 bytes. Or am I missing something?