@@ -348,96 +348,98 @@ def _monkeypatch_svm_docstrings():
348
348
349
349
# {{{ PooledSVM
350
350
351
- PooledSVM .__doc__ = """
352
- An object representing a :class:`SVMPool`-based allocation of
353
- :ref:`svm`. Analogous to :class:`~pyopencl.SVMAllocation`, however once
354
- this object is deleted, its associated device memory is returned to the
355
- pool from which it came.
351
+ PooledSVM .__doc__ = ( # pylint: disable=possibly-used-before-assignment
352
+ """ An object representing a :class:`SVMPool`-based allocation of
353
+ :ref:`svm`. Analogous to :class:`~pyopencl.SVMAllocation`, however once
354
+ this object is deleted, its associated device memory is returned to the
355
+ pool from which it came.
356
356
357
- .. versionadded:: 2022.2
357
+ .. versionadded:: 2022.2
358
358
359
- .. note::
359
+ .. note::
360
360
361
- If the :class:`SVMAllocator` for the :class:`SVMPool` that allocated an
362
- object of this type is associated with an (in-order)
363
- :class:`~pyopencl.CommandQueue`, sufficient synchronization is provided
364
- to ensure operations enqueued before deallocation complete before
365
- operations from a different use (possibly in a different queue) are
366
- permitted to start. This applies when :class:`release` is called and
367
- also when the object is freed automatically by the garbage collector.
361
+ If the :class:`SVMAllocator` for the :class:`SVMPool` that allocated an
362
+ object of this type is associated with an (in-order)
363
+ :class:`~pyopencl.CommandQueue`, sufficient synchronization is provided
364
+ to ensure operations enqueued before deallocation complete before
365
+ operations from a different use (possibly in a different queue) are
366
+ permitted to start. This applies when :class:`release` is called and
367
+ also when the object is freed automatically by the garbage collector.
368
368
369
- Is a :class:`pyopencl.SVMPointer`.
369
+ Is a :class:`pyopencl.SVMPointer`.
370
370
371
- Supports structural equality and hashing.
371
+ Supports structural equality and hashing.
372
372
373
- .. automethod:: release
373
+ .. automethod:: release
374
374
375
- Return the held memory to the pool. See the note about synchronization
376
- behavior during deallocation above.
375
+ Return the held memory to the pool. See the note about synchronization
376
+ behavior during deallocation above.
377
377
378
- .. automethod:: enqueue_release
378
+ .. automethod:: enqueue_release
379
379
380
- Synonymous to :meth:`release`, for consistency with
381
- :class:`~pyopencl.SVMAllocation`. Note that, unlike
382
- :meth:`pyopencl.SVMAllocation.enqueue_release`, specifying a queue
383
- or events to be waited for is not supported.
380
+ Synonymous to :meth:`release`, for consistency with
381
+ :class:`~pyopencl.SVMAllocation`. Note that, unlike
382
+ :meth:`pyopencl.SVMAllocation.enqueue_release`, specifying a queue
383
+ or events to be waited for is not supported.
384
384
385
- .. automethod:: bind_to_queue
385
+ .. automethod:: bind_to_queue
386
386
387
- Analogous to :meth:`pyopencl.SVMAllocation.bind_to_queue`.
387
+ Analogous to :meth:`pyopencl.SVMAllocation.bind_to_queue`.
388
388
389
- .. automethod:: unbind_from_queue
389
+ .. automethod:: unbind_from_queue
390
390
391
- Analogous to :meth:`pyopencl.SVMAllocation.unbind_from_queue`.
392
- """
391
+ Analogous to :meth:`pyopencl.SVMAllocation.unbind_from_queue`.
392
+ """ )
393
393
394
394
# }}}
395
395
396
396
# {{{ SVMAllocator
397
397
398
- SVMAllocator .__doc__ = """
399
- .. versionadded:: 2022.2
398
+ SVMAllocator .__doc__ = ( # pylint: disable=possibly-used-before-assignment
399
+ """
400
+ .. versionadded:: 2022.2
400
401
401
- .. automethod:: __init__
402
+ .. automethod:: __init__
402
403
403
- :arg flags: See :class:`~pyopencl.svm_mem_flags`.
404
- :arg queue: If not specified, allocations will be freed
405
- eagerly, irrespective of whether pending/enqueued operations
406
- are still using the memory.
404
+ :arg flags: See :class:`~pyopencl.svm_mem_flags`.
405
+ :arg queue: If not specified, allocations will be freed
406
+ eagerly, irrespective of whether pending/enqueued operations
407
+ are still using the memory.
407
408
408
- If specified, deallocation of memory will be enqueued
409
- with the given queue, and will only be performed
410
- after previously-enqueue operations in the queue have
411
- completed.
409
+ If specified, deallocation of memory will be enqueued
410
+ with the given queue, and will only be performed
411
+ after previously-enqueue operations in the queue have
412
+ completed.
412
413
413
- It is an error to specify an out-of-order queue.
414
+ It is an error to specify an out-of-order queue.
414
415
415
- .. warning::
416
+ .. warning::
416
417
417
- Not specifying a queue will typically lead to undesired
418
- behavior, including crashes and memory corruption.
419
- See the warning in :ref:`svm`.
418
+ Not specifying a queue will typically lead to undesired
419
+ behavior, including crashes and memory corruption.
420
+ See the warning in :ref:`svm`.
420
421
421
- .. automethod:: __call__
422
+ .. automethod:: __call__
422
423
423
- Return a :class:`~pyopencl.SVMAllocation` of the given *size*.
424
- """
424
+ Return a :class:`~pyopencl.SVMAllocation` of the given *size*.
425
+ """ )
425
426
426
427
# }}}
427
428
428
429
# {{{ SVMPool
429
430
430
- SVMPool .__doc__ = remove_common_indentation ("""
431
- A memory pool for OpenCL device memory in :ref:`SVM <svm>` form.
432
- *allocator* must be an instance of :class:`SVMAllocator`.
431
+ SVMPool .__doc__ = ( # pylint: disable=possibly-used-before-assignment
432
+ remove_common_indentation ("""
433
+ A memory pool for OpenCL device memory in :ref:`SVM <svm>` form.
434
+ *allocator* must be an instance of :class:`SVMAllocator`.
433
435
434
- .. versionadded:: 2022.2
436
+ .. versionadded:: 2022.2
435
437
436
- .. automethod:: __init__
437
- .. automethod:: __call__
438
+ .. automethod:: __init__
439
+ .. automethod:: __call__
438
440
439
- Return a :class:`PooledSVM` of the given *size*.
440
- """ ) + _MEMPOOL_IFACE_DOCS
441
+ Return a :class:`PooledSVM` of the given *size*.
442
+ """ ) + _MEMPOOL_IFACE_DOCS )
441
443
442
444
# }}}
443
445
@@ -1363,6 +1365,8 @@ def vec_arg_factory(typename, name):
1363
1365
parsed_arg = arg
1364
1366
elif isinstance (arg , tuple ):
1365
1367
parsed_arg = ScalarArg (self .parse_type (arg [0 ]), arg [1 ])
1368
+ else :
1369
+ raise TypeError ("unexpected argument type: %s" % type (arg ))
1366
1370
1367
1371
parsed_args .append (parsed_arg )
1368
1372
0 commit comments