-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[flang][hlfir] Alias analysis for host associated accesses. #65919
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
Conversation
This patch adds `host_assoc` attribute for operations that implement FortranVariableInterface (e.g. `hlfir.declare`). The attribute is used by the alias analysis to make better conclusions about memory overlap. For example, a dummy argument of an inner subroutine and a host's variable used inside the inner subroutine cannot refer to the same object (if the dummy argument does not satisify exceptions in F2018 15.5.2.13). This closes a performance gap between HLFIR optimization pipeline and FIR ArrayValueCopy for Polyhedron/nf.
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.
I would rather avoid the new state in the Bridge (if it can be avoided), otherwise this looks great to me, thanks!
flang/lib/Lower/HostAssociations.cpp
Outdated
converter.addHostAssocSymbol(&sym); | ||
if (converter.getLoweringOptions().getLowerToHighLevelFIR()) | ||
Fortran::lower::genDeclareSymbol(converter, symMap, sym, val); |
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.
Have you consider adding and passing a boolean flag to genDeclareSymbol instead of using a denseset state in the bridge?
Maybe this could be a fir::FortranVariableFlagsEnum extraFlags = fir::FortranVariableFlagsEnum::None
argument to be more generic.
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.
I just wanted to keep all the attributes computation in translateSymbolAttributes
, but I can achieve the same by threading the extra flags to it. I will do it. Thank you!
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.
Looks great, thanks for the update!
Thank you for the review, Jean! |
This patch adds `host_assoc` attribute for operations that implement FortranVariableInterface (e.g. `hlfir.declare`). The attribute is used by the alias analysis to make better conclusions about memory overlap. For example, a dummy argument of an inner subroutine and a host's variable used inside the inner subroutine cannot refer to the same object (if the dummy argument does not satisify exceptions in F2018 15.5.2.13). This closes a performance gap between HLFIR optimization pipeline and FIR ArrayValueCopy for Polyhedron/nf.
This patch adds `host_assoc` attribute for operations that implement FortranVariableInterface (e.g. `hlfir.declare`). The attribute is used by the alias analysis to make better conclusions about memory overlap. For example, a dummy argument of an inner subroutine and a host's variable used inside the inner subroutine cannot refer to the same object (if the dummy argument does not satisify exceptions in F2018 15.5.2.13). This closes a performance gap between HLFIR optimization pipeline and FIR ArrayValueCopy for Polyhedron/nf.
This patch adds `host_assoc` attribute for operations that implement FortranVariableInterface (e.g. `hlfir.declare`). The attribute is used by the alias analysis to make better conclusions about memory overlap. For example, a dummy argument of an inner subroutine and a host's variable used inside the inner subroutine cannot refer to the same object (if the dummy argument does not satisify exceptions in F2018 15.5.2.13). This closes a performance gap between HLFIR optimization pipeline and FIR ArrayValueCopy for Polyhedron/nf.
This patch adds
host_assoc
attribute for operations that implementFortranVariableInterface (e.g.
hlfir.declare
). The attribute is usedby the alias analysis to make better conclusions about memory overlap.
For example, a dummy argument of an inner subroutine and a host's
variable used inside the inner subroutine cannot refer to the same
object (if the dummy argument does not satisify exceptions in F2018 15.5.2.13).
This closes a performance gap between HLFIR optimization pipeline
and FIR ArrayValueCopy for Polyhedron/nf.