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

interface name changed after scalehls? #34

Open
eeriecl opened this issue Dec 14, 2021 · 5 comments
Open

interface name changed after scalehls? #34

eeriecl opened this issue Dec 14, 2021 · 5 comments
Labels
enhancement New feature or request

Comments

@eeriecl
Copy link

eeriecl commented Dec 14, 2021

image

The left is original code, and the port name C,A,B is translated to v0,v1,v2
what's the purpose?

@hanchenye
Copy link
Collaborator

For now, we don't have a mechanism to represent the "name" of C variables in the IR. One possible approach is retaining them as string attributes attached to function operations.

@eeriecl
Copy link
Author

eeriecl commented Dec 14, 2021

" retaining them as string attributes"
how-to? is there an example?

@hanchenye
Copy link
Collaborator

For example, see the following IR:

func @test_gemm(%arg0: f32 {hlscpp.var_name = "alpha"}, %arg1: f32 {hlscpp.var_name = "beta"}, %arg2: memref<32x32xf32> {hlscpp.var_name = "A"}, %arg3: memref<32x32xf32> {hlscpp.var_name = "B"}, %arg4: memref<32x32xf32> {hlscpp.var_name = "C"}) {
  affine.for %arg5 = 0 to 32 {
... ...
  }
  return
}

This feature requires at least two PRs:

  1. In mlir-clang during parsing the C program, store the variable name as an attribute attached to the defining operation of the variable.
  2. In emit-hlscpp, support to parse the "var_name" attribute and emit it as the name of an variable rather than a auto-generated name like v0, v1, v2, etc.

@Oxygen-Chu
Copy link

so complex for ordinary developer :- (
it will be hard for people to use it

@hanchenye
Copy link
Collaborator

@Oxygen-Chu MLIR itself is complex, but powerful 😄 Based on my understanding, the C/C++ emission is just for the integration with downstream tools, such as Vivado HLS. From the IR point of view, we have the "mlir::Value" structure to represent and manipulate variables in the program -- which can support any desired program transformation and analysis for us.

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

3 participants