[SYCL] Trim builtins header dependencies for compile time#21631
Draft
koparasy wants to merge 3 commits intointel:syclfrom
Draft
[SYCL] Trim builtins header dependencies for compile time#21631koparasy wants to merge 3 commits intointel:syclfrom
koparasy wants to merge 3 commits intointel:syclfrom
Conversation
Replace the vector_convert.hpp dependency in sycl/detail/builtins/builtins.hpp with narrower includes and exclude host-only builtin helper templates from device compilation. This reduces frontend parsing/instantiation work for users of sycl/builtins.hpp while preserving the public header surface.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reduce frontend compile-time overhead in
sycl/include/sycl/detail/builtins/builtins.hppby narrowing its dependencies and excluding host-only helpers from device compilation.This change:
Replaces the
sycl/detail/vector_convert.hppinclusion with the narrower headers actually needed here:sycl/detail/generic_type_traits.hpp and sycl/half_type.hpp.Wraps:
builtin_default_host_implandbuiltin_delegate_to_scalarin
#ifndef __SYCL_DEVICE_ONLY__so they are not parsed during device-only compilation.The intent is to reduce parsing and template-instantiation cost for translation units that pull in
sycl/builtins.hpp, while preserving existing behavior.Motivation
Compilation-time tracing for a device-side SYCL workload that includes
sycl/builtins.hppshowed that the cost is frontend-dominated. This header is on a hot include path, so avoiding an unnecessary transitive dependency and skipping host-only helper code in device mode reduces frontend work in the common device compilation path.Rough numbers:
when compiling the benchmark (gemm_sycl.cpp) provided in JIRA ticket (CMPLRLLVM-73941). This is roughly a 7% compile time reduction.