Skip to content

Commit 15a03a7

Browse files
committed
[SYCL] address Alexey's comments
Signed-off-by: Sergey V Maslov <[email protected]>
1 parent 62ada2c commit 15a03a7

File tree

13 files changed

+43
-25
lines changed

13 files changed

+43
-25
lines changed

sycl/include/CL/sycl/detail/aligned_allocator.hpp

100755100644
File mode changed.

sycl/include/CL/sycl/detail/device_impl.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class device_impl_pi : public device_impl {
113113
~device_impl_pi() {
114114
if (!m_isRootDevice) {
115115
// TODO catch an exception and put it to list of asynchronous exceptions
116-
PI_CALL(RT::piDeviceRelease(m_device));
116+
CHECK_OCL_CODE_NO_EXC(RT::piDeviceRelease(m_device));
117117
}
118118
}
119119

@@ -151,7 +151,7 @@ class device_impl_pi : public device_impl {
151151
PI_CALL(RT::piDeviceGetInfo(
152152
m_device, PI_DEVICE_INFO_PLATFORM, sizeof(plt), &plt, 0));
153153

154-
// TODO: thisi possibly will violate common reference semantics,
154+
// TODO: this possibly will violate common reference semantics,
155155
// particularly, equality comparison may fail for two consecutive
156156
// get_platform() on the same device, as it compares impl objects.
157157
return createSyclObjFromImpl<platform>(
@@ -169,13 +169,13 @@ class device_impl_pi : public device_impl {
169169
size_t SubDevicesCount) const;
170170

171171
vector_class<device>
172-
create_sub_devices(size_t ComputeUnits) const;
172+
create_sub_devices(size_t ComputeUnits) const override;
173173

174174
vector_class<device>
175-
create_sub_devices(const vector_class<size_t> &Counts) const;
175+
create_sub_devices(const vector_class<size_t> &Counts) const override;
176176

177177
vector_class<device>
178-
create_sub_devices(info::partition_affinity_domain AffinityDomain) const;
178+
create_sub_devices(info::partition_affinity_domain AffinityDomain) const override;
179179

180180
private:
181181
RT::pi_device m_device = 0;
@@ -214,21 +214,21 @@ class device_host : public device_impl {
214214
return false;
215215
}
216216

217-
vector_class<device> create_sub_devices(size_t nbSubDev) const {
217+
vector_class<device> create_sub_devices(size_t nbSubDev) const override {
218218
// TODO: implement host device partitioning
219219
throw runtime_error(
220220
"Partitioning to subdevices of the host device is not implemented yet");
221221
}
222222

223223
vector_class<device>
224-
create_sub_devices(const vector_class<size_t> &counts) const {
224+
create_sub_devices(const vector_class<size_t> &counts) const override {
225225
// TODO: implement host device partitioning
226226
throw runtime_error(
227227
"Partitioning to subdevices of the host device is not implemented yet");
228228
}
229229

230230
vector_class<device>
231-
create_sub_devices(info::partition_affinity_domain affinityDomain) const {
231+
create_sub_devices(info::partition_affinity_domain affinityDomain) const override {
232232
// TODO: implement host device partitioning
233233
throw runtime_error(
234234
"Partitioning to subdevices of the host device is not implemented yet");

sycl/include/CL/sycl/detail/device_info.hpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -258,13 +258,6 @@ struct get_device_info<info::partition_property,
258258
return info::partition_property(arrayResult[0]);
259259
}
260260
};
261-
/*
262-
// Specialization for parent device
263-
template <>
264-
struct get_device_info<device, info::device::parent_device> {
265-
static device _(RT::pi_device dev);
266-
};
267-
*/
268261
// Specialization for supported subgroup sizes
269262
template <>
270263
struct get_device_info<vector_class<size_t>,

sycl/include/CL/sycl/detail/image_impl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ class image_impl : public SYCLMemObjT {
279279

280280
// TODO: Implement this function.
281281
void *allocateMem(ContextImplPtr Context, bool InitFromUserData,
282-
cnri_event &OutEventToWait) override {
282+
cl_event &OutEventToWait) override {
283283
if (true)
284284
throw cl::sycl::feature_not_supported(
285285
"MemoryAllocation Function Not Implemented for image class");

sycl/include/CL/sycl/detail/pi.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@
1515
#ifndef _PI_H_
1616
#define _PI_H_
1717

18+
// Every single change in PI API should be accamponied with the minor
19+
// version increase (+1). In the cases where backward compatibility is not
20+
// maintained there should be a (+1) change to the major version in
21+
// addition to the increase of the minor.
22+
//
23+
#define _PI_H_VERSION_MAJOR 1
24+
#define _PI_H_VERSION_MINOR 1
25+
1826
// TODO: we need a mapping of PI to OpenCL somewhere, and this can be done
1927
// elsewhere, e.g. in the pi_opencl, but constants/enums mapping is now
2028
// done here, for efficiency and simplicity.
@@ -229,7 +237,7 @@ pi_program piclProgramCreateWithSource( // TODO: change to return pi_result
229237
//
230238
// TODO: describe interfaces in Doxygen format
231239

232-
/// Selects the most appropriate device ninary based on runtime information
240+
/// Selects the most appropriate device binary based on runtime information
233241
/// and the IR characteristics.
234242
///
235243
pi_result piextDeviceSelectBinary(

sycl/include/CL/sycl/detail/pi_opencl.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
//==---------- pi_opencl.hpp - OpenCL Plugin for SYCL RT -------------------==//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
18
#pragma once
29

310
#include <CL/opencl.h>

sycl/include/CL/sycl/device.hpp

100755100644
File mode changed.

sycl/include/CL/sycl/platform.hpp

100755100644
File mode changed.

sycl/source/detail/device_impl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//==----------------- device_impl.hpp - SYCL device ------------------------==//
1+
//==----------------- device_impl.cpp - SYCL device ------------------------==//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.

sycl/source/detail/device_info.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ device get_device_info<device, info::device::parent_device>::_(
4040
std::make_shared<device_impl_pi>(result));
4141
}
4242

43-
//template struct get_device_info<device, info::device::parent_device>;
44-
45-
void get_device_info_BAD() {}
46-
4743
vector_class<info::fp_config> read_fp_bitfield(cl_device_fp_config bits) {
4844
vector_class<info::fp_config> result;
4945
if (bits & CL_FP_DENORM)

sycl/source/detail/pi.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
//==---------- pi.cpp - Plugin Interface for SYCL RT -----------------------==//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
18
#include <CL/sycl/detail/pi.hpp>
29
#include <cstdarg>
310
#include <iostream>

sycl/source/detail/pi_opencl.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
//==---------- pi_opencl.cpp - OpenCL Plugin -------------------------------==//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
18
#include <CL/sycl/detail/pi.hpp>
29
#include "CL/opencl.h"
310

sycl/source/detail/platform_impl.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//==----------- platform_host.cpp -----------------------------------------------==//
1+
//==----------- platform_impl.cpp ------------------------------------------==//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -59,9 +59,9 @@ platform_impl_pi::get_devices(info::device_type deviceType) const {
5959

6060
// TODO: remove this check when switched to PI as it would just return
6161
// zero in num_devices.
62-
if (err == CL_DEVICE_NOT_FOUND) {
62+
if (err == CL_DEVICE_NOT_FOUND)
6363
return res;
64-
}
64+
6565
// TODO catch an exception and put it to list of asynchronous exceptions
6666
// TODO: remove dependency on CHECK_OCL_CODE
6767
CHECK_OCL_CODE(err);

0 commit comments

Comments
 (0)