Skip to content

Clang format #19

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

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Get clang-format first
run: sudo apt-get install -yqq clang-format-9

- uses: actions/checkout@v2
with:
fetch-depth: 2

- name: Get clang-format first
run: sudo apt-get install -yqq clang-format-10

- name: Run clang-format for the patch
run: |
git diff -U0 --no-color ${GITHUB_SHA}^1 ${GITHUB_SHA} -- | ./clang/tools/clang-format/clang-format-diff.py -p1 -binary clang-format-10 > ./clang-format.patch
git diff -U0 --no-color ${GITHUB_SHA}^1 ${GITHUB_SHA} -- | ./clang/tools/clang-format/clang-format-diff.py -p1 -binary clang-format-9 > ./clang-format.patch

# Add patch with formatting fixes to CI job artifacts
- uses: actions/upload-artifact@v1
Expand Down
4 changes: 2 additions & 2 deletions sycl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ include(AddSYCLExecutable)
set(SYCL_MAJOR_VERSION 2)
set(SYCL_MINOR_VERSION 1)
set(SYCL_PATCH_VERSION 0)
set(SYCL_DEV_ABI_VERSION 3)
set(SYCL_DEV_ABI_VERSION 4)
if (SYCL_ADD_DEV_VERSION_POSTFIX)
set(SYCL_VERSION_POSTFIX "-${SYCL_DEV_ABI_VERSION}")
endif()
Expand Down Expand Up @@ -326,7 +326,7 @@ set( SYCL_TOOLCHAIN_DEPLOY_COMPONENTS
sycl-headers-extras
sycl
pi_opencl
pi_level0
pi_level_zero
libsycldevice
)
if(OpenCL_INSTALL_KHRONOS_ICD_LOADER AND TARGET ocl-icd)
Expand Down
2 changes: 1 addition & 1 deletion sycl/ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Release notes for the commit range ba404be..24726df
- Added a cache for PI plugins, so subsequent calls for `sycl::device`
creation should be cheaper [03dd60d]
- A SYCL program will be aborted now if program linking is requested when
using L0 plugin. This is done because L0 doesn't support program linking
using Level Zero plugin. This is done because L0 doesn't support program linking
[d4a5b71]
- Added a diagnostic on attempt to use `sycl::program::set_spec_constant` when
the program is already in compiled or linked state [e2e3d3d]
Expand Down
4 changes: 2 additions & 2 deletions sycl/doc/EnvironmentVariables.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Environment Variables

This document describes environment variables that are having effect on DPC++
This document describes environment variables that are having effect on DPC++
compiler and runtime.

## Controlling DPC++ RT
Expand All @@ -12,7 +12,7 @@ subject to change. Do not rely on these variables in production code.
| Environment variable | Values | Description |
| -------------------- | ------ | ----------- |
| SYCL_PI_TRACE | Described [below](#sycl_pi_trace-options) | Enable specified level of tracing for PI. |
| SYCL_BE | PI_OPENCL, PI_LEVEL0, PI_CUDA | Force SYCL RT to consider only devices of the specified backend during the device selection. |
| SYCL_BE | PI_OPENCL, PI_LEVEL_ZERO, PI_CUDA | Force SYCL RT to consider only devices of the specified backend during the device selection. |
| SYCL_DEVICE_TYPE | One of: CPU, GPU, ACC, HOST | Force SYCL to use the specified device type. If unset, default selection rules are applied. If set to any unlisted value, this control has no effect. If the requested device type is not found, a `cl::sycl::runtime_error` exception is thrown. If a non-default device selector is used, a device must satisfy both the selector and this control to be chosen. This control only has effect on devices created with a selector. |
| SYCL_PROGRAM_COMPILE_OPTIONS | String of valid OpenCL compile options | Override compile options for all programs. |
| SYCL_PROGRAM_LINK_OPTIONS | String of valid OpenCL link options | Override link options for all programs. |
Expand Down
56 changes: 37 additions & 19 deletions sycl/doc/GetStartedGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,37 +166,37 @@ To run DPC++ applications on Level Zero devices, Level Zero implementation(s)
must be present in the system. You can find the link to the Level Zero spec in
the following section [Find More](#find-more).

The Level Zero RT for `GPU`, OpenCL RT for `GPU`, OpenCL RT for `CPU` and TBB runtime
which are needed to run DPC++ application on Intel `GPU` or Intel `CPU` devices can be
downloaded using links in
The Level Zero RT for `GPU`, OpenCL RT for `GPU`, OpenCL RT for `CPU`, FPGA
emulation RT and TBB runtime which are needed to run DPC++ application
on Intel `GPU` or Intel `CPU` devices can be downloaded using links in
[the dependency configuration file](../../buildbot/dependency.conf)
and installed following the instructions below. The same versions are used in
PR testing.

Intel OpenCL RT for `CPU` devices can be switched into OpenCL runtime for
Intel FPGA Emulation. The following parameter should be set in `cl.cfg` file
(available in directory containing CPU runtime for OpenCL) or environment
variable with the same name. The following value should be set to switch
OpenCL device mode:

```bash
CL_CONFIG_DEVICES = fpga-emu
```

**Linux**:

1) Extract the archive. For example, for the archive
`oclcpu_rt_<cpu_version>.tar.gz` you would run the following commands
1) Extract the archive. For example, for the archives
`oclcpuexp_<cpu_version>.tar.gz` and `fpgaemu_<fpga_version>.tar.gz` you would
run the following commands

