Device class C wrapper

Overview

// global functions

DPCTL_API bool
DPCTLDevice_AreEq(
    __dpctl_keep const DPCTLSyclDeviceRef DRef1,
    __dpctl_keep const DPCTLSyclDeviceRef DRef2
    );

DPCTL_API __dpctl_give DPCTLSyclDeviceRef
DPCTLDevice_Copy(__dpctl_keep const DPCTLSyclDeviceRef DRef);

DPCTL_API __dpctl_give DPCTLSyclDeviceRef
DPCTLDevice_Create(void);

DPCTL_API __dpctl_give DPCTLSyclDeviceRef
DPCTLDevice_CreateFromSelector(__dpctl_keep const DPCTLSyclDeviceSelectorRef DSRef);

DPCTL_API __dpctl_give DPCTLDeviceVectorRef
DPCTLDevice_CreateSubDevicesByAffinity(
    __dpctl_keep const DPCTLSyclDeviceRef DRef,
    DPCTLPartitionAffinityDomainType PartAffDomTy
    );

DPCTL_API __dpctl_give DPCTLDeviceVectorRef
DPCTLDevice_CreateSubDevicesByCounts(
    __dpctl_keep const DPCTLSyclDeviceRef DRef,
    __dpctl_keep size_t* counts,
    size_t ncounts
    );

DPCTL_API __dpctl_give DPCTLDeviceVectorRef
DPCTLDevice_CreateSubDevicesEqually(
    __dpctl_keep const DPCTLSyclDeviceRef DRef,
    size_t count
    );

DPCTL_API void
DPCTLDevice_Delete(__dpctl_take DPCTLSyclDeviceRef DRef);

DPCTL_API DPCTLSyclBackendType
DPCTLDevice_GetBackend(__dpctl_keep const DPCTLSyclDeviceRef DRef);

DPCTL_API DPCTLSyclDeviceType
DPCTLDevice_GetDeviceType(__dpctl_keep const DPCTLSyclDeviceRef DRef);

DPCTL_API __dpctl_give const char*
DPCTLDevice_GetDriverVersion(__dpctl_keep const DPCTLSyclDeviceRef DRef);

DPCTL_API uint64_t
DPCTLDevice_GetGlobalMemSize(__dpctl_keep const DPCTLSyclDeviceRef DRef);

DPCTL_API uint64_t
DPCTLDevice_GetLocalMemSize(__dpctl_keep const DPCTLSyclDeviceRef DRef);

DPCTL_API uint32_t
DPCTLDevice_GetMaxComputeUnits(__dpctl_keep const DPCTLSyclDeviceRef DRef);

DPCTL_API uint32_t
DPCTLDevice_GetMaxNumSubGroups(__dpctl_keep const DPCTLSyclDeviceRef DRef);

DPCTL_API size_t
DPCTLDevice_GetMaxWorkGroupSize(__dpctl_keep const DPCTLSyclDeviceRef DRef);

DPCTL_API uint32_t
DPCTLDevice_GetMaxWorkItemDims(__dpctl_keep const DPCTLSyclDeviceRef DRef);

DPCTL_API __dpctl_keep size_t*
DPCTLDevice_GetMaxWorkItemSizes1d(__dpctl_keep const DPCTLSyclDeviceRef DRef);

DPCTL_API __dpctl_keep size_t*
DPCTLDevice_GetMaxWorkItemSizes2d(__dpctl_keep const DPCTLSyclDeviceRef DRef);

DPCTL_API __dpctl_keep size_t*
DPCTLDevice_GetMaxWorkItemSizes3d(__dpctl_keep const DPCTLSyclDeviceRef DRef);

DPCTL_API __dpctl_give const char*
DPCTLDevice_GetName(__dpctl_keep const DPCTLSyclDeviceRef DRef);

DPCTL_API uint32_t
DPCTLDevice_GetNativeVectorWidthChar(__dpctl_keep const DPCTLSyclDeviceRef DRef);

DPCTL_API uint32_t
DPCTLDevice_GetNativeVectorWidthDouble(__dpctl_keep const DPCTLSyclDeviceRef DRef);

DPCTL_API uint32_t
DPCTLDevice_GetNativeVectorWidthFloat(__dpctl_keep const DPCTLSyclDeviceRef DRef);

DPCTL_API uint32_t
DPCTLDevice_GetNativeVectorWidthHalf(__dpctl_keep const DPCTLSyclDeviceRef DRef);

DPCTL_API uint32_t
DPCTLDevice_GetNativeVectorWidthInt(__dpctl_keep const DPCTLSyclDeviceRef DRef);

DPCTL_API uint32_t
DPCTLDevice_GetNativeVectorWidthLong(__dpctl_keep const DPCTLSyclDeviceRef DRef);

DPCTL_API uint32_t
DPCTLDevice_GetNativeVectorWidthShort(__dpctl_keep const DPCTLSyclDeviceRef DRef);

DPCTL_API __dpctl_give DPCTLSyclPlatformRef
DPCTLDevice_GetPlatform(__dpctl_keep const DPCTLSyclDeviceRef DRef);

DPCTL_API uint32_t
DPCTLDevice_GetPreferredVectorWidthChar(__dpctl_keep const DPCTLSyclDeviceRef DRef);

DPCTL_API uint32_t
DPCTLDevice_GetPreferredVectorWidthDouble(__dpctl_keep const DPCTLSyclDeviceRef DRef);

DPCTL_API uint32_t
DPCTLDevice_GetPreferredVectorWidthFloat(__dpctl_keep const DPCTLSyclDeviceRef DRef);

DPCTL_API uint32_t
DPCTLDevice_GetPreferredVectorWidthHalf(__dpctl_keep const DPCTLSyclDeviceRef DRef);

DPCTL_API uint32_t
DPCTLDevice_GetPreferredVectorWidthInt(__dpctl_keep const DPCTLSyclDeviceRef DRef);

DPCTL_API uint32_t
DPCTLDevice_GetPreferredVectorWidthLong(__dpctl_keep const DPCTLSyclDeviceRef DRef);

DPCTL_API uint32_t
DPCTLDevice_GetPreferredVectorWidthShort(__dpctl_keep const DPCTLSyclDeviceRef DRef);

DPCTL_API bool
DPCTLDevice_GetSubGroupIndependentForwardProgress(__dpctl_keep const DPCTLSyclDeviceRef DRef);

DPCTL_API __dpctl_keep size_t*
DPCTLDevice_GetSubGroupSizes(
    __dpctl_keep const DPCTLSyclDeviceRef DRef,
    size_t* res_len
    );

DPCTL_API __dpctl_give const char*
DPCTLDevice_GetVendor(__dpctl_keep const DPCTLSyclDeviceRef DRef);

DPCTL_API bool
DPCTLDevice_HasAspect(
    __dpctl_keep const DPCTLSyclDeviceRef DRef,
    DPCTLSyclAspectType AT
    );

DPCTL_API bool
DPCTLDevice_IsAccelerator(__dpctl_keep const DPCTLSyclDeviceRef DRef);

DPCTL_API bool
DPCTLDevice_IsCPU(__dpctl_keep const DPCTLSyclDeviceRef DRef);

DPCTL_API bool
DPCTLDevice_IsGPU(__dpctl_keep const DPCTLSyclDeviceRef DRef);

Detailed Documentation

Global Functions

DPCTL_API bool
DPCTLDevice_AreEq(
    __dpctl_keep const DPCTLSyclDeviceRef DRef1,
    __dpctl_keep const DPCTLSyclDeviceRef DRef2
    )

Checks if two DPCTLSyclDeviceRef objects point to the same sycl::device.

Parameters:

DRef1

First opaque pointer to a sycl::device.

DRef2

Second opaque pointer to a sycl::device.

Returns:

True if the underlying sycl::device are same, false otherwise.

DPCTL_API __dpctl_give DPCTLSyclDeviceRef
DPCTLDevice_Copy(__dpctl_keep const DPCTLSyclDeviceRef DRef)

Returns a copy of the DPCTLSyclDeviceRef object.

Parameters:

DRef

DPCTLSyclDeviceRef object to be copied.

Returns:

A new DPCTLSyclDeviceRef created by copying the passed in DPCTLSyclDeviceRef object.

DPCTL_API __dpctl_give DPCTLSyclDeviceRef
DPCTLDevice_Create(void)

Returns a new DPCTLSyclDeviceRef opaque object wrapping a SYCL device instance as a host device.

Returns:

An opaque pointer to a sycl::device created as an instance of the host device.

DPCTL_API __dpctl_give DPCTLSyclDeviceRef
DPCTLDevice_CreateFromSelector(__dpctl_keep const DPCTLSyclDeviceSelectorRef DSRef)

Returns a new DPCTLSyclDeviceRef opaque object created using the provided device_selector.

Parameters:

DSRef

An opaque pointer to a sycl::device_selector.

Returns:

Returns an opaque pointer to a SYCL device created using the device_selector, if the requested device could not be created a nullptr is returned.

DPCTL_API __dpctl_give DPCTLDeviceVectorRef
DPCTLDevice_CreateSubDevicesByAffinity(
    __dpctl_keep const DPCTLSyclDeviceRef DRef,
    DPCTLPartitionAffinityDomainType PartAffDomTy
    )

Returns a vector of sub-devices partitioned from this SYCL device by affinity domain based on the domain parameter.

Parameters:

DRef

Opaque pointer to a sycl::device

PartAffDomTy

A DPCTLPartitionAffinityDomainType enum value

Returns:

A DPCTLDeviceVectorRef containing DPCTLSyclDeviceRef objects

DPCTL_API __dpctl_give DPCTLDeviceVectorRef
DPCTLDevice_CreateSubDevicesByCounts(
    __dpctl_keep const DPCTLSyclDeviceRef DRef,
    __dpctl_keep size_t* counts,
    size_t ncounts
    )

Returns a vector of sub devices partitioned from this SYCL device based on the counts parameter. For each non-zero value M in the counts vector, a sub device with M compute units is created.

Parameters:

DRef

Opaque pointer to a sycl::device

counts

Array with count compute units that need to contains in subdevices

ncounts

Number of counts

Returns:

A DPCTLDeviceVectorRef containing DPCTLSyclDeviceRef objects

DPCTL_API __dpctl_give DPCTLDeviceVectorRef
DPCTLDevice_CreateSubDevicesEqually(
    __dpctl_keep const DPCTLSyclDeviceRef DRef,
    size_t count
    )

Returns a vector of sub devices partitioned from this SYCL device based on the count parameter. The returned vector contains as many sub devices as can be created such that each sub device contains count compute units. If the device’s total number of compute units is not evenly divided by count, then the remaining compute units are not included in any of the sub devices.

Parameters:

DRef

Opaque pointer to a sycl::device

count

Count compute units that need to contains in subdevices

Returns:

A DPCTLDeviceVectorRef containing DPCTLSyclDeviceRef objects

DPCTL_API void
DPCTLDevice_Delete(__dpctl_take DPCTLSyclDeviceRef DRef)

Deletes a DPCTLSyclDeviceRef pointer after casting to to sycl::device.

Parameters:

DRef

The DPCTLSyclDeviceRef pointer to be freed.

DPCTL_API DPCTLSyclBackendType
DPCTLDevice_GetBackend(__dpctl_keep const DPCTLSyclDeviceRef DRef)

Returns the backend for the device.

Parameters:

DRef

Opaque pointer to a sycl::device

Returns:

A DPCTLSyclBackendType enum value representing the sycl::backend for the device.

DPCTL_API DPCTLSyclDeviceType
DPCTLDevice_GetDeviceType(__dpctl_keep const DPCTLSyclDeviceRef DRef)

Returns the DPCTLSyclDeviceType enum value for the DPCTLSyclDeviceRef argument.

Parameters:

DRef

Opaque pointer to a sycl::device

Returns:

The DPCTLSyclDeviceType value corresponding to the device.

DPCTL_API __dpctl_give const char*
DPCTLDevice_GetDriverVersion(__dpctl_keep const DPCTLSyclDeviceRef DRef)

Returns the OpenCL software driver version as a C string.

Parameters:

DRef

Opaque pointer to a sycl::device

Returns:

A C string in the form major_number.minor.number that corresponds to the OpenCL driver version if this is a OpenCL device.

DPCTL_API uint64_t
DPCTLDevice_GetGlobalMemSize(__dpctl_keep const DPCTLSyclDeviceRef DRef)

Wrapper over device.get_info<info::device::global_mem_size>().

Parameters:

DRef

Opaque pointer to a sycl::device

Returns:

Returns the valid result if device exists else returns 0.

DPCTL_API uint64_t
DPCTLDevice_GetLocalMemSize(__dpctl_keep const DPCTLSyclDeviceRef DRef)

Wrapper over device.get_info<info::device::local_mem_size>().

Parameters:

DRef

Opaque pointer to a sycl::device

Returns:

Returns the valid result if device exists else returns 0.

DPCTL_API uint32_t
DPCTLDevice_GetMaxComputeUnits(__dpctl_keep const DPCTLSyclDeviceRef DRef)

Wrapper over device.get_info<info::device::max_compute_units>().

Parameters:

DRef

Opaque pointer to a sycl::device

Returns:

Returns the valid result if device exists else returns 0.

DPCTL_API uint32_t
DPCTLDevice_GetMaxNumSubGroups(__dpctl_keep const DPCTLSyclDeviceRef DRef)

Wrapper over device.get_info<info::device::max_num_sub_groups>.

Parameters:

DRef

Opaque pointer to a sycl::device

Returns:

Returns the valid result if device exists else returns 0.

DPCTL_API size_t
DPCTLDevice_GetMaxWorkGroupSize(__dpctl_keep const DPCTLSyclDeviceRef DRef)

Wrapper for get_info<info::device::max_work_group_size>().

Parameters:

DRef

Opaque pointer to a sycl::device

Returns:

Returns the valid result if device exists else returns 0.

DPCTL_API uint32_t
DPCTLDevice_GetMaxWorkItemDims(__dpctl_keep const DPCTLSyclDeviceRef DRef)

Wrapper for get_info<info::device::max_work_item_dimensions>().

Parameters:

DRef

Opaque pointer to a sycl::device

Returns:

Returns the valid result if device exists else returns 0.

DPCTL_API __dpctl_keep size_t*
DPCTLDevice_GetMaxWorkItemSizes1d(__dpctl_keep const DPCTLSyclDeviceRef DRef)

Wrapper for get_info<info::device::max_work_item_sizes<1>>().

Parameters:

DRef

Opaque pointer to a sycl::device

Returns:

Returns the valid result if device exists else returns NULL.

DPCTL_API __dpctl_keep size_t*
DPCTLDevice_GetMaxWorkItemSizes2d(__dpctl_keep const DPCTLSyclDeviceRef DRef)

Wrapper for get_info<info::device::max_work_item_sizes<2>>().

Parameters:

DRef

Opaque pointer to a sycl::device

Returns:

Returns the valid result if device exists else returns NULL.

DPCTL_API __dpctl_keep size_t*
DPCTLDevice_GetMaxWorkItemSizes3d(__dpctl_keep const DPCTLSyclDeviceRef DRef)

Wrapper for get_info<info::device::max_work_item_sizes<3>>().

Parameters:

DRef

Opaque pointer to a sycl::device

Returns:

Returns the valid result if device exists else returns NULL.

DPCTL_API __dpctl_give const char*
DPCTLDevice_GetName(__dpctl_keep const DPCTLSyclDeviceRef DRef)

Returns a C string for the device name.

Parameters:

DRef

Opaque pointer to a sycl::device

Returns:

A C string containing the OpenCL device name.

DPCTL_API uint32_t
DPCTLDevice_GetNativeVectorWidthChar(__dpctl_keep const DPCTLSyclDeviceRef DRef)

Wrapper over device.get_info<info::device::native_vector_width_char>.

Parameters:

DRef

Opaque pointer to a sycl::device

Returns:

Returns the native ISA vector width size for built-in scalar types that can be put into vectors.

DPCTL_API uint32_t
DPCTLDevice_GetNativeVectorWidthDouble(__dpctl_keep const DPCTLSyclDeviceRef DRef)

Wrapper over device.get_info<info::device::native_vector_width_double>.

Parameters:

DRef

Opaque pointer to a sycl::device

Returns:

Returns the native ISA vector width size for built-in scalar types that can be put into vectors.

DPCTL_API uint32_t
DPCTLDevice_GetNativeVectorWidthFloat(__dpctl_keep const DPCTLSyclDeviceRef DRef)

Wrapper over device.get_info<info::device::native_vector_width_float>.

Parameters:

DRef

Opaque pointer to a sycl::device

Returns:

Returns the native ISA vector width size for built-in scalar type.

DPCTL_API uint32_t
DPCTLDevice_GetNativeVectorWidthHalf(__dpctl_keep const DPCTLSyclDeviceRef DRef)

Wrapper over device.get_info<info::device::native_vector_width_half>.

Parameters:

DRef

Opaque pointer to a sycl::device

Returns:

Returns the native ISA vector width size for built-in scalar types that can be put into vectors.

DPCTL_API uint32_t
DPCTLDevice_GetNativeVectorWidthInt(__dpctl_keep const DPCTLSyclDeviceRef DRef)

Wrapper over device.get_info<info::device::native_vector_width_int>.

Parameters:

DRef

Opaque pointer to a sycl::device

Returns:

Returns the native ISA vector width size for built-in scalar types that can be put into vectors.

DPCTL_API uint32_t
DPCTLDevice_GetNativeVectorWidthLong(__dpctl_keep const DPCTLSyclDeviceRef DRef)

Wrapper over device.get_info<info::device::native_vector_width_long>.

Parameters:

DRef

Opaque pointer to a sycl::device

Returns:

Returns the native ISA vector width size for built-in scalar types that can be put into vectors.

DPCTL_API uint32_t
DPCTLDevice_GetNativeVectorWidthShort(__dpctl_keep const DPCTLSyclDeviceRef DRef)

Wrapper over device.get_info<info::device::native_vector_width_short>.

Parameters:

DRef

Opaque pointer to a sycl::device

Returns:

Returns the native ISA vector width size for built-in scalar types that can be put into vectors.

DPCTL_API __dpctl_give DPCTLSyclPlatformRef
DPCTLDevice_GetPlatform(__dpctl_keep const DPCTLSyclDeviceRef DRef)

Returns the sycl::platform for the device as DPCTLSyclPlatformRef opaque pointer.

Parameters:

DRef

Opaque pointer to a sycl::device

Returns:

An opaque pointer to the sycl::platform for the device.

DPCTL_API uint32_t
DPCTLDevice_GetPreferredVectorWidthChar(__dpctl_keep const DPCTLSyclDeviceRef DRef)

Wrapper over device.get_info<info::device::preferred_vector_width_char>.

Parameters:

DRef

Opaque pointer to a sycl::device

Returns:

Returns the preferred native vector width size for built-in scalar types that can be put into vectors.

DPCTL_API uint32_t
DPCTLDevice_GetPreferredVectorWidthDouble(__dpctl_keep const DPCTLSyclDeviceRef DRef)

Wrapper over device.get_info<info::device::preferred_vector_width_double>.

Parameters:

DRef

Opaque pointer to a sycl::device

Returns:

Returns the preferred native vector width size for built-in scalar types that can be put into vectors.

DPCTL_API uint32_t
DPCTLDevice_GetPreferredVectorWidthFloat(__dpctl_keep const DPCTLSyclDeviceRef DRef)

Wrapper over device.get_info<info::device::preferred_vector_width_float>.

Parameters:

DRef

Opaque pointer to a sycl::device

Returns:

Returns the preferred native vector width size for built-in scalar type.

DPCTL_API uint32_t
DPCTLDevice_GetPreferredVectorWidthHalf(__dpctl_keep const DPCTLSyclDeviceRef DRef)

Wrapper over device.get_info<info::device::preferred_vector_width_half>.

Parameters:

DRef

Opaque pointer to a sycl::device

Returns:

Returns the preferred native vector width size for built-in scalar types that can be put into vectors.

DPCTL_API uint32_t
DPCTLDevice_GetPreferredVectorWidthInt(__dpctl_keep const DPCTLSyclDeviceRef DRef)

Wrapper over device.get_info<info::device::preferred_vector_width_int>.

Parameters:

DRef

Opaque pointer to a sycl::device

Returns:

Returns the preferred native vector width size for built-in scalar types that can be put into vectors.

DPCTL_API uint32_t
DPCTLDevice_GetPreferredVectorWidthLong(__dpctl_keep const DPCTLSyclDeviceRef DRef)

Wrapper over device.get_info<info::device::preferred_vector_width_long>.

Parameters:

DRef

Opaque pointer to a sycl::device

Returns:

Returns the preferred native vector width size for built-in scalar types that can be put into vectors.

DPCTL_API uint32_t
DPCTLDevice_GetPreferredVectorWidthShort(__dpctl_keep const DPCTLSyclDeviceRef DRef)

Wrapper over device.get_info<info::device::preferred_vector_width_short>.

Parameters:

DRef

Opaque pointer to a sycl::device

Returns:

Returns the preferred native vector width size for built-in scalar types that can be put into vectors.

DPCTL_API bool
DPCTLDevice_GetSubGroupIndependentForwardProgress(__dpctl_keep const DPCTLSyclDeviceRef DRef)

Wrapper over device.get_info<info::device::sub_group_independent_forward_progress>.

Parameters:

DRef

Opaque pointer to a sycl::device

Returns:

Returns true if the device supports independent forward progress of sub-groups with respect to other sub-groups in the same work-group.

DPCTL_API __dpctl_keep size_t*
DPCTLDevice_GetSubGroupSizes(
    __dpctl_keep const DPCTLSyclDeviceRef DRef,
    size_t* res_len
    )

Wrapper for get_info<info::device::sub_group_sizes>().

Parameters:

DRef

Opaque pointer to a sycl::device

res_len

Populated with size of the returned array

Returns:

Returns the valid result if device exists else returns NULL.

DPCTL_API __dpctl_give const char*
DPCTLDevice_GetVendor(__dpctl_keep const DPCTLSyclDeviceRef DRef)

Returns a C string corresponding to the vendor name.

Parameters:

DRef

Opaque pointer to a sycl::device

Returns:

A C string containing the OpenCL device vendor name.

DPCTL_API bool
DPCTLDevice_HasAspect(
    __dpctl_keep const DPCTLSyclDeviceRef DRef,
    DPCTLSyclAspectType AT
    )

Checks if device has aspect.

Parameters:

DRef

Opaque pointer to a sycl::device

AT

DPCTLSyclAspectType of device::aspect.

Returns:

True if sycl::device has device::aspect, else false.

DPCTL_API bool
DPCTLDevice_IsAccelerator(__dpctl_keep const DPCTLSyclDeviceRef DRef)

Returns true if this SYCL device is an OpenCL device and the device type is sycl::info::device_type::accelerator.

Parameters:

DRef

Opaque pointer to a sycl::device

Returns:

True if the device type is an accelerator, else False.

DPCTL_API bool
DPCTLDevice_IsCPU(__dpctl_keep const DPCTLSyclDeviceRef DRef)

Returns true if this SYCL device is an OpenCL device and the device type is sycl::info::device_type::cpu.

Parameters:

DRef

Opaque pointer to a sycl::device

Returns:

True if the device type is a cpu, else False.

DPCTL_API bool
DPCTLDevice_IsGPU(__dpctl_keep const DPCTLSyclDeviceRef DRef)

Returns true if this SYCL device is an OpenCL device and the device type is sycl::info::device_type::gpu.

Parameters:

DRef

Opaque pointer to a sycl::device

Returns:

True if the device type is a gpu, else False.