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

[flang][Lower] Always generate namelist group locally #109303

Closed
wants to merge 1 commit into from

Commits on Sep 19, 2024

  1. [flang][Lower] Always generate namelist group locally

    Namelists are allowed inside of OpenMP reduction regions. Those regions
    map the symbol for the reduction variable to a thread-local reduction
    variable, but this mapping is escaped if the namelist is generated as a
    global variable because the global variable will refer the original
    symbol mapping. See llvm#101907 for a code example.
    
    We can't do this only when inside of an OpenMP region because the IO
    function might be inside of a subroutine/function which is called from
    inside the OpenMP region.
    
    There is also no restriction against namelist variables for the `reduce`
    clause of `do concurrent` in F23. We currently don't seem to implement
    initial values for reduction variables (F23 table 11.1), but when we do
    I expect this would see the same issue as OpenMP.
    
    A disadvantage of doing this is that the namelist has to be constructed
    in place every time. If for some reason this is not hoisted out of hot
    loops (e.g. it is inside of another subroutine called in the loop body)
    this might have some performance impact (although I suspect this won't
    be huge compared to the context switches required for I/O).
    
    Fixes llvm#101907
    tblah committed Sep 19, 2024
    Configuration menu
    Copy the full SHA
    332512d View commit details
    Browse the repository at this point in the history