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

[f2dace/dev, fortran] Instead of using parfor everywhere, give every transforms their unique short names. #1887

Draft
wants to merge 1 commit into
base: f2dace/dev
Choose a base branch
from

Conversation

pratyai
Copy link
Collaborator

@pratyai pratyai commented Jan 20, 2025

Unsurprisingly, this "fix" brings out another two million bugs out of the woodwork. Surprisingly, this wasn't noticed earlier.

Before, the added variables had name collisions (possibly even type collisions), that passed the typical validation checks until one starts to really look at the built graphs.

@pratyai pratyai marked this pull request as ready for review January 20, 2025 23:25
@pratyai pratyai requested review from mcopik and acalotoiu January 20, 2025 23:25
@pratyai pratyai marked this pull request as draft January 20, 2025 23:28
@@ -2239,7 +2239,7 @@ def par_Decl_Range_Finder(node: ast_internal_classes.Array_Subscript_Node,
newbody.append(
ast_internal_classes.Decl_Stmt_Node(vardecl=[
ast_internal_classes.Symbol_Decl_Node(
name="tmp_parfor_" + str(count + len(rangepos) - 1), type="INTEGER", sizes=None, init=None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parDeclRangeFinder is called from many different transformations. Do you think this can still cause name collisions? if yes, then we can change it by passing a custom prefix from each transform

@@ -714,20 +714,20 @@ def visit_Execution_Part_Node(self, node: ast_internal_classes.Execution_Part_No
initrange = i[0]
finalrange = i[1]
init = ast_internal_classes.BinOp_Node(
lval=ast_internal_classes.Name_Node(name="tmp_parfor_" + str(self.count + range_index)),
lval=ast_internal_classes.Name_Node(name="tmp_lbrt_" + str(self.count + range_index)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here - this is a base used by many intrinsics. Two different intrinsic replacements can emit the same tmp_lbrt_0, for example.

If this is a problem for name collision, then I will change the implementation to pass a custom prefix from each intrinsic.

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

Successfully merging this pull request may close these issues.

2 participants