[llvm-bugs] [Bug 51996] New: llvm-spir crashed
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Sep 28 04:17:54 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=51996
Bug ID: 51996
Summary: llvm-spir crashed
Product: tools
Version: 12.0
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: llvm-as
Assignee: unassignedbugs at nondot.org
Reporter: david.livshin at dalsoft.com
CC: llvm-bugs at lists.llvm.org
couldn't find entry for llvm-spirv that crashed; used the following:
clang -cc1 -O3 -emit-llvm -cl-std=CL1.2 -triple spir64-unknown-unknown
-finclude-default-header -cl-ext=cl_khr_fp64 -o x.bc x.cl
llvm-as-12 x.bc -o x.obj
llvm-spirv x.obj -o x.spr
!.../david/wd/dpl/openCL>make x.spr
clang -cc1 -O3 -emit-llvm -cl-std=CL1.2 -triple spir64-unknown-unknown
-finclude-default-header -cl-ext=cl_khr_fp64 -o x.bc x.cl
llvm-as-12 x.bc -o x.obj
llvm-spirv x.obj -o x.spr
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace.
Stack dump:
0. Program arguments: llvm-spirv x.obj -o x.spr
1. Running pass 'LLVMToSPIRV' on module 'x.obj'.
/lib/x86_64-linux-gnu/libLLVM-11.so.1(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamE+0x1f)[0x7f31b488802f]
/lib/x86_64-linux-gnu/libLLVM-11.so.1(_ZN4llvm3sys17RunSignalHandlersEv+0x50)[0x7f31b4886380]
/lib/x86_64-linux-gnu/libLLVM-11.so.1(+0xaed500)[0x7f31b4888500]
/lib/x86_64-linux-gnu/libc.so.6(+0x41040)[0x7f31b39d7040]
/lib/libLLVMSPIRVLib.so.11(_ZN5SPIRV11LLVMToSPIRV9transTypeEPN4llvm4TypeE+0xde)[0x7f31b8fefafe]
/lib/libLLVMSPIRVLib.so.11(_ZN5SPIRV11LLVMToSPIRV13transAsmINTELEPN4llvm9InlineAsmE+0xb0)[0x7f31b8ff2eb0]
/lib/libLLVMSPIRVLib.so.11(_ZN5SPIRV11LLVMToSPIRV27transValueWithoutDecorationEPN4llvm5ValueEPNS_15SPIRVBasicBlockEbNS0_13FuncTransModeE+0xc1e)[0x7f31b8feda2e]
/lib/libLLVMSPIRVLib.so.11(_ZN5SPIRV11LLVMToSPIRV10transValueEPN4llvm5ValueEPNS_15SPIRVBasicBlockEbNS0_13FuncTransModeE+0x13a)[0x7f31b8fef83a]
/lib/libLLVMSPIRVLib.so.11(_ZN5SPIRV11LLVMToSPIRV13transFunctionEPN4llvm8FunctionE+0xd9)[0x7f31b8ff51f9]
/lib/libLLVMSPIRVLib.so.11(_ZN5SPIRV11LLVMToSPIRV9translateEv+0x2d0)[0x7f31b8ff7b90]
/lib/libLLVMSPIRVLib.so.11(_ZN5SPIRV11LLVMToSPIRV11runOnModuleERN4llvm6ModuleE+0x70)[0x7f31b8ff7d50]
/lib/x86_64-linux-gnu/libLLVM-11.so.1(_ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE+0x3e0)[0x7f31b4997700]
/lib/libLLVMSPIRVLib.so.11(_ZN4llvm10writeSpirvEPNS_6ModuleERKN5SPIRV14TranslatorOptsERSoRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xd2)[0x7f31b8ff7e32]
llvm-spirv(main+0x1bcb)[0x55b33a4d1f9b]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xd5)[0x7f31b39be565]
llvm-spirv(_start+0x2e)[0x55b33a4d229e]
make: *** [makefile:45: x.spr] Segmentation fault (core dumped)
make: *** Deleting file 'x.spr'
clang -v
Ubuntu clang version 12.0.0-3ubuntu1~21.04.2
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/10
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/10
Candidate multilib: .;@m64
Selected multilib: .;@m64
llvm-as-12 --version
LLVM (http://llvm.org/):
LLVM version 12.0.0
Optimized build.
Default target: x86_64-pc-linux-gnu
Host CPU: tigerlake
llvm-spirv --version
LLVM (http://llvm.org/):
LLVM version 11.0.1
Optimized build.
Default target: x86_64-pc-linux-gnu
Host CPU: tigerlake
x.cl - the watered down version of the real kernel; removing some lines make it
pass
__kernel void dpl_stencil_1p( __const unsigned long n, __global double *a,
__global double *b, __global double *x,
__local double *Save, __local double *Intrmd, __local double *Init
)
{
size_t globalID, localSz, globalSz, numGroups;
uint workDim;
globalID = get_global_id( 0 );
// The number of work-items per work-group = WI/WG in dimension 0
localSz = get_local_size ( 0 );
// The total number of work-items (WI) in dimension 0
globalSz = get_global_size( 0 );
// The total number of work-groups (WG) in dimension 0
numGroups = get_num_groups( 0 );
// The number of dimensions
workDim = get_work_dim();
size_t sz;
sz = localSz;
if ( globalID == 0 ) Save[sz-10] = 1.23;
barrier( CLK_LOCAL_MEM_FENCE ); // CLK_GLOBAL_MEM_FENCE
if ( globalID == 0 ) x[globalID] = localSz;
else if ( globalID == 1 ) x[globalID] = globalSz;
else if ( globalID == 2 ) x[globalID] = workDim;
else if ( globalID == 3 ) x[globalID] = numGroups;
else if ( globalID == 4 ) x[globalID] = Save[0];
else if ( globalID == 5 ) x[globalID] = Save[sz-10];
else x[globalID] = a[globalID] + b[globalID];
int ThreadsNum;
int nOfThreads, nOfThread;
nOfThreads = localSz;
nOfThread = globalID;
double Save_, Intrmd_;
// Stage1
unsigned long nn, iCnt, iRem, loopCnt, loopIters;
unsigned long i, j;
double xx, xx1;
nn = n - 1;
iCnt = nn / nOfThreads;
iRem = nn % nOfThreads;
loopCnt = iCnt;
loopIters = nOfThread*iCnt;
if ( nOfThread < iRem )
{
loopIters++;
}
// if ( nOfThread != ( nOfThreads - 1 ) )
{
/*
** we dont need the data in the last thread,
** but it seems tha on GPU it is easier just to execute the code
*/
Save_ = 0.;
Intrmd_ = 1.;
for ( j = loopIters + 1, i = j + loopCnt; j < i; j++ )
{
Save_ = xx*Save_ + xx1;
}
Save[nOfThread] = Save_;
Intrmd[nOfThread] = Intrmd_;
} // if ( nOfThread != ( nOfThreads - 1 ) )
}
--
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/20210928/05b5c350/attachment-0001.html>
More information about the llvm-bugs
mailing list