Skip to content

[SYCL] Compile time/remove vec convert from builtins#21698

Merged
KornevNikita merged 4 commits intointel:syclfrom
koparasy:compile-time/remove-vec-convert-from-builtins
Apr 16, 2026
Merged

[SYCL] Compile time/remove vec convert from builtins#21698
KornevNikita merged 4 commits intointel:syclfrom
koparasy:compile-time/remove-vec-convert-from-builtins

Conversation

@koparasy
Copy link
Copy Markdown
Contributor

@koparasy koparasy commented Apr 7, 2026

Stop pulling vec::convert in through SYCL builtin headers by using a local relational mask widening path and a public sycl/vector_convert.hpp wrapper for opt-in conversion support.

This reduces header dependencies and improves compile time by about 9.3% for host compilation and 7.5% for device compilation when including <sycl/builtin.hpp>

@koparasy koparasy changed the title Compile time/remove vec convert from builtins [SYCL] Compile time/remove vec convert from builtins Apr 7, 2026
@koparasy koparasy force-pushed the compile-time/remove-vec-convert-from-builtins branch from 046824f to ea1856e Compare April 10, 2026 18:17
Stop pulling vec::convert in through SYCL builtin headers by using a
local relational mask widening path and a public sycl/vector_convert.hpp
wrapper for opt-in conversion support.

This reduces header dependencies and improves compile time by about 9.3%
for host compilation and 7.5% for device compilation on simple translation unit.
@koparasy koparasy force-pushed the compile-time/remove-vec-convert-from-builtins branch from ea1856e to b6367fd Compare April 10, 2026 18:38
@koparasy koparasy marked this pull request as ready for review April 10, 2026 20:25
@koparasy koparasy requested review from a team as code owners April 10, 2026 20:25
@koparasy koparasy requested a review from uditagarwal97 April 10, 2026 20:25
Copy link
Copy Markdown
Contributor

@YuriPlyakhin YuriPlyakhin left a comment

Choose a reason for hiding this comment

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

change in sycl/test-e2e/BFloat16/bfloat16_vec.cpp LGTM

@koparasy
Copy link
Copy Markdown
Contributor Author

Hi @uditagarwal97 , just a quick ping on this PR when you get a chance.
I’d appreciate any feedback, especially since I’m continuing related work on compile-time reductions and next PRs depending on this one.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR reduces compile-time header dependencies by stopping SYCL builtin headers from pulling in vec::convert implicitly, and instead introducing a public opt-in wrapper header (<sycl/vector_convert.hpp>) plus a local mask-widening path for relational builtins.

Changes:

  • Add public <sycl/vector_convert.hpp> wrapper and include-dependency test coverage for it.
  • Remove implicit detail/vector_convert.hpp dependency from builtin/khr include chains; update include-deps tests accordingly.
  • Replace relational builtin mask widening from vec::convert to a local relational_mask_widen implementation; update device-code checks.

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
sycl/include/sycl/detail/builtins/builtins.hpp Drops detail/vector_convert.hpp, adds relational_mask_widen helper to avoid pulling vec conversion machinery into builtins.
sycl/include/sycl/detail/builtins/relational_functions.inc Uses relational_mask_widen instead of vec::convert for relational mask widening.
sycl/include/sycl/vector_convert.hpp New public wrapper header for opt-in vec::convert support.
sycl/include/sycl/sycl.hpp Switches umbrella header to include the new public vector_convert.hpp rather than the detail header.
sycl/include/sycl/detail/image_accessor_util.hpp Updates includes to pull in vec::convert support via the new public header.
sycl/include/sycl/ext/oneapi/experimental/bfloat16_math.hpp Updates include to use public sycl/vector_convert.hpp.
sycl/include/sycl/ext/oneapi/bf16_storage_builtins.hpp Adds missing exception header dependency for host-side throws.
sycl/source/detail/image_accessor_util.cpp Updates include to use public sycl/vector_convert.hpp.
sycl/test/include_deps/sycl_vector_convert.hpp.cpp New include-dependency test for the public vector_convert.hpp header.
sycl/test/include_deps/sycl_khr_includes_usm.hpp.cpp Updates expected include dependency list after removing implicit vector-convert pull-in.
sycl/test/include_deps/sycl_khr_includes_math.hpp.cpp Updates expected include dependency list after removing implicit vector-convert pull-in.
sycl/test/include_deps/sycl_khr_includes_stream.hpp.cpp Updates expected include dependency list after removing implicit vector-convert pull-in.
sycl/test/include_deps/sycl_khr_includes_reduction.hpp.cpp Updates expected include dependency list after removing implicit vector-convert pull-in.
sycl/test/check_device_code/vector/bf16_builtins_old_vec.cpp Adjusts LLVM IR checks to match new mask widening/conversion lowering.
sycl/test/check_device_code/vector/bf16_builtins_new_vec.cpp Adjusts LLVM IR checks to match new mask widening/conversion lowering.
sycl/test-e2e/Basic/vector/int-convert.cpp Switches from detail include to public sycl/vector_convert.hpp.
sycl/test-e2e/Basic/vector/byte.cpp Switches from detail include to public sycl/vector_convert.hpp.
sycl/test-e2e/Basic/vector/bool.cpp Switches from detail include to public sycl/vector_convert.hpp.
sycl/test-e2e/Basic/sycl_2020_images/common.hpp Switches from detail include to public sycl/vector_convert.hpp.
sycl/test-e2e/Basic/half_builtins.cpp Adds explicit include of public sycl/vector_convert.hpp.
sycl/test-e2e/Basic/char_builtins.cpp Adds explicit include of public sycl/vector_convert.hpp.
sycl/test-e2e/BFloat16/bfloat16_vec.cpp Switches from detail include to public sycl/vector_convert.hpp.

Comment thread sycl/include/sycl/detail/builtins/builtins.hpp
Comment thread sycl/include/sycl/detail/builtins/builtins.hpp Outdated
Comment thread sycl/include/sycl/detail/builtins/builtins.hpp
Copy link
Copy Markdown
Contributor

@uditagarwal97 uditagarwal97 left a comment

Choose a reason for hiding this comment

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

Overall, I support the idea of decoupling builtins from the heavy vec::convert, if it helps improving compilation time.

My concern is with the new sycl/vector_convert.hpp header - I think that's unnecessary as users can just include sycl/detail/vector_convert.hpp header. @cperkinsintel WDYT?

@koparasy
Copy link
Copy Markdown
Contributor Author

Overall, I support the idea of decoupling builtins from the heavy vec::convert, if it helps improving compilation time.

My concern is with the new sycl/vector_convert.hpp header - I think that's unnecessary as users can just include sycl/detail/vector_convert.hpp header. @cperkinsintel WDYT?

Good point. I agree users can include the detail/ header today.

My intention with introducing sycl/vector_convert.hpp was to avoid encouraging reliance on detail/ headers, which we generally treat as implementation details and reserve the right to change. Providing a thin public wrapper gives us a stable entry point without exposing internals.

That said, I agree this is not strictly required for the compile-time improvement in this PR. If we prefer to keep the scope minimal, I’m happy to drop the public header here and follow up separately with a more explicit discussion on whether we want to expose this as part of the public API.

@uditagarwal97
Copy link
Copy Markdown
Contributor

That said, I agree this is not strictly required for the compile-time improvement in this PR. If we prefer to keep the scope minimal, I’m happy to drop the public header here and follow up separately with a more explicit discussion on whether we want to expose this as part of the public API.

Yes, I think it would be better to drop public header change from this PR.

@cperkinsintel
Copy link
Copy Markdown
Contributor

There are other changes to vec being discussed, if there is going to be one or more public headers for it, we should decide that later.

@koparasy
Copy link
Copy Markdown
Contributor Author

@uditagarwal97 I removed the header and updated tests etc.

@github-actions
Copy link
Copy Markdown
Contributor

@intel/llvm-gatekeepers please consider merging

@KornevNikita KornevNikita merged commit 7899a49 into intel:sycl Apr 16, 2026
30 checks passed
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.

6 participants