Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor
scatter
for list columns (#8255)
This PR refactors `scatter` for `LIST` type columns. Previously there were nested `for_each_n` when constructing child columns. The outer loop loops over the rows and the inner loops over the elements of each row. We can replace these loops with a single `transform` because we already have the offsets information of the column to construct. For each element, we first lookup the `unbound_list_view` it belongs to via binary searching the offset vector. Then the corresponding element to copy from can be retrieved by dereferencing bounded `list_view` with the proper intra index. Struct type refactor is different. Currently the implementation wraps every child in a lists column and dispatch to the list type specialization. This is fine, but the wrapping process now deep copies the list offsets and child column for dispatching. We can simplify it by just wrapping it with a view. Since `scatter.cuh` is included in many other files, separating scatter implementation detail can help reducing compilation time during refactoring the code. Most helper function is moved into `scatter_helper.cu`. Benchmarking code for scattering lists is added. Benchmark snapshot is below: ``` Benchmark Time CPU Time Old Time New CPU Old CPU New ----------------------------------------------------------------------------------------------------------------------------------------------------------- ScatterLists/double_type_colesce_o/1024/64/manual_time -0.1073 -0.0926 110648 98781 129731 117724 ScatterLists/double_type_colesce_o/4096/64/manual_time -0.1177 -0.1015 113393 100045 132412 118971 ScatterLists/double_type_colesce_o/32768/64/manual_time -0.3785 -0.3391 167288 103962 185599 122663 ScatterLists/double_type_colesce_o/262144/64/manual_time -0.3175 -0.2834 171123 116785 188191 134865 ScatterLists/double_type_colesce_o/2097152/64/manual_time -0.2581 -0.2426 270225 200472 290363 219934 ScatterLists/double_type_colesce_o/16777216/64/manual_time -0.8464 -0.8438 6205089 953139 6224867 972548 ScatterLists/double_type_colesce_o/33554432/64/manual_time -0.8437 -0.8423 12087712 1889483 12107066 1909170 ScatterLists/double_type_colesce_o/1024/512/manual_time -0.3487 -0.3111 150169 97810 169463 116736 ScatterLists/double_type_colesce_o/4096/512/manual_time -0.3499 -0.3116 151978 98794 170918 117661 ScatterLists/double_type_colesce_o/32768/512/manual_time -0.4337 -0.3901 196663 111364 215048 131162 ScatterLists/double_type_colesce_o/262144/512/manual_time -0.8083 -0.7844 590691 113251 607891 131089 ScatterLists/double_type_colesce_o/2097152/512/manual_time -0.7018 -0.6815 641149 191192 661107 210559 ScatterLists/double_type_colesce_o/16777216/512/manual_time -0.6893 -0.6842 2581320 802057 2601542 821602 ScatterLists/double_type_colesce_o/33554432/512/manual_time -0.8277 -0.8259 9150244 1576769 9169846 1596137 ScatterLists/double_type_colesce_o/1024/2048/manual_time -0.6584 -0.6178 284006 97008 303179 115869 ScatterLists/double_type_colesce_o/4096/2048/manual_time -0.6648 -0.6250 289209 96934 308413 115647 ScatterLists/double_type_colesce_o/32768/2048/manual_time -0.7433 -0.7089 386115 99120 404566 117774 ScatterLists/double_type_colesce_o/262144/2048/manual_time -0.8214 -0.7984 611876 109305 629110 126803 ScatterLists/double_type_colesce_o/2097152/2048/manual_time -0.9107 -0.9024 2098263 187417 2118254 206798 ScatterLists/double_type_colesce_o/16777216/2048/manual_time -0.6869 -0.6816 2527109 791306 2546819 810805 ScatterLists/double_type_colesce_o/33554432/2048/manual_time -0.5102 -0.5070 3018595 1478458 3038315 1497923 ``` Authors: - Michael Wang (https://github.com/isVoid) Approvers: - Robert Maynard (https://github.com/robertmaynard) - AJ Schmidt (https://github.com/ajschmidt8) - David Wendt (https://github.com/davidwendt) - MithunR (https://github.com/mythrocks) URL: #8255
- Loading branch information