cornell-zhang / heterocl

HeteroCL: A Multi-Paradigm Programming Infrastructure for Software-Defined Heterogeneous Computing
https://cornell-zhang.github.io/heterocl/
Apache License 2.0
322 stars 92 forks source link

Bitcast Operation Support #310

Closed zzzDavid closed 3 years ago

zzzDavid commented 3 years ago

This issue is to document bitcast operation which is not directly exposed to user.

Description

FlexCNN uses 512-bit bus to transport packed 32-bit raw bits, which is casted to 32-bit floating point data upon computation. In this case, we need support for bitcast operation.

Note

hcl.cast() is cast by value, meaning uint 0010 would be converted to 2.0f. Bitcast operation is available in HeteroCL but not directly exposed to user: check this example.

seanlatias commented 3 years ago

@zzzDavid I remember you implemented something? You can contribute if you'd like.

zzzDavid commented 3 years ago

Yes, I implemented a bitcast() API in python/heterocl/compute_api.py and corresponding tests.

It's in the heteroflow branch now:

https://github.com/zzzDavid/heterocl/blob/heteroflow/python/heterocl/compute_api.py#L971

seanlatias commented 3 years ago

Could you extract that part of the code and create a separate PR? Thanks.

zzzDavid commented 3 years ago

Sure, the new PR is: https://github.com/cornell-zhang/heterocl/pull/330