google / google/xls

Add array slice update IR node

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

Description

For array types in the IR we the following ops:

* array_index : return individual element
* array_slice: return contiguous elements
* array_update : update individual element

But we don't have a way of updating contiguous elements of an array (ie, array_slice_update). This is a hole in our IR semantics.

Possible definition of new op:

```
result = array_update_slice(array, slice, indices=[idx_{0}, ... , idx_{N-1}], assumed_in_bounds=)
```
Where:

- `array`: array of at least N dimensions with element type T
- `slice`: array of type T[K]
- `index_{i}`: arbitrary bits types
- `result`: same type as `array`

Returns a copy of the input array with the K elements starting at the given indices replaced with the elements of `slice`. Elements of the slice to update which fall out of bounds of `array` are ignored.

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.