intel / intel/llvm

C++ Modules Do Not Work with SYCL

Open
#9,245 2 comments 0 reactions 0 assignees View on GitHub
confirmed enhancement
Dominant language
LLVM
Stars
1.5k
Forks
854
Avg merge
3d 17h
Merged PRs (30d)
137

Description

C++ modules do not seem to currently work with intel/llvm when SYCL is used. I'm curious if this is likely to be added in the near future, or if there are architectural reasons that prevent C++ modules from working with intel/llvm.

I've written a minimal reproducer here: [modules.tar.gz](https://github.com/intel/llvm/files/11348601/modules.tar.gz)

**To Reproduce**
In my minimal reproducer I create two modules. One of them uses SYCL, and this generates a `pcm: invalid file type specified error`, while the other compiles successfully.

```bash
(base) bbrock@ortce-skl22:~/src/issues/modules$ make
clang++ -std=c++2b --precompile -x c++-module test.cpp
clang++ -std=c++20 -c test.pcm
clang++ example.cpp -o example -std=c++2b -fprebuilt-module-path=. test.o
clang++ -fsycl -std=c++2b --precompile -x c++-module test-sycl.cpp
/nfs/site/home/bbrock/pkg/dpcpp-2023-04-17/bin/clang-offload-bundler: error: 'pcm': invalid file type specified
clang++: error: clang-offload-bundler command failed with exit code 1 (use -v to see invocation)
make: *** [Makefile:21: test-sycl.pcm] Error 1
(base) bbrock@ortce-skl22:~/src/issues/modules$
```

**Environment (please complete the following information):**

I'm using a recent commit of intel/llvm

```bash
(base) bbrock@ortce-skl22:~/src/issues/modules$ clang++ --version
clang version 17.0.0 (https://github.com/intel/llvm.git 554ed2187d320bb3d18616a439e9b867a5aff10d)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /nfs/site/home/bbrock/pkg/dpcpp-2023-04-17/bin
```

**Additional context**
I'm working on the distributed ranges project, where we're writing a lot of templated SYCL code. Compile times are growing, and we'd like to use modules if/when they are available. Our CI currently takes around 20 minutes in the build/test phase, the majority of which is spent compiling. My concern though is more about the user experience. Most of our users will probably be on Aurora and other supercomputers, where the file systems tend to be slow. We need to use any tricks we can to speed up compile times, and modules could potentially help significantly by pre-processing header files.

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.