OpenMP on x86?

Does libomp support x86?
From code in kmp_wait_release.h I see that kmp_flag_32 derives from kmp_flag_atomic, so uses std::atomic for the lock. But kmp_flag_64 derives from kmp_flag_native and uses volatile for the lock, not atomic. On x86 it’s not enough.
Does anybody actually need OpenMP on x86?

Intel is maintaining libomp in LLVM. If OpenMP doesn’t work on x86 anymore, I’d be a little concerned.

If you want to know how a specific feature works, or why it works, that’s a different question. Feel free to follow up. Maybe tag @RaviNarayanaswamy and @alexey-bataev, Andrey doesn’t seem to be registered here.

Yes on linunx and Windows AFAIK.

What is the problem with volatile location field? Can you please elaborate in more details?
Operations those need synchronization are done atomically, so I don’t see any problems with kmp_flag_64 on x86.

@AndreyChurbanov : oops, I was (again) fooled by ‘loc’ name - location. not lock (as I thought).
We have a test failing randomly on x86 only, so far I was able to get a mini-dump only, with the stack
STACK_TEXT:
1100df58 7938a66e 00000000 1100dfc0 00000000 libomp140_i386!__kmp_wait_template<kmp_flag_64,1,0,1>+0x1f
1100dfd4 79389679 00000001 00000000 0000006e libomp140_i386!__kmp_hyper_barrier_release+0xbe
1100e020 7937719b 0000006e fffffffe 0c0c1ec0 libomp140_i386!__kmp_fork_barrier+0x1d9
1100e044 793a67c7 0c0c1ec0 00000000 00000000 libomp140_i386!__kmp_launch_thread+0x3b
1100fe08 75b5fa29 0c0c1ec0 75b5fa10 1100fe74 libomp140_i386!__kmp_launch_worker+0x147

The issue may be anywhere: test, MSVC codegen, MSVC codegen of libomp, libomp. Test creates more threads than other tests (17*17), and if I reduce it to 4 threads runs fine for hours. I thought that maybe non-atomic ‘loc’ is an issue, but you are saying it’s accessed under a lock. Will have to dig deeper.

Thank you

Finally returning to this thread. I have a test which randomly fails on Windows 32 (works fine on Windows 64). First found the issue with MSVC compiler. Now compiled it with clang/llvm 14.0.0, using libomp from 14.0.0 release: yes, crashes with AV in about 10 min of running. Will open a bug for libomp.

Natalia

Submitted [OpenMP] Nondeterministic failures on Windows, x86 · Issue #54708 · llvm/llvm-project · GitHub
@AndreyChurbanov : let me know if you need more details