Skip to content

[SYCL][CUDA][L0] fatal error: translation unit is too large for Clang to process #20371

@abagusetty

Description

@abagusetty

Describe the bug

When building a project with just JIT mode results in the following linking error. Stack trace and reproducer below. This was confirmed with L0 & CUDA backend. Expecting similar behavior for HIP backend as well.

We see a similar issue with 2025.2.0 version with agama 1146.12 on PVC (L0) as well (ticket if folks have access to CMPLRLLVM-70962)

Reproducer:

git clone https://github.com/abagusetty/ExchCXX.git ExchCXX_test
cd ExchCXX_test
f=src/sycl/exchcxx_sycl.cmake

# insert link option (device-code-split) after the compile option within the block
sed -i -E '
/^if[[:space:]]*\( *EXCHCXX_SYCL_DEVICE_CODE_SPLIT_PER_SOURCE *\)/,/^endif[[:space:]]*\(\)/ {
  /target_compile_options[[:space:]]*\([[:space:]]*exchcxx[[:space:]]+PRIVATE/,/^[[:space:]]*\)[[:space:]]*$/ {
    /^[[:space:]]*\)[[:space:]]*$/ a\
  target_link_options( exchcxx PRIVATE -fsycl-device-code-split=per_source )
  }
}
' "$f"

find . -type f -path "*/src/sycl/*.cmake" -exec sed -i -e 's/per_source/per_kernel/g' {} +
find . -type f -path "*/src/sycl/*.cmake" -exec sed -i -e 's/PER_SOURCE/PER_KERNEL/g' {} +
cmake -H. -Bbuild_sycl_jit_kernel -DEXCHCXX_ENABLE_SYCL=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DEXCHCXX_ENABLE_TESTS=OFF -DEXCHCXX_ENABLE_LIBXC=OFF -DCMAKE_INSTALL_PREFIX=$PWD/install_jit -DCMAKE_CXX_FLAGS="-fno-system-debug" -DCMAKE_C_COMPILER=`which clang` -DCMAKE_CXX_COMPILER=`which clang++`
cd build_sycl_jit_kernel
make VERBOSE=1 -j48

Error:

fatal error: translation unit is too large for Clang to process: ran out of source locations
note: 2B (2B) in local locations, 0B (0B) in locations loaded from AST files, for a total of
      2B (2B) (0% of available space)
