1. May 29, 2024
  2. May 28, 2024
    • Matthias Gehre's avatar
      TosaToTensor: Support reshape on tensors of unsigned integer (#91734) · af22e274
      Matthias Gehre authored
      This adds 
      - `mlir::tosa::populateTosaToLinalgTypeConversion` which converts
      tensors of unsigned integers into tensors of signless integers
      - modifies the `tosa.reshape` lowering in TosaToTensor to use the type
      converter correctly
      
      I choose to implement the type converter in
      `mlir/Conversion/TosaToLinalg/TosaToLinalg.h` instead of
      `mlir/Conversion/TosaToTensor/TosaToTensor.h` because I need the same
      type converter in the TosaToLinalg lowerings (future PR).
      Alternatively, I could duplicate the type converter so it exists both in
      TosaToLinalg and TosaToTensor. Let me know if you prefer that.
      af22e274
    • Joseph Huber's avatar
      [Offload][Fix] Fix lazy initialization with multiple images · f284af48
      Joseph Huber authored
      Summary:
      There was a bug here where we would initialize the plugin multiple times
      when there were multiple images. Fix it by putting the `is_initliaized`
      check later.
      f284af48
    • Craig Topper's avatar
      [RISCV] Use mask undisturbed policy when silencing sNans for strict rounding ops. (#93356) · d490ce22
      Craig Topper authored
      The elements that aren't sNans need to get passed through this fadd
      instruction unchanged. With the agnostic mask policy they might be
      forced to all ones.
      d490ce22
    • Zequan Wu's avatar
      Reapply [lldb][DWARF] Delay struct/class/union definition DIE searching when... · 51dd4eaa
      Zequan Wu authored
       Reapply [lldb][DWARF] Delay struct/class/union definition DIE searching when parsing declaration DIEs. (#92328)
      
      This reapplies
      https://github.com/llvm/llvm-project/commit/9a7262c2601874e5aa64c5db19746770212d4b44
      (#90663) and added https://github.com/llvm/llvm-project/pull/91808 as a
      fix.
      
      It was causing tests on macos to fail because
      `SymbolFileDWARF::GetForwardDeclCompilerTypeToDIE` returned the map
      owned by this symol file. When there were two symbol files, two
      different maps were created for caching from compiler type to DIE even
      if they are for the same module. The solution is to do the same as
      `SymbolFileDWARF::GetUniqueDWARFASTTypeMap`: inquery
      SymbolFileDWARFDebugMap first to get the shared underlying SymbolFile so
      the map is shared among multiple SymbolFileDWARF.
      51dd4eaa
    • Krzysztof Parzyszek's avatar
      [Frontend][OpenMP] Rename some variables, NFC · 88902147
      Krzysztof Parzyszek authored
      Rename things in a couple of places to make the code a bit clearer.
      88902147
    • jeanPerier's avatar
      [flang] update fir.box_rank and fir.is_array codegen (#93541) · 26e0ce0b
      jeanPerier authored
      fir.box_rank codegen was invalid, it was assuming the rank field in the
      descriptor was an i32. This is not correct. Do not hard code the type,
      use the named position to find the type, and convert as needed in the
      patterns.
      26e0ce0b
    • stefankoncarevic's avatar
      [mlir][ROCDL] Update the LLVM data layout for ROCDL lowering. (#92127) · 94be8018
      stefankoncarevic authored
      This change updates the dataLayout string to ensure alignment with the
      latest LLVM TargetMachine configuration. The aim is to
      maintain consistency and prevent potential compilation issues related to
      memory address space handling.
      94be8018
    • Zequan Wu's avatar
      cde1ae4c
    • Ryan Holt's avatar
      [mlir][linalg] Add linalg.transpose constant folding (#92589) · 74ed79f7
      Ryan Holt authored
      There was existing support for constant folding a `linalg.generic` that
      was actually a transpose. This commit adds support for the named op,
      `linalg.transpose`, as well by making use of the `LinalgOp` interface.
      74ed79f7
    • Kazu Hirata's avatar
      [memprof] Remove const from the return type of toMemProfRecord (#93415) · d2a103e6
      Kazu Hirata authored
      "const" being removed in this patch prevents the move semantics from
      being used in:
      
        AI.CallStack = Callback(IndexedAI.CSId);
      
      With this patch on an indexed MemProf Version 2 profile, the cycle
      count and instruction count go down by 13.3% and 26.3%, respectively,
      with "llvm-profdata show" modified to deserialize all MemProfRecords.
      d2a103e6
    • Daniil Fukalov's avatar
      [IR] Fix ignoring `non-global-value-max-name-size` in... · 3864bfd2
      Daniil Fukalov authored
      [IR] Fix ignoring `non-global-value-max-name-size` in `ValueSymbolTable::makeUniqueName()`. (#89057)
      
      E.g. during inlining new symbol name can be duplicated and then
      `ValueSymbolTable::makeUniqueName()` will add unique suffix, exceeding
      the `non-global-value-max-name-size` restriction.
      
      Also fixed `unsigned` type of the option to `int` since `ValueSymbolTable`'
      constructor can use `-1` value that means unrestricted name size.
      3864bfd2
    • Sander de Smalen's avatar
      46a30dfd
    • LLVM GN Syncbot's avatar
      [gn build] Port 23e1ed65 · 57790db0
      LLVM GN Syncbot authored
      57790db0
    • cor3ntin's avatar
      [Clang] allow `` `@$ `` in raw string delimiters in C++26 (#93216) · 2ace7bdc
      cor3ntin authored
      And as an extension in older language modes.
      
      Per https://eel.is/c++draft/lex.string#nt:d-char
      
      Fixes #93130
      2ace7bdc
    • Xu Zhang's avatar
      [Clang] Add support for [[msvc::noinline]] attribute. (#91720) · 8995ccc4
      Xu Zhang authored
      Fixes #90941.
      Add support for ``[[msvc::noinline]]`` attribute, which is actually an
      alias of ``[[clang::noinline]]``.
      8995ccc4
    • Tyker's avatar
      Fix failure after d46e3734 · 6e1a0424
      Tyker authored
      6e1a0424
    • Aaron Ballman's avatar
      [clang] Diagnose problematic diagnostic messages (#93229) · 24a12a9c
      Aaron Ballman authored
      Clang has some unwritten rules about diagnostic wording regarding things
      like punctuation and capitalization. This patch documents those rules
      and adds some tablegen support for checking diagnostics follow the
      rules.
      
      Specifically: tablegen now checks that a diagnostic does not start with
      a capital letter or end with punctuation, except for the usual
      exceptions like proper nouns or ending with a question.
      
      Now that the code base is clean of such issues, the diagnostics are
      emitted as an error rather than a warning to ensure that failure to
      follow these rules is either addressed by an author, or a new exception
      is added to the checking logic.
      24a12a9c
    • Sayan Saha's avatar
      [mlir] [linalg] Check for dim shape to decide unit dim for each operand in... · 44861c7a
      Sayan Saha authored
      [mlir] [linalg] Check for dim shape to decide unit dim for each operand in dropUnitDims pass. (#93317)
      
      `mlir-opt --linalg-fold-unit-extent-dims` pass on the following IR
      
      ```
      #map = affine_map<(d0, d1, d2, d3, d4, d5, d6) -> (d0, d1 + d4, d2 + d5, d6)>
      #map1 = affine_map<(d0, d1, d2, d3, d4, d5, d6) -> (d4, d5, d6, d3)>
      #map2 = affine_map<(d0, d1, d2, d3, d4, d5, d6) -> (d0, d1, d2, d3)>
      module {
        func.func @main(%arg0: tensor<1x?x?x1xf32>, %arg1: index) -> tensor<?x1x61x1xf32> {
          %cst = arith.constant dense<1.000000e+00> : tensor<1x1x1x1xf32>
          %0 = tensor.empty(%arg1) : tensor<?x1x61x1xf32>
          %1 = linalg.generic {indexing_maps = [#map, #map1, #map2], iterator_types = ["parallel", "parallel", "parallel", "parallel", "reduction", "reduction", "reduction"]} ins(%arg0, %cst : tensor<1x?x?x1xf32>, tensor<1x1x1x1xf32>) outs(%0 : tensor<?x1x61x1xf32>) {
          ^bb0(%in: f32, %in_0: f32, %out: f32):
            %2 = arith.mulf %in, %in_0 : f32
            %3 = arith.addf %out, %2 : f32
            linalg.yield %3 : f32
          } -> tensor<?x1x61x1xf32>
          return %1 : tensor<?x1x61x1xf32>
        }
      }
      ```
      
      produces an incorrect tensor.expand_shape operation:
      
      ```
      error: 'tensor.expand_shape' op expected dimension 0 of collapsed type to be dynamic since one or more of the corresponding dimensions in the expanded type is dynamic
          %1 = linalg.generic {indexing_maps = [#map, #map1, #map2], iterator_types = ["parallel", "parallel", "parallel", "parallel", "reduction", "reduction", "reduction"]} ins(%arg0, %cst : tensor<1x?x?x1xf32>, tensor<1x1x1x1xf32>) outs(%0 : tensor<?x1x61x1xf32>) {
               ^
      /mathworks/devel/sandbox/sayans/geckWorks/g3294570/repro.mlir:8:10: note: see current operation: %5 = "tensor.expand_shape"(%4) <{reassociation = [[0, 1, 2, 3]]}> : (tensor<61xf32>) -> tensor<?x1x61x1xf32>
      // -----// IR Dump After LinalgFoldUnitExtentDimsPass Failed (linalg-fold-unit-extent-dims) //----- //
      #map = affine_map<(d0) -> (0, d0)>
      #map1 = affine_map<(d0) -> ()>
      #map2 = affine_map<(d0) -> (d0)>
      "builtin.module"() ({
        "func.func"() <{function_type = (tensor<1x?x?x1xf32>, index) -> tensor<?x1x61x1xf32>, sym_name = "main"}> ({
        ^bb0(%arg0: tensor<1x?x?x1xf32>, %arg1: index):
          %0 = "arith.constant"() <{value = dense<1.000000e+00> : tensor<f32>}> : () -> tensor<f32>
          %1 = "tensor.collapse_shape"(%arg0) <{reassociation = [[0, 1], [2, 3]]}> : (tensor<1x?x?x1xf32>) -> tensor<?x?xf32>
          %2 = "tensor.empty"() : () -> tensor<61xf32>
          %3 = "tensor.empty"() : () -> tensor<61xf32>
          %4 = "linalg.generic"(%1, %0, %2, %3) <{indexing_maps = [#map, #map1, #map2, #map2], iterator_types = [#linalg.iterator_type<parallel>], operandSegmentSizes = array<i32: 3, 1>}> ({
          ^bb0(%arg2: f32, %arg3: f32, %arg4: f32, %arg5: f32):
            %6 = "arith.mulf"(%arg2, %arg3) <{fastmath = #arith.fastmath<none>}> : (f32, f32) -> f32
            %7 = "arith.addf"(%arg4, %6) <{fastmath = #arith.fastmath<none>}> : (f32, f32) -> f32
            "linalg.yield"(%7) : (f32) -> ()
          }) : (tensor<?x?xf32>, tensor<f32>, tensor<61xf32>, tensor<61xf32>) -> tensor<61xf32>
          %5 = "tensor.expand_shape"(%4) <{reassociation = [[0, 1, 2, 3]]}> : (tensor<61xf32>) -> tensor<?x1x61x1xf32>
          "func.return"(%5) : (tensor<?x1x61x1xf32>) -> ()
        }) : () -> ()
      }) : () -> ()
      ```
      
      The reason of this is because the dimension `d0` is determined to be an
      unit-dim that can be dropped based on the dimensions of operand `arg0`
      to `linalg.generic`. Later on when iterating over operand `outs` the
      dimension `d0` is determined to be an unit-dim even though the shape
      corresponding to it is `Shape::kDynamic`. For the `linalg.generic` to be
      valid `d0` of `outs` does need to be `1` but that isn't properly
      processed in the current implementation and the dimension is dropped
      resulting in `outs` operand to be `tensor<61xf32>` in the example.
      
      The fix is to also check that the dimension shape is actually `1` before
      dropping the dimension. The IR after the fix is:
      
      ```
      #map = affine_map<()[s0, s1] -> (s0 * s1)>
      #map1 = affine_map<(d0) -> (0, d0)>
      #map2 = affine_map<(d0) -> ()>
      module {
        func.func @main(%arg0: tensor<1x?x?x1xf32>, %arg1: index) -> tensor<?x1x61x1xf32> {
          %c0 = arith.constant 0 : index
          %c1 = arith.constant 1 : index
          %cst = arith.constant dense<1.000000e+00> : tensor<f32>
          %collapsed = tensor.collapse_shape %arg0 [[0, 1], [2, 3]] : tensor<1x?x?x1xf32> into tensor<?x?xf32>
          %0 = tensor.empty(%arg1) : tensor<?x61xf32>
          %1 = affine.apply #map()[%arg1, %c1]
          %2 = tensor.empty(%1) : tensor<?x61xf32>
          %3 = linalg.generic {indexing_maps = [#map1, #map2, #map1, #map1], iterator_types = ["parallel"]} ins(%collapsed, %cst, %0 : tensor<?x?xf32>, tensor<f32>, tensor<?x61xf32>) outs(%2 : tensor<?x61xf32>) {
          ^bb0(%in: f32, %in_0: f32, %in_1: f32, %out: f32):
            %4 = arith.mulf %in, %in_0 : f32
            %5 = arith.addf %in_1, %4 : f32
            linalg.yield %5 : f32
          } -> tensor<?x61xf32>
          %expanded = tensor.expand_shape %3 [[0, 1], [2, 3]] output_shape [%c0, 1, 61, 1] : tensor<?x61xf32> into tensor<?x1x61x1xf32>
          return %expanded : tensor<?x1x61x1xf32>
        }
      }
      ```
      44861c7a
    • Tom Eccles's avatar
      [flang][HLFIR][NFC] Reduce HLFIR to FIR conversion boilerplate (#93539) · de327865
      Tom Eccles authored
      The pass constructor can be generated automatically.
      
      This pass is module-level and then runs on all relevant intrinsic
      operations inside of the module, no matter what top level operation they
      are inside of.
      de327865
    • Nico Weber's avatar
      [gn] port 17ecd23f (-gen-x86-instr-mapping) · 2c7c9df6
      Nico Weber authored
      2c7c9df6
    • Shengchen Kan's avatar
    • Benjamin Kramer's avatar
      [bazel] Port 17ecd23f · bdd4e8b1
      Benjamin Kramer authored
      bdd4e8b1
    • Artem Kroviakov's avatar
      [mlir][vector] Add support for linearizing Insert VectorOp in VectorLinearize (#92370) · 01fbc565
      Artem Kroviakov authored
      Building on top of
      [#88204](https://github.com/llvm/llvm-project/pull/88204), this PR adds
      support for converting `vector.insert` into an equivalent
      `vector.shuffle` operation that operates on linearized (1-D) vectors.
      01fbc565
    • Kelvin Li's avatar
      1da52caf
    • Matt Arsenault's avatar
    • josel-amd's avatar
    • David Green's avatar
      [VectorCombine] Add Cmp and Select for shuffleToIdentity (#92794) · 516a9f51
      David Green authored
      Other than some additional checks needed for compare predicates and
      selects with scalar condition operands, these are relatively simple
      additions to what already exists.
      516a9f51
    • Shengchen Kan's avatar
      [X86][tablgen] Extend X86CompressEVEXTablesEmitter for NF transform · 17ecd23f
      Shengchen Kan authored
      The generated table will be used in #93508
      17ecd23f