dpctl.SyclDevice

class dpctl.SyclDevice

Python equivalent for cl::sycl::device class.

There are two ways of creating a SyclDevice instance:

Example
import dpctl

# Create a SyclDevice with an explicit filter string, in
# this case the first level_zero gpu device.
level_zero_gpu = dpctl.SyclDevice("level_zero:gpu:0"):
level_zero_gpu.print_device_info()
Example
import dpctl

# Create a SyclDevice of type GPU based on whatever is returned
# by the SYCL `gpu_selector` device selector class.
gpu = dpctl.select_gpu_device():
gpu.print_device_info()

Attributes:

backend

Returns the backend_type enum value for this device

default_selector_score

device_type

Returns the type of the device as a device_type enum.

driver_version

Returns a backend-defined driver version as a string.

filter_string

For a parent device returns a tuple (backend, device_kind, relative_id).

has_aspect_accelerator

has_aspect_cpu

has_aspect_custom

has_aspect_fp16

has_aspect_fp64

has_aspect_gpu

has_aspect_host

has_aspect_image

has_aspect_int64_base_atomics

has_aspect_int64_extended_atomics

has_aspect_online_compiler

has_aspect_online_linker

has_aspect_queue_profiling

has_aspect_usm_device_allocations

has_aspect_usm_host_allocations

has_aspect_usm_restricted_shared_allocations

has_aspect_usm_shared_allocations

has_aspect_usm_system_allocator

image_2d_max_height

Returns the maximum height of a 2D image or 1D image in pixels.

image_2d_max_width

Returns the maximum width of a 2D image or 1D image in pixels.

image_3d_max_depth

Returns the maximum depth of a 3D image in pixels.

image_3d_max_height

Returns the maximum height of a 3D image in pixels.

image_3d_max_width

Returns the maximum width of a 3D image in pixels.

is_accelerator

Returns True if the SyclDevice instance is a SYCL accelerator device.

is_cpu

Returns True if the SyclDevice instance is a SYCL CPU device.

is_gpu

Returns True if the SyclDevice instance is a SYCL GPU device.

is_host

Returns True if the SyclDevice instance is a SYCL host device.

max_compute_units

Returns the number of parallel compute units available to the device.

max_num_sub_groups

Returns the maximum number of sub-groups in a work-group for any kernel executed on the device.

max_read_image_args

Returns the maximum number of simultaneous image objects that can be read from by a kernel.

max_work_group_size

Returns the maximum number of work-items that are permitted in a work-group executing a kernel on a single compute unit.

max_work_item_dims

Returns the maximum dimensions that specify the global and local work-item IDs used by the data parallel execution model.

max_work_item_sizes

Returns the maximum number of work-items that are permitted in each dimension of the work-group of the nd_range.

max_write_image_args

Returns the maximum number of simultaneous image objects that can be written to by a kernel.

name

Returns the name of the device as a string

parent_device

Parent device for a sub-device, or None for a root device.

preferred_vector_width_char

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

preferred_vector_width_double

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

preferred_vector_width_float

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

preferred_vector_width_half

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

preferred_vector_width_int

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

preferred_vector_width_long

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

preferred_vector_width_short

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

sub_group_independent_forward_progress

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

vendor

Returns the device vendor name as a string.

Public methods:

addressof_ref

Returns the address of the DPCTLSyclDeviceRef pointer as a size_t.

create_sub_devices

print_device_info

Print information about the SYCL device.

Detail

Public methods

SyclDevice.addressof_ref()

Returns the address of the DPCTLSyclDeviceRef pointer as a size_t.

Returns

The address of the DPCTLSyclDeviceRef object used to create this SyclDevice cast to a size_t.

Return type

int

SyclDevice.backend

Returns the backend_type enum value for this device

Returns

The backend for the device.

Return type

backend_type

SyclDevice.create_sub_devices()
SyclDevice.default_selector_score
SyclDevice.device_type

Returns the type of the device as a device_type enum.

Returns

The type of device encoded as a device_type enum.

Return type

device_type

Raises

A ValueError is raised if the device type is not recognized.

SyclDevice.driver_version

Returns a backend-defined driver version as a string.

SyclDevice.filter_string

For a parent device returns a tuple (backend, device_kind, relative_id). Raises an exception for sub-devices.

SyclDevice.has_aspect_accelerator
SyclDevice.has_aspect_cpu
SyclDevice.has_aspect_custom
SyclDevice.has_aspect_fp16
SyclDevice.has_aspect_fp64
SyclDevice.has_aspect_gpu
SyclDevice.has_aspect_host
SyclDevice.has_aspect_image
SyclDevice.has_aspect_int64_base_atomics
SyclDevice.has_aspect_int64_extended_atomics
SyclDevice.has_aspect_online_compiler
SyclDevice.has_aspect_online_linker
SyclDevice.has_aspect_queue_profiling
SyclDevice.has_aspect_usm_device_allocations
SyclDevice.has_aspect_usm_host_allocations
SyclDevice.has_aspect_usm_restricted_shared_allocations
SyclDevice.has_aspect_usm_shared_allocations
SyclDevice.has_aspect_usm_system_allocator
SyclDevice.image_2d_max_height

Returns the maximum height of a 2D image or 1D image in pixels. The minimum value is 8192 if the SYCL device has aspect::image.

SyclDevice.image_2d_max_width

Returns the maximum width of a 2D image or 1D image in pixels. The minimum value is 8192 if the SYCL device has aspect::image.

SyclDevice.image_3d_max_depth

Returns the maximum depth of a 3D image in pixels. The minimum value is 2048 if the SYCL device has aspect::image.

SyclDevice.image_3d_max_height

Returns the maximum height of a 3D image in pixels. The minimum value is 2048 if the SYCL device has aspect::image.

SyclDevice.image_3d_max_width

Returns the maximum width of a 3D image in pixels. The minimum value is 2048 if the SYCL device has aspect::image.

SyclDevice.is_accelerator

Returns True if the SyclDevice instance is a SYCL accelerator device.

Returns

True if the SyclDevice is a SYCL accelerator device, else False.

Return type

bool

SyclDevice.is_cpu

Returns True if the SyclDevice instance is a SYCL CPU device.

Returns

True if the SyclDevice is a SYCL CPU device, else False.

Return type

bool

SyclDevice.is_gpu

Returns True if the SyclDevice instance is a SYCL GPU device.

Returns

True if the SyclDevice is a SYCL GPU device, else False.

Return type

bool

SyclDevice.is_host

Returns True if the SyclDevice instance is a SYCL host device.

Returns

True if the SyclDevice is a SYCL host device, else False.

Return type

bool

SyclDevice.max_compute_units

Returns the number of parallel compute units available to the device. The minimum value is 1.

SyclDevice.max_num_sub_groups

Returns the maximum number of sub-groups in a work-group for any kernel executed on the device. The minimum value is 1.

SyclDevice.max_read_image_args

Returns the maximum number of simultaneous image objects that can be read from by a kernel. The minimum value is 128 if the SYCL device has aspect::image.

SyclDevice.max_work_group_size

Returns the maximum number of work-items that are permitted in a work-group executing a kernel on a single compute unit. The minimum value is 1.

SyclDevice.max_work_item_dims

Returns the maximum dimensions that specify the global and local work-item IDs used by the data parallel execution model. The cb value is 3 if this SYCL device is not of device type info::device_type::custom.

SyclDevice.max_work_item_sizes

Returns the maximum number of work-items that are permitted in each dimension of the work-group of the nd_range. The minimum value is (1; 1; 1) for devices that are not of device type info::device_type::custom.

SyclDevice.max_write_image_args

Returns the maximum number of simultaneous image objects that can be written to by a kernel. The minimum value is 8 if the SYCL device has aspect::image.

SyclDevice.name

Returns the name of the device as a string

SyclDevice.parent_device

Parent device for a sub-device, or None for a root device.

SyclDevice.preferred_vector_width_char

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

SyclDevice.preferred_vector_width_double

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

SyclDevice.preferred_vector_width_float

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

SyclDevice.preferred_vector_width_half

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

SyclDevice.preferred_vector_width_int

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

SyclDevice.preferred_vector_width_long

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

SyclDevice.preferred_vector_width_short

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

SyclDevice.print_device_info()

Print information about the SYCL device.

SyclDevice.sub_group_independent_forward_progress

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

SyclDevice.vendor

Returns the device vendor name as a string.