note: file entered 1 time using 1B (1B) of space
clang: /vast/users/abagusetty/compilers/llvm/clang/lib/Frontend/CompilerInstance.cpp:1003: static bool clang::CompilerInstance::InitializeSourceManager(const clang::FrontendInputFile&, clang::DiagnosticsEngine&, clang::FileManager&, clang::SourceManager&): Assertion `SourceMgr.getMainFileID().isValid() && "Couldn't establish MainFileID!"' failed.
PLEASE submit a bug report to https://github.com/intel/llvm/issues and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: /vast/users/abagusetty/gpu4pyscf/install_llvm_cuda12.9.1_09-16-2025/bin/clang --target=x86_64-unknown-linux-gnu -c -o /tmp/libexchcxx-f896a5.o /tmp/wrapper-dc8b3b.bc -fPIC
 #0 0x00000000024fce8b llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/vast/users/abagusetty/gpu4pyscf/install_llvm_cuda12.9.1_09-16-2025/bin/clang+0x24fce8b)
 #1 0x00000000024f9dfb llvm::sys::RunSignalHandlers() (/vast/users/abagusetty/gpu4pyscf/install_llvm_cuda12.9.1_09-16-2025/bin/clang+0x24f9dfb)
 #2 0x000000000243d7d8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007f35f7057900 __restore_rt (/lib64/libc.so.6+0x57900)
 #4 0x00007f35f70a8dfc __pthread_kill_implementation (/lib64/libc.so.6+0xa8dfc)
 #5 0x00007f35f7057842 gsignal (/lib64/libc.so.6+0x57842)
 #6 0x00007f35f703f5cf abort (/lib64/libc.so.6+0x3f5cf)
 #7 0x00007f35f703f4e7 _nl_load_domain.cold (/lib64/libc.so.6+0x3f4e7)
 #8 0x00007f35f704fb32 (/lib64/libc.so.6+0x4fb32)
 #9 0x00000000031af258 (/vast/users/abagusetty/gpu4pyscf/install_llvm_cuda12.9.1_09-16-2025/bin/clang+0x31af258)
#10 0x0000000003249b57 clang::FrontendAction::BeginSourceFile(clang::CompilerInstance&, clang::FrontendInputFile const&) (/vast/users/abagusetty/gpu4pyscf/install_llvm_cuda12.9.1_09-16-2025/bin/clang+0x3249b57)
#11 0x00000000031ba14a clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/vast/users/abagusetty/gpu4pyscf/install_llvm_cuda12.9.1_09-16-2025/bin/clang+0x31ba14a)
#12 0x000000000332d0fb clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/vast/users/abagusetty/gpu4pyscf/install_llvm_cuda12.9.1_09-16-2025/bin/clang+0x332d0fb)
#13 0x0000000000d2f022 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/vast/users/abagusetty/gpu4pyscf/install_llvm_cuda12.9.1_09-16-2025/bin/clang+0xd2f022)
#14 0x0000000000d24ab7 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#15 0x0000000002f4a6a9 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#16 0x000000000243dc32 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/vast/users/abagusetty/gpu4pyscf/install_llvm_cuda12.9.1_09-16-2025/bin/clang+0x243dc32)
#17 0x0000000002f4c9f8 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#18 0x0000000002eec3da clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/vast/users/abagusetty/gpu4pyscf/install_llvm_cuda12.9.1_09-16-2025/bin/clang+0x2eec3da)
#19 0x0000000002eed5a6 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/vast/users/abagusetty/gpu4pyscf/install_llvm_cuda12.9.1_09-16-2025/bin/clang+0x2eed5a6)
#20 0x0000000002efd414 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/vast/users/abagusetty/gpu4pyscf/install_llvm_cuda12.9.1_09-16-2025/bin/clang+0x2efd414)
#21 0x0000000000d2a27b clang_main(int, char**, llvm::ToolContext const&) (/vast/users/abagusetty/gpu4pyscf/install_llvm_cuda12.9.1_09-16-2025/bin/clang+0xd2a27b)
#22 0x0000000000c14863 main (/vast/users/abagusetty/gpu4pyscf/install_llvm_cuda12.9.1_09-16-2025/bin/clang+0xc14863)
#23 0x00007f35f7040e6c __libc_start_call_main (/lib64/libc.so.6+0x40e6c)
#24 0x00007f35f7040f35 __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x40f35)
#25 0x0000000000d24041 _start /home/abuild/rpmbuild/BUILD/glibc-2.38/csu/../sysdeps/x86_64/start.S:117:0
clang: error: clang frontend command failed with exit code 134 (use -v to see invocation)
clang version 21.0.0git (https://github.com/intel/llvm.git 68f3fdf41ca373e413c74da2949d807d3d7d777f)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /vast/users/abagusetty/gpu4pyscf/install_llvm_cuda12.9.1_09-16-2025/bin
Build config: +assertions
clang: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs.
clang++: error: clang-offload-wrapper command failed with exit code 1 (use -v to see invocation)

To reproduce

No response

Environment

  • OS: Linux
  • Target device and vendor: Intel PVC, Nvidia H100
  • DPC++ version:
$ clang++ -v
clang version 21.0.0git (https://github.com/intel/llvm.git 68f3fdf41ca373e413c74da2949d807d3d7d777f)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /vast/users/abagusetty/gpu4pyscf/install_llvm_cuda12.9.1_09-16-2025/bin
Build config: +assertions
Found candidate GCC installation: /usr/lib64/gcc/x86_64-suse-linux/14
Found candidate GCC installation: /usr/lib64/gcc/x86_64-suse-linux/7
Selected GCC installation: /usr/lib64/gcc/x86_64-suse-linux/14
Candidate multilib: .;@m64
Selected multilib: .;@m64
Found CUDA installation: /soft/compilers/cuda/cuda-12.9.1, version 

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions