@@ -373,7 +373,7 @@ cdef class SyclDevice(_SyclDevice):
373
373
Returns:
374
374
device_type: The type of device encoded as a device_type enum.
375
375
Raises:
376
- A ValueError is raised if the device type is not recognized.
376
+ ValueError: If the device type is not recognized.
377
377
"""
378
378
cdef _device_type DTy = (
379
379
DPCTLDevice_GetDeviceType(self ._device_ref)
@@ -393,116 +393,199 @@ cdef class SyclDevice(_SyclDevice):
393
393
394
394
@property
395
395
def has_aspect_host (self ):
396
- " Returns True if this device is a host device, False otherwise"
396
+ """ Returns True if this device is a host device, False otherwise.
397
+
398
+ Returns:
399
+ bool: Indicates if the device is a host device.
400
+ """
397
401
cdef _aspect_type AT = _aspect_type._host
398
402
return DPCTLDevice_HasAspect(self ._device_ref, AT)
399
403
400
404
@property
401
405
def has_aspect_cpu (self ):
402
- " Returns True if this device is a CPU device, False otherwise"
406
+ """ Returns True if this device is a CPU device, False otherwise.
407
+
408
+ Returns:
409
+ bool: Indicates if the device is a cpu.
410
+ """
403
411
cdef _aspect_type AT = _aspect_type._cpu
404
412
return DPCTLDevice_HasAspect(self ._device_ref, AT)
405
413
406
414
@property
407
415
def has_aspect_gpu (self ):
408
- " Returns True if this device is a GPU device, False otherwise"
416
+ """ Returns True if this device is a GPU device, False otherwise.
417
+
418
+ Returns:
419
+ bool: Indicates if the device is a gpu.
420
+ """
409
421
cdef _aspect_type AT = _aspect_type._gpu
410
422
return DPCTLDevice_HasAspect(self ._device_ref, AT)
411
423
412
424
@property
413
425
def has_aspect_accelerator (self ):
414
- " Returns True if this device is an accelerator device, False otherwise"
426
+ """ Returns True if this device is an accelerator device, False
427
+ otherwise.
428
+
429
+ SYCL considers an accelerator to be a device that usually uses a
430
+ peripheral interconnect for communication.
431
+
432
+ Returns:
433
+ bool: Indicates if the device is an accelerator.
434
+ """
415
435
cdef _aspect_type AT = _aspect_type._accelerator
416
436
return DPCTLDevice_HasAspect(self ._device_ref, AT)
417
437
418
438
@property
419
439
def has_aspect_custom (self ):
420
- " Returns True if this device is a custom device, False otherwise"
440
+ """ Returns True if this device is a custom device, False otherwise.
441
+
442
+ A custom device can be a dedicated accelerator that can use the
443
+ SYCL API, but programmable kernels cannot be dispatched to the device,
444
+ only fixed functionality is available. Refer SYCL spec for more details.
445
+
446
+ Returns:
447
+ bool: Indicates if the device is a custom SYCL device.
448
+ """
421
449
cdef _aspect_type AT = _aspect_type._custom
422
450
return DPCTLDevice_HasAspect(self ._device_ref, AT)
423
451
424
452
@property
425
453
def has_aspect_fp16 (self ):
426
- """ Returns True if kernels submitted to this device
427
- may use 16-bit floating point types, False otherwise
454
+ """ Returns True if the device supports half-precision floating point
455
+ operations, False otherwise.
456
+
457
+ Returns:
458
+ bool: Indicates that the device supports half precision floating
459
+ point operations.
428
460
"""
429
461
cdef _aspect_type AT = _aspect_type._fp16
430
462
return DPCTLDevice_HasAspect(self ._device_ref, AT)
431
463
432
464
@property
433
465
def has_aspect_fp64 (self ):
434
- """ Returns True if kernels submitted to this device
435
- may use 64-bit floating point types, False otherwise
466
+ """ Returns True if the device supports 64-bit precision floating point
467
+ operations, False otherwise.
468
+
469
+ Returns:
470
+ bool: Indicates that the device supports 64-bit precision floating
471
+ point operations.
436
472
"""
437
473
cdef _aspect_type AT = _aspect_type._fp64
438
474
return DPCTLDevice_HasAspect(self ._device_ref, AT)
439
475
440
476
@property
441
477
def has_aspect_atomic64 (self ):
442
- """ Returns True if kernels submitted to this device
443
- may perform 64-bit atomic operations, False otherwise
478
+ """ Returns true if the device supports a basic set of atomic
479
+ operations, False otherwise.
480
+
481
+ Indicates that the device supports the following atomic operations on
482
+ 64-bit values:
483
+ - atomic::load
484
+ - atomic::store
485
+ - atomic::fetch_add
486
+ - atomic::fetch_sub
487
+ - atomic::exchange
488
+ - atomic::compare_exchange_strong
489
+ - atomic::compare_exchange_weak
490
+
491
+ Returns:
492
+ bool: Indicates that the device supports a basic set of atomic
493
+ operations on 64-bit values.
444
494
"""
445
495
cdef _aspect_type AT = _aspect_type._atomic64
446
496
return DPCTLDevice_HasAspect(self ._device_ref, AT)
447
497
448
498
@property
449
499
def has_aspect_image (self ):
450
- """ Returns True if this device supports images, False otherwise
500
+ """ Returns True if the device supports images, False otherwise (refer
501
+ Sec 4.7.3 of SYCL 2020 spec).
502
+
503
+ Returns:
504
+ bool: Indicates that the device supports images
451
505
"""
452
506
cdef _aspect_type AT = _aspect_type._image
453
507
return DPCTLDevice_HasAspect(self ._device_ref, AT)
454
508
455
509
@property
456
510
def has_aspect_online_compiler (self ):
457
511
""" Returns True if this device supports online compilation of
458
- device code, False otherwise
512
+ device code, False otherwise.
513
+
514
+ Returns:
515
+ bool: Indicates that the device supports online compilation of
516
+ device code.
459
517
"""
460
518
cdef _aspect_type AT = _aspect_type._online_compiler
461
519
return DPCTLDevice_HasAspect(self ._device_ref, AT)
462
520
463
521
@property
464
522
def has_aspect_online_linker (self ):
465
523
""" Returns True if this device supports online linking of
466
- device code, False otherwise
524
+ device code, False otherwise.
525
+
526
+ Returns:
527
+ bool: Indicates that the device supports online linking of device
528
+ code.
467
529
"""
468
530
cdef _aspect_type AT = _aspect_type._online_linker
469
531
return DPCTLDevice_HasAspect(self ._device_ref, AT)
470
532
471
533
@property
472
534
def has_aspect_queue_profiling (self ):
473
535
""" Returns True if this device supports queue profiling,
474
- False otherwise
536
+ False otherwise.
537
+
538
+ Returns:
539
+ bool: Indicates that the device supports queue profiling.
475
540
"""
476
541
cdef _aspect_type AT = _aspect_type._queue_profiling
477
542
return DPCTLDevice_HasAspect(self ._device_ref, AT)
478
543
479
544
@property
480
545
def has_aspect_usm_device_allocations (self ):
481
546
""" Returns True if this device supports explicit USM allocations,
482
- False otherwise
547
+ False otherwise (refer Siction 4.8 of SYCL 2020 specs).
548
+
549
+ Returns:
550
+ bool: Indicates that the device supports explicit USM allocations.
483
551
"""
484
552
cdef _aspect_type AT = _aspect_type._usm_device_allocations
485
553
return DPCTLDevice_HasAspect(self ._device_ref, AT)
486
554
487
555
@property
488
556
def has_aspect_usm_host_allocations (self ):
489
557
""" Returns True if this device can access USM-host memory,
490
- False otherwise
558
+ False otherwise (refer Siction 4.8 of SYCL 2020 specs).
559
+
560
+ Returns:
561
+ bool: Indicates that the device can access USM memory
562
+ allocated via ``usm::alloc::host``.
491
563
"""
492
564
cdef _aspect_type AT = _aspect_type._usm_host_allocations
493
565
return DPCTLDevice_HasAspect(self ._device_ref, AT)
494
566
495
567
@property
496
568
def has_aspect_usm_shared_allocations (self ):
497
569
""" Returns True if this device supports USM-shared memory
498
- allocated on the same device, False otherwise
570
+ allocated on the same device, False otherwise.
571
+
572
+ Returns:
573
+ bool: Indicates that the device supports USM memory
574
+ allocated via ``usm::alloc::shared``.
499
575
"""
500
576
cdef _aspect_type AT = _aspect_type._usm_shared_allocations
501
577
return DPCTLDevice_HasAspect(self ._device_ref, AT)
502
578
503
579
@property
504
580
def has_aspect_usm_restricted_shared_allocations (self ):
505
- """ Deprecated property, do not use.
581
+ """ Returns True if this device supports USM memory
582
+ allocated as restricted USM, False otherwise.
583
+
584
+ Returns:
585
+ bool: Indicates that the device supports USM memory allocated via
586
+ ``usm::alloc::shared`` as restricted USM.
587
+
588
+ .. deprecated:: 0.14
506
589
"""
507
590
cdef _aspect_type AT = _aspect_type._usm_restricted_shared_allocations
508
591
return DPCTLDevice_HasAspect(self ._device_ref, AT)
@@ -511,7 +594,11 @@ cdef class SyclDevice(_SyclDevice):
511
594
def has_aspect_usm_system_allocations (self ):
512
595
""" Returns True if system allocator may be used instead of SYCL USM
513
596
allocation mechanism for USM-shared allocations on this device,
514
- False otherwise
597
+ False otherwise.
598
+
599
+ Returns:
600
+ bool: Indicates that system allocator may be used instead of SYCL
601
+ ``usm::alloc::shared``.
515
602
"""
516
603
cdef _aspect_type AT = _aspect_type._usm_system_allocations
517
604
return DPCTLDevice_HasAspect(self ._device_ref, AT)
@@ -650,6 +737,9 @@ cdef class SyclDevice(_SyclDevice):
650
737
def max_work_item_dims (self ):
651
738
""" Returns the maximum dimensions that specify the global and local
652
739
work-item IDs used by the data parallel execution model.
740
+
741
+ Returns:
742
+ int: The maximum number of work items supported by the device.
653
743
"""
654
744
cdef uint32_t max_work_item_dims = 0
655
745
max_work_item_dims = DPCTLDevice_GetMaxWorkItemDims(self ._device_ref)
@@ -659,8 +749,12 @@ cdef class SyclDevice(_SyclDevice):
659
749
def max_work_item_sizes1d (self ):
660
750
""" Returns the maximum number of work-items that are permitted in each
661
751
dimension of the work-group of the nd_range<1>. The minimum value is
662
- `(1 )` for devices that are not of device type
663
- ``info::device_type::custom``.
752
+ `(1 )` for devices that evaluate to False for
753
+ :py:attr:`~has_aspect_custom`.
754
+
755
+ Returns:
756
+ tuple[int,]: A tuple with the maximum allowed value for a 1D range
757
+ used to enqueue a kernel on the device.
664
758
"""
665
759
cdef size_t * max_work_item_sizes1d = NULL
666
760
max_work_item_sizes1d = DPCTLDevice_GetMaxWorkItemSizes1d(
@@ -674,8 +768,12 @@ cdef class SyclDevice(_SyclDevice):
674
768
def max_work_item_sizes2d (self ):
675
769
""" Returns the maximum number of work-items that are permitted in each
676
770
dimension of the work-group of the nd_range<2>. The minimum value is
677
- `(1; 1)` for devices that are not of device type
678
- ``info::device_type::custom``.
771
+ `(1; 1)` for devices that evaluate to False for
772
+ :py:attr:`~has_aspect_custom`.
773
+
774
+ Returns:
775
+ tuple[int, int]: A tuple with the maximum allowed value for each
776
+ dimension of a 2D range used to enqueue a kernel on the device.
679
777
"""
680
778
cdef size_t * max_work_item_sizes2d = NULL
681
779
max_work_item_sizes2d = DPCTLDevice_GetMaxWorkItemSizes2d(
@@ -689,8 +787,12 @@ cdef class SyclDevice(_SyclDevice):
689
787
def max_work_item_sizes3d (self ):
690
788
""" Returns the maximum number of work-items that are permitted in each
691
789
dimension of the work-group of the nd_range<3>. The minimum value is
692
- `(1; 1; 1)` for devices that are not of device type
693
- ``info::device_type::custom``.
790
+ `(1; 1; 1)` for devices that evaluate to False for
791
+ :py:attr:`~has_aspect_custom`.
792
+
793
+ Returns:
794
+ tuple[int, int, int]: A tuple with the maximum allowed value for
795
+ each dimension of a 3D range used to enqueue a kernel on the device.
694
796
"""
695
797
return (
696
798
self ._max_work_item_sizes[0 ],
@@ -702,8 +804,16 @@ cdef class SyclDevice(_SyclDevice):
702
804
def max_work_item_sizes (self ):
703
805
""" Returns the maximum number of work-items that are permitted in each
704
806
dimension of the work-group of the nd_range. The minimum value is
705
- `(1; 1; 1)` for devices that are not of device type
706
- ``info::device_type::custom``.
807
+ `(1; 1; 1)` for devices that evaluate to False for
808
+ :py:attr:`~has_aspect_custom`.
809
+
810
+ Returns:
811
+ tuple[int, int, int]: A tuple whose length depends on the number of
812
+ workgrpup dimensions supported by the device.
813
+
814
+ .. deprecated:: 0.14
815
+ The property is deprecated use :py:attr:`~max_work_item_sizes3d`
816
+ instead.
707
817
"""
708
818
warnings.warn(
709
819
" dpctl.SyclDevice.max_work_item_sizes is deprecated, "
@@ -720,17 +830,22 @@ cdef class SyclDevice(_SyclDevice):
720
830
def max_compute_units (self ):
721
831
""" Returns the number of parallel compute units available to the
722
832
device. The minimum value is 1.
833
+
834
+ Returns:
835
+ int: The number of compute units in the device.
723
836
"""
724
837
cdef uint32_t max_compute_units = 0
725
838
max_compute_units = DPCTLDevice_GetMaxComputeUnits(self ._device_ref)
726
839
return max_compute_units
727
840
728
841
@property
729
842
def max_work_group_size (self ):
730
- """ Returns the maximum number of work-items
731
- that are permitted in a work-group executing a
732
- kernel on a single compute unit. The minimum
843
+ """ Returns the maximum number of work-items that are permitted in a
844
+ work-group executing a kernel on a single compute unit. The minimum
733
845
value is 1.
846
+
847
+ Returns:
848
+ int: The maximum supported work group size.
734
849
"""
735
850
cdef uint32_t max_work_group_size = 0
736
851
max_work_group_size = DPCTLDevice_GetMaxWorkGroupSize(self ._device_ref)
@@ -755,8 +870,12 @@ cdef class SyclDevice(_SyclDevice):
755
870
756
871
@property
757
872
def sub_group_independent_forward_progress (self ):
758
- """ Returns true if the device supports independent forward progress of
873
+ """ Returns True if the device supports independent forward progress of
759
874
sub-groups with respect to other sub-groups in the same work-group.
875
+
876
+ Returns:
877
+ bool: Indicates if the device supports independent forward progress
878
+ of sub-groups.
760
879
"""
761
880
return DPCTLDevice_GetSubGroupIndependentForwardProgress(
762
881
self ._device_ref
@@ -1109,8 +1228,7 @@ cdef class SyclDevice(_SyclDevice):
1109
1228
Returns:
1110
1229
global_mem_cache_type: type of cache memory
1111
1230
Raises:
1112
- A RuntimeError is raised if an unrecognized memory type
1113
- is reported by runtime.
1231
+ RuntimeError: If an unrecognized memory type is reported by runtime.
1114
1232
"""
1115
1233
cdef _global_mem_cache_type gmcTy = (
1116
1234
DPCTLDevice_GetGlobalMemCacheType(self ._device_ref)
0 commit comments