Skip to content

[SYCL] Add Support for Precompiled Headers#22357

Open
premanandrao wants to merge 4 commits into
intel:syclfrom
premanandrao:remote_pch_redo
Open

[SYCL] Add Support for Precompiled Headers#22357
premanandrao wants to merge 4 commits into
intel:syclfrom
premanandrao:remote_pch_redo

Conversation

@premanandrao

@premanandrao premanandrao commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Remove the restriction of using PCH with SYCL.

PCH files can be created with:
clang -fsycl -c -x c++-header header.h

This precompiles the header file header.h once for the device target,
and once for the host. The individual pch files generated are then
bundled to form a fat header.pchi binary.

PCH files can be used with:
clang -fsycl -c -include-pch header.pchi file.cpp

This unbundles the fat header.pchi file into its respective target components
and uses the unbundled pchi files in the device target and host compilations.

In the old offload driver model, clang-offload-bundler is used for bundling and
unbundling; in the new model, llvm-offload-binary is used.

Remove the restriction of using PCH with SYCL.

PCH files can be created with:
clang -fsycl -c -x c++-header header.h

This precompiles the header file header.h once for the device
target, and once for the host. The individual pch files
generated are then bundled to form a fat header.pchi binary.

PCH files can be used with:
clang -fsycl -c -include-pch header.pchi file.cpp

This unbundles the fat header.pchi file into its respective
target components and uses the unbundled pchi files in the
device target and host compilations.

In the old offload driver model, clang-offload-bundler is used
for bundling and unbundling; in the new model, llvm-offload-binary
is used.
@premanandrao premanandrao requested review from a team as code owners June 18, 2026 01:24
@premanandrao premanandrao requested a review from slawekptak June 18, 2026 01:24
@premanandrao

Copy link
Copy Markdown
Contributor Author

There seems to be some testing issue with the original PR #21491 ;
some tests are repeatedly failing unrelated to the changes. The same
changes work in a new PR, hence this one.
(Sorry to the reviewers to reviewed the old one before.)

@premanandrao

Copy link
Copy Markdown
Contributor Author

@mdtoguchi, I missed your review comments from earlier today in the other PR.
I will address all those in a new commit. No need to review this PR until then.

@premanandrao

Copy link
Copy Markdown
Contributor Author

@mdtoguchi, thanks again for your review comments in #21491. Unfortunately, due to stale bits, some tests fail there.

I have addressed most of your comments in fd1a93e

  • removed the inadvertent use of C-style comments and replaced with C++-style comments
  • a neutral phrase extract is used instead of unbundle when referring to both the old and new model extraction
  • used -- %s with clang_cl to avoid potential forward-slash/backslash issues

There were three other places you commented on - I have added inline comments in this PR for those.
Sorry, I realize this makes review harder.

Comment thread clang/lib/Driver/Driver.cpp
Comment thread clang/lib/Driver/ToolChains/Clang.cpp
Comment thread clang/lib/Driver/ToolChains/Clang.cpp
Comment thread clang/test/Driver/sycl-pch-inlude.cpp
Comment thread clang/lib/Driver/Driver.cpp Outdated
Comment thread clang/lib/Driver/Driver.cpp
Comment thread clang/test/Driver/sycl-pch-use.cpp Outdated
// WS_USE_OND: clang{{.*}} "-triple" "x86_64{{.*}}"{{.*}} "-fsycl-is-host"
// WS_USE_OND-SAME: "-include-pch" "[[PCHFILE1]]"{{.*}}

// Windows

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Windows

nit - you already marked 'Windows' above.

@mdtoguchi mdtoguchi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK for driver

@slawekptak slawekptak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SYCL changes LGTM

@sys-ce-bb

Copy link
Copy Markdown
Contributor

@intel/llvm-gatekeepers please consider merging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants