[llvm-bugs] [Bug 48644] New: OpenMP profiling via ITT API is broken on Clang 11.x and 12.x (OpenMP runtime crashes)

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jan 1 11:40:56 PST 2021


https://bugs.llvm.org/show_bug.cgi?id=48644

            Bug ID: 48644
           Summary: OpenMP profiling via ITT API is broken on Clang 11.x
                    and 12.x (OpenMP runtime crashes)
           Product: OpenMP
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Runtime Library
          Assignee: unassignedbugs at nondot.org
          Reporter: vitaly.slobodskoy at huawei.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 24335
  --> https://bugs.llvm.org/attachment.cgi?id=24335&action=edit
Simple ITT collector

Attempt to profile OpenMP application via ITT API (e.g. using VTune) leads to
crash within OpenMP runtime.

Steps to reproduce:
1) compile simple ITT collector (attached ittcollector.cpp):
g++ -std=c++11 -fPIC -g ./ittcollector.cpp -I <path to
llvm-project>/openmp/runtime/src/thirdparty/ittnotify/ -o libittc.so -shared
-ldl
2) compile the following OpenMP workload:
$ cat test.c
#include <stdio.h>

int main() {
    #pragma omp parallel
    {
            printf("Hello!\n");
    }
}
$ clang test.c -fopenmp -o test
3) run workload this way:
INTEL_LIBITTNOTIFY64=<absolute path>/libittc.so ./test
...
Hello!
Hello!
Hello!
Segmentation fault (core dumped)

Stack of crash:
Program received signal SIGSEGV, Segmentation fault.
0x000003fff7e74640 in __kmp_itt_frame_submit (gtid=0, begin=0, end=0,
imbalance=0, loc=0x400848, team_size=96, region=0)
    at /home/vslobods/llvm-project-main/openmp/runtime/src/kmp_itt.inl:287
287               loc->reserved_2 |= (frm + 1) << 16; // save "new" value
Missing separate debuginfos, use: debuginfo-install glibc-2.17-260.el7.aarch64
(gdb) bt
#0  0x000003fff7e74640 in __kmp_itt_frame_submit (gtid=0, begin=0, end=0,
imbalance=0, loc=0x400848, team_size=96, region=0)
    at /home/vslobods/llvm-project-main/openmp/runtime/src/kmp_itt.inl:287
#1  0x000003fff7ebba4c in __kmp_join_barrier (gtid=0) at
/home/vslobods/llvm-project-main/openmp/runtime/src/kmp_barrier.cpp:1874
#2  0x000003fff7e8d1b8 in __kmp_internal_join (id=0x400848, gtid=0,
team=0x44bc40)
    at /home/vslobods/llvm-project-main/openmp/runtime/src/kmp_runtime.cpp:7468
#3  0x000003fff7e80878 in __kmp_join_call (loc=0x400848, gtid=0,
fork_context=fork_context_intel, exit_teams=0)
    at /home/vslobods/llvm-project-main/openmp/runtime/src/kmp_runtime.cpp:2368
#4  0x000003fff7e6c120 in __kmpc_fork_call (loc=0x400848, argc=0,
microtask=0x40075c <.omp_outlined.>)
    at /home/vslobods/llvm-project-main/openmp/runtime/src/kmp_csupport.cpp:314
#5  0x000000000040074c in main ()

It fails on attempt to write to loc->reserved_2 which resides in read-only
segment.
This is a regression in LLVM 11 (LLVM 10 doesn't have this issue) which still
resides within LLVM 12. The regression was introduced by the following commit:
https://github.com/llvm/llvm-project/commit/9f4a92a4349ff1794379b706a4851c678899d5d2

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210101/b1347797/attachment-0001.html>


More information about the llvm-bugs mailing list