google-research / dex-lang

Research language for array processing in the Haskell/ML family
BSD 3-Clause "New" or "Revised" License
1.58k stars 106 forks source link

Add a vectorization rule for table indexing. #1298

Closed axch closed 1 year ago

axch commented 1 year ago

This necessitates a new instruction in SimpIR to represent the vector load.

Also allow loops being vectorized to refer to top-level data by adding a VRename constructor to VSubstValC.

Result is that Dex can vectorize simple loops that refer to (loop-invariant) arrays, such as in the added test.