google / google/xls

Priority Selects on Arrays

Open
#1,448 0 comments 0 reactions 0 assignees View on GitHub
codegen
Dominant language
C++
Stars
1.9k
Forks
283
Avg merge
2d 10h
Merged PRs (30d)
135

Description

Currently, priority selects do not codegen for arrays. I have a fix incoming, but the fix has an issue: priority selects on different array types with the same element type do not dedup. For example, priority selects on `bits[16][4]` and `bits[16][2]` will both do elementwise priority selects in codegen, e.g.:

```
a[0] = priority_sel_function0(sel, x[0], y[0]);
a[1] = ...
b[0] = priority_sel_function1(sel, g[0], h[0]);
...
```

The element types are the same, so they could use the same function- but they don't.

The reason is that the function name (which is used to dedup) is based on the op. Arrays are weird because they need to be done elementwise. Array priority selects should probably get names based only on their elements, but it's a bit ugly to make that happen.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.