```bash
# Extract OpenCL FPGA emulation RT
mkdir -p /opt/intel/oclfpgaemu_<fpga_version>
cd /opt/intel/oclfpgaemu_<fpga_version>
tar zxvf fpgaemu_<fpga_version>.tar.gz
# Extract OpenCL CPU RT
mkdir -p /opt/intel/oclcpuexp_<cpu_version>
cd /opt/intel/oclcpuexp_<cpu_version>
tar -zxvf oclcpu_rt_<cpu_version>.tar.gz
```

2) Create ICD file pointing to the new runtime
2) Create ICD file pointing to the new runtime (requires root access)

```bash
# OpenCL FPGA emulation RT
echo /opt/intel/oclfpgaemu_<fpga_version>/x64/libintelocl_emu.so >
/etc/OpenCL/vendors/intel_fpgaemu.icd
# OpenCL CPU RT
echo /opt/intel/oclcpuexp_<cpu_version>/x64/libintelocl.so >
/etc/OpenCL/vendors/intel_expcpu.icd
```
Expand All @@ -213,6 +213,16 @@ CL_CONFIG_DEVICES = fpga-emu
folder:

```bash
# OpenCL FPGA emulation RT
ln -s /opt/intel/tbb_<tbb_version>/tbb/lib/intel64/gcc4.8/libtbb.so
/opt/intel/oclfpgaemu_<fpga_version>/x64
ln -s /opt/intel/tbb_<tbb_version>/tbb/lib/intel64/gcc4.8/libtbbmalloc.so
/opt/intel/oclfpgaemu_<fpga_version>/x64
ln -s /opt/intel/tbb_<tbb_version>/tbb/lib/intel64/gcc4.8/libtbb.so.2
/opt/intel/oclfpgaemu_<fpga_version>/x64
ln -s /opt/intel/tbb_<tbb_version>/tbb/lib/intel64/gcc4.8/libtbbmalloc.so.2
/opt/intel/oclfpgaemu_<fpga_version>/x64
# OpenCL CPU RT
ln -s /opt/intel/tbb_<tbb_version>/tbb/lib/intel64/gcc4.8/libtbb.so
/opt/intel/oclcpuexp_<cpu_version>/x64
ln -s /opt/intel/tbb_<tbb_version>/tbb/lib/intel64/gcc4.8/libtbbmalloc.so
Expand All @@ -223,10 +233,12 @@ folder:
/opt/intel/oclcpuexp_<cpu_version>/x64
```

5) Configure library paths
5) Configure library paths (requires root access)

```bash
echo /opt/intel/oclcpuexp_<cpu_version>/x64 >
echo /opt/intel/oclfpgaemu_<fpga_version>/x64 >
/etc/ld.so.conf.d/libintelopenclexp.conf
echo /opt/intel/oclcpuexp_<cpu_version>/x64 >>
/etc/ld.so.conf.d/libintelopenclexp.conf
ldconfig -f /etc/ld.so.conf.d/libintelopenclexp.conf
```
Expand All @@ -239,7 +251,8 @@ OpenCL runtime for Intel `GPU` installer may re-write some important
files or settings and make existing OpenCL runtime for Intel `CPU` runtime
not working properly.

2) Extract the archive with OpenCL runtime for Intel `CPU` using links in
2) Extract the archive with OpenCL runtime for Intel `CPU` and/or for Intel
`FPGA` emulation using links in
[the dependency configuration file](../../buildbot/dependency.conf). For
example, to `c:\oclcpu_rt_<cpu_version>`.

Expand All @@ -257,6 +270,11 @@ extracted files are in `c:\oclcpu_rt_<cpu_version>\` folder, then type the
command:

```bash
# Install OpenCL FPGA emulation RT
# Answer N to clean previous OCL_ICD_FILENAMES configuration
c:\oclfpga_rt_<fpga_version>\install.bat c:\tbb_<tbb_version>\tbb\bin\intel64\vc14
# Install OpenCL CPU RT
# Answer Y to setup CPU RT side-bi-side with FPGA RT
c:\oclcpu_rt_<cpu_version>\install.bat c:\tbb_<tbb_version>\tbb\bin\intel64\vc14
```

Expand Down
5 changes: 5 additions & 0 deletions sycl/include/CL/sycl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
#include <CL/sycl/platform.hpp>
#include <CL/sycl/pointers.hpp>
#include <CL/sycl/program.hpp>
#include <CL/sycl/properties/accessor_properties.hpp>
#include <CL/sycl/properties/buffer_properties.hpp>
#include <CL/sycl/properties/context_properties.hpp>
#include <CL/sycl/properties/image_properties.hpp>
#include <CL/sycl/properties/queue_properties.hpp>
#include <CL/sycl/queue.hpp>
#include <CL/sycl/range.hpp>
#include <CL/sycl/sampler.hpp>
Expand Down
2 changes: 2 additions & 0 deletions sycl/include/CL/sycl/accessor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include <CL/sycl/id.hpp>
#include <CL/sycl/image.hpp>
#include <CL/sycl/pointers.hpp>
#include <CL/sycl/properties/accessor_properties.hpp>
#include <CL/sycl/property_list.hpp>
#include <CL/sycl/sampler.hpp>

/// \file accessor.hpp
Expand Down
32 changes: 16 additions & 16 deletions sycl/include/CL/sycl/backend/level_zero.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,37 @@
__SYCL_INLINE_NAMESPACE(cl) {
namespace sycl {

template <> struct interop<backend::level0, platform> {
template <> struct interop<backend::level_zero, platform> {
using type = ze_driver_handle_t;
};

template <> struct interop<backend::level0, device> {
template <> struct interop<backend::level_zero, device> {
using type = ze_device_handle_t;
};

template <> struct interop<backend::level0, queue> {
template <> struct interop<backend::level_zero, queue> {
using type = ze_command_queue_handle_t;
};

template <> struct interop<backend::level0, program> {
template <> struct interop<backend::level_zero, program> {
using type = ze_module_handle_t;
};

template <typename DataT, int Dimensions, access::mode AccessMode>
struct interop<backend::level0, accessor<DataT, Dimensions, AccessMode,
access::target::global_buffer,
access::placeholder::false_t>> {
struct interop<backend::level_zero, accessor<DataT, Dimensions, AccessMode,
access::target::global_buffer,
access::placeholder::false_t>> {
using type = char *;
};

template <typename DataT, int Dimensions, access::mode AccessMode>
struct interop<backend::level0, accessor<DataT, Dimensions, AccessMode,
access::target::constant_buffer,
access::placeholder::false_t>> {
struct interop<backend::level_zero, accessor<DataT, Dimensions, AccessMode,
access::target::constant_buffer,
access::placeholder::false_t>> {
using type = char *;
};

namespace level0 {
namespace level_zero {

// Implementation of various "make" functions resides in libsycl.so
platform make_platform(pi_native_handle NativeHandle);
Expand All @@ -55,34 +55,34 @@ queue make_queue(const context &Context, pi_native_handle InteropHandle);
// Construction of SYCL platform.
template <typename T, typename std::enable_if<
std::is_same<T, platform>::value>::type * = nullptr>
T make(typename interop<backend::level0, T>::type Interop) {
T make(typename interop<backend::level_zero, T>::type Interop) {
return make_platform(reinterpret_cast<pi_native_handle>(Interop));
}

// Construction of SYCL device.
template <typename T, typename std::enable_if<
std::is_same<T, device>::value>::type * = nullptr>
T make(const platform &Platform,
typename interop<backend::level0, T>::type Interop) {
typename interop<backend::level_zero, T>::type Interop) {
return make_device(Platform, reinterpret_cast<pi_native_handle>(Interop));
}

// Construction of SYCL program.
template <typename T, typename std::enable_if<
std::is_same<T, program>::value>::type * = nullptr>
T make(const context &Context,
typename interop<backend::level0, T>::type Interop) {
typename interop<backend::level_zero, T>::type Interop) {
return make_program(Context, reinterpret_cast<pi_native_handle>(Interop));
}

// Construction of SYCL queue.
template <typename T, typename std::enable_if<
std::is_same<T, queue>::value>::type * = nullptr>
T make(const context &Context,
typename interop<backend::level0, T>::type Interop) {
typename interop<backend::level_zero, T>::type Interop) {
return make_queue(Context, reinterpret_cast<pi_native_handle>(Interop));
}

} // namespace level0
} // namespace level_zero
} // namespace sycl
} // __SYCL_INLINE_NAMESPACE(cl)
4 changes: 2 additions & 2 deletions sycl/include/CL/sycl/backend_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
__SYCL_INLINE_NAMESPACE(cl) {
namespace sycl {

enum class backend : char { host, opencl, level0, cuda };
enum class backend : char { host, opencl, level_zero, cuda };

template <backend name, typename SYCLObjectT> struct interop;

Expand All @@ -30,7 +30,7 @@ inline std::ostream &operator<<(std::ostream &Out, backend be) {
case backend::opencl:
Out << std::string("opencl");
break;
case backend::level0:
case backend::level_zero:
Out << std::string("level-zero");
break;
case backend::cuda:
Expand Down
4 changes: 2 additions & 2 deletions sycl/include/CL/sycl/detail/pi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ bool trace(TraceLevel level);

#ifdef SYCL_RT_OS_WINDOWS
#define OPENCL_PLUGIN_NAME "pi_opencl.dll"
#define LEVEL0_PLUGIN_NAME "pi_level0.dll"
#define LEVEL_ZERO_PLUGIN_NAME "pi_level_zero.dll"
#define CUDA_PLUGIN_NAME "pi_cuda.dll"
#else
#define OPENCL_PLUGIN_NAME "libpi_opencl.so"
#define LEVEL0_PLUGIN_NAME "libpi_level0.so"
#define LEVEL_ZERO_PLUGIN_NAME "libpi_level_zero.so"
#define CUDA_PLUGIN_NAME "libpi_cuda.so"
#endif

Expand Down
83 changes: 83 additions & 0 deletions sycl/include/CL/sycl/detail/property_helper.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
//==--------- property_helper.hpp --- SYCL property helper -----------------==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#pragma once

#include <CL/sycl/detail/common.hpp>

__SYCL_INLINE_NAMESPACE(cl) {
namespace sycl {

namespace detail {

// All properties are split here to dataless properties and properties with
// data. A dataless property is one which has no data stored in it. A property
// with data is one which has data stored in it and usually provides and access
// to it. For dataless property we just store a bool which indicates if a
// property is set or not. For properties with data we store a pointer to the
// base class because we do not know the size of such properties beforehand.

// List of all dataless properties' IDs
enum DataLessPropKind {
BufferUseHostPtr = 0,
ImageUseHostPtr,
QueueEnableProfiling,
InOrder,
NoInit,
BufferUsePinnedHostMemory,
UsePrimaryContext,
DataLessPropKindSize
};

// List of all properties with data IDs
enum PropWithDataKind {
BufferUseMutex = 0,
BufferContextBound,
ImageUseMutex,
ImageContextBound,
PropWithDataKindSize
};

// Base class for dataless properties, needed to check that the type of an
// object passed to the property_list is a property.
class DataLessPropertyBase {};

// Helper class for the dataless properties. Every such property is supposed
// to inherit from it. The ID template parameter should be one from
// DataLessPropKind.
template <int ID> class DataLessProperty : DataLessPropertyBase {
public:
static constexpr int getKind() { return ID; }
};

// Base class for properties with data, needed to check that the type of an
// object passed to the property_list is a property and for checking if two
// properties with data are of the same type.
class PropertyWithDataBase {
public:
PropertyWithDataBase(int ID) : MID(ID) {}
bool isSame(int ID) const { return ID == MID; }
virtual ~PropertyWithDataBase() = default;

private:
int MID = -1;
};

// Helper class for the properties with data. Every such property is supposed
// to inherit from it. The ID template parameter should be one from
// PropWithDataKind.
template <int ID> class PropertyWithData : public PropertyWithDataBase {
public:
PropertyWithData() : PropertyWithDataBase(ID) {}
static int getKind() { return ID; }
};

} // namespace detail

} // namespace sycl
} // __SYCL_INLINE_NAMESPACE(cl)
Loading