Skip to content

Commit 5dca7ba

Browse files
committed
Split type check
1 parent 86c812e commit 5dca7ba

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

dpctl/_sycl_queue.pyx

+10-4
Original file line numberDiff line numberDiff line change
@@ -1553,6 +1553,8 @@ cdef class WorkGroupMemory:
15531553
Workgroup Memory oneAPI SYCL extension for low-overhead allocation of local
15541554
memory shared by the workitems in a workgroup.
15551555
1556+
This class is intended be used as kernel argument when launching kernels.
1557+
15561558
This is based on a DPC++ SYCL extension and only available in newer
15571559
versions. Use ``is_available()`` to check availability in your build.
15581560
@@ -1589,12 +1591,16 @@ cdef class WorkGroupMemory:
15891591
if len(args) == 1:
15901592
if not isinstance(args[0], numbers.Integral):
15911593
raise TypeError("WorkGroupMemory single argument constructor"
1592-
"expects number of bytes as integer value")
1594+
"expects first argument to be `int`",
1595+
f"but got {type(args[0])}")
15931596
nbytes = <size_t>(args[0])
15941597
else:
1595-
if not isinstance(args[0], str) or not isinstance(args[1], numbers.Integral):
1596-
raise TypeError("WorkGroupMemory constructor expects type as"
1597-
"string and number of bytes as integer value.")
1598+
if not isinstance(args[0], str):
1599+
raise TypeError("WorkGroupMemory constructor expects first"
1600+
f"argument to be `str`, but got {type(args[0])}")
1601+
if not isinstance(args[1], numbers.Integral):
1602+
raise TypeError("WorkGroupMemory constructor expects second"
1603+
f"argument to be `int`, but got {type(args[1])}")
15981604
dtype = <str>(args[0])
15991605
count = <size_t>(args[1])
16001606
if not dtype[0] in ["i", "u", "f"]:

0 commit comments

Comments
 (0)