Skip to content

[SYCL][NFC] Refactor __SYCL_INLINE macro #1121

New issue

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

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

Already on GitHub? Sign in to your account

Merged

Conversation

AlexeySachkov
Copy link
Contributor

The problem with previous definition of macro is that clang-format
insert additional indentation:

Original code:

__SYCL_INLINE namespace cl {
// some code

When applied clang-format:

__SYCL_INLINE namespace cl {
  // some code

Replaced __SYCL_INLINE with __SYCL_INLINE_NAMESPACE(X) which defines
either inline or regular namespace and marked it as NamespaceMacro in
clang-format config file to avoid dealing with broken formatting while
adding new code

bader
bader previously approved these changes Feb 12, 2020
alexbatashev
alexbatashev previously approved these changes Feb 12, 2020
@bader
Copy link
Contributor

bader commented Feb 12, 2020

@AlexeySachkov, please, fix clang lit tests.

The problem with previous definition of macro is that clang-format
insert additional indentation:

Original code:
```c++
__SYCL_INLINE namespace cl {
// some code
```

When applied clang-format:
```c++
__SYCL_INLINE namespace cl {
  // some code
```

Replaced `__SYCL_INLINE` with `__SYCL_INLINE_NAMESPACE(X)` which defines
either inline or regular namespace and marked it as `NamespaceMacro` in
clang-format config file to avoid dealing with broken formatting while
adding new code

Signed-off-by: Alexey Sachkov <alexey.sachkov@intel.com>
@AlexeySachkov AlexeySachkov dismissed stale reviews from alexbatashev and bader via a56b047 February 12, 2020 13:57
@AlexeySachkov AlexeySachkov force-pushed the private/asachkov/refactor-inline-namespace branch from 667b175 to a56b047 Compare February 12, 2020 13:57
@AlexeySachkov
Copy link
Contributor Author

@AlexeySachkov, please, fix clang lit tests.

@bader, it should be fixed now

Copy link
Contributor

@Pennycook Pennycook left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks, @AlexeySachkov!

@bader bader merged commit 7a2260f into intel:sycl Feb 12, 2020
Alexander-Johnston referenced this pull request in codeplaysoftware/sycl-for-cuda Feb 19, 2020
Synchronise the CUDA backend with the general SYCL changes from #1121.

Signed-off-by: Andrea Bocci <andrea.bocci@cern.ch>
Alexander-Johnston referenced this pull request in codeplaysoftware/sycl-for-cuda Feb 21, 2020
Synchronise the CUDA backend with the general SYCL changes from #1121.

Signed-off-by: Andrea Bocci <andrea.bocci@cern.ch>
Alexander-Johnston referenced this pull request in codeplaysoftware/sycl-for-cuda Feb 24, 2020
Synchronise the CUDA backend with the general SYCL changes from #1121.

Signed-off-by: Andrea Bocci <andrea.bocci@cern.ch>
bader pushed a commit that referenced this pull request Feb 24, 2020
* [SYCL][LIBCLC] Additional libclc builtins to support SYCL work

Adds builtins to libclc to support the CUDA backend for SYCL.

Contributors
Alexander Johnston <alexander@codeplay.com>
David Wood <david.wood@codeplay.com>
Victor Lomuller <victor@codeplay.com>

Signed-off-by: Alexander Johnston <alexander@codeplay.com>

* [SYCL] CMake and lit support for SYCL CUDA backend

Adds defines CMake and lit variables used for SYCL CUDA backend
development and test

Contributors
Alexander Johnston <alexander@codeplay.com>
Bjoern Knafla <bjoern@codeplay.com>
Ruyman Reyes <ruyman@codeplay.com>

Signed-off-by: Alexander Johnston <alexander@codeplay.com>

* [SYCL] Local Accessor Support for CUDA

Provides the LocalAccessorToSharedMemory compiler pass required
for supporting SYCL local accessors in CUDA.

Contributors
Alexander Johnston <alexander@codeplay.com>
David Wood <david.wood@codeplay.com>

Signed-off-by: Alexander Johnston <alexander@codeplay.com>

* [SYCL][CUDA] Change __spirv_BuiltIn.. to functions

Changes the following builtins to functions

__spirv_BuiltInGlobalSize
__spirv_BuiltInWorkgroupSize
__spirv_BuiltInNumWorkgroups
__spirv_BuiltInLocalInvocationId
__spirv_BuiltInWorkgroupId
__spirv_BuiltInGlobalOffset

Contributors
David Wood <david.wood@codeplay.com>

Signed-off-by: Alexander Johnston <alexander@codeplay.com>

* [SYCL][CUDA] Add SYCL CUDA support to clang driver

Adds CUDA support for sycl compilation in the clang driver

Contributors
Alexander Johnston <alexander@codeplay.com>
David Wood <david.wood@codeplay.com>
Victor Lomuller <victor@codeplay.com>

Signed-off-by: Alexander Johnston <alexander@codeplay.com>

* [SYCL][CUDA] Initial Implementation of the CUDA backend

Contributors
Alan Forbes <alan.forbes@codeplay.com>
Alexander Johnston <alexander@codeplay.com>
Bjoern Knafla <bjoern@codeplay.com>
Daniel Soutar <daniel.soutar@codeplay.com>
David Wood <david.wood@codeplay.com>
Kumudha Narasimhan <kumudha.narasimhan@codeplay.com>
Mehdi Goli <mehdi.goli@codeplay.com>
Przemek Malon <przemek.malon@codeplay.com>
Ruyman Reyes <ruyman@codeplay.com>
Stuart Adams <stuart.adams@codeplay.com>
Svetlozar Georgiev <svetlozar.georgiev@codeplay.com>
Steffen Larsen <steffen.larsen@codeplay.com>
Victor Lomuller <victor@codeplay.com>

Signed-off-by: Alexander Johnston <alexander@codeplay.com>

* [SYCL] Update libclc install rules

Have libclc install clc-* and libspirv-* to lib and share

Signed-off-by: Alexander Johnston <alexander@codeplay.com>

* [SYCL][CUDA] Inline cl namespace to simplify SYCL API usage

Synchronise the CUDA backend with the general SYCL changes from #974.

Signed-off-by: Andrea Bocci <andrea.bocci@cern.ch>

* Added missing flags for device-side builtins

Signed-off-by: Alexander Johnston <alexander@codeplay.com>

* [SYCL][CUDA] Removing unnecessary tool from the tree

Acked-by: Victor Lomuller <victor@codeplay.com>
Signed-off-by: Ruyman <ruyman@codeplay.com>

* [SYCL][PI] Fix kernel group info parameter conversion

Signed-off-by: Steffen Larsen <steffen.larsen@codeplay.com>

* [SYCL][CUDA] Refactor __SYCL_INLINE macro

Synchronise the CUDA backend with the general SYCL changes from #1121.

Signed-off-by: Andrea Bocci <andrea.bocci@cern.ch>

* [SYCL] Have default_selector consider SYCL_BE

Have the default_selector consider the env var SYCL_BE when rating
device scores to make choosing a backend easier.

Signed-off-by: Alexander Johnston <alexander@codeplay.com>

* [SYCL] Select GlobalPlugin based on SYCL_BE

Rather than choose the last found plugin as GlobalPlugin, select
it depending on the SYCL_BE env var.

Signed-off-by: Alexander Johnston <alexander@codeplay.com>

* [SYCL] Improve default device selection checks

Better checks for CUDA and OpenCL devices to match with SYCL_BE in the
default device selection, based on the platform version info.

Signed-off-by: Alexander Johnston <alexander@codeplay.com>

* [SYCL] Formatting update for device_selector.cpp

Signed-off-by: Alexander Johnston <alexander@codeplay.com>

* [SYCL] Changed CUDA unit tests to call through plugin

Signed-off-by: Steffen Larsen <steffen.larsen@codeplay.com>

* [SYCL] Pass SYCL_BE=PI_OPENCL in check-sycl

To ensure that the check-sycl targets test OpenCL devices, pass
SYCL_BE=PI_OPENCL. This mirrors the check-sycl-cuda target which
passes SYCL_BE=PI_CUDA. Without this it is nondeterministic which
device is tested by check-sycl.

Signed-off-by: Alexander Johnston <alexander@codeplay.com>

* [SYCL][CUDA] Remove PI_CUDA specific details from clang

Removes PI_CUDA specific code paths and tests from clang, opting to
always enable them.

Signed-off-by: Alexander Johnston <alexander@codeplay.com>

* [SYCL][CUDA] Disable linear_id/opencl-interop.cpp for cuda

Signed-off-by: Alexander Johnston <alexander@codeplay.com>

* [SYCL][CUDA] Further fixes to CUDA device selection

Fix platform string comparison for CUDA platform detection.
Fix device info platform query so that it uses the device's plugin,
rather than the GlobalPlugin.

Signed-off-by: Alexander Johnston <alexander@codeplay.com>

* [SYCL][CUDA] Code style and cleanup to CUDA support

Signed-off-by: Alexander Johnston <alexander@codeplay.com>

* [SYCL] Enable asserts in all buildbot builds

Signed-off-by: Alexander Johnston <alexander@codeplay.com>

* [SYCL][CUDA] Minor test and build configuration

Fix minor test and build configuration issues introduced in the
development of the CUDA backend.

Signed-off-by: Alexander Johnston <alexander@codeplay.com>

Co-authored-by: Andrea Bocci <andrea.bocci@cern.ch>
Co-authored-by: Ruyman <ruyman@codeplay.com>
Co-authored-by: Steffen Larsen <56076654+steffenlarsen@users.noreply.github.com>
@AlexeySachkov AlexeySachkov deleted the private/asachkov/refactor-inline-namespace branch April 1, 2020 10:23
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