Skip to content

Commit 7d8e770

Browse files
author
Diptorup Deb
committed
Fix the docstrings for some of the SyclDevice aspect properties.
1 parent eb8ddb2 commit 7d8e770

File tree

1 file changed

+107
-20
lines changed

1 file changed

+107
-20
lines changed

dpctl/_sycl_device.pyx

Lines changed: 107 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -393,116 +393,199 @@ cdef class SyclDevice(_SyclDevice):
393393

394394
@property
395395
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+
"""
397401
cdef _aspect_type AT = _aspect_type._host
398402
return DPCTLDevice_HasAspect(self._device_ref, AT)
399403

400404
@property
401405
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+
"""
403411
cdef _aspect_type AT = _aspect_type._cpu
404412
return DPCTLDevice_HasAspect(self._device_ref, AT)
405413

406414
@property
407415
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+
"""
409421
cdef _aspect_type AT = _aspect_type._gpu
410422
return DPCTLDevice_HasAspect(self._device_ref, AT)
411423

412424
@property
413425
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+
"""
415435
cdef _aspect_type AT = _aspect_type._accelerator
416436
return DPCTLDevice_HasAspect(self._device_ref, AT)
417437

418438
@property
419439
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+
"""
421449
cdef _aspect_type AT = _aspect_type._custom
422450
return DPCTLDevice_HasAspect(self._device_ref, AT)
423451

424452
@property
425453
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.
428460
"""
429461
cdef _aspect_type AT = _aspect_type._fp16
430462
return DPCTLDevice_HasAspect(self._device_ref, AT)
431463

432464
@property
433465
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.
436472
"""
437473
cdef _aspect_type AT = _aspect_type._fp64
438474
return DPCTLDevice_HasAspect(self._device_ref, AT)
439475

440476
@property
441477
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.
444494
"""
445495
cdef _aspect_type AT = _aspect_type._atomic64
446496
return DPCTLDevice_HasAspect(self._device_ref, AT)
447497

448498
@property
449499
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
451505
"""
452506
cdef _aspect_type AT = _aspect_type._image
453507
return DPCTLDevice_HasAspect(self._device_ref, AT)
454508

455509
@property
456510
def has_aspect_online_compiler(self):
457511
""" 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.
459517
"""
460518
cdef _aspect_type AT = _aspect_type._online_compiler
461519
return DPCTLDevice_HasAspect(self._device_ref, AT)
462520

463521
@property
464522
def has_aspect_online_linker(self):
465523
""" 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.
467529
"""
468530
cdef _aspect_type AT = _aspect_type._online_linker
469531
return DPCTLDevice_HasAspect(self._device_ref, AT)
470532

471533
@property
472534
def has_aspect_queue_profiling(self):
473535
""" 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.
475540
"""
476541
cdef _aspect_type AT = _aspect_type._queue_profiling
477542
return DPCTLDevice_HasAspect(self._device_ref, AT)
478543

479544
@property
480545
def has_aspect_usm_device_allocations(self):
481546
""" 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.
483551
"""
484552
cdef _aspect_type AT = _aspect_type._usm_device_allocations
485553
return DPCTLDevice_HasAspect(self._device_ref, AT)
486554

487555
@property
488556
def has_aspect_usm_host_allocations(self):
489557
""" 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``.
491563
"""
492564
cdef _aspect_type AT = _aspect_type._usm_host_allocations
493565
return DPCTLDevice_HasAspect(self._device_ref, AT)
494566

495567
@property
496568
def has_aspect_usm_shared_allocations(self):
497569
""" 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``.
499575
"""
500576
cdef _aspect_type AT = _aspect_type._usm_shared_allocations
501577
return DPCTLDevice_HasAspect(self._device_ref, AT)
502578

503579
@property
504580
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
506589
"""
507590
cdef _aspect_type AT = _aspect_type._usm_restricted_shared_allocations
508591
return DPCTLDevice_HasAspect(self._device_ref, AT)
@@ -511,7 +594,11 @@ cdef class SyclDevice(_SyclDevice):
511594
def has_aspect_usm_system_allocations(self):
512595
""" Returns True if system allocator may be used instead of SYCL USM
513596
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``.
515602
"""
516603
cdef _aspect_type AT = _aspect_type._usm_system_allocations
517604
return DPCTLDevice_HasAspect(self._device_ref, AT)

0 commit comments

Comments
 (0)