File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff 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 ])
You can’t perform that action at this time.
0 commit comments