[PATCH] D144893: [OpenMP][WIP] `spir64` device runtime library template

Jean-Baptiste Skutnik via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 9 17:50:00 PST 2023


spoutn1k added inline comments.


================
Comment at: openmp/libomptarget/DeviceRTL/src/LibC.cpp:37
+/// Intel implementation
+#pragma omp begin declare variant match(device = {arch(spir64)})
+namespace impl {
----------------
tianshilei1992 wrote:
> spoutn1k wrote:
> > tianshilei1992 wrote:
> > > I'm thinking potentially we can have a generic implementation of `omp_vprintf` that just returns -1 and having the NVPTX version calls `vprintf`. In this way we don't need to do it for every target.
> > How do I go about doing this ? Declare `omp_vprintf` as weak ?
> just something like:
> ```
> int32_t omp_vprintf(const char *Format, void *Arguments, uint32_t) {
>   return -1;
> }
> #pragma omp begin declare variant match(device = {arch(nvptx64)})
> int32_t omp_vprintf(const char *Format, void *Arguments, uint32_t) {
>   return vprintf(...);
> }
> #pragma omp end declare variant
> ```
> In this way, when the arch is NVPTX64, that variant will replace the default one.
Oh I see. I was under the impression this would create a symbol conflict. Will do !


================
Comment at: openmp/libomptarget/DeviceRTL/src/Mapping.cpp:162
+uint32_t getNumHardwareThreadsInBlock() {
+  return __spirv_BuiltInWorkgroupSize(0);
+}
----------------
tianshilei1992 wrote:
> Do we have these builtins in LLVM right now?
That was my question but Johannes told me to go ahead and use them.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144893/new/

https://reviews.llvm.org/D144893



More information about the llvm-commits mailing list