1. Sep 15, 2022
  2. Sep 14, 2022
    • Peiming Liu's avatar
      [mlir][sparse] Make sparse compiler more admissible. · 55a1d50f
      Peiming Liu authored
      Previously, the iteration graph is computed without priority. This patch add a heuristic when computing the iteration graph by starting with Reduction iterator when doing topo sort, which makes Reduction iterators (likely) appear as late in the sorted array as possible.
      
      The current sparse compiler also failed to compile the newly added case.
      
      Reviewed By: aartbik
      
      Differential Revision: https://reviews.llvm.org/D133738
      55a1d50f
    • Nicolas Vasilache's avatar
      Revert "[mlir][scf][Transform] Refactor transform.fuse_into_containing_op so... · e479aecd
      Nicolas Vasilache authored
      Revert "[mlir][scf][Transform] Refactor transform.fuse_into_containing_op so it is iterative and supports output fusion."
      
      This reverts commit 54a5f606 which is a WIP that was pushed by mistake.
      e479aecd
    • Nicolas Vasilache's avatar
      [mlir][scf][Transform] Refactor transform.fuse_into_containing_op so it is... · 54a5f606
      Nicolas Vasilache authored
      [mlir][scf][Transform] Refactor transform.fuse_into_containing_op so it is iterative and supports output fusion.
      
      This revision revisits the implementation of `transform.fuse_into_containing_op` so that it iterates on
      producers one use at a time.
      
      Support is added to fuse a producer through a foreach_thread shared tensor argument, in which case we
      tile and fuse the op inside the containing op and update the shared tensor argument to the unique destination operand.
      If one cannot find such a unique destination operand the transform fails.
      54a5f606
    • Nicolas Vasilache's avatar
      [mlir][Linalg] Add return type filter to the transform dialect · 593c14d4
      Nicolas Vasilache authored
      This allows matching ops by additionally providing an idiomatic spec for a unique return type.
      
      Differential Revision: https://reviews.llvm.org/D133862
      593c14d4
    • Alexey Bataev's avatar
      [SLP][NFC]Extract getLastInstructionInBundle function for better · d647312e
      Alexey Bataev authored
      dependence  checking, NFC.
      
      Part of D110978
      d647312e
    • Jeff Niu's avatar
      [MLIR][math] Use approximate matches for folded ops · 3108249d
      Jeff Niu authored
      LibM implementations differ, so the folders can have different results
      on different platforms. For instance, the `cos` folder was failing on M1
      mac. I chose to match the constant floats to 2(.5) significant digits.
      
      Reviewed By: jacquesguan
      
      Differential Revision: https://reviews.llvm.org/D133797
      3108249d
    • Groverkss's avatar
      [MLIR][Presburger] Add hermite normal form computation to Matrix · b696e25a
      Groverkss authored
      This patch adds hermite normal form computation to Matrix. Part of this algorithm
      lived in LinearTransform, being used for compuing column echelon form. This
      patch moves the implementation to Matrix::hermiteNormalForm and generalises it
      to compute the hermite normal form.
      
      Reviewed By: arjunp
      
      Differential Revision: https://reviews.llvm.org/D133510
      b696e25a
    • Mats Petersson's avatar
      [flang][driver]Fix broken PowerPC tests · 9067de2a
      Mats Petersson authored
      Tests don't work on PPC since `return` instruciton is't called `ret` (apparently)
      
      Reviewed By: awarzynski
      
      Differential Revision: https://reviews.llvm.org/D133859
      9067de2a
    • Zain Jaffal's avatar
      [InstCombine] Optimize multiplication where both operands are negated · 8253f7e2
      Zain Jaffal authored
      Handle the case where both operands are negated in matrix multiplication
      
      Reviewed By: fhahn
      
      Differential Revision: https://reviews.llvm.org/D133695
      8253f7e2
    • Haojian Wu's avatar
    • David Spickett's avatar
      [LLVM][AArch64] Don't warn about clobbering X16 when Speculative Load Hardening is used · 3acaf040
      David Spickett authored
      SLH will fall back to a different technique if X16 is being used,
      so there is no need to warn for inline asm use. Only prevent other codegen
      from using it.
      
      Reviewed By: kristof.beyls
      
      Differential Revision: https://reviews.llvm.org/D133766
      3acaf040
    • Joseph Huber's avatar
      [OpenMP] Remove unused function after removing simplified interface · bae1a2cf
      Joseph Huber authored
      Summary:
      A previous patch removed the user of this function but did not remove
      the function causing unused function warnings. Remove it.
      bae1a2cf
    • John Ericson's avatar
      [CMake] Avoid `LLVM_BINARY_DIR` when other more specific variable are better-suited, part 1 · 154db06c
      John Ericson authored
      A simple sed doing these substitutions:
      
      - `${LLVM_BINARY_DIR}/\$\{CMAKE_CFG_INTDIR}/lib(${LLVM_LIBDIR_SUFFIX})?\>` -> `${LLVM_LIBRARY_DIR}`
      - `${LLVM_BINARY_DIR}/\$\{CMAKE_CFG_INTDIR}/bin\>` -> `${LLVM_TOOLS_BINARY_DIR}`
      
      where `\>` means "word boundary".
      
      The only manual modifications were reverting changes in
      
      - `compiler-rt/cmake/Modules/CompilerRTUtils.cmake`
      
      because these were "entry points" where we wanted to tread carefully not not introduce a "loop" which would end with an undefined variable being expanded to nothing.
      
      There are many more occurrences without `CMAKE_CFG_INTDIR`, but those are left for D132316 as they have proved somewhat tricky to fix.
      
      This hopefully increases readability overall, and also decreases the usages of `LLVM_LIBDIR_SUFFIX`, preparing us for D130586.
      
      Reviewed By: sebastian-ne
      
      Differential Revision: https://reviews.llvm.org/D133828
      154db06c
    • Arjun P's avatar
      [MLIR][Presburger] use arbitrary-precision arithmetic with MPInt instead of int64_t · 6d6f6c4d
      Arjun P authored
      Only the main Presburger library under the Presburger directory has been switched to use arbitrary precision. Users have been changed to just cast returned values back to int64_t or to use newly added convenience functions that perform the same cast internally.
      
      The performance impact of this has been tested by checking test runtimes after copy-pasting 100 copies of each function. Affine/simplify-structures.mlir goes from 0.76s to 0.80s after this patch. Its performance sees no regression compared to its original performance at commit 18a06d4f before a series of patches that I landed to offset the performance overhead of switching to arbitrary precision.
      
      Affine/canonicalize.mlir and SCF/canonicalize.mlir show no noticable difference, staying at 2.02s and about 2.35s respectively.
      
      Also, for Affine and SCF tests as a whole (no copy-pasting), the runtime remains about 0.09s on average before and after.
      
      Reviewed By: bondhugula
      
      Differential Revision: https://reviews.llvm.org/D129510
      6d6f6c4d
    • Balazs Benics's avatar
      [analyzer] Initialize ShouldEmitErrorsOnInvalidConfigValue analyzer option · b8e1da05
      Balazs Benics authored
      Downstream users who doesn't make use of the clang cc1 frontend for
      commandline argument parsing, won't benefit from the Marshalling
      provided default initialization of the AnalyzerOptions entries. More
      about this later.
      Those analyzer option fields, as they are bitfields, cannot be default
      initialized at the declaration (prior c++20), hence they are initialized
      at the constructor.
      The only problem is that `ShouldEmitErrorsOnInvalidConfigValue` was
      forgotten.
      
      In this patch I'm proposing to initialize that field with the rest.
      
      Note that this value is read by
      `CheckerRegistry.cpp:insertAndValidate()`.
      The analyzer options are initialized by the marshalling at
      `CompilerInvocation.cpp:GenerateAnalyzerArgs()` by the expansion of the
      `ANALYZER_OPTION_WITH_MARSHALLING` xmacro to the appropriate default
      value regardless of the constructor initialized list which I'm touching.
      Due to that this only affects users using CSA as a library, without
      serious effort, I believe we cannot test this.
      
      Reviewed By: martong
      
      Differential Revision: https://reviews.llvm.org/D133851
      b8e1da05
    • Joseph Huber's avatar
      [OpenMP][AMDGPU] Link bitcode ROCm device libraries per-TU · 194ec844
      Joseph Huber authored
      Previously, we linked in the ROCm device libraries which provide math
      and other utility functions late. This is not stricly correct as this
      library contains several flags that are only set per-TU, such as fast
      math or denormalization. This patch changes this to pass the bitcode
      libraries per-TU using the same method we use for the CUDA libraries.
      This has the advantage that we correctly propagate attributes making
      this implementation more correct. Additionally, many annoying unused
      functions were not being fully removed during LTO. This lead to
      erroneous warning messages and remarks on unused functions.
      
      I am not sure if not finding these libraries should be a hard error. let
      me know if it should be demoted to a warning saying that some device
      utilities will not work without them.
      
      Reviewed By: JonChesterfield
      
      Differential Revision: https://reviews.llvm.org/D133726
      194ec844
    • Joseph Huber's avatar
      [OpenMP] Remove simplified device runtime handling · 2d26ecb1
      Joseph Huber authored
      The old device runtime had a "simplified" version that prevented many of
      the runtime features from being initialized. The old device runtime was
      deleted in LLVM 14 and is no longer in use. Selectively deactivating
      features is now done using specific flags rather than the old technique.
      This patch simply removes the extra logic required for handling the old
      simple runtime scheme.
      
      Reviewed By: jdoerfert
      
      Differential Revision: https://reviews.llvm.org/D133802
      2d26ecb1
    • Nikita Popov's avatar
      [AA] Tracking per-location ModRef info in FunctionModRefBehavior (NFCI) · b1cd393f
      Nikita Popov authored
      Currently, FunctionModRefBehavior tracks whether the function reads
      or writes memory (ModRefInfo) and which locations it can access
      (argmem, inaccessiblemem and other). This patch changes it to track
      ModRef information per-location instead.
      
      To give two examples of why this is useful:
      
      * D117095 highlights a weakness of ModRef modelling in the presence
        of operand bundles. For a memcpy call with deopt operand bundle,
        we want to say that it can read any memory, but only write argument
        memory. This would allow them to be treated like any other calls.
        However, we currently can't express this and have to say that it
        can read or write any memory.
      * D127383 would ideally be modelled as a separate threadid location,
        where threadid Refs outside pre-split coroutines can be ignored
        (like other accesses to constant memory). The current representation
        does not allow modelling this precisely.
      
      The patch as implemented is intended to be NFC, but there are some
      obvious opportunities for improvements and simplification. To fully
      capitalize on this we would also want to change the way we represent
      memory attributes on functions, but that's a larger change, and I
      think it makes sense to separate out the FunctionModRefBehavior
      refactoring.
      
      Differential Revision: https://reviews.llvm.org/D130896
      b1cd393f
    • Florian Hahn's avatar
      [ConstraintElimination] Clear new indices directly in getConstraint(NFC) · efd3ec47
      Florian Hahn authored
      Instead of checking if any of the new indices has a non-zero coefficient
      before using the constraint, do this directly when constructing the
      constraint.
      efd3ec47