-
Notifications
You must be signed in to change notification settings - Fork 68
fix: hierarchical dataflow simulator deadlock and HLS codegen (#561, #565) #577
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
base: main
Are you sure you want to change the base?
Changes from all commits
8a4337f
8f0ae96
f01ee05
816edd5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2211,10 +2211,20 @@ def build_FunctionDef(ctx: ASTContext, node: ast.FunctionDef): | |
| args_kw = get_kwarg_value(decorator.keywords, "args") | ||
| if args_kw is not None: | ||
| args = build_stmts(ctx, args_kw) | ||
| arg_values = [ | ||
| ASTTransformer.get_mlir_op_result(ctx, arg) | ||
| for arg in args | ||
| ] | ||
| arg_values = [] | ||
| for arg in args: | ||
| res = ASTTransformer.get_mlir_op_result( | ||
| ctx, arg | ||
| ) | ||
| # If it's a 0D memref (scalar), load it to get the value | ||
| if ( | ||
| isinstance(res.type, MemRefType) | ||
| and len(res.type.shape) == 0 | ||
| ): | ||
| op_ = ASTTransformer.build_scalar(ctx, arg) | ||
| arg_values.append(op_.result) | ||
|
Comment on lines
+2219
to
+2225
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this would pass the scalar argument by value. |
||
| else: | ||
| arg_values.append(res) | ||
| else: | ||
| arg_values = [] | ||
| # Insert calls | ||
|
|
@@ -2729,13 +2739,22 @@ def build_Call(ctx: ASTContext, node: ast.Call, out_buffer: OpView = None): | |
| new_ctx.func_suffix = inst_suffix | ||
|
|
||
| func_op = ASTTransformer.build_FunctionDef(new_ctx, func_def) | ||
| func_op.attributes["dataflow"] = UnitAttr.get() | ||
| if ctx.top_func is not None: | ||
| func_op.operation.move_before(ctx.top_func) | ||
|
Comment on lines
+2743
to
+2744
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this is also added to fix foward reference. Forward reference is valid in mlir but invalide in HLS backend. We'd better fix the issue in HLS backend codegen. |
||
|
|
||
| # Now insert the call | ||
| # Parse arguments | ||
| new_args = build_stmts(ctx, node.args) | ||
| arg_values = [ | ||
| ASTTransformer.get_mlir_op_result(ctx, arg) for arg in new_args | ||
| ] | ||
| arg_values = [] | ||
| for arg in new_args: | ||
| res = ASTTransformer.get_mlir_op_result(ctx, arg) | ||
| if isinstance(res.type, MemRefType) and len(res.type.shape) == 0: | ||
| op_ = ASTTransformer.build_scalar(ctx, arg) | ||
| arg_values.append(op_.result) | ||
|
Comment on lines
+2752
to
+2754
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this would pass the scalar argument by value. Is this the intended behavior? |
||
| else: | ||
| arg_values.append(res) | ||
|
|
||
| call_op = func_d.CallOp( | ||
| [], | ||
| FlatSymbolRefAttr.get(func_def.name), | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does #557 still fail to fix the forward reference issue? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
always not
None?