1. Sep 24, 2022
  2. Sep 23, 2022
    • Petar Avramovic's avatar
      AMDGPU: Use tablegen patterns for buffer global and flat atomic fadd · 6db7921b
      Petar Avramovic authored
      Remove manual selection for atomic fadd from global-isel.
      Stop pre-isel translation to AtomicLoadFAdd/G_ATOMICRMW_FADD
      which corresponds to llvm-ir's atomicrmw fadd instruction.
      
      global and flat atomic fadd patterns changes:
      Split rtn/no-rtn patterns
      Add missing patterns or fix predicates
      Remove atomicrmw patterns for v2f16 (atomic rmw doesn't support vectors).
      Patterns now check addrspace of pointer, added patterns for flat intrinsic.
      with global addrspace pointer that selects into global atomic instruction.
      
      buffer atomic fadd patterns changes:
      Rdit patterns to import into global-isel.
      Remove gfx6/gfx7 _addr64 and _offset patterns.
      Remove patterns that can't be reached (same pattern but different feature).
      
      Differential Revision: https://reviews.llvm.org/D130579
      6db7921b
    • Petar Avramovic's avatar
      AMDGPU: Improve atomicrmw fadd selection · 5cee9047
      Petar Avramovic authored
      Use same atomicrmw fadd expansion rules for gfx908, gfx940 and gfx11
      as for gfx90a. Add missing globalisel legalizer support for flat
      atomicrmw fadd f32 on gfx940 and gfx11.
      Isel support for gfx11 will be added in D130579.
      
      Differential Revision: https://reviews.llvm.org/D131560
      5cee9047
    • Petar Avramovic's avatar
      AMDGPU: Add detailed buffer, global and flat atomic fadd tests · 48968c47
      Petar Avramovic authored
      Precommit for D130579 that will remove manual selection and use
      patterns from td files. Tests are grouped based on target features.
      
      All patterns have rtn and no-rtn versions.
      
      buffer atomics patterns are selected based on the intrinsic used
      (raw or struct) and the offset operand (imm or vgpr):
      _offset raw with imm offset
      _offen raw with vgpr offset (or large imm offset)
      _idxen struct with imm offset
      _bothen struct with vgpr offset (or large imm offset)
      
      global and flat atomics are selected via intrinsic or the atomicrmw fadd.
      atomicrmw tests have amdgpu-unsafe-fp-atomics=true and non-system scope
      since they get expanded otherwise. atomicrmw fadd does not support vector
      type, test float and double.
      
      global atomics patterns are selected based on address type via (global or
      flat) intrinsic or atomicrmw fadd with global address(addrspace(1)*).
      'no suffix' vgpr addrspace(1)* address
      _saddr sgpr addrspace(1)* address
      
      flat atomics patterns are selected via (flat)intrinsic or atomicrmw fadd
      with flat address (* - address space 0).
      
      Differential Revision: https://reviews.llvm.org/D131561
      48968c47
    • Petar Avramovic's avatar
      [AMDGPU] Add FeatureFlatAtomicFaddF32Inst · e03d36d4
      Petar Avramovic authored
      Feature used by targets that have flat_atomic_add_f32 instruction
      (gfx940 and gfx11). Remove isGFX940GFX11Plus.
      Add hasFlatAtomicFaddF32Inst Subtarget check for codegen.
      
      Differential Revision: https://reviews.llvm.org/D134532
      e03d36d4
    • Philip Reames's avatar
      [SLP] Fix cost model w.r.t. operand properties · 42ef5720
      Philip Reames authored
      We allow the target to report different costs depending on properties of the operands; given this, we have to make sure we pass the right set of operands and account for the fact that different scalar instructions can have operands with different properties.
      
      As a motivating example, consider a set of multiplies which each multiply by a constant (but not all the same constant). Most of the constants are power of two (but not all).
      
      If the target doesn't have support for non-uniform constant immediates, this will likely require constant materialization and a non-uniform multiply. However, depending on the balance of target costs for constant scalar multiplies vs a single vector multiply, this might or might not be a profitable vectorization.
      
      This ends up basically being a rewrite of the existing code. Normally, I'd scope the change more narrowly, but I kept noticing things which seemed highly suspicious, and none of the existing code appears to have any test coverage at all. I think this is a case where simply throwing out the existing code and starting from scratch is reasonable.
      
      This is a follow on to Alexey's D126885, but also handles the arithmetic instruction case since the existing code appears to have the same problem.
      
      Differential Revision: https://reviews.llvm.org/D132566
      42ef5720
    • Chris Bieneman's avatar
      [Docs] [HLSL] Add IR reference for HLSL · d20f9f8d
      Chris Bieneman authored
      HLSL uses a variety of named IR metadata and attributes to convey
      additional information from the frontend to the backend. This document
      tries to capture and document the named annotations to provide a
      reference for future contributors.
      
      Reviewed By: python3kgae
      
      Differential Revision: https://reviews.llvm.org/D134304
      d20f9f8d
    • Peter Klausler's avatar
      [flang] Prevent a bad folding rewrite · bd1d1701
      Peter Klausler authored
      When a subexpression does not have both constant elements and
      a constant shape, folding is rewriting it into a vector of its
      elements.  This is of course wrong when the shape shows that
      the result has rank greater than 1.
      
      Differential Revision: https://reviews.llvm.org/D134392
      bd1d1701
    • Anders Langlands's avatar
      Allow getting template args for ClassTemplateSpecializations · e8c78d85
      Anders Langlands authored
      Modifies clang_Cursor_getNumTemplateArguments() and friends to work on
      Struct, Class and ClassTemplatePartialSpecialization decls as well as
      functions.
      
      Differential Revision: https://reviews.llvm.org/D134416
      e8c78d85
    • Guray Ozen's avatar
      [mlir] Add map_nested_foreach_thread_to_gpu_blocks op to transform dialect · f7907bc5
      Guray Ozen authored
      This revision adds a new op `map_nested_foreach_thread_to_gpu_blocks` to transform dialect.
      If `generate_gpu_launch` argument is given, the op first generates `gpu_launch`. Otherwise, `target` must be `gpu_launch`. The op searches top level `scf.foreach_threads` inside the `gpu_launch` and distributes them with gpu.block_id attribute.
      Loop mapping is explicit and given by the map_nested_foreach_thread_to_gpu_blocks op. Mapping is done one-to-one, therefore the loops disappear.
      It also adds `gpu dialect` as dependent since the new op can create `gpu::LaunchOp` for given `scf::ForeachThreadOp`.
      
      Reviewed By: nicolasvasilache
      
      Differential Revision: https://reviews.llvm.org/D134190
      f7907bc5
    • Florian Hahn's avatar
      [LoopDeletion] Invalidate SCEV after moving instruction. · d72eb9c9
      Florian Hahn authored
      LoopDeletion may hoist instructions out of a loop using
      makeLoopInvariant without invalidating the SCEV for the moved
      instruction.
      
      Moving the instruction to a different block may change its
      cached block disposition, so invalidate the cached info.
      
      Fixes #57837.
      d72eb9c9
    • Rainer Orth's avatar
      [sanitizer_common] Restore sanitizer_procmaps_solaris.cpp compilation on Solaris 11.3 · 1cd4d63f
      Rainer Orth authored
      When upstream `compiler-rt` was recently imported into GCC's
      `libsanitizer`, Solaris 11.3 bootstrap broke because in 11.3
      `<sys/procfs.h>` doesn't mix with largefile compilation.  I'd caused this
      in D129837 <https://reviews.llvm.org/D129837> where I forgot that the code
      still needs to support Solaris 11.3.
      
      Fixed by restoring the `#undef _FILE_OFFSET_BITS`.
      
      Tested on `sparc-sun-solaris2.11` and `amd64-pc-solaris2.11` (Solaris 11.4)
      in LLVM and both Solaris 11.3 and 11.4 in GCC.
      
      Differential Revision: https://reviews.llvm.org/D133556
      1cd4d63f
    • Simon Pilgrim's avatar
      Fix gcc warning about ambiguous if-else chain · c94cbc34
      Simon Pilgrim authored
      Fixes warnings introduced by D111968
      c94cbc34
    • Nico Weber's avatar
      [clang] Make --ld-path= work with -fuse-ld=lld · 31142c42
      Nico Weber authored
      This allows using --ld-path= to set a custom linker path, while
      still informing clang that the binary at that path is an lld built
      at the same revision as clang, so that clang can make assumptions
      about the flags it supports, its output format, etc.
      
      This currently only has an observable effect on Darwin.
      
      Differential Revision: https://reviews.llvm.org/D134063
      31142c42
    • Simon Pilgrim's avatar
      [TTI] Add OperandValueProperties::OP_NegatedPowerOf2 enum (PR51436) · a6e91415
      Simon Pilgrim authored
      The mul by constant costmodels handle power-of-2 constants, but not negated-power-of-2, despite the backends handling both.
      
      This patch adds the OperandValueProperties::OP_NegatedPowerOf2 enum and wires it for use for basic mul cost analysis and SLP handling.
      
      Fixes #50778
      
      Differential Revision: https://reviews.llvm.org/D111968
      a6e91415
    • Nikita Popov's avatar
      3f1c65a3
    • David Spickett's avatar
      [LLDB] Fix "memory region --all" when there is no ABI plugin · c831cea5
      David Spickett authored
      There are two conditions for the loop exit. Either we hit LLDB_INVALID_ADDRESS
      or the ABI tells us we are beyond mappable memory.
      
      I made a mistake in that second part that meant if you had no ABI plugin
      --all would stop on the first loop and return nothing.
      
      If there's no ABI plugin we should only check for LLDB_INVALID_ADDRESS.
      
      Depends on D134029
      
      Reviewed By: labath
      
      Differential Revision: https://reviews.llvm.org/D134030
      c831cea5