Skip to content

Commit ff81365

Browse files
committed
Adds test to triage AMD CPU top_k failure
1 parent be9f5ce commit ff81365

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

dpctl/tests/test_usm_ndarray_top_k.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,24 @@ def test_topk_1d_smallest(dtype, n):
9292
assert s.indices.shape == (k,)
9393
assert dpt.all(s.values == dpt.zeros(k, dtype=dtype))
9494
assert dpt.all(s.values == inp[s.indices])
95+
96+
97+
# triage failing top k radix implementation on CPU
98+
# replicates from Python behavior of radix sort topk implementation
99+
def test_topk_largest_1d_radix_i1_255():
100+
get_queue_or_skip()
101+
n = 255
102+
dt = "i1"
103+
104+
o = dpt.ones(n, dtype=dt)
105+
z = dpt.zeros(n, dtype=dt)
106+
zo = dpt.concat((o, z))
107+
inp = dpt.roll(zo, 734)
108+
k = 5
109+
110+
sorted = dpt.copy(dpt.sort(inp, descending=True, kind="radixsort")[:k])
111+
argsorted = dpt.copy(
112+
dpt.argsort(inp, descending=True, kind="radixsort")[:k]
113+
)
114+
assert dpt.all(sorted == dpt.ones(k, dtype=dt))
115+
assert dpt.all(sorted == inp[argsorted])

0 commit comments

Comments
 (0)