| Issue |
52850
|
| Summary |
Error generating preprocessed source(s)
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
italoaug
|
I may have come across a compilation bug when running clang-14 with OpenMP offload.
Here is the crash backtrace:
```
$ clang -O3 -g -fPIC -Wall -Wno-unused-result -Wno-unused-variable -ffast-math -Xopenmp-target -march=sm_60 -shared -fopenmp -fopenmp-targets=nvptx64 /tmp/devito-jitcache-uid999/d20671d527140c758fc5efcba649440c293f3163.c -lm -o /tmp/devito-jitcache-uid999/d20671d527140c758fc5efcba649440c293f3163.so
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /llvm/bin/clang-14 -cc1 -triple nvptx64 -aux-triple x86_64-unknown-linux-gnu -S -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name d20671d527140c758fc5efcba649440c293f3163.c -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -menable-no-infs -menable-no-nans -menable-unsafe-fp-math -fno-signed-zeros -mreassociate -freciprocal-math -ffp-contract=fast -fno-rounding-math -ffast-math -ffinite-math-only -fno-verbose-asm -no-integrated-as -mlink-builtin-bitcode /opt/nvidia/hpc_sdk/Linux_x86_64/21.9/cuda/11.4/nvvm/libdevice/libdevice.10.bc -target-feature +ptx74 -target-sdk-version=11.4 -mlink-builtin-bitcode /llvm/lib/libomptarget-new-nvptx-sm_60.bc -target-cpu sm_60 -mllvm -treat-scalable-fixed-error-as-warning -debug-info-kind=line-directives-only -dwarf-version=2 -debugger-tuning=gdb -fno-dwarf-directory-asm -resource-dir /llvm/lib/clang/14.0.0 -internal-isystem /llvm/lib/clang/14.0.0/include/openmp_wrappers -include __clang_openmp_device_functions.h -I/opt/nvidia/hpc_sdk/Linux_x86_64/2021/comm_libs/mpi/include -I. -internal-isystem /llvm/lib/clang/14.0.0/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -internal-isystem /opt/nvidia/hpc_sdk/Linux_x86_64/21.9/cuda/11.4/include -internal-isystem /llvm/lib/clang/14.0.0/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -Wall -Wno-unused-result -Wno-unused-variable -fdebug-compilation-dir=/devito -ferror-limit 19 -fopenmp -fopenmp-target-new-runtime -fgnuc-version=4.2.1 -fcolor-diagnostics -vectorize-loops -vectorize-slp -fopenmp-is-device -fopenmp-host-ir-file-path /tmp/d20671d527140c758fc5efcba649440c293f3163-0e60a5.bc -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/d20671d527140c758fc5efcba649440c293f3163-bd6dfc.s -x c /tmp/devito-jitcache-uid999/d20671d527140c758fc5efcba649440c293f3163.c
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module '/tmp/devito-jitcache-uid999/d20671d527140c758fc5efcba649440c293f3163.c'.
4. Running pass 'NVPTX Assembly Printer' on function '@_ZN12_GLOBAL__N_115invokeMicrotaskEiiPvPS0_l'
#0 0x00005646e53610f0 PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
#1 0x00005646e535e9ee SignalHandler(int) Signals.cpp:0:0
#2 0x00007fea4961d140 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14140)
#3 0x00005646e606c4bf llvm::DwarfDebug::emitInitialLocDirective(llvm::MachineFunction const&, unsigned int) (/llvm/bin/clang-14+0x2e394bf)
#4 0x00005646e6039153 llvm::AsmPrinter::emitInitialRawDwarfLocDirective(llvm::MachineFunction const&) (/llvm/bin/clang-14+0x2e06153)
#5 0x00005646e4172baf llvm::NVPTXAsmPrinter::emitFunctionEntryLabel() (/llvm/bin/clang-14+0xf3fbaf)
#6 0x00005646e604104d llvm::AsmPrinter::emitFunctionHeader() (/llvm/bin/clang-14+0x2e0e04d)
#7 0x00005646e60448ed llvm::AsmPrinter::emitFunctionBody() (/llvm/bin/clang-14+0x2e118ed)
#8 0x00005646e4166219 llvm::NVPTXAsmPrinter::runOnMachineFunction(llvm::MachineFunction&) (/llvm/bin/clang-14+0xf33219)
#9 0x00005646e45bf2a4 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/llvm/bin/clang-14+0x138c2a4)
#10 0x00005646e4a77b20 llvm::FPPassManager::runOnFunction(llvm::Function&) (/llvm/bin/clang-14+0x1844b20)
#11 0x00005646e4a77c8c llvm::FPPassManager::runOnModule(llvm::Module&) (/llvm/bin/clang-14+0x1844c8c)
#12 0x00005646e4a79741 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/llvm/bin/clang-14+0x1846741)
#13 0x00005646e56a1d36 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) (/llvm/bin/clang-14+0x246ed36)
#14 0x00005646e639892c clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/llvm/bin/clang-14+0x316592c)
#15 0x00005646e6d923c9 clang::ParseAST(clang::Sema&, bool, bool) (/llvm/bin/clang-14+0x3b5f3c9)
#16 0x00005646e5d6cb69 clang::FrontendAction::Execute() (/llvm/bin/clang-14+0x2b39b69)
#17 0x00005646e5cf9a9b clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/llvm/bin/clang-14+0x2ac6a9b)
#18 0x00005646e5e22c80 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/llvm/bin/clang-14+0x2befc80)
#19 0x00005646e3e1ab8d cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/llvm/bin/clang-14+0xbe7b8d)
#20 0x00005646e3e18496 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#21 0x00005646e3d95936 main (/llvm/bin/clang-14+0xb62936)
#22 0x00007fea490ebd0a __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x26d0a)
#23 0x00005646e3e17e4a _start (/llvm/bin/clang-14+0xbe4e4a)
clang-14: error: unable to execute command: Segmentation fault (core dumped)
clang-14: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 14.0.0 (https://github.com/llvm/llvm-project.git a9bb97e8410b09446c8d6da3b7bb493f79a4aaea)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /llvm/bin
clang-14: note: diagnostic msg: Error generating preprocessed source(s).
```
And here is the source code:
```
$ cat /tmp/devito-jitcache-uid999/d20671d527140c758fc5efcba649440c293f3163.c
#define _POSIX_C_SOURCE 200809L
#define START_TIMER(S) struct timeval start_ ## S , end_ ## S ; gettimeofday(&start_ ## S , NULL);
#define STOP_TIMER(S,T) gettimeofday(&end_ ## S, NULL); T->S += (double)(end_ ## S .tv_sec-start_ ## S.tv_sec)+(double)(end_ ## S .tv_usec-start_ ## S .tv_usec)/1000000;
#include "stdlib.h"
#include "math.h"
#include "sys/time.h"
#include "omp.h"
struct dataobj
{
void *restrict data;
int * size;
int * npsize;
int * dsize;
int * hsize;
int * hofs;
int * oofs;
} ;
struct profiler
{
double section0;
} ;
int norm2(const float h_x, const float h_y, struct dataobj *restrict n_vec, const float o_x, const float o_y, struct dataobj *restrict rec_vec, struct dataobj *restrict rec_coords_vec, const int x_M, const int x_m, const int y_M, const int y_m, const int p_rec_M, const int p_rec_m, const int time_M, const int time_m, const int deviceid, const int devicerm, struct profiler * timers)
{
/* Begin of OpenMP setup */
if (deviceid != -1)
{
omp_set_default_device(deviceid);
}
/* End of OpenMP setup */
float (*restrict n) = (float (*)) n_vec->data;
float (*restrict rec)[rec_vec->size[1]] = (float (*)[rec_vec->size[1]]) rec_vec->data;
float (*restrict rec_coords)[rec_coords_vec->size[1]] = (float (*)[rec_coords_vec->size[1]]) rec_coords_vec->data;
#pragma omp target enter data map(to: rec[0:rec_vec->size[0]][0:rec_vec->size[1]])
#pragma omp target enter data map(to: rec_coords[0:rec_coords_vec->size[0]][0:rec_coords_vec->size[1]])
float sum = 0.0F;
/* Begin section0 */
START_TIMER(section0)
if (rec_vec->size[0]*rec_vec->size[1] > 0)
{
#pragma omp target teams distribute parallel for collapse(2) reduction(+:sum)
for (int time = time_m; time <= time_M; time += 1)
{
for (int p_rec = p_rec_m; p_rec <= p_rec_M; p_rec += 1)
{
float posx = -o_x + rec_coords[p_rec][0];
float posy = -o_y + rec_coords[p_rec][1];
int ii_rec_0 = (int)(floor(posx/h_x));
int ii_rec_1 = (int)(floor(posy/h_y));
if (x_M >= ii_rec_0 && y_M >= ii_rec_1 && x_m <= ii_rec_0 && y_m <= ii_rec_1)
{
sum += fabs(rec[time][p_rec]*rec[time][p_rec]);
}
}
}
}
STOP_TIMER(section0,timers)
/* End section0 */
n[0] = sum;
#pragma omp target exit data map(delete: rec[0:rec_vec->size[0]][0:rec_vec->size[1]]) if(devicerm && (rec_vec->size[0] != 0) && (rec_vec->size[1] != 0))
#pragma omp target exit data map(delete: rec_coords[0:rec_coords_vec->size[0]][0:rec_coords_vec->size[1]]) if(devicerm && (rec_coords_vec->size[0] != 0) && (rec_coords_vec->size[1] != 0))
return 0;
}
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs