Skip to content

Commit ad02f84

Browse files
Merge pull request #1168 from IntelPython/fix-for-gh-1167
Fix for gh 1167
2 parents 297269b + d5faeec commit ad02f84

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

dpctl/tensor/libtensor/include/utils/type_dispatch.hpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,17 @@ struct usm_ndarray_types
223223
throw_unrecognized_typenum_error(typenum);
224224
}
225225
}
226+
else if (typenum == api.UAR_LONGLONG_ || typenum == api.UAR_ULONGLONG_)
227+
{
228+
switch (sizeof(long long)) {
229+
case sizeof(std::int64_t):
230+
return ((typenum == api.UAR_LONGLONG_)
231+
? static_cast<int>(typenum_t::INT64)
232+
: static_cast<int>(typenum_t::UINT64));
233+
default:
234+
throw_unrecognized_typenum_error(typenum);
235+
}
236+
}
226237
else {
227238
throw_unrecognized_typenum_error(typenum);
228239
}
@@ -234,7 +245,7 @@ struct usm_ndarray_types
234245
private:
235246
void throw_unrecognized_typenum_error(int typenum) const
236247
{
237-
throw std::runtime_error("Unrecogized typenum " +
248+
throw std::runtime_error("Unrecognized typenum " +
238249
std::to_string(typenum) + " encountered.");
239250
}
240251
};

dpctl/tests/test_tensor_asarray.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,3 +355,11 @@ def test_asarray_seq_of_arrays_on_different_queues():
355355

356356
with pytest.raises(dpctl.utils.ExecutionPlacementError):
357357
dpt.asarray([m, [w, py_seq]])
358+
359+
360+
def test_ulonglong_gh_1167():
361+
get_queue_or_skip()
362+
x = dpt.asarray(9223372036854775807, dtype="u8")
363+
assert x.dtype == dpt.uint64
364+
x = dpt.asarray(9223372036854775808, dtype="u8")
365+
assert x.dtype == dpt.uint64

0 commit comments

Comments
 (0)