1. Nov 22, 2023
    • Guray Ozen's avatar
      [mlir] `im2col` & `l2cache` on cp.async.bulk.tensor.shared.cluster.global` (#72967) · 9ceea088
      Guray Ozen authored
      PR adds support of `im2col` and `l2cache` to
      `cp.async.bulk.tensor.shared.cluster.global`. The Op is now supports all
      the traits of the corresponding PTX instruction.
      
      The current structure of this operation looks somewhat like below. The
      PR also simplifies types so we don't need to write obvious types after
      `:` anymore.
      ```
      nvvm.cp.async.bulk.tensor.shared.cluster.global
      		%dest, %tmaDescriptor, %barrier,
      		box[%crd0,%crd1,%crd2,%crd3,%crd4]
      		im2col[%off0,%off1,%off2] 			<-- PR introduces
      		multicast_mask = %ctamask
      		l2_cache_hint = %cacheHint			<-- PR introduces
      		: !llvm.ptr<3>, !llvm.ptr
      ```
      9ceea088
    • Momchil Velikov's avatar
      [AArch64] Add quadword gather load/scatter store intrinsics with unscaled vector offset (#71290) · ed5404cd
      Momchil Velikov authored
      This patch add intrinsics of the form
         
      sv<type>_t svld1q_gather_u64offset_<typ>(svbool_t pg, const <type>_t *base, svuint64_t offs);
      void svst1q_scatter_u64offset_<typ>(sbvool_t, <type>_t *base, svuint64_t offst, sv<type>_t data);
      
      as well as their short forms.
      
      ACLE spec: ARM-software/acle#257
      ed5404cd
    • Johannes Reifferscheid's avatar
      [Bazel] Fixes for dff97c1e · 2b0b0ad7
      Johannes Reifferscheid authored
      2b0b0ad7
    • Phoebe Wang's avatar
      [X86][AVX10] Add no-evex512 for MMX intrinsics, NFCI · e5cc3da6
      Phoebe Wang authored
      Some MMX intrinsics like _mm_setzero_si64 will be called by XMM
      intrinsics, so need to propagate no-evex512 there.
      
      Checked locally with a lot of modified tests and no side effect with
      this change. No extra test needed for the update.
      e5cc3da6
    • Joseph Huber's avatar
      [libc] Disable nexttoward tests on the GPU · fa1e49cf
      Joseph Huber authored
      Summary:
      
      These tests are currently failing for some reason. A lot of math tests
      on the GPU are disabled temporarily and need to be fixed.
      fa1e49cf
    • Benjamin Maxwell's avatar
      [mlir][ArmSME] Move ArmSME -> intrinsics lowerings to `convert-arm-sme-to-llvm` pass (#72890) · dff97c1e
      Benjamin Maxwell authored
      This gives more flexibility with when these lowerings are performed,
      without also lowering unrelated vector ops.
      
      This is a NFC (other than adding a new `-convert-arm-sme-to-llvm` pass)
      dff97c1e
    • CarolineConcatto's avatar
      Revert "Revert "[SVE2.1][Clang][LLVM]Add BFloat16 builtin in Clang an… (#73110) · 55f067f3
      CarolineConcatto authored
      …d LLVM intrinisc (#70362)""
      
      This reverts commit e1ee0e85.
      
      The patch https://github.com/llvm/llvm-project/pull/70362 had a test in
      LLDB failing. The Feature sve2p1 in AArch64InstrInfo.td uses
      AssemblerPredicate instead of AssemblerPredicateWithAll This patch adds
      again PR #70362 with the fix in the AArch64InstrInfo.td.
      55f067f3
    • Tai Ly's avatar
      [Tosa] Add local_bound attribute (#73001) · 22d05acc
      Tai Ly authored
      
      
      This adds an optional bool attribute, local_bound, with default false,
      to following ops per TOSA spec 0.90:
        CONV2D
        CONV3D
        DEPTHWISE_CONV2D
        FFT2D
        RFFT2D
        TRANSPOSE_CONV2D
      
      also added tests in ops.mlir to validate this attribute is optional
      
      Signed-off-by: default avatarTai Ly <tai.ly@arm.com>
      22d05acc
    • Rafael Ubal's avatar
      Fix for TOSA-to-linalg lowering of tosa.transpose op (#72698) · ea47887e
      Rafael Ubal authored
      The TOSA-to-linalg conversion of `tosa.transpose` contains a bug in the
      computation of the result tensor shape when using dynamic dimensions.
      This bug may have widespread implications in projects such as
      Tensorflow, where `tosa.transpose` is frequently generated.
      
      Consider the following TOSA code using only static dimensions. The code
      transposes a tensor of shape 10x11x12 into 12x10x11 by permuting
      dimensions [2, 0, 1] into [0, 1, 2].
       
      ```
      func.func @test_tosa_transpose(%input: tensor<10x11x12xf32>) -> tensor<12x10x11xf32> {
        %perms = "tosa.const"() <{value = dense<[2, 0, 1]> : tensor<3xi32>}> : () -> tensor<3xi32>
        %transposed = "tosa.transpose"(%input, %perms) : (tensor<10x11x12xf32>, tensor<3xi32>) -> tensor<12x10x11xf32>
        return %transposed : tensor<12x10x11xf32>
      }
      ```
       
      The code is correctly lowered to:
       
      ```
      #map = affine_map<(d0, d1, d2) -> (d1, d2, d0)>
      #map1 = affine_map<(d0, d1, d2) -> (d0, d1, d2)>
      module {
        func.func @test_tosa_transpose(%arg0: tensor<10x11x12xf32>) -> tensor<12x10x11xf32> {
          %empty = tensor.empty() : tensor<12x10x11xf32>
          %transposed = linalg.generic {indexing_maps = [#map, #map1], iterator_types = ["parallel", "parallel", "parallel"]} ins(%arg0 : tensor<10x11x12xf32>) outs(%empty : tensor<12x10x11xf32>) {
          ^bb0(%in: f32, %out: f32):
            linalg.yield %in : f32
          } -> tensor<12x10x11xf32>
          return %transposed : tensor<12x10x11xf32>
        }
      }
      ```
       
      Now let's make all dimensions dynamic in the TOSA code:
       
      ```
      func.func @test_tosa_transpose(%input: tensor<?x?x?xf32>) -> tensor<?x?x?xf32> {
        %perms = "tosa.const"() <{value = dense<[2, 0, 1]> : tensor<3xi32>}> : () -> tensor<3xi32>
        %transposed = "tosa.transpose"(%input, %perms) : (tensor<?x?x?xf32>, tensor<3xi32>) -> tensor<?x?x?xf32>
        return %transposed : tensor<?x?x?xf32>
      }
      ```
       
      The `tensor.empty()` op now needs additional information about the size
      of the output tensor, which is computed dynamically with a set of
      `tensor.dim` ops. The comments below assume an input tensor of size
      10x11x12, as before. The code is lowered as:
       
      ```
      #map = affine_map<(d0, d1, d2) -> (d1, d2, d0)>
      #map1 = affine_map<(d0, d1, d2) -> (d0, d1, d2)>
      module {
        func.func @test_tosa_transpose(%arg0: tensor<?x?x?xf32>) -> tensor<?x?x?xf32> {
          %c0 = arith.constant 0 : index
          %c1 = arith.constant 1 : index
          %c2 = arith.constant 2 : index
       
          %arg0_dim0 = tensor.dim %arg0, %c0 : tensor<?x?x?xf32>   // Evaluates to 10
          %arg0_dim1 = tensor.dim %arg0, %c1 : tensor<?x?x?xf32>   // Evaluates to 11
          %arg0_dim2 = tensor.dim %arg0, %c2 : tensor<?x?x?xf32>   // Evaluates to 12
       
          %empty = tensor.empty(%arg0_dim1, %arg0_dim2, %arg0_dim0) : tensor<?x?x?xf32>   // Output of type tensor<11x12x10>  WRONG!
          %transposed = linalg.generic {indexing_maps = [#map, #map1], iterator_types = ["parallel", "parallel", "parallel"]} ins(%arg0 : tensor<?x?x?xf32>) outs(%empty : tensor<?x?x?xf32>) {
          ^bb0(%in: f32, %out: f32):
            linalg.yield %in : f32
          } -> tensor<?x?x?xf32>
          return %transposed : tensor<?x?x?xf32>
        }
      }
      ```
       
      The output tensor shape is dynamically computed as 11x12x10 instead of
      12x10x11. Since the total size of the output tensor is still the same,
      the code does not segfault after bufferization. However, index
      computations are invalid and lead to SWAs.
      ea47887e
    • Simon Pilgrim's avatar
      [X86] combineFMulcFCMulc - use KnownBits to detect conjugate patterns. · b810b668
      Simon Pilgrim authored
      We currently look for X86ISD::VBROADCAST_LOAD patterns, but this won't work with a future patch which will improve sharing of constant pool loads.
      b810b668
    • Florian Hahn's avatar
      [LV] Use SCEV for subtraction of src/sink for diff runtime checks. · 32d1197a
      Florian Hahn authored
      Instead of expanding the src/sink SCEV expressions and emitting an IR
      sub to compute the difference, the subtraction can be directly be
      performed by ScalarEvolution. This allows the subtraction to be
      simplified by SCEV, which in turn can reduced the number of redundant
      runtime check instructions generated.
      
      It also allows to generate checks that are invariant w.r.t. an outer
      loop, if he inner loop AddRecs have the same outer loop AddRec as start.
      32d1197a
    • Spenser Bauman's avatar
      [mlir][tosa] Fix lowering of tosa.matmul with dynamic outputs (#72724) · eed17dcf
      Spenser Bauman authored
      The existing lowering of tosa.matmul will construct illegal tensor.empty
      operations when the output type is more dynamic than the input types.
      
      %0 = tosa.matmul %arg0, %arg1 : (tensor<1x1x8xf32>, tensor<1x8x1xf32>)
      -> tensor<?x1x1xf32>
      
      When constructing the tensor.empty operation, consult the output type
      rather than the input types to decide whether a dimension is dynamic.
      eed17dcf
    • Florian Hahn's avatar
      [LV] Add test with a number of redundant runtime check instructions. · 9b20af16
      Florian Hahn authored
      Add a test case where many runtime check instructions can be simplified.
      9b20af16
    • Utkarsh Saxena's avatar
      [coroutines] Introduce [[clang::coro_lifetimebound]] (#72851) · fbfd2c99
      Utkarsh Saxena authored
      Adds attribute `[[clang::coro_lifetimebound]]`.
      
      All arguments to a function are considered to be **lifetime bound** if
      the function
      returns a type annotated with ``[[clang::coro_lifetimebound]]`` and
      ``[[clang::coro_return_type]]``.
      fbfd2c99
    • Hui's avatar
      [libc++] Floating Point Atomic (#67799) · de7fbfee
      Hui authored
      - implement P0020R6 Floating Point Atomic
      
      Differential Revision: https://reviews.llvm.org/D153981
      de7fbfee
    • NimishMishra's avatar
      [flang][OpenMP] Fix min reduction initialization (#73102) · 956cf0e5
      NimishMishra authored
      Initialization of reduction variable for min-reduction is set to largest
      negative value. As such, in presence of non-negative operands, min
      reduction gives incorrect output. This patch initialises min-reduction
      to use the maximum positive value instead, so that it can produce
      correct output for the entire range of real valued operands.
      
      Fixes https://github.com/llvm/llvm-project/issues/73101
      956cf0e5
    • Simon Pilgrim's avatar
      [X86] combineFaddCFmul - use KnownBits to detect FNEG patterns. · 95828eed
      Simon Pilgrim authored
      We currently look for X86ISD::VBROADCAST_LOAD patterns, but this won't work with a future patch which will improve sharing of constant pool loads.
      95828eed
    • Florian Hahn's avatar
      [LV] Reduce memory-check-threshold for test to preserve original test. · b3a9e8f7
      Florian Hahn authored
      Future patches will remove some redundant instructions for runtime
      checks, which brings this test case slightly below the default limit of
      128. Force a lower limit to preserve the original spirit of the test
      (checking that no interleaving happens if the number of checks is
      above he threshold)
      b3a9e8f7
    • Nikita Popov's avatar
      [DomTree] Remove unnecessary check (NFC) · cfad8bf5
      Nikita Popov authored
      ReverseChildren is populated during runDFS() with reachable nodes
      only. This check dates back to a time when this code used
      inverse_children<> directly, which could indeed contain unreachable
      nodes.
      cfad8bf5
    • Mats Petersson's avatar
      [FuncSpec] Update function specialization to handle phi-chains (#72903) · 2fb51fba
      Mats Petersson authored
      When using the LLVM flang compiler with alias analysis (AA) enabled,
      SPEC2017:548.exchange2_r was running significantly slower than wihtout
      the AA.
      
      This was caused by the GVN pass replacing many of the loads in the
      pre-AA code with phi-nodes that form a long chain of dependencies, which
      the function specialization was unable to follow.
      
      This adds a function to discover phi-nodes in a transitive set, with
      some limitations to avoid spending ages analysing phi-nodes.
      
      The minimum latency savings also had to be lowered - fewer load
      instructions means less saving.
      
      Adding some more prints to help debugging the isProfitable decision.
      
      No significant change in compile time or generated code-size.
      
      (A previous attempt to fix this was abandoned: https://github.com/llvm/llvm-project/pull/71442
      
      )
      
      ---------
      
      Co-authored-by: default avatarAlexandros Lamprineas <alexandros.lamprineas@arm.com>
      2fb51fba
    • Jonas Paulsson's avatar
      [clang] Ensure minimal alignment of global vars of incomplete type. (#72886) · 2e09ea65
      Jonas Paulsson authored
      The SystemZ ABI requires any global variable to be aligned to at least 2
      bytes, and therefore an external global Value with an opaque type should
      get this alignment as well.
      2e09ea65
    • Nikita Popov's avatar
      [IR][TLI] Cache getLibFunc() result on Function (NFC) (#72867) · 510fb871
      Nikita Popov authored
      Cache the result of the TLI libfunc lookup in the Function object. This
      only caches the actual lookup of the LibFunc in the TLI map, but not the
      prototype validation, as that might differ between different TLI
      instances.
      
      This uses the existing mechanism for invalidating the intrinsic ID when
      the function name changes. The libfunc will be invalidated in that case
      as well.
      
      I don't believe this increases the size of Function on 64bit (which
      currently has a trailing `bool` member), and I don't think we would
      particularly care if it did, as Functions are uncommon as Values go.
      510fb871
    • simpal01's avatar
      [llvm][ARM] Emit MVE .arch_extension after .fpu directive if it does not... · 74cdb8e6
      simpal01 authored
      [llvm][ARM] Emit MVE .arch_extension after .fpu directive if it does not include MVE features (#71545)
      
      The floating-point and MVE features together specify the MVE
      functionality that is supported on the Cortex-M85 processor. But the FPU
      extension for the underlying architecture(armv8.1-m.main) is FPV5 which
      does not include MVE-F. So Compiler's -S output and `-save-temps=obj`
      loses MVE feature which leads to assembler error. What happening here is
      .fpu directive overrides any previously set features by .cpu directive.
      Since the the corresponding .fpu generated (.fpu fpv5-d16) does not
      include MVE-F, it overrides those features even though it is supported
      and set by the .cpu directive. Looks like .fpu is supposed to do this.
      
      In this case, there should be an .arch_extension directive re-enabling
      the relevant extensions after .fpu if the goal is to keep these
      extensions enabled. GCC also does the same.
      
      So this patch enables the MVE features by emitting the below arch
      extension:
        .fpu fpv5-d16
        .arch_extension mve.fp
      
      ---------
      
      Co-authored-by: Simi Pallipurath <simi.pallipurath.com>
      74cdb8e6
    • Sander de Smalen's avatar
    • Sander de Smalen's avatar
      [llvm][TypeSize] Fix addition/subtraction in TypeSize. (#72979) · 81b7f115
      Sander de Smalen authored
      It seems TypeSize is currently broken in the sense that:
      
        TypeSize::Fixed(4) + TypeSize::Scalable(4) => TypeSize::Fixed(8)
      
      without failing its assert that explicitly tests for this case:
      
        assert(LHS.Scalable == RHS.Scalable && ...);
      
      The reason this fails is that `Scalable` is a static method of class
      TypeSize,
      and LHS and RHS are both objects of class TypeSize. So this is
      evaluating
      if the pointer to the function Scalable == the pointer to the function
      Scalable,
      which is always true because LHS and RHS have the same class.
      
      This patch fixes the issue by renaming `TypeSize::Scalable` ->
      `TypeSize::getScalable`, as well as `TypeSize::Fixed` to
      `TypeSize::getFixed`,
      so that it no longer clashes with the variable in
      FixedOrScalableQuantity.
      
      The new methods now also better match the coding standard, which
      specifies that:
      * Variable names should be nouns (as they represent state)
      * Function names should be verb phrases (as they represent actions)
      81b7f115
    • Nikita Popov's avatar
      [IR] Don't include GenericDomTreeConstruction.h in header (NFC) · 03f05a4e
      Nikita Popov authored
      The whole point of the GenericDomTree.h vs
      GenericDomTreeConstruction.h distinction is that the latter only
      needs to be included in the source file and not the header.
      03f05a4e
    • Zi Xuan Wu (Zeson)'s avatar
      [RISCV] Fix the order of arguments of setTruncStoreAction and setLoadExtAction (#73090) · 06e733b1
      Zi Xuan Wu (Zeson) authored
      The first argument of setTruncStoreAction/setLoadExtAction should be
      Value VT instead of Memory VT.
      06e733b1
    • Craig Topper's avatar
    • Yuxuan Chen's avatar
      [Clang][Coroutines] Properly emit EH code for initial suspend `await_resume` (#73073) · 1fad78b1
      Yuxuan Chen authored
      This change aims to fix an ICE in issue
      https://github.com/llvm/llvm-project/issues/63803
      
      The crash happens in `ExitCXXTryStmt` because `EmitAnyExpr()` adds
      additional cleanup to the `EHScopeStack`. This messes up the assumption
      in `ExitCXXTryStmt` that the top of the stack should be a
      `EHCatchScope`.
      
      However, since we never read a value returned from `await_resume()` of
      an init suspend, we can skip the part that builds this `RValue`.
      
      The code here may not be in the best shape. There's another bug that
      `memberCallExpressionCanThrow` doesn't work on the current Expr due to
      type mismatch. I am preparing a separate PR to address it plus some
      refactoring might be beneficial.
      1fad78b1
    • Vitaly Buka's avatar
      [test][hwasan] Deflake release-shadow.c · 2c875719
      Vitaly Buka authored
      kNumShadowPages=1024 helps to pass it consistenly (10k runs).
      But to be sure also changing success condition to 8 out of 10.
      2c875719
    • Ho Cheung's avatar
      [BOLT] Fix type mismatch error (#73016) · 3af586f7
      Ho Cheung authored
      Fix build issue on Windows.
      
      Fixes #73006
      3af586f7
    • Shengchen Kan's avatar
      [X86][MC] Support encoding/decoding for JMPABS (#72835) · 42d48408
      Shengchen Kan authored
      JMPABS is a 64-bit only ISA extension, and acts as a near-direct branch
      with an absolute target. The 64-bit immediate operand is treated an as
      absolute effective address, which is subject to canonicality checks. It
      is in legacy map 0 and requires REX2 prefix with `REX2.M0=0` and
      `REX2.W=0`. All other REX2 payload bits are ignored.
      
      blog: https://kanrobert.github.io/rfc/All-about-APX-JMPABS/
      
      This patch
      1. Extends `ExplicitVEXPrefix` to `ExplicitOpPrefix` for instrcutions
      requires explicit `REX2` or `EVEX`
      2. Adds `ATTR_REX2` and `IC_64BIT_REX2` to put `JMPABS` , `MOV EAX,
      moffs32` in different tables to avoid opcode conflict
      
      NOTE:
      1. `ExplicitREX2Prefix` can be reused by the following PUSHP/POPP
      instructions.
      2. `ExplicitEVEXPrefix` will be used by the instructions promoted to
      EVEX space for EGPR.
      42d48408
    • Matthias Braun's avatar
      Support BranchProbabilityInfo in update_analyze_test_checks.py (#72943) · 33111127
      Matthias Braun authored
      - Change `BranchProbabilityPrinterPass` output to match expectations of `update_analyze_test_checks.py`.
      - Add `Branch Probability Analysis` to list of supported analyses.
      - Process `llvm/test/Analysis/BranchProbabilityInfo/basic.ll` with `update_analyze_test_checks.py` as proof of concept. Leaving the other tests unchanged to reduce the amount of churn.
      33111127
    • Aart Bik's avatar
      [mlir][sparse] fixed naming consistency (#73053) · d213220a
      Aart Bik authored
      All DLT related methods have DLT at end, removed stale TODO
      d213220a
    • Yeting Kuo's avatar
      [TargetLowering][RISCV] Introduce shouldFoldSelectWithSingleBitTest and RISC-V implement. (#72978) · a756a6b9
      Yeting Kuo authored
      DAGCombiner folds (select_cc seteq (and x, y), 0, 0, A) to (and (sra
      (shl x)) A) where y has a single bit set. Previously, DAGCombiner relies
      on `shouldAvoidTransformToShift` to decide when to do the combine, but
      `shouldAvoidTransformToShift` is only about shift cost. This patch
      introuduces a specific hook to decide when to do the combine and disable
      the combine when Zicond enabled and AndMask <= 1024.
      a756a6b9
    • Valentin Clement (バレンタイン クレメン)'s avatar
    • Valentin Clement (バレンタイン クレメン)'s avatar
    • Valentin Clement (バレンタイン クレメン)'s avatar
      [flang][openacc][NFC] Check only HLFIR lowering for enter/exit data tests (#73035) · c384888f
      HLFIR lowering as been set by default now and FIR lowering support will
      be removed in the near future. This patch removes the specific FIR check
      lines on enter/exit data tests.
      c384888f
    • GkvJwa's avatar
      Supports viewing class member variables in lambda when using the vs debugger (#71564) · 7c3c243c
      GkvJwa authored
      Use "__this" in DataMemberRecord, make vs debugger can be parsed normally
      
      Fixes #71562
      7c3c243c
    • Valentin Clement (バレンタイン クレメン)'s avatar
      [flang][openacc][NFC] Remove run line for FIR only checks (#73050) · d82b5213
      Remove the run lines that check for the FIR lowering. HLFIR lowering
      produce the same check lines.
      d82b5213