Skip to content

Commit e94d08e

Browse files
authored
ENH: add uint8 (#47)
* add the `uint8` type, an 8-bit unsigned integer whose values exist on the interval `[0, +255]` * this type is required by the Python array API standard: https://data-apis.org/array-api/latest/API_specification/data_types.html
1 parent d3946ed commit e94d08e

File tree

6 files changed

+7
-1
lines changed

6 files changed

+7
-1
lines changed

include/fwd.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ enum KokkosViewDataType {
127127
Int16,
128128
Int32,
129129
Int64,
130+
Uint8,
130131
Uint16,
131132
Uint32,
132133
Uint64,

include/traits.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ VIEW_DATA_TYPE(int8_t, Int8, "int8", "signed_char")
7979
VIEW_DATA_TYPE(int16_t, Int16, "int16", "short")
8080
VIEW_DATA_TYPE(int32_t, Int32, "int32", "int")
8181
VIEW_DATA_TYPE(int64_t, Int64, "int64", "long")
82+
VIEW_DATA_TYPE(uint8_t, Uint8, "uint8", "unsigned_char")
8283
VIEW_DATA_TYPE(uint16_t, Uint16, "uint16", "unsigned_short")
8384
VIEW_DATA_TYPE(uint32_t, Uint32, "uint32", "unsigned", "unsigned_int")
8485
VIEW_DATA_TYPE(uint64_t, Uint64, "uint64", "unsigned_long")

kokkos/__init__.py.in

+1
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ try:
151151
"int16",
152152
"int32",
153153
"int64",
154+
"uint8",
154155
"uint16",
155156
"uint32",
156157
"uint64",

kokkos/test/test_types.py

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
(kokkos.int16, np.int16),
1212
(kokkos.int32, np.int32),
1313
(kokkos.int64, np.int64),
14+
(kokkos.uint8, np.uint8),
1415
(kokkos.uint16, np.uint16),
1516
(kokkos.uint32, np.uint32),
1617
(kokkos.uint64, np.uint64),

kokkos/utility.py

+2
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ def read_dtype(_dtype):
8989
return lib.int32
9090
elif _dtype == np.int64:
9191
return lib.int64
92+
elif _dtype == np.uint8:
93+
return lib.uint8
9294
elif _dtype == np.uint16:
9395
return lib.uint16
9496
elif _dtype == np.uint32:

src/variants/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ TARGET_LINK_LIBRARIES(libpykokkos-variants PUBLIC
2626

2727
SET(_types concrete dynamic)
2828
SET(_variants layout memory_trait)
29-
SET(_data_types Int8 Int16 Int32 Int64 Uint16 Uint32 Uint64 Float32 Float64)
29+
SET(_data_types Int8 Int16 Int32 Int64 Uint8 Uint16 Uint32 Uint64 Float32 Float64)
3030

3131
SET(layout_enums Right)
3232
SET(memory_trait_enums Managed)

0 commit comments

Comments
 (0)