1. Nov 17, 2023
  2. Nov 16, 2023
    • Valery Pykhtin's avatar
      [AMDGPU] Fix GCNRewritePartialRegUses pass: vector regclass is selected instead of scalar. (#69957) · 667ba7f8
      Valery Pykhtin authored
      For the following testcase:
      
      undef %1.sub1:sgpr_96 = COPY undef %0:sgpr_32
      %3:vgpr_32 = V_LSHL_ADD_U32_e64 %1.sub1:sgpr_96, ...
      
      GCNRewritePartialRegUses produced:
      
      %4:vgpr_32 = COPY undef %1:sgpr_32
      dead %2:vgpr_32 = V_LSHL_ADD_U32_e64 %4, ...
      
      Register class for %4 is incorrect: there should be sgpr_32 instead of
      vgpr_32 because the original %1 had scalar regclass. This patch fixes
      that.
      
      Note that GCNRewritePartialRegUses pass isn't enabled by default yet.
      667ba7f8
    • Alexey Bataev's avatar
      [SLP]Fix PR72524: "Out-of-bounds shuffle mask element" failed. · 206799fc
      Alexey Bataev authored
      Need to check if we ran into subvector extract pattern before checking
      for identity vector to avoid compiler crash.
      206799fc
    • Lucas Duarte Prates's avatar
      [AArch64] Introduce the Armv9.5-A architecture version (#72392) · 59b23015
      Lucas Duarte Prates authored
      This introduces the Armv9.5-A architecture version, including the
      relevant command-line option for -march.
      
      Mode details about the Armv9.5-A architecture version can be found at:
      *
      https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/arm-a-profile-architecture-developments-2023
      * https://developer.arm.com/documentation/ddi0602/2023-09/
      
      Patch by Oliver Stannard.
      59b23015
    • Youngsuk Kim's avatar
      [llvm] Remove no-op ptr-to-ptr bitcasts (NFC) · f432a004
      Youngsuk Kim authored
      Opaque ptr cleanup effort (NFC).
      f432a004
    • Alexey Bataev's avatar
      [SLP]Fix PR72202: wrong mask emission for the first found vector · 95703642
      Alexey Bataev authored
      operand.
      
      Need to copy the submask not to the very first part of the common
      extractelements vector mask, but to the proper one to avoid wrong code
      emission.
      95703642
    • LLVM GN Syncbot's avatar
      [gn build] Port 7f28e8ce · 9edc0f59
      LLVM GN Syncbot authored
      9edc0f59
    • Alex Bradbury's avatar
      [TargetInstrInfo][NFC] Don't restrict isAddImmediate description to physical registers (#72357) · 42d9232a
      Alex Bradbury authored
      None of the in-tree implementations have different behaviour for
      physical vs virtual registers, and it seems would work equally well if
      used with virtual registers. As such, perhaps it's simplest to just drop
      that part of the doc comment.
      42d9232a
    • Alex Bradbury's avatar
      [RISCV] Implement RISCVInstrInfo::isAddImmediate (#72356) · 7f28e8ce
      Alex Bradbury authored
      This hook is called by the target-independent implementation of
      TargetInstrInfo::describeLoadedValue. I've opted to test it via a C++
      unit test, which although fiddly to set up seems the right way to test a
      function with such clear intended semantics (rather than testing the
      impact indirectly).
      
      isAddImmediate will never recognise ADDIW as an add immediate which I
      _think_ is conservatively correct, as the caller may not understand its
      semantics vs ADDI.
      
      Note that although the doc comment for isAddImmediate specifies its
      behaviour solely in terms of physical registers, none of the current
      in-tree implementations (including this one) bail out on virtual
      registers (see #72357).
      7f28e8ce
    • Alexey Bataev's avatar
      [SLP][NFC]Add a test for PR72202 to show a bug in a mask generation for · 181b2c1b
      Alexey Bataev authored
      vectorized extractelements operands.
      181b2c1b
    • Piyou Chen's avatar
      [RISCV] Split regalloc between RVV and other (#72096) · ac4868ea
      Piyou Chen authored
      Enable this flow by -riscv-split-regalloc=1 (default disable), and could
      designate specific allocator to RVV by
      -riscv-rvv-regalloc=<fast|basic|greedy>
      
      It uses the RegClass filter function to decide which regclass need to be
      processed.
      
      This patch is pre-requirement for supporting PostRA vsetvl insertion
      pass.
      ac4868ea
    • Jake Egan's avatar
      [AIX] Disable flaky ClangScanDeps test · c0c8679f
      Jake Egan authored
      I missed this test in PR https://github.com/llvm/llvm-project/pull/72304
      c0c8679f
    • Sam Tebbs's avatar
      [Clang][SME2] Add single and multi min/max by vector builtins (#71707) · fc35ad06
      Sam Tebbs authored
      Adds the following SME2 builtins:
      
      svminnm_single_f(16|32|64)_x(2|4)
      svminnm_f(16|32|64)_x(2|4)
      svmaxnm_single_f(16|32|64)_x(2|4)
      svmaxnm_f(16|32|64)_x(2|4)
      
      See
      [ARM-software/acle#217](https://github.com/ARM-software/acle/pull/217)
      
      Patch by: Kerry McLaughlin <kerry.mclaughlin@arm.com>
      fc35ad06
    • Timm Baeder's avatar
      4cf996d6
    • lntue's avatar
    • Yaxun (Sam) Liu's avatar
      [CUDA][HIP] make trivial ctor/dtor host device (#72394) · 27e6e4a4
      Yaxun (Sam) Liu authored
      Make trivial ctor/dtor implicitly host device functions so that they can
      be used to initialize file-scope
      device variables to match nvcc behavior.
      
      Fixes: https://github.com/llvm/llvm-project/issues/72261
      
      Fixes: SWDEV-432412
      27e6e4a4
    • Guray Ozen's avatar
      [mlir][gpu] Introduce `gpu.dynamic_shared_memory` Op (#71546) · ea84897b
      Guray Ozen authored
      While the `gpu.launch` Op allows setting the size via the
      `dynamic_shared_memory_size` argument, accessing the dynamic shared
      memory is very convoluted. This PR implements the proposed Op,
      `gpu.dynamic_shared_memory` that aims to simplify the utilization of
      dynamic shared memory.
      
      RFC:
      https://discourse.llvm.org/t/rfc-simplifying-dynamic-shared-memory-access-in-gpu/
      
      **Proposal from RFC**
      This PR `gpu.dynamic.shared.memory` Op to use dynamic shared memory
      feature efficiently. It is is a powerful feature that enables the
      allocation of shared memory at runtime with the kernel launch on the
      host. Afterwards, the memory can be accessed directly from the device. I
      believe similar story exists for AMDGPU.
      
      **Current way Using Dynamic Shared Memory with MLIR**
      
      Let me illustrate the challenges of using dynamic shared memory in MLIR
      with an example below. The process involves several steps:
      - memref.global 0-sized array LLVM's NVPTX backend expects
      - dynamic_shared_memory_size Set the size of dynamic shared memory
      - memref.get_global Access the global symbol
      - reinterpret_cast and subview Many OPs for pointer arithmetic
      
      ```
      // Step 1. Create 0-sized global symbol. Manually set the alignment
      memref.global "private" @dynamicShmem  : memref<0xf16, 3> { alignment = 16 }
      func.func @main() {
        // Step 2. Allocate shared memory
        gpu.launch blocks(...) threads(...)
          dynamic_shared_memory_size %c10000 {
          // Step 3. Access the global object
          %shmem = memref.get_global @dynamicShmem : memref<0xf16, 3>
          // Step 4. A sequence of `memref.reinterpret_cast` and `memref.subview` operations.
          %4 = memref.reinterpret_cast %shmem to offset: [0], sizes: [14, 64, 128],  strides: [8192,128,1] : memref<0xf16, 3> to memref<14x64x128xf16,3>
          %5 = memref.subview %4[7, 0, 0][7, 64, 128][1,1,1] : memref<14x64x128xf16,3> to memref<7x64x128xf16, strided<[8192, 128, 1], offset: 57344>, 3>
          %6 = memref.subview %5[2, 0, 0][1, 64, 128][1,1,1] : memref<7x64x128xf16, strided<[8192, 128, 1], offset: 57344>, 3> to memref<64x128xf16, strided<[128, 1], offset: 73728>, 3>
          %7 = memref.subview %6[0, 0][64, 64][1,1]  : memref<64x128xf16, strided<[128, 1], offset: 73728>, 3> to memref<64x64xf16, strided<[128, 1], offset: 73728>, 3>
          %8 = memref.subview %6[32, 0][64, 64][1,1] : memref<64x128xf16, strided<[128, 1], offset: 73728>, 3> to memref<64x64xf16, strided<[128, 1], offset: 77824>, 3>
          // Step.5 Use
          "test.use.shared.memory"(%7) : (memref<64x64xf16, strided<[128, 1], offset: 73728>, 3>) -> (index)
          "test.use.shared.memory"(%8) : (memref<64x64xf16, strided<[128, 1], offset: 77824>, 3>) -> (index)
          gpu.terminator
        }
      ```
      
      Let’s write the program above with that:
      
      ```
      func.func @main() {
          gpu.launch blocks(...) threads(...) dynamic_shared_memory_size %c10000 {
          	%i = arith.constant 18 : index
              // Step 1: Obtain shared memory directly
              %shmem = gpu.dynamic_shared_memory : memref<?xi8, 3>
              %c147456 = arith.constant 147456 : index
              %c155648 = arith.constant 155648 : index
              %7 = memref.view %shmem[%c147456][] : memref<?xi8, 3> to memref<64x64xf16, 3>
              %8 = memref.view %shmem[%c155648][] : memref<?xi8, 3> to memref<64x64xf16, 3>
      
              // Step 2: Utilize the shared memory
              "test.use.shared.memory"(%7) : (memref<64x64xf16, 3>) -> (index)
              "test.use.shared.memory"(%8) : (memref<64x64xf16, 3>) -> (index)
          }
      }
      ```
      
      This PR resolves #72513
      ea84897b
    • Guray Ozen's avatar
      [mlir][nvvm] Add `cp.async.bulk.tensor.shared.cluster.global.multicast` (#72429) · 108380da
      Guray Ozen authored
      This PR introduce `cp.async.bulk.tensor.shared.cluster.global.multicast`
      Op in NVVM dialect. It loads data using TMA data from global memory to
      shared memory of multiple CTAs in the cluster.
      
      It resolves #72368
      108380da
    • Kiran Chandramohan's avatar
      [Flang][OpenMP][OpenACC] Hoist nonAtomic Expr in atomic intrinsics (#72131) · 25d0f9fc
      Kiran Chandramohan authored
      Hoist non-atomic expressions in atomic intrinsics. Use a list to collect
      the non-atomic expressions since the max and min intrinsics can have
      more than two operands.
      
      Hoisting makes the lowering to LLVMIR of iand,ior,ieor intrinsics
      trivial. For max and min this still results in multiple instructions in
      the atomic region but the loads are removed, which should help improve
      performance.
      25d0f9fc