Skip to content

Commit

Permalink
Some more ext vs (next) core things
Browse files Browse the repository at this point in the history
Aside from cleaning up some conditional info queries, this defines
the _KHR equivalents to make it easier to detect missing defines
programmatically.
  • Loading branch information
Oblomov committed Apr 24, 2021
1 parent aabec89 commit 72a1ee2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/clinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,6 @@ DEFINE_EXT_CHECK(arm_job_slots)
DEFINE_EXT_CHECK(arm_scheduling_controls)
DEFINE_EXT_CHECK(fission)
DEFINE_EXT_CHECK(atomic_counters)
DEFINE_EXT_CHECK(image2d_buffer)
DEFINE_EXT_CHECK(il_program)
DEFINE_EXT_CHECK(intel_local_thread)
DEFINE_EXT_CHECK(intel_AME)
Expand Down Expand Up @@ -1153,6 +1152,11 @@ cl_bool dev_has_images_20(const struct device_info_checks *chk)
return dev_has_images(chk) && dev_is_20(chk);
}

cl_bool dev_has_image2d_buffer(const struct device_info_checks *chk)
{
return dev_has_images_20(chk) || !!(chk->has_image2d_buffer[0]);
}

cl_bool dev_has_compiler(const struct device_info_checks *chk)
{
return chk->compiler_available;
Expand Down Expand Up @@ -2887,7 +2891,7 @@ struct device_info_traits dinfo_traits[] = {

/* Terminate context */
{ CLINFO_BOTH, DINFO(CL_DEVICE_TERMINATE_CAPABILITY_KHR_1x, "Terminate capability (1.2 define)", terminate_capability), dev_has_terminate_context },
{ CLINFO_BOTH, DINFO(CL_DEVICE_TERMINATE_CAPABILITY_KHR_2x, "Terminate capability (2.x define)", terminate_capability), dev_has_terminate_context },
{ CLINFO_BOTH, DINFO(CL_DEVICE_TERMINATE_CAPABILITY_KHR, "Terminate capability (2.x and later)", terminate_capability), dev_has_terminate_context },

{ CLINFO_BOTH, DINFO(CL_DEVICE_CONTROLLED_TERMINATION_CAPABILITIES_ARM, "Controlled termination caps. (ARM)", terminate_arm), dev_has_terminate_arm },

Expand Down
22 changes: 21 additions & 1 deletion src/ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,22 @@ typedef struct _cl_name_version {
* Extensions
*/

/* cl_khr_extended_versioning */
// the _KHR fields are the same as the unsuffixed from OpenCL 3
#define CL_PLATFORM_NUMERIC_VERSION_KHR CL_PLATFORM_NUMERIC_VERSION
#define CL_PLATFORM_EXTENSIONS_WITH_VERSION_KHR CL_PLATFORM_EXTENSIONS_WITH_VERSION
#define CL_DEVICE_NUMERIC_VERSION_KHR CL_DEVICE_NUMERIC_VERSION
#define CL_DEVICE_OPENCL_C_NUMERIC_VERSION_KHR CL_DEVICE_OPENCL_C_NUMERIC_VERSION
#define CL_DEVICE_EXTENSIONS_WITH_VERSION_KHR CL_DEVICE_EXTENSIONS_WITH_VERSION
#define CL_DEVICE_ILS_WITH_VERSION_KHR CL_DEVICE_ILS_WITH_VERSION
#define CL_DEVICE_BUILT_IN_KERNELS_WITH_VERSION_KHR CL_DEVICE_BUILT_IN_KERNELS_WITH_VERSION

/* cl_khr_image2d_from_buffer */
// the _KHR fields are the same as the unsuffixed from OpenCL 2
#define CL_DEVICE_IMAGE_PITCH_ALIGNMENT_KHR CL_DEVICE_IMAGE_PITCH_ALIGNMENT
#define CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT_KHR CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT


/* cl_khr_icd */
#define CL_PLATFORM_ICD_SUFFIX_KHR 0x0920
#define CL_PLATFORM_NOT_FOUND_KHR -1001
Expand Down Expand Up @@ -214,7 +230,7 @@ typedef struct _cl_name_version {

/* cl_khr_terminate_context */
#define CL_DEVICE_TERMINATE_CAPABILITY_KHR_1x 0x200F
#define CL_DEVICE_TERMINATE_CAPABILITY_KHR_2x 0x2031
#define CL_DEVICE_TERMINATE_CAPABILITY_KHR 0x2031

/* TODO: I cannot find official definitions for these,
* so I'm currently extrapolating them from the specification
Expand Down Expand Up @@ -343,6 +359,10 @@ typedef cl_ulong cl_device_partition_property_ext;

/* cl_arm_shared_virtual_memory */
#define CL_DEVICE_SVM_CAPABILITIES_ARM 0x40B6
#define CL_DEVICE_SVM_COARSE_GRAIN_BUFFER_ARM CL_DEVICE_SVM_COARSE_GRAIN_BUFFER
#define CL_DEVICE_SVM_FINE_GRAIN_BUFFER_ARM CL_DEVICE_SVM_FINE_GRAIN_BUFFER
#define CL_DEVICE_SVM_FINE_GRAIN_SYSTEM_ARM CL_DEVICE_SVM_FINE_GRAIN_SYSTEM
#define CL_DEVICE_SVM_ATOMICS_ARM CL_DEVICE_SVM_ATOMICS

/* cl_arm_core_id */
#define CL_DEVICE_COMPUTE_UNITS_BITFIELD_ARM 0x40BF
Expand Down

0 comments on commit 72a1ee2

Please sign in to comment.