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][OpenMP][MLIR] Fix common block mapping for regular and declare target link #91829

Merged
merged 6 commits into from
Jun 25, 2024

Commits on Jun 25, 2024

  1. [Flang][OpenMP][MLIR] Fix common block mapping for regular and declar…

    …e target link
    
    This PR attempts to fix common block mapping for regular mapping of these types as
    well as when they have been marked as "declare target link". This PR should allow correct
    mapping of both the members of a common block and the full common block via its
    block symbol.
    
    The main changes were some adjustments to the Fortran OpenMP lowering to HLFIR/FIR,
    the lowering of the LLVM+OpenMP dialect to LLVM-IR and adjustments to the way the
    we handle target kernel map argument rebinding inside of the OMPIRBuilder.
    
    For the Fortran OpenMP lowering were two changes, one to prevent the implicit capture
    of common block members when the common block symbol itself has been marked and
    the other creates intermediate member access inside of the target region to be used
    in-place of those external to the target region, this prevents external usages breaking the
    IsolatedFromAbove pact.
    
    In the latter case, there was an adjustment to the size calculation for types to better
    handle cases where we pass an array as the type of a map (as opposed to the
    bounds and the type of the element), which occurs in the case of common blocks. There
    is also some adjustment to how handleDeclareTargetMapVar handles renaming of declare
    target symbols in the module to the reference pointer, now it will only apply to those
    within the kernel that is currently being generated and we also perform a modification
    to replace constants with instructions as necessary as we cannot replace these with our
    reference pointer (non-constant and constants do not mix nicely).
    
    In the case of the OpenMPIRBuilder some changes were mde to defer global symbol
    rebinding to kernel arguments until all other arguments have been rebound. This
    makes sure we do not replace uses that may refer to the global (e.g. a GEP) but are
    themselves actually a separate argument that needs bound.
    
    Currently "declare target to" still needs some work, but this may be the case for all
    types in conjunction with "declare target to" at the moment.
    agozillon committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    81b65f8 View commit details
    Browse the repository at this point in the history
  2. [OpenMP][OMPIRBuilder][MLIR] Rebase and replace old constant -> instr…

    …uction transformation code with newer variation from recently landed PR
    agozillon committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    219604a View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    8920362 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    46ff40f View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    0f9f10b View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    892b725 View commit details
    Browse the repository at this point in the history