Skip to content

Commit 07384c5

Browse files
Merge remote-tracking branch 'origin/master' into feature/SyclContext
2 parents 4897bc2 + f0ada84 commit 07384c5

21 files changed

+1096
-341
lines changed

dpctl-capi/include/dpctl_sycl_platform_interface.h

Lines changed: 62 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,42 @@
3030
#include "Support/MemOwnershipAttrs.h"
3131
#include "dpctl_data_types.h"
3232
#include "dpctl_sycl_enum_types.h"
33+
#include "dpctl_sycl_platform_manager.h"
3334
#include "dpctl_sycl_types.h"
3435

3536
DPCTL_C_EXTERN_C_BEGIN
3637

38+
/*!
39+
* @brief Returns a copy of the DPCTLSyclPlatformRef object.
40+
*
41+
* @param DRef DPCTLSyclPlatformRef object to be copied.
42+
* @return A new DPCTLSyclPlatformRef created by copying the passed in
43+
* DPCTLSyclPlatformRef object.
44+
*/
45+
DPCTL_API
46+
__dpctl_give DPCTLSyclPlatformRef
47+
DPCTLPlatform_Copy(__dpctl_keep const DPCTLSyclPlatformRef PRef);
48+
49+
/*!
50+
* @brief Creates a new DPCTLSyclPlatformRef for a SYCL platform constructed
51+
* using SYCL's default_selector.
52+
*
53+
* @return A new DPCTLSyclPlatformRef pointer wrapping a SYCL platform object.
54+
*/
55+
DPCTL_API
56+
__dpctl_give DPCTLSyclPlatformRef DPCTLPlatform_Create();
57+
58+
/*!
59+
* @brief Creates a new DPCTLSyclPlatformRef for a SYCL platform constructed
60+
* using the device_selector wrapped by DPCTLSyclDeviceSelectorRef.
61+
*
62+
* @param DSRef An opaque pointer to a SYCL device_selector object.
63+
* @return A new DPCTLSyclPlatformRef pointer wrapping a SYCL platform object.
64+
*/
65+
DPCTL_API
66+
__dpctl_give DPCTLSyclPlatformRef DPCTLPlatform_CreateFromSelector(
67+
__dpctl_keep const DPCTLSyclDeviceSelectorRef DSRef);
68+
3769
/*!
3870
* @brief Deletes the DPCTLSyclProgramRef pointer.
3971
*
@@ -43,46 +75,58 @@ DPCTL_API
4375
void DPCTLPlatform_Delete(__dpctl_take DPCTLSyclPlatformRef PRef);
4476

4577
/*!
46-
* @brief Returns the number of non-host type sycl::platform available on the
47-
* system.
78+
* @brief Returns a DPCTLSyclBackendType enum value identifying the SYCL
79+
* backend associated with the platform.
4880
*
49-
* @return The number of available sycl::platforms.
81+
* @param PRef Opaque pointer to a sycl::platform
82+
* @return A DPCTLSyclBackendType enum value identifying the SYCL backend
83+
* associated with the platform.
5084
*/
5185
DPCTL_API
52-
size_t DPCTLPlatform_GetNumNonHostPlatforms();
86+
DPCTLSyclBackendType
87+
DPCTLPlatform_GetBackend(__dpctl_keep const DPCTLSyclPlatformRef PRef);
5388

5489
/*!
55-
* @brief Returns the number of unique non-host sycl backends on the system.
90+
* @brief Returns a C string for the platform name.
5691
*
57-
* @return The number of unique sycl backends.
92+
* @param PRef Opaque pointer to a sycl::platform
93+
* @return A C string containing the name of the sycl::platform.
5894
*/
5995
DPCTL_API
60-
size_t DPCTLPlatform_GetNumNonHostBackends();
96+
__dpctl_give const char *
97+
DPCTLPlatform_GetName(__dpctl_keep const DPCTLSyclPlatformRef PRef);
6198

6299
/*!
63-
* @brief Returns an array of the unique non-host DPCTLSyclBackendType values on
64-
* the system.
100+
* @brief Returns a C string corresponding to the vendor providing the platform.
65101
*
66-
* @return An array of DPCTLSyclBackendType enum values.
102+
* @param PRef Opaque pointer to a sycl::platform
103+
* @return A C string containing the name of the vendor provifing the
104+
* platform.
67105
*/
68106
DPCTL_API
69-
__dpctl_give DPCTLSyclBackendType *DPCTLPlatform_GetListOfNonHostBackends();
107+
__dpctl_give const char *
108+
DPCTLPlatform_GetVendor(__dpctl_keep const DPCTLSyclPlatformRef PRef);
70109

71110
/*!
72-
* @brief Frees an array of DPCTLSyclBackendType enum values.
111+
* @brief Returns the software driver version of the sycl::platform as a C
112+
* string.
73113
*
74-
* @param BEArr An array of DPCTLSyclBackendType enum values to be
75-
* freed.
114+
* @param PRef Opaque pointer to a sycl::platform
115+
* @return A C string containing the software driver version of the device
116+
* associated with the platform.
76117
*/
77118
DPCTL_API
78-
void DPCTLPlatform_DeleteListOfBackends(
79-
__dpctl_take DPCTLSyclBackendType *BEArr);
119+
__dpctl_give const char *
120+
DPCTLPlatform_GetVersion(__dpctl_keep const DPCTLSyclPlatformRef PRef);
80121

81122
/*!
82-
* @brief Prints out some selected info about all sycl::platform on the system.
123+
* @brief Returns an opaque pointer to a vector of SYCL platforms available on
124+
* the system.
83125
*
126+
* @return A #DPCTLPlatformVectorRef containing #DPCTLSyclPlatformRef
127+
* objects.
84128
*/
85129
DPCTL_API
86-
void DPCTLPlatform_DumpInfo();
130+
__dpctl_give DPCTLPlatformVectorRef DPCTLPlatform_GetPlatforms();
87131

88132
DPCTL_C_EXTERN_C_END
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
//===-- dpctl_sycl_platform_manager.h - Helpers for sycl::platform -*-C++-*- =//
2+
//
3+
// Data Parallel Control (dpCtl)
4+
//
5+
// Copyright 2020-2021 Intel Corporation
6+
//
7+
// Licensed under the Apache License, Version 2.0 (the "License");
8+
// you may not use this file except in compliance with the License.
9+
// You may obtain a copy of the License at
10+
//
11+
// http://www.apache.org/licenses/LICENSE-2.0
12+
//
13+
// Unless required by applicable law or agreed to in writing, software
14+
// distributed under the License is distributed on an "AS IS" BASIS,
15+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
// See the License for the specific language governing permissions and
17+
// limitations under the License.
18+
//
19+
//===----------------------------------------------------------------------===//
20+
///
21+
/// \file
22+
/// This header declares helper functions to work with sycl::platform objects.
23+
///
24+
//===----------------------------------------------------------------------===//
25+
26+
#pragma once
27+
28+
#include "Support/DllExport.h"
29+
#include "Support/ExternC.h"
30+
#include "Support/MemOwnershipAttrs.h"
31+
#include "dpctl_sycl_types.h"
32+
#include "dpctl_vector.h"
33+
34+
DPCTL_C_EXTERN_C_BEGIN
35+
36+
// Declares a set of types abd functions to deal with vectors of
37+
// DPCTLSyclPlatformRef. Refer dpctl_vector_macros.h
38+
DPCTL_DECLARE_VECTOR(Platform)
39+
40+
/*!
41+
* @brief Prints out information about the sycl::platform argument.
42+
* @param PRef A #DPCTLSyclPlatformRef opaque pointer.
43+
*/
44+
DPCTL_API
45+
void DPCTLPlatformMgr_PrintInfo(__dpctl_keep const DPCTLSyclPlatformRef PRef);
46+
47+
DPCTL_C_EXTERN_C_END

0 commit comments

Comments
 (0)