Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VHLS Codegen Overshift Issue #471

Open
wyanzhao opened this issue Aug 19, 2022 · 1 comment
Open

VHLS Codegen Overshift Issue #471

wyanzhao opened this issue Aug 19, 2022 · 1 comment

Comments

@wyanzhao
Copy link

Hi, I am writing the following heteroCL code, which can cause an overshift code. But there's no warning during the code generation . Is it possible to add overshift detections in the heteroCL.

import heterocl as hcl
import numpy

hcl.init()

def kernel(A, B):  
        hcl.update(B, lambda x: A[x] >> -9223372036854775808 )

A = hcl.placeholder((1,), "A", hcl.UInt(64))
B = hcl.placeholder((1,), "B", hcl.UInt(64))
s = hcl.create_schedule([A, B], kernel)

print(hcl.lower(s))

f = hcl.build(s, "vhls")
print(f)
void default_function(ap_uint<64> A[1], ap_uint<64> B[1]) {
  int _top;
  int update0;
  update0_x: for (int x = 0; x < 1; ++x) {
    B[x] = (A[x] >> -9223372036854775808);
  }
}

Above is the output VHLS code, which could have undefined behaviors during execution:

@hecmay
Copy link
Collaborator

hecmay commented Aug 29, 2022

@wyanzhao Thanks for the suggestion !
Sure. it will be very useful to add some extra legality checking on this. I will try to open a new PR for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants