google / google/xls

[enhancement] Extended FixedPoint library for quantized ML models development

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

Description

### What's hard to do? (limit 100 words)

I am using DXLS to write a backend for another tool that compiles ML models directly to HLS code. FixedPoint types are a hard requirement to deploy quantized models. The current library is missing functionality (e.g., fmas, dot products), while also having a resource overhead due to the reason in [Issue1848](https://github.com/google/xls/issues/1848).

### Current best alternative workaround (limit 100 words)

Currently, I am working on a copied version of the original fixed_point.x standard file where I add all the required functionality. I am considering rewriting all core functions without the `struct` to avoid the overhead inquired by the current type system.
e.g.,
```C
fn dot_prod
// unsigned exp DOT PROD
(x: FixedPoint[VEC_SZ],
y: FixedPoint[VEC_SZ])
-> FixedPoint {

for (i, acc): (u32, FixedPoint) in u32:0..VEC_SZ {
fmadd_already_widened(x[i], y[i], acc)
}(fixed_point::make_fixed_point(sN[NB_DOT_PROD]:0))
}
```

### Your view of the "best case XLS enhancement" (limit 100 words)

TI2 to unblock [Issue1848](https://github.com/google/xls/issues/1848) and contribute by providing the identified missing functionality required to deploy quantized models.

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.