[mlir][MemRef] Make fold-memref-alias-ops use memref interfaces This replaces the large switch-cases and operation-specific patterns in FoldMemRefAliashops with patterns that use the new IndexedAccessOpInterface and IndexedMemCopyOpInterface, which will allow us to remove the memref transforms' dependency on the NVGPU dialect. This does also resolve some bugs and potential unsoundnesses: 1. We will no longer fold in expand_shape into vector.load or vector.transfer_read in cases where that would alter the strides between dimensions in multi-dimensional loads. For example, if we have a `vector.load %e[%i, %j, %k] : memref<8x8x9xf32>, vector<2x3xf32>` where %e is `expand_shape %m [[0], [1], [2. 3]] : memref<8x8x3x3xf32> to 8x8x9xf32, we will no longer fold in that shape, since that would change which value would be read (the previous patterns tried to account for this but failed). 2. Subviews that have non-unit strides in positions that aren't being meaningfully accessed (ex. the outer dimensions of a 1-D vector load) are now folded 3. While it is still not possible to fold a collapse_shape with a transfer_read or transfer_write if it would affect the transfer dimensions, the fold will now occur if it would not 4. DMA operations (nvgpu async copy, memref.dma_start) now support expand_shape and collapse_shape folding in addition to subview. 5. Loading or storing a 1xN vector from a memref where the 1 and N are the result of expanding the same dimension will now fold into loading a vector of length N and a shape cast. 6. An issue where IR would be created before pattern failure has been resolved. Assisted-By: Claude code (generating copies of similar patterns, test generation)
Welcome to the LLVM project!
This repository contains the source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and run-time environments.
The LLVM project has multiple components. The core of the project is itself called “LLVM”. This contains all of the tools, libraries, and header files needed to process intermediate representations and convert them into object files. Tools include an assembler, disassembler, bitcode analyzer, and bitcode optimizer.
C-like languages use the Clang frontend. This component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode -- and from there into object files, using LLVM.
Other components include: the libc++ C++ standard library, the LLD linker, and more.
Consult the Getting Started with LLVM page for information on building and running LLVM.
For information on how to contribute to the LLVM project, please take a look at the Contributing to LLVM guide.
Join the LLVM Discourse forums, Discord chat, LLVM Office Hours or Regular sync-ups.
The LLVM project has adopted a code of conduct for participants to all modes of communication within the project.