Skip to content

[SYCL] Switch to using integration footer by default#3777

Merged
romanovvlad merged 34 commits into
intel:syclfrom
dm-vodopyanov:private/dvodopya/move-__buildin_unique_stable_name-to-separate-header
Jun 30, 2021
Merged

[SYCL] Switch to using integration footer by default#3777
romanovvlad merged 34 commits into
intel:syclfrom
dm-vodopyanov:private/dvodopya/move-__buildin_unique_stable_name-to-separate-header

Conversation

@dm-vodopyanov

@dm-vodopyanov dm-vodopyanov commented May 18, 2021

Copy link
Copy Markdown
Contributor

Added spec_constant_integration.hpp header file, which is included from
integration footer.
Added get_spec_constant_symbolic_ID_wrapper which in combination
with spec_constant_integration.hpp allows us to avoid exploiting a UB
related to instantiating a template before we have seen all its
specializations.

Replaced -fsycl-use-footer compiler flag with -fno-sycl-use-footer
flag with the opposite semantics.

…e header

This patch moves functions which use `__builtin_unique_stable_name` to a
separate header which should only be included to integration footer.

This was made to get rid of UB when the compiler sees defenition of the
template specialization before seeing a declaration.
@dm-vodopyanov
dm-vodopyanov requested a review from a team as a code owner May 18, 2021 15:49
@dm-vodopyanov
dm-vodopyanov requested a review from romanovvlad May 18, 2021 15:49
@bader bader changed the title [SYCL] Move __buildin_unique_stable_name dependent funcs to a separate header [SYCL] Move __builtin_unique_stable_name dependent funcs to a separate header May 18, 2021
@bader

bader commented May 18, 2021

Copy link
Copy Markdown
Contributor

This patch moves functions which use __builtin_unique_stable_name to a
separate header which should only be included to integration footer.

This description is not accurate KernelInfoData method still uses __builtin_unique_stable_name:

static constexpr auto n = __builtin_unique_stable_name(T);

@romanovvlad

Copy link
Copy Markdown
Contributor

This patch moves functions which use __builtin_unique_stable_name to a
separate header which should only be included to integration footer.

This description is not accurate KernelInfoData method still uses __builtin_unique_stable_name:

static constexpr auto n = __builtin_unique_stable_name(T);

Right, it is not directly related to __builtin_unique_stable_name, we rather need to guarantee that calls of get_spec_constant_symbolic_ID appear after specializations of this functions which defined in the integration footer.

@dm-vodopyanov dm-vodopyanov changed the title [SYCL] Move __builtin_unique_stable_name dependent funcs to a separate header [SYCL] Move get_spec_constant_symbolic_ID to a separate header May 19, 2021
Comment thread clang/lib/Sema/SemaSYCL.cpp Outdated
@erichkeane

Copy link
Copy Markdown
Contributor

I don't think we should be putting the last patch into the repo, we are about a week and a half away from getting the actual implementation, and this will delay it.

Comment thread clang/test/Driver/sycl-preprocess.cpp

@erichkeane erichkeane 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.

Just 2 CFE test nits.

Comment thread clang/test/CodeGenSYCL/anonymous_integration_footer.cpp Outdated
Comment thread clang/test/CodeGenSYCL/anonymous_integration_footer2.cpp Outdated
@AlexeySachkov
AlexeySachkov dismissed stale reviews from mdtoguchi and AaronBallman via 3ef8887 June 25, 2021 13:27
@AlexeySachkov
AlexeySachkov removed the request for review from kbobrovs June 25, 2021 13:31
@AlexeySachkov AlexeySachkov changed the title [SYCL] Move get_spec_constant_symbolic_ID to a separate header [SYCL] Switch to using integration footer by default Jun 25, 2021
The primary function/wrapper which is used by DPC++ RT is left as-is,
i.e. `get_spec_constant_symbolic_ID`.
The internal function and its specialziations which are generated by the
compiler renamed to `get_spec_constant_symbolic_ID_impl`.

@romanovvlad romanovvlad 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.

LGTM

@AlexeySachkov

Copy link
Copy Markdown
Contributor

@AGindinson, @mdtoguchi, could you please take a look at the driver part? Basically, we have enabled integration footer by default and turned existing -fsycl-use-footer into -fno-sycl-use-footer and adjusted tests. However, I'm not exactly sure that we have enough coverage for this new option.

@AaronBallman, @elizabethandrews, @premanandrao, could you please take a look at FE part? The changes are quite simple: we have added a few more includes to emitted integration footer + did renaming get_spec_constant_symbolic_ID -> get_spec_constant_symbolic_ID_impl

@elizabethandrews elizabethandrews 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.

FE changes LGTM. Thanks!

Comment thread clang/test/Driver/sycl-int-footer.cpp
…eparate-header' of github.com:dm-vodopyanov/llvm into private/dvodopya/move-__buildin_unique_stable_name-to-separate-header

@elizabethandrews elizabethandrews 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.

FE changes LGTM

@romanovvlad romanovvlad 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.

LGTM

@romanovvlad
romanovvlad merged commit 4a6d21f into intel:sycl Jun 30, 2021
alexbatashev added a commit to alexbatashev/llvm that referenced this pull request Jul 2, 2021
* upstream/sycl: (649 commits)
  [SYCL][Driver][NFC] Update integration footer test for 32-bit host (intel#4039)
  [SYCL][L0] Initialize descriptor .stype and .pNext (intel#4032)
  [SYCL] Add sycl::kernel::get_kernel_bundle method (intel#3855)
  [SYCL] Add support for device UUID as a SYCL extension. (intel#3696)
  [SYCL][Matrix] Add spec document for the matrix extension interface and its first implementation for AMX (intel#3551)
  Fix debug build mangler test after PR#3992 (8f38045). (intel#4033)
  [Driver][SYCL] Restrict user -include file in final integration footer step (intel#4036)
  [SYCL] [Tests] Do not copy device binary image mocks (intel#4023)
  [SYCL][Doc] Update docs to reflect new compiler features (intel#4030)
  [SYCL][CUDA] cl_khr_fp16 extension connected to cuda PI. (intel#4029)
  [SYCL][NFC] Refactor RT unit tests (intel#4021)
  [SYCL] Switch to using integration footer by default (intel#3777)
  [SYCL][CUDA] Add the Use Default Stream property (intel#4004)
  Uplift GPU RT version for Linux to 21.24.20098 (intel#4003)
  [SYCL][CUDA] atomic_ref.fetch_add used for fp64 reduction if device.has(atomic64) (intel#3950)
  [Driver][SYCL] Differentiate host dependency link from regular host link (intel#4002)
  [SYCL][ESIMD] Support device half type in intrinsics. (intel#4024)
  [SYCL] Allow fpga_reg only for PODs and Trivially-copyable structs (intel#3643)
  [SYCL][FPGA] Restore legacy debug info version for the hardware (intel#3991)
  [SYCL][PI][L0] Force reset of memcpy command-list. (intel#4001)
  ...
@dm-vodopyanov
dm-vodopyanov deleted the private/dvodopya/move-__buildin_unique_stable_name-to-separate-header branch February 10, 2022 14:06
iclsrc pushed a commit that referenced this pull request Jul 17, 2026
For a vector type, add `SPV_EXT_long_vector` extension and prioritize it
over `SPV_INTEL_vector_compute` whenever the vector type doesn't have a
standard component size (2, 3, 4, 8, or 16).

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@7d4b128df7e6ff3
iclsrc pushed a commit that referenced this pull request Jul 17, 2026
#3829)

#3777 added `SPV_EXT_long_vector` and gave it priority over
`SPV_INTEL_vector_compute`: when both extensions are enabled and a
vector has a non-standard component count, the translator now emits
`CapabilityLongVectorEXT` instead of `CapabilityVectorAnyINTEL`.

This regresses `VectorCompute` modules. The offloading flow (producing
both `VectorCompute` and non-`VectorCompute` modules) applies a single,
fixed extension list uniformly to every device image, so a
`VectorCompute` module is translated with both
`SPV_INTEL_vector_compute` and `SPV_EXT_long_vector` enabled. Before
#3777 such a module emitted `VectorAnyINTEL` for its non-standard
vectors; after #3777 it emits `LongVectorEXT`. `VectorCompute` consumers
require `VectorAnyINTEL`, so this is a functional regression.

Hence, the enabled extension list does not identify a module as
`VectorCompute` - the `VectorCompute` metadata (`VCFunction`
/`VCGlobalVariable`) does. `IsVectorComputeModule` records the presence
of that metadata before type translation. `VectorCompute` modules keep
using `VectorAnyINTEL`, restoring the pre-#3777 behavior; all other
modules still prefer the multi-vendor `LongVectorEXT` when its extension
is enabled.

---------

Co-authored-by: Ye, Qi <qi.ye@intel.com>

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@3238c2903cd177e
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.

9 participants