xref: /aosp_15_r20/external/OpenCL-CTS/test_common/harness/deviceInfo.h (revision 6467f958c7de8070b317fc65bcb0f6472e388d82)
1*6467f958SSadaf Ebrahimi //
2*6467f958SSadaf Ebrahimi // Copyright (c) 2017-2019 The Khronos Group Inc.
3*6467f958SSadaf Ebrahimi //
4*6467f958SSadaf Ebrahimi // Licensed under the Apache License, Version 2.0 (the "License");
5*6467f958SSadaf Ebrahimi // you may not use this file except in compliance with the License.
6*6467f958SSadaf Ebrahimi // You may obtain a copy of the License at
7*6467f958SSadaf Ebrahimi //
8*6467f958SSadaf Ebrahimi //    http://www.apache.org/licenses/LICENSE-2.0
9*6467f958SSadaf Ebrahimi //
10*6467f958SSadaf Ebrahimi // Unless required by applicable law or agreed to in writing, software
11*6467f958SSadaf Ebrahimi // distributed under the License is distributed on an "AS IS" BASIS,
12*6467f958SSadaf Ebrahimi // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*6467f958SSadaf Ebrahimi // See the License for the specific language governing permissions and
14*6467f958SSadaf Ebrahimi // limitations under the License.
15*6467f958SSadaf Ebrahimi //
16*6467f958SSadaf Ebrahimi #ifndef _deviceInfo_h
17*6467f958SSadaf Ebrahimi #define _deviceInfo_h
18*6467f958SSadaf Ebrahimi 
19*6467f958SSadaf Ebrahimi // Configuration
20*6467f958SSadaf Ebrahimi #include "../config.hpp"
21*6467f958SSadaf Ebrahimi 
22*6467f958SSadaf Ebrahimi #include <string>
23*6467f958SSadaf Ebrahimi 
24*6467f958SSadaf Ebrahimi #include <CL/opencl.h>
25*6467f958SSadaf Ebrahimi 
26*6467f958SSadaf Ebrahimi /* Helper to return a string containing device information for the specified
27*6467f958SSadaf Ebrahimi  * device info parameter. */
28*6467f958SSadaf Ebrahimi std::string get_device_info_string(cl_device_id device,
29*6467f958SSadaf Ebrahimi                                    cl_device_info param_name);
30*6467f958SSadaf Ebrahimi 
31*6467f958SSadaf Ebrahimi /* Determines if an extension is supported by a device. */
32*6467f958SSadaf Ebrahimi int is_extension_available(cl_device_id device, const char *extensionName);
33*6467f958SSadaf Ebrahimi 
34*6467f958SSadaf Ebrahimi /* Returns the version of the extension the device supports or throws an
35*6467f958SSadaf Ebrahimi  * exception if the extension is not supported by the device. */
36*6467f958SSadaf Ebrahimi cl_version get_extension_version(cl_device_id device,
37*6467f958SSadaf Ebrahimi                                  const char *extensionName);
38*6467f958SSadaf Ebrahimi 
39*6467f958SSadaf Ebrahimi /* Returns a string containing the supported extensions list for a device. */
40*6467f958SSadaf Ebrahimi std::string get_device_extensions_string(cl_device_id device);
41*6467f958SSadaf Ebrahimi 
42*6467f958SSadaf Ebrahimi /* Returns a string containing the supported IL version(s) for a device. */
43*6467f958SSadaf Ebrahimi std::string get_device_il_version_string(cl_device_id device);
44*6467f958SSadaf Ebrahimi 
45*6467f958SSadaf Ebrahimi /* Returns a string containing the supported OpenCL version for a device. */
46*6467f958SSadaf Ebrahimi std::string get_device_version_string(cl_device_id device);
47*6467f958SSadaf Ebrahimi 
48*6467f958SSadaf Ebrahimi /* Returns a string containing the device name. */
49*6467f958SSadaf Ebrahimi std::string get_device_name(cl_device_id device);
50*6467f958SSadaf Ebrahimi 
51*6467f958SSadaf Ebrahimi // Returns the maximum size in bytes for Kernel Parameters
52*6467f958SSadaf Ebrahimi size_t get_max_param_size(cl_device_id device);
53*6467f958SSadaf Ebrahimi 
54*6467f958SSadaf Ebrahimi #endif // _deviceInfo_h
55