google / google/xls

Add array slice optimizations

Open
#453 0 comments 0 reactions 0 assignees View on GitHub
good first issue optimizer
Dominant language
C++
Stars
1.9k
Forks
283
Avg merge
2d 10h
Merged PRs (30d)
135

Description

Currently we don't have any array slice optimizations. Here are a couple which might be useful:

1. ArraySlice of an Array operation where the ArraySlice has a literal start. In this case you should be able to replace the ArraySlice with an Array operation which gathers the statically-known element of the slice from the original Array operation's operands.
2. ArraySlice of an ArraySlice in some instances might be replaceable with a single ArraySlice.

A (potentially crazy) idea might be to decompose ArraySlice into a bunch of ArrayIndex's followed by an Array operation to gather them up, We already have lots of optimizations for ArrayIndex which would then automatically kick in. This would avoid duplicating a lot of complicated index logic. And it doesn't fundamentally affect the scaling of XLS for big arrays because we already have to emit array operations as element-by-element in Verilog.

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.