intel / intel/llvm

Compiler crashes when linking dynamically SYCL kernels and functions called inside it

Open
#22,350 5 comments 0 reactions 1 assignee Claimed by @dyniols View on GitHub
confirmed enhancement
Dominant language
LLVM
Stars
1.5k
Forks
854
Avg merge
3d 17h
Merged PRs (30d)
137

Description

### Describe the bug

Linking fails when trying to link a file which contains a SYCL kernel calling a function contained inside a different library. This happens only with dynamic linking. With static linking, it works.

Basically, if a SYCL kernel calls a function declared and compiled elsewhere, during the dynamic linking phase, the compiler crashes with this error:
```
...
warning: Undefined function _Z3sumdd found in /scratch_local/icpx-dee970ba03/main-8d7ef7.bc. This may result in runtime errors.

build log:
Compilation started
Compilation done
Linking started
Linking done
Device build started
Options used by backend compiler: -I "/scratch_local/icpx-dee970ba03"
Failed to build device program
remark: :0:0: loop not vectorized: Cannot vectorize uncountable loop
remark: :0:0: Kernel was 16-way vectorized
remark: :0:0: Kernel was 16-way vectorized
remark: :0:0: Kernel was 16-way vectorized
remark: :0:0: 69 instructions in function
remark: :0:0: 35 instructions in function
remark: :0:0: 235 instructions in function
CompilerException Failed to lookup symbol _ZTSN4sycl3_V16detail18RoundedRangeKernelINS0_4itemILi1ELb1EEELi1EZNS0_7handler4fillIdEEvPvRKT_mEUlNS0_2idILi1EEEE_EE
JIT session error: Symbols not found: [ _Z3sumdd ]
Failed to materialize symbols: { (main, { _ZTSZN4sycl3_V17handler4fillIdEEvPvRKT_mEUlNS0_2idILi1EEEE_, _ZTSN4sycl3_V16detail18RoundedRangeKernelINS0_4itemILi1ELb1EEELi1EZNS0_7handler4fillIdEEvPvRKT_mEUlNS0_2idILi1EEEE_EE, _ZTSZZ4mainENKUlRN4sycl3_V17handlerEE_clES2_EUlNS0_7nd_itemILi1EEEE_ }) }

Failed to build: : -11 (CL_BUILD_PROGRAM_FAILURE)

llvm-foreach:
icpx: error: x86_64 compiler command failed with exit code 245 (use -v to see invocation)
...
```

### To reproduce

I have prepared a small reproducible example [here](https://gitlab.hpc.cineca.it/fbarbari/sycl-link-error) along with instructions to compile and run.

### Environment

- OS: RHEL 8.8

Reproduced the bug with oneAPI 2026.0.0, 2025.2.0 and 2025.1.1.

### Additional context

The bug appears both when targeting `spir64_x86_64` and `nvptx64-nvidia-cuda`, but not when targeting `spir64` on the CPU.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.