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

printing hex value prints random values #156

Open
jcasas00 opened this issue Oct 11, 2022 · 2 comments
Open

printing hex value prints random values #156

jcasas00 opened this issue Oct 11, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@jcasas00
Copy link
Collaborator

    def kernel():
        stype = hcl.Struct({"x": hcl.UInt(8), "y": hcl.UInt(8)})
        xy = hcl.scalar(0x1234, "foo", dtype=stype).v
        hcl.print((xy.x, xy.y), "dec: %d %d\n")
        hcl.print((xy.x, xy.y), "hex: %x %x\n")

generates:

match 0: 52 18
match 0: 0 598f4740

The "hex" print actually prints random values (number changes every run).

@zzzDavid zzzDavid self-assigned this Oct 11, 2022
@zzzDavid zzzDavid added the enhancement New feature or request label Oct 11, 2022
@zzzDavid
Copy link
Collaborator

%x format string hasn't been supported in the LLVM backend, let me add that

@zzzDavid
Copy link
Collaborator

llvm.mlir.printf only support f64 input type. Currently we are casting integers to float first and use .0f as a replacement for %d. We should implement our own print utility function that supports %x and %X format string

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

No branches or pull requests

2 participants