[Openmp-commits] [llvm] [openmp] [openmp][wasm] Allow compiling OpenMP to WebAssembly (PR #71297)
Andrew Brown via Openmp-commits
openmp-commits at lists.llvm.org
Mon Dec 4 17:49:38 PST 2023
================
@@ -2286,7 +2286,27 @@ KMP_PREFIX_UNDERSCORE(__kmp_unnamed_critical_addr):
#if KMP_OS_LINUX
# if KMP_ARCH_ARM || KMP_ARCH_AARCH64
.section .note.GNU-stack,"",%progbits
-# else
+# elif !KMP_ARCH_WASM
.section .note.GNU-stack,"", at progbits
# endif
#endif
+
+#if KMP_ARCH_WASM
+.data
+.global .gomp_critical_user_
+.global .gomp_critical_user_.var
+.global .gomp_critical_user_.reduction.var
+.global __kmp_unnamed_critical_addr
+.gomp_critical_user_:
+.zero 4
+.size .gomp_critical_user_, 4
+.gomp_critical_user_.var:
+.zero 4
+.size .gomp_critical_user_.var, 4
+.gomp_critical_user_.reduction.var:
+.zero 4
+.size .gomp_critical_user_.reduction.var, 4
+__kmp_unnamed_critical_addr:
+ .4byte .gomp_critical_user_
+ .size __kmp_unnamed_critical_addr, 4
+#endif
----------------
abrown wrote:
> For WASM, it would be best if an assembly version of the __kmp_invoke_microtask() function is created to handle any number of "shareds" passed in.
I'm not sure if that is even possible here. WebAssembly does not have variable arguments, so to call the microtask I suspect we'll always need a `switch` to dispatch to the right signature.
https://github.com/llvm/llvm-project/pull/71297
More information about the Openmp-commits
mailing list