File tree Expand file tree Collapse file tree 2 files changed +59
-0
lines changed Expand file tree Collapse file tree 2 files changed +59
-0
lines changed Original file line number Diff line number Diff line change @@ -932,6 +932,43 @@ cdef class SyclQueue(_SyclQueue):
932
932
933
933
return SyclEvent._create(ERef, [])
934
934
935
+ @property
936
+ def backend (self ):
937
+ """ Returns the backend_type enum value for the device
938
+ associated with this queue.
939
+
940
+ Returns:
941
+ backend_type: The backend for the device.
942
+ """
943
+ return self .sycl_device.backend
944
+
945
+ @property
946
+ def name (self ):
947
+ """ Returns the device name for the device
948
+ associated with this queue.
949
+
950
+ Returns:
951
+ str: The name of the device as a string.
952
+ """
953
+ return self .sycl_device.name
954
+
955
+ @property
956
+ def driver_version (self ):
957
+ """ Returns the driver version for the device
958
+ associated with this queue.
959
+
960
+ Returns:
961
+ str: The driver version of the device as a string.
962
+ """
963
+ return self .sycl_device.driver_version
964
+
965
+ def print_device_info (self ):
966
+ """ Print information about the SYCL device
967
+ associated with this queue.
968
+ """
969
+ self .sycl_device.print_device_info()
970
+
971
+
935
972
cdef public DPCTLSyclQueueRef get_queue_ref(SyclQueue q):
936
973
"""
937
974
C-API function to get opaque queue reference from
Original file line number Diff line number Diff line change @@ -391,6 +391,28 @@ def test_hashing_of_queue():
391
391
assert queue_dict
392
392
393
393
394
+ def test_channeling_device_properties ():
395
+ try :
396
+ q = dpctl .SyclQueue ()
397
+ dev = q .sycl_device
398
+ except dpctl .SyclQueueCreationError :
399
+ pytest .fail ("Failed to create device from default selector" )
400
+ import io
401
+ from contextlib import redirect_stdout
402
+
403
+ f1 = io .StringIO ()
404
+ with redirect_stdout (f1 ):
405
+ q .print_device_info () # should execute without raising
406
+ f2 = io .StringIO ()
407
+ with redirect_stdout (f2 ):
408
+ dev .print_device_info ()
409
+ assert f1 .getvalue () == f2 .getvalue (), "Mismatch in print_device_info"
410
+ for pr in ["backend" , "name" , "driver_version" ]:
411
+ assert getattr (q , pr ) == getattr (
412
+ dev , pr
413
+ ), "Mismatch found for property {}" .format (pr )
414
+
415
+
394
416
def test_queue_submit_barrier (valid_filter ):
395
417
try :
396
418
q = dpctl .SyclQueue (valid_filter )
You can’t perform that action at this time.
0 commit comments