Skip to content

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

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Conversation

dm-vodopyanov
Copy link
Contributor

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

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
Copy link
Contributor

bader commented May 18, 2021

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

Copy link
Contributor

@erichkeane erichkeane left a comment

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.

Added a wrapper, which is defined in integration footer only after we
define all specializations for `get_spec_constant_symbolic_ID`. By using
it we ensure that we do not try to instantiate
`get_spec_constant_symbolic_ID` until after we made all required
specializations.
…eparate-header' of github.com:dm-vodopyanov/llvm into private/dvodopya/move-__buildin_unique_stable_name-to-separate-header
@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`.
Copy link
Contributor

@romanovvlad romanovvlad left a comment

Choose a reason for hiding this comment

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

LGTM

@AlexeySachkov
Copy link
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

Copy link
Contributor

@elizabethandrews elizabethandrews left a comment

Choose a reason for hiding this comment

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

FE changes LGTM. Thanks!

…eparate-header' of github.com:dm-vodopyanov/llvm into private/dvodopya/move-__buildin_unique_stable_name-to-separate-header
Copy link
Contributor

@elizabethandrews elizabethandrews left a comment

Choose a reason for hiding this comment

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

FE changes LGTM

Copy link
Contributor

@romanovvlad romanovvlad left a comment

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
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants