Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Race condition in regression test bug49334.cpp #49708

Open Quuxplusone opened 3 years ago

Quuxplusone commented 3 years ago
Bugzilla Link PR50739
Status CONFIRMED
Importance P enhancement
Reported by Michael Kruse (llvm@meinersbur.de)
Reported on 2021-06-16 08:02:07 -0700
Last modified on 2021-06-16 10:41:35 -0700
Version unspecified
Hardware PC Linux
CC herve@ic.unicamp.br, llvm-bugs@lists.llvm.org, tianshilei1992@gmail.com
Fixed by commit(s)
Attachments
Blocks
Blocked by PR49940
See also
The regression test bug49334.cpp occasionally fails because of a race condition
in the asynchronous data movement. The test case was introduced in
https://reviews.llvm.org/D97329 to fix http://llvm.org/PR49334. PR49334 was a
null dereference not a race condition.

== https://lab.llvm.org/staging/#/builders/154/builds/540

******************** TEST 'libomptarget :: nvptx64-nvidia-cuda ::
offloading/bug49334.cpp' FAILED ********************
Script:
--
: 'RUN: at line 1';   /home/buildbot-worker/minipc-1050ti-linux/openmp-offload-
cuda-runtime/llvm.build/./bin/clang++ -fopenmp  -fno-experimental-isel --cuda-
path=/opt/cuda  -I /home/buildbot-worker/minipc-1050ti-linux/openmp-offload-
cuda-runtime/llvm.src/openmp/libomptarget/test -I /home/buildbot-worker/minipc-
1050ti-linux/openmp-offload-cuda-runtime/llvm.build/runtimes/runtimes-
bins/openmp/runtime/src -L /home/buildbot-worker/minipc-1050ti-linux/openmp-
offload-cuda-runtime/llvm.build/runtimes/runtimes-bins/openmp/libomptarget -L
/home/buildbot-worker/minipc-1050ti-linux/openmp-offload-cuda-
runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src  -fopenmp-
targets=nvptx64-nvidia-cuda /home/buildbot-worker/minipc-1050ti-linux/openmp-
offload-cuda-runtime/llvm.src/openmp/libomptarget/test/offloading/bug49334.cpp -
o /home/buildbot-worker/minipc-1050ti-linux/openmp-offload-cuda-
runtime/llvm.build/runtimes/runtimes-bins/openmp/libomptarget/test/nvptx64-
nvidia-cuda/offloading/Output/bug49334.cpp.tmp && /home/buildbot-worker/minipc-
1050ti-linux/openmp-offload-cuda-runtime/llvm.build/runtimes/runtimes-
bins/openmp/libomptarget/test/nvptx64-nvidia-
cuda/offloading/Output/bug49334.cpp.tmp | /home/buildbot-worker/minipc-1050ti-
linux/openmp-offload-cuda-runtime/llvm.build/./bin/FileCheck /home/buildbot-
worker/minipc-1050ti-linux/openmp-offload-cuda-runtime/llvm.src/openmp/libomptarget/test/offloading/bug49334.cpp
--
Exit Code: 2
Command Output (stdout):
--
$ ":" "RUN: at line 1"
$ "/home/buildbot-worker/minipc-1050ti-linux/openmp-offload-cuda-
runtime/llvm.build/./bin/clang++" "-fopenmp" "-fno-experimental-isel" "--cuda-
path=/opt/cuda" "-I" "/home/buildbot-worker/minipc-1050ti-linux/openmp-offload-
cuda-runtime/llvm.src/openmp/libomptarget/test" "-I" "/home/buildbot-
worker/minipc-1050ti-linux/openmp-offload-cuda-
runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src" "-L"
"/home/buildbot-worker/minipc-1050ti-linux/openmp-offload-cuda-
runtime/llvm.build/runtimes/runtimes-bins/openmp/libomptarget" "-L"
"/home/buildbot-worker/minipc-1050ti-linux/openmp-offload-cuda-
runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src" "-fopenmp-
targets=nvptx64-nvidia-cuda" "/home/buildbot-worker/minipc-1050ti-linux/openmp-
offload-cuda-runtime/llvm.src/openmp/libomptarget/test/offloading/bug49334.cpp"
"-o" "/home/buildbot-worker/minipc-1050ti-linux/openmp-offload-cuda-
runtime/llvm.build/runtimes/runtimes-bins/openmp/libomptarget/test/nvptx64-nvidia-cuda/offloading/Output/bug49334.cpp.tmp"
# command stderr:
clang-13: warning: Unknown CUDA version. cuda.h: CUDA_VERSION=11030. Assuming
the latest supported version 10.1 [-Wunknown-cuda-version]
$ "/home/buildbot-worker/minipc-1050ti-linux/openmp-offload-cuda-
runtime/llvm.build/runtimes/runtimes-bins/openmp/libomptarget/test/nvptx64-nvidia-cuda/offloading/Output/bug49334.cpp.tmp"
note: command had no output on stdout or stderr
error: command failed with exit status: 1
$ "/home/buildbot-worker/minipc-1050ti-linux/openmp-offload-cuda-
runtime/llvm.build/./bin/FileCheck" "/home/buildbot-worker/minipc-1050ti-
linux/openmp-offload-cuda-runtime/llvm.src/openmp/libomptarget/test/offloading/bug49334.cpp"
# command stderr:
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /home/buildbot-worker/minipc-1050ti-linux/openmp-
offload-cuda-runtime/llvm.build/./bin/FileCheck /home/buildbot-worker/minipc-
1050ti-linux/openmp-offload-cuda-runtime/llvm.src/openmp/libomptarget/test/offloading/bug49334.cpp
error: command failed with exit status: 2
--
********************

******************** TEST 'libomptarget :: x86_64-pc-linux-gnu ::
offloading/bug49334.cpp' FAILED ********************
Script:
--
: 'RUN: at line 1';   /home/buildbot-worker/minipc-1050ti-linux/openmp-offload-
cuda-runtime/llvm.build/./bin/clang++ -fopenmp  -fno-experimental-isel --cuda-
path=/opt/cuda  -I /home/buildbot-worker/minipc-1050ti-linux/openmp-offload-
cuda-runtime/llvm.src/openmp/libomptarget/test -I /home/buildbot-worker/minipc-
1050ti-linux/openmp-offload-cuda-runtime/llvm.build/runtimes/runtimes-
bins/openmp/runtime/src -L /home/buildbot-worker/minipc-1050ti-linux/openmp-
offload-cuda-runtime/llvm.build/runtimes/runtimes-bins/openmp/libomptarget -L
/home/buildbot-worker/minipc-1050ti-linux/openmp-offload-cuda-
runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src  -fopenmp-
targets=x86_64-pc-linux-gnu /home/buildbot-worker/minipc-1050ti-linux/openmp-
offload-cuda-runtime/llvm.src/openmp/libomptarget/test/offloading/bug49334.cpp -
o /home/buildbot-worker/minipc-1050ti-linux/openmp-offload-cuda-
runtime/llvm.build/runtimes/runtimes-bins/openmp/libomptarget/test/x86_64-pc-
linux-gnu/offloading/Output/bug49334.cpp.tmp && /home/buildbot-worker/minipc-
1050ti-linux/openmp-offload-cuda-runtime/llvm.build/runtimes/runtimes-
bins/openmp/libomptarget/test/x86_64-pc-linux-
gnu/offloading/Output/bug49334.cpp.tmp | /home/buildbot-worker/minipc-1050ti-
linux/openmp-offload-cuda-runtime/llvm.build/./bin/FileCheck /home/buildbot-
worker/minipc-1050ti-linux/openmp-offload-cuda-runtime/llvm.src/openmp/libomptarget/test/offloading/bug49334.cpp
--
Exit Code: 2
Command Output (stdout):
--
$ ":" "RUN: at line 1"
$ "/home/buildbot-worker/minipc-1050ti-linux/openmp-offload-cuda-
runtime/llvm.build/./bin/clang++" "-fopenmp" "-fno-experimental-isel" "--cuda-
path=/opt/cuda" "-I" "/home/buildbot-worker/minipc-1050ti-linux/openmp-offload-
cuda-runtime/llvm.src/openmp/libomptarget/test" "-I" "/home/buildbot-
worker/minipc-1050ti-linux/openmp-offload-cuda-
runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src" "-L"
"/home/buildbot-worker/minipc-1050ti-linux/openmp-offload-cuda-
runtime/llvm.build/runtimes/runtimes-bins/openmp/libomptarget" "-L"
"/home/buildbot-worker/minipc-1050ti-linux/openmp-offload-cuda-
runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src" "-fopenmp-
targets=x86_64-pc-linux-gnu" "/home/buildbot-worker/minipc-1050ti-linux/openmp-
offload-cuda-runtime/llvm.src/openmp/libomptarget/test/offloading/bug49334.cpp"
"-o" "/home/buildbot-worker/minipc-1050ti-linux/openmp-offload-cuda-
runtime/llvm.build/runtimes/runtimes-bins/openmp/libomptarget/test/x86_64-pc-linux-gnu/offloading/Output/bug49334.cpp.tmp"
$ "/home/buildbot-worker/minipc-1050ti-linux/openmp-offload-cuda-
runtime/llvm.build/runtimes/runtimes-bins/openmp/libomptarget/test/x86_64-pc-linux-gnu/offloading/Output/bug49334.cpp.tmp"
note: command had no output on stdout or stderr
error: command failed with exit status: 1
$ "/home/buildbot-worker/minipc-1050ti-linux/openmp-offload-cuda-
runtime/llvm.build/./bin/FileCheck" "/home/buildbot-worker/minipc-1050ti-
linux/openmp-offload-cuda-runtime/llvm.src/openmp/libomptarget/test/offloading/bug49334.cpp"
# command stderr:
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /home/buildbot-worker/minipc-1050ti-linux/openmp-
offload-cuda-runtime/llvm.build/./bin/FileCheck /home/buildbot-worker/minipc-
1050ti-linux/openmp-offload-cuda-runtime/llvm.src/openmp/libomptarget/test/offloading/bug49334.cpp
error: command failed with exit status: 2
--
********************
Quuxplusone commented 3 years ago

For the nvptx backend, it is covered https://bugs.llvm.org/show_bug.cgi?id=49940.

We could potentially use this tracker for the x86 host offloading.

Quuxplusone commented 3 years ago

Thanks for the bug49940 link.

It seems that this problem (and the proposed quickfix https://bugs.llvm.org/show_bug.cgi?id=49940#c8) affects all offload plugins, not just nvptx or x86. If this is the case, thus bug could be marked as a duplicate.

Quuxplusone commented 3 years ago

Well, what is discussed in https://bugs.llvm.org/show_bug.cgi?id=49940 is about the data race introduced by async data movement, but x86 host offloading doesn't support it. Therefore I think x86 failure should be caused by another problem. We can use this tracker for an overall view.

Quuxplusone commented 3 years ago
(In reply to Shilei Tian from comment #3)
> Well, what is discussed in https://bugs.llvm.org/show_bug.cgi?id=49940 is
> about the data race introduced by async data movement, but x86 host
> offloading doesn't support it. Therefore I think x86 failure should be
> caused by another problem. We can use this tracker for an overall view.

Shilei, just a detail: x86 plugin does support running multiple target tasks in
parallel so the race condition in HostDataToTarget Map happens for this plugin
as well. In fact, you only need to have target nowait kernel running
concurrently which will create multiple OpenMP threads doing offloading in
parallel.

I believe that it is important not to mix up the asynchronicity induced by the
"target nowait" and the one induced by the async functions of libomptarget.
However, I agree that the other race condition related to the async queue does
not concern the x86 plugin.