1. Apr 13, 2021
    • Aart Bik's avatar
      [mlir] introduce "encoding" attribute to tensor type · 7714b405
      Aart Bik authored
      This CL introduces a generic attribute (called "encoding") on tensors.
      The attribute currently does not carry any concrete information, but the type
      system already correctly determines that tensor<8xi1,123> != tensor<8xi1,321>.
      The attribute will be given meaning through an interface in subsequent CLs.
      
      See ongoing discussion on discourse:
      
      [RFC] Introduce a sparse tensor type to core MLIR
      https://llvm.discourse.group/t/rfc-introduce-a-sparse-tensor-type-to-core-mlir/2944
      
      A sparse tensor will look something like this:
      
      ```
      // named alias with all properties we hold dear:
      #CSR = {
        // individual named attributes
      }
      
      // actual sparse tensor type:
      tensor<?x?xf64, #CSR>
      ```
      
      I see the following rough 5 step plan going forward:
      
      (1) introduce this format attribute in this CL, currently still empty
      (2) introduce attribute interface that gives it "meaning", focused on sparse in first phase
      (3) rewrite sparse compiler to use new type, remove linalg interface and "glue"
      (4) teach passes to deal with new attribute, by rejecting/asserting on non-empty attribute as simplest solution, or doing meaningful rewrite in the longer run
      (5) add FE support, document, test, publicize new features, extend "format" meaning to other domains if useful
      
      Reviewed By: stellaraccident, bondhugula
      
      Differential Revision: https://reviews.llvm.org/D99548
      7714b405
    • Emilio Cota's avatar
      [mlir] Rename AVX512 dialect to X86Vector · 8508a63b
      Emilio Cota authored
      We will soon be adding non-AVX512 operations to MLIR, such as AVX's rsqrt. In https://reviews.llvm.org/D99818 several possibilities were discussed, namely to (1) add non-AVX512 ops to the AVX512 dialect, (2) add more dialects (e.g. AVX dialect for AVX rsqrt), and (3) expand the scope of the AVX512 to include these SIMD x86 ops, thereby renaming the dialect to something more accurate such as X86Vector.
      
      Consensus was reached on option (3), which this patch implements.
      
      Reviewed By: aartbik, ftynse, nicolasvasilache
      
      Differential Revision: https://reviews.llvm.org/D100119
      8508a63b
    • MaheshRavishankar's avatar
      [mlir][Linalg] Disable const -> linalg.generic when fused op is illegal. · b0fc712b
      MaheshRavishankar authored
      Fusing a constant with a linalg.generic operation can result in the
      fused operation being illegal since the loop bound computation
      fails. Avoid such fusions.
      
      Differential Revision: https://reviews.llvm.org/D100272
      b0fc712b
    • Mitch Phillips's avatar
      [asan] Replaceable new/delete is unsupported in Windows. · 15689f3a
      Mitch Phillips authored
      Mark the test as unsupported to bring the bot online. Could probably be
      permanently fixed by using one of the workarounds already present in
      compiler-rt.
      15689f3a
    • Alexander Kornienko's avatar
      Fix nits. · 8883cb3e
      Alexander Kornienko authored
      8883cb3e
    • Jens Massberg's avatar
      [clang-tidy] Add option to ignore macros in readability-function-cognitive-complexity check. · 8a944d82
      Jens Massberg authored
      (this was originally part of https://reviews.llvm.org/D96281 and has been split off into its own patch)
      
      If a macro is used within a function, the code inside the macro
      doesn't make the code less readable. Instead, for a reader a macro is
      more like a function that is called. Thus the code inside a macro
      shouldn't increase the complexity of the function in which it is called.
      Thus the flag 'IgnoreMacros' is added. If set to 'true' code inside
      macros isn't considered during analysis.
      
      This isn't perfect, as now the code of a macro isn't considered at all,
      even if it has a high cognitive complexity itself. It might be better if
      a macro is considered in the analysis like a function and gets its own
      cognitive complexity. Implementing such an analysis seems to be very
      complex (if possible at all with the given AST), so we give the user the
      option to either ignore macros completely or to let the expanded code
      count to the calling function's complexity.
      
      See the code example from vgeof (originally added as note in https://reviews.llvm.org/D96281)
      
         bool doStuff(myClass* objectPtr){
               if(objectPtr == nullptr){
                   LOG_WARNING("empty object");
                   return false;
               }
               if(objectPtr->getAttribute() == nullptr){
                   LOG_WARNING("empty object");
                   return false;
               }
               use(objectPtr->getAttribute());
           }
      
      The LOG_WARNING macro itself might have a high complexity, but it do not make the
      the function more complex to understand like e.g. a 'printf'.
      
      By default 'IgnoreMacros' is set to 'false', which is the original behavior of the check.
      
      Reviewed By: lebedev.ri, alexfh
      
      Differential Revision: https://reviews.llvm.org/D98070
      8a944d82
    • Tim Keith's avatar
      [flang] Fix narrowing warning on macos · 50386fe1
      Tim Keith authored
      With clang 11 on macos we were getting this warning:
      ```
      flang/runtime/random.cpp:61:30: error: non-constant-expression cannot be narrowed from type 'unsigned long long' to 'runtime::GeneratedWord' (aka 'unsigned int') in initializer list [-Wc++11-narrowing]
                GeneratedWord word{(generator() - generator.min()) & rangeMask};
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      flang/runtime/random.cpp:99:5: note: in instantiation of function template specialization 'runtime::Generate<double, 53>' requested here
          Generate<CppTypeFor<TypeCategory::Real, 8>, 53>(harvest);
          ^
      ```
      
      Changing the type of `rangeMask` fixes it.
      
      Differential Revision: https://reviews.llvm.org/D100320
      50386fe1
    • Artem Belevich's avatar
      38cf112a
    • Yuanfang Chen's avatar
      [InstCombine] when calling conventions are compatible, don't convert the call to undef idiom · f4d682d6
      Yuanfang Chen authored
      D24453 enabled libcalls simplication for ARM PCS. This may cause
      caller/callee calling conventions mismatch in some situations such as
      LTO. This patch makes instcombine aware that the compatible calling
      conventions differences are benign (not emitting undef idom).
      
      Differential Revision: https://reviews.llvm.org/D99773
      f4d682d6
    • Arthur O'Dwyer's avatar
      [libc++] Implement D2351R0 "Mark all library static cast wrappers as [[nodiscard]]" · 4b7bad9e
      Arthur O'Dwyer authored
      These [[nodiscard]] annotations are added as a conforming extension;
      it's unclear whether the paper will actually be adopted and make them
      mandatory, but they do seem like good ideas regardless.
      
      https://isocpp.org/files/papers/D2351R0.pdf
      
      This patch implements the paper's effect on:
      - std::to_integer, std::to_underlying
      - std::forward, std::move, std::move_if_noexcept
      - std::as_const
      - std::identity
      
      The paper also affects (but libc++ does not yet have an implementation of):
      - std::bit_cast
      
      Differential Revision: https://reviews.llvm.org/D99895
      4b7bad9e
    • Arthur O'Dwyer's avatar
      [libc++] [test] Detect an improperly noexcept'ed __decay_copy. · d7eb797e
      Arthur O'Dwyer authored
      `__decay_copy` is used by `std::thread`'s constructor to copy its arguments
      into the new thread. If `__decay_copy` claims to be noexcept, but then
      copying the argument does actually throw, we'd call std::terminate instead
      of passing this test. (And I've verified that adding an unconditional `noexcept`
      to `__decay_copy` does indeed fail this test.)
      
      Differential Revision: https://reviews.llvm.org/D100277
      d7eb797e
    • Sanjay Patel's avatar
      [PassManager][PhaseOrdering] lower expects before running simplifyCFG · 330619a3
      Sanjay Patel authored
      If we run passes before lowering llvm.expect intrinsics to metadata,
      then those passes have no way to act on the hints provided by llvm.expect.
      SimplifyCFG is the known offender, and we made it smarter about profile
      metadata in D98898.
      
      In the motivating example from https://llvm.org/PR49336 , this means we
      were ignoring the recommended method for a programmer to tell the compiler
      that a compare+branch is expensive. This change appears to solve that case -
      the metadata survives to the backend, the compare order is as expected in IR,
      and the backend does not do anything to reverse it.
      
      We make the same change to the old pass manager to keep things synchronized.
      
      Differential Revision: https://reviews.llvm.org/D100213
      330619a3
    • David Green's avatar
      [ARM] Add a number of intrinsics for MVE lane interleaving · dd31b2c6
      David Green authored
      Add a number of intrinsics which natively lower to MVE operations to the
      lane interleaving pass, allowing it to efficiently interleave the lanes
      of chucks of operations containing these intrinsics.
      
      Differential Revision: https://reviews.llvm.org/D97293
      dd31b2c6
  2. Apr 12, 2021