ispc / ispc

Intel® Implicit SPMD Program Compiler
BSD 3-Clause "New" or "Revised" License
2.52k stars 315 forks source link

Assertion fail #1688

Closed maxnbk closed 4 years ago

maxnbk commented 4 years ago

Not sure what to name this more specifically. First day using ispc to build something.

ispc: /usr/local/src/llvm/bin-9.0/include/llvm/IR/Instructions.h:868: llvm::Type *llvm::checkGEPType(llvm::Type *): Assertion `Ty && "Invalid GetElementPtrInst indices for type!"' failed. /home/appveyor/projects/ispc/src/main.cpp(359): FATAL ERROR: Unhandled signal sent to process; terminating.

This is when compiling embree-3.8.0 with devtoolset-6 on ispc-1.12.1.dev (latest download as of today), also using tbb-2017 through 2019.

Had to remove the uint typedefs in embree source at ./tutorials/common/common.isph, to get past 44% on the build, but that seems not to impact this otherwise.

dbabokin commented 4 years ago

Could you extract the specific command line, which fails (make VERBOSE=TRUE should do the trick)?

maxnbk commented 4 years ago

I anonymized some paths, and to make the output a little shorter.

ispc -I [...]/tutorials/pathtracer -DTASKING_TBB --arch=x86-64 --addressing=32 -O3 --target=sse2,sse4,avx,avx2 --woff --opt=fast-math --pic -h [...]/tutorials/pathtracer/pathtracer_device_ispc.h -MMM [...]/tutorials/pathtracer//pathtracer_device.dev.idep -o [...]/tutorials/pathtracer//pathtracer_device.dev.o [...]/tutorials/pathtracer/pathtracer_device.ispc
maxnbk commented 4 years ago

I also tested the same code with 1.12.0 and it works fine.

DeepakRajendrakumaran commented 4 years ago

It's easily reproducible and looks like an ispc bug.

DeepakRajendrakumaran commented 4 years ago

struct globStruct { int *struct_elem; };

extern uniform globStruct g_globStruct;

int uniform * g_final = &g_globStruct.struct_elem[0];

the code snippet above is an easily reproducible example

DeepakRajendrakumaran commented 4 years ago

The problem is a bug in the logic for obtaining constant value from an addresOf expr. '&g_globStruct.struct_elem[0]' is not a compile time constant but we try to get a constant value

dbabokin commented 4 years ago

Fixed.