aboutsummaryrefslogtreecommitdiff
path: root/utils
AgeCommit message (Collapse)AuthorFilesLines
2021-11-22Revert "[mlir] Move AllocationOpInterface to ↵Alexander Belyaev1-38/+0
Bufferize/IR/AllocationOpInterface.td." This reverts commit 3028bca6a987e424365ca67f6dc29e037e52ea11. For some reason using FallbackModel works with CMake and does not work with bazel. Using `ExternalModel` works. I will check what's going on and resubmit tomorrow.
2021-11-22[mlir] Move AllocationOpInterface to Bufferize/IR/AllocationOpInterface.td.Alexander Belyaev1-0/+38
Remove the interface from op defs in MemRefOps.td and make it an external model. This is the first PR of many that will move bufferization-related ops, interfaces, passes to Dialect/Bufferize. RFC: https://llvm.discourse.group/t/rfc-dialect-for-bufferization-related-ops/4712 It is still debated if the comprehensive bufferization has to be moved there as well, so for now I am just moving the "gradual" bufferization. Differential Revision: https://reviews.llvm.org/D114147
2021-11-22Revert "[mlir][Vector] Add a vblendps-based impl for transpose8x8 (both ↵Mehdi Amini1-2/+0
intrin and inline_asm)" This reverts commit a9e236bed835c58be381dadb973a1db0681e4795. This broke the Windows build: mlir\include\mlir/Dialect/X86Vector/Transforms.h(28): error C2061: syntax error: identifier 'uint'
2021-11-22[mlir] Add InitializeNativeTargetAsmParser to ExecutionEngine.Nicolas Vasilache1-0/+1
This is required to allow python to work with lowerings that use inline_asm. Differential Revision: https://reviews.llvm.org/D114338
2021-11-22[mlir][Vector] Add a vblendps-based impl for transpose8x8 (both intrin and ↵Nicolas Vasilache1-0/+2
inline_asm) This revision follows up on the conversation titled: ```[llvm-dev] Understanding and controlling some of the AVX shuffle emission paths``` The revision adds a vblendps-based implementation for transpose8x8 and further distinguishes between and intrinsics and an inline_asm implementation. This results in roughly 20% fewer cycles as reported by llvm-mca: After this revision (intrinsic version, resolves to virtually identical assembly as per the llvm-dev discussion, no vblendps instruction is emitted): ``` Iterations: 100 Instructions: 5900 Total Cycles: 2415 Total uOps: 7300 Dispatch Width: 6 uOps Per Cycle: 3.02 IPC: 2.44 Block RThroughput: 24.0 Cycles with backend pressure increase [ 89.90% ] Throughput Bottlenecks: Resource Pressure [ 89.65% ] - SKXPort1 [ 0.04% ] - SKXPort2 [ 12.42% ] - SKXPort3 [ 12.42% ] - SKXPort5 [ 89.52% ] Data Dependencies: [ 37.06% ] - Register Dependencies [ 37.06% ] - Memory Dependencies [ 0.00% ] ``` After this revision (inline_asm version, vblendps instructions are indeed emitted): ``` Iterations: 100 Instructions: 6300 Total Cycles: 2015 Total uOps: 7700 Dispatch Width: 6 uOps Per Cycle: 3.82 IPC: 3.13 Block RThroughput: 20.0 Cycles with backend pressure increase [ 83.47% ] Throughput Bottlenecks: Resource Pressure [ 83.18% ] - SKXPort0 [ 14.49% ] - SKXPort1 [ 14.54% ] - SKXPort2 [ 19.70% ] - SKXPort3 [ 19.70% ] - SKXPort5 [ 83.03% ] - SKXPort6 [ 14.49% ] Data Dependencies: [ 39.75% ] - Register Dependencies [ 39.75% ] - Memory Dependencies [ 0.00% ] ``` An accessible copy of the conversation is available [here](https://gist.github.com/nicolasvasilache/68c7f34012584b0e00f335bcb374ede0). Reviewed By: ftynse, dcaballe Differential Revision: https://reviews.llvm.org/D114335
2021-11-21[mlir] Move trait to InferTypeOpInterfaceJacques Pienaar1-0/+15
Step towards removing the hard coded behavior for this trait and to instead use common interface. Differential Revision: https://reviews.llvm.org/D114208
2021-11-16[Bazel] Ignore both old and new benchmark directoriesGeoffrey Martin-Noble1-0/+1
This is getting reverted and relanded a lot, breaking the build each time. Differential Revision: https://reviews.llvm.org/D114043
2021-11-16[Bazel] Update .bazelignore for moved google/benchmarkGeoffrey Martin-Noble1-2/+3
We need to avoid directly processing the Bazel config in LLVM's copy of google/benchmark, which was moved in https://github.com/llvm/llvm-project/commit/1ee32055ea. Differential Revision: https://reviews.llvm.org/D114014
2021-11-15[Bazel] Enable layering_check for MLIR buildGeoffrey Martin-Noble1-0/+1
This feature checks that headers included by a file are provided by a header exported by one of the direct dependencies of the build rule in which it is contained. It ensures that appropriate layering (a goal of the LLVM project) is preserved. So far, I'm only adding this to MLIR because we've had it turned on internally since the beginning, so MLIR is already layering clean. It would be nice to also enable it for LLVM, but that requires some additional cleanup. Reviewed By: jpienaar Differential Revision: https://reviews.llvm.org/D113952
2021-11-12Don't define //mlir:MLIRBindingsPythonCore in terms of the NoCAPI and ↵Peter Hawkins1-42/+48
CAPIDeps targets. We noticed that the library structure causes link ordering problems in Google's internal build. However, we don't think the problem is specific to Google's build, it probably can be reproduced anywhere with the right library structure. In general splitting the Python bindings from their dependencies (the C API targets) creates the possibility that the two libraries might end up in the wrong order on the linker command line. We can avoid this problem happening by reverting the structure of the MLIRBindingsPythonCore to represent its dependencies in the usual way, rather than composing an incomplete `MLIRBindingsPythonCoreNoCAPI` target and their CAPI dependencies. It was probably a mistake to rewrite this particular `cc_library()` rule in terms of the two, since nothing guarantees that the two will be correctly ordered by the linker when both are being linked into the same binary, and it was only an incidental "cleanup" done in passing. Otherwise the previous PR (D113565) is fine, since that was about the case where both are being built into two separate shared libraries. It just shouldn't have made this (unrelated) change. Reviewed By: GMNGeoffrey Differential Revision: https://reviews.llvm.org/D113773
2021-11-12[mlir][linalg][bufferize] Decouple ComprehensiveBufferize from LinalgMatthias Springer1-2/+22
The remaining dialects will be decoupled from ComprehensiveBufferize in separate commits. Differential Revision: https://reviews.llvm.org/D113459
2021-11-11Split headers from implementations in MLIR C API Bazel build.Peter Hawkins2-36/+175
This allows clients to build, e.g., the Python bindings against the C API headers, without including the C API implementations. This is useful when distributing software as multiple shared libraries. Reviewed By: GMNGeoffrey Differential Revision: https://reviews.llvm.org/D113565
2021-11-11[mlir][linalg][bufferize] Remove remaining linalg dependenciesMatthias Springer1-0/+2
* Move "linalg.inplaceable" attr name literals to BufferizableOpInterface. * Use `memref.copy` by default. Override to `linalg.copy` in ComprehensiveBufferizePass. These are the last remaining code dependencies on Linalg in Comprehensive Bufferize. The next commit will make ComprehensiveBufferize independent of the Linalg dialect. Differential Revision: https://reviews.llvm.org/D113457
2021-11-11[mlir][X86Vector] Add specialized vector.transpose lowering patterns for AVX2Nicolas Vasilache2-0/+3
This revision adds an implementation of 2-D vector.transpose for 4x8 and 8x8 for AVX2 and surfaces it to the Linalg level of control. Reviewed By: dcaballe Differential Revision: https://reviews.llvm.org/D113347
2021-11-11[mlir][linalg][bufferize] Move more helper functions/structs to interfaceMatthias Springer1-0/+1
Move helper functions for traversing reverse use-def chains. These are useful for implementing custom optimizations (e.g., custom InitTensorOp eliminations). Also move over the AllocationCallbacks struct. This is in preparation for decoupling ComprehensiveBufferize from various dialects. Differential Revision: https://reviews.llvm.org/D113386
2021-11-10Restructure the Test dialect ODS to include the AttrDef in TestOps.td (NFC)Mehdi Amini1-1/+1
This structure is necessary to be able to use AttrDef as arguments on operations. Differential Revision: https://reviews.llvm.org/D113327
2021-11-08[MLIR] Attribute and type formats in ODSJeff Niu1-0/+1
Declarative attribute and type formats with assembly formats. Define an `assemblyFormat` field in attribute and type defs with a `mnemonic` to generate a parser and printer. ```tablegen def MyAttr : AttrDef<MyDialect, "MyAttr"> { let parameters = (ins "int64_t":$count, "AffineMap":$map); let mnemonic = "my_attr"; let assemblyFormat = "`<` $count `,` $map `>`"; } ``` Use `struct` to define a comma-separated list of key-value pairs: ```tablegen def MyType : TypeDef<MyDialect, "MyType"> { let parameters = (ins "int":$one, "int":$two, "int":$three); let mnemonic = "my_attr"; let assemblyFormat = "`<` $three `:` struct($one, $two) `>`"; } ``` Use `struct(*)` to capture all parameters. Reviewed By: rriddle Differential Revision: https://reviews.llvm.org/D111594
2021-11-05[mlir][sparse] Factoring magic numbers into a headerwren romano1-2/+8
Addresses https://bugs.llvm.org/show_bug.cgi?id=52303 Reviewed By: aartbik Differential Revision: https://reviews.llvm.org/D112962
2021-11-05Extend timeout of llvm/unittests:ir_testsTres Popp1-1/+2
This test became much slower after 01d8759ac9
2021-11-05[NFC] Inclusive language: Remove instances of master in URLsQuinn Pham2-4/+4
[NFC] This patch fixes URLs containing "master". Old URLs were either broken or redirecting to the new URL. Reviewed By: #libc, ldionne, mehdi_amini Differential Revision: https://reviews.llvm.org/D113186
2021-11-05Add Bazel support for LLVM_WINDOWS_PREFER_FORWARD_SLASHTres Popp2-0/+6
This was added in df0ba47c36f6bd0865e3286853b76d37e037c2d7
2021-11-05[mlir][linalg][bufferize] Separate pass from ComprehensiveBufferizeMatthias Springer1-15/+40
This commit separates the bufferization from the bufferization pass in Linalg. This allows other dialects to use ComprehensiveBufferize more easily. This commit mainly moves files to a new directory and adds a new build target. Differential Revision: https://reviews.llvm.org/D112989
2021-11-02[mlir][sparse] bazel correction after filename changeAart Bik1-1/+1
Reviewed By: GMNGeoffrey, rdzhabarov Differential Revision: https://reviews.llvm.org/D113052
2021-11-02Revert "Update bazel file after fe364e5dc78c58a915986d9a44cfd65f919a00c2"Tres Popp1-1/+9
This reverts commit 8af9912113fb74f4fcc5457f9e830337fff19df1. The other relevant commit was reverted.
2021-11-02Update bazel file after fe364e5dc78c58a915986d9a44cfd65f919a00c2Tres Popp1-9/+1
2021-11-02[bazel] Update BUILD file for llvm-reduceTres Popp1-0/+1
This is needed after fd41738e2ca975b6d3bea021ef38e6d49f27a71b
2021-11-02[mlir][linalg][bufferize] Add BufferizableOpInterfaceMatthias Springer1-4/+56
This commit adds a new op interface: BufferizableOpInterface. In the future, ops that implement this interface can be bufferized using Comprehensive Bufferize. Note: The interface methods of this interface correspond to the "op interface" in ComprehensiveBufferize.cpp. Differential Revision: https://reviews.llvm.org/D112974
2021-11-02[Bazel] Get `//clang` building on Windows with clang-cl.Chandler Carruth7-64/+155
This required substantially more invasive changes. We need to handle some of the LLVM `config.h` changes differently from the old pattern. These aren't always safe on the commandline, and the Windows ones specifically break Clang. Instead, use conditional defines in the header itself. This more closely matches how CMake builds see the definitions. I think this is also just cleaner and we should maybe move more of the macros out of Bazel. The config defines for Windows that I've kept in Bazel are the ones that LLVM's CMake does at the commandline as well. I've also added numerous ones that CMake uses and we didn't replicate in Bazel. I also needed a different approach to get `libclang` working well. This, IMO, improves things on all platforms. Now we build the plugin and actually wrap it back up with `cc_import`. We have to use a collection of manually tagged `cc_binary` rules to get the naming to work out the right way, but this isn't too different from the prior approach. By directly having a `cc_binary` rule for each platform spelling of `libclang`, we can actually extract the interface library from it and correctly depend on it with `cc_import`. I think the result now is much closer to the intent and to the CMake build for libclang. Sadly, some tests also needed disabling. This is actually narrower than what CMake does. The issue isn't indicative of anything serious -- the test just assumes Unix-style paths. I also have cleaned up the Windows flags in `.bazelrc` to much more closely match what CMake does. Differential Revision: https://reviews.llvm.org/D112399
2021-11-02Re-introduce `copts` hacks for lib/AST includes.Chandler Carruth1-7/+16
Sadly, these are necessary AFAICT. There is a file `lib/AST/CXXABI.h`. On case insensitive file systems like macOS this will collide with `cxxabi.h` on the system if we use the `includes` trick to allow file-relative `#include` of generated files. I've tested this on both Linux and Windows to make sure it remains reasonably portable. Differential Revision: https://reviews.llvm.org/D112883
2021-11-01 Add a Bazel build file for mlir/python.Peter Hawkins2-0/+620
This BUILD file: * generates machine-generated Python files using tblgen, and * exports both generated and handwritten Python files via filegroup() rules. This allows downstream users to use Bazel to build Python wheels that incorporate the MLIR Python bindings. Reviewed By: GMNGeoffrey Differential Revision: https://reviews.llvm.org/D112844
2021-11-01[mlir][gpu] Add basic support to do elementwise ops on mma matrix typethomasraoux1-0/+8
In order to support fusion with mma matrix type we need to be able to execute elementwise operations on them. This add an op to be able to support some basic elementwise operations. This is a is not a full solution as it only supports a limited scope or operations. Ideally we would want to be able to fuse with more kind of operations. Differential Revision: https://reviews.llvm.org/D112857
2021-11-01[mlir][nvvm] Generalize wmma ops to handle more types and shapesthomasraoux1-0/+8
wmma intrinsics have a large number of combinations, ideally we want to be able to target all the different variants. To avoid a combinatorial explosion in the number of mlir op we use attributes to represent the different variation of load/store/mma ops. We also can generate with tablegen helpers to know which combinations are available. Using this we can avoid having too hardcode a path for specific shapes and can support more types. This patch also adds boiler plates for tf32 op support. Differential Revision: https://reviews.llvm.org/D112689
2021-10-28Add support for Bazel builds on Windows with `clang-cl`.Chandler Carruth6-18/+53
Adds basic `--config=clang-cl` to set up the basic options needed, and then fix a number of issues that surface in Windows builds for me. With these fixes, `//llvm/...` builds cleanly. One unittest still fails, but its just due to running out of stack space due to creating a large number of short-lived stack variables. The test should probably be decomposed into a set of tests (`LegalizerInfoTest::RuleSets`), but that seemed like too invasive of a change here and with everything building cleanly this isn't disrupting me experimenting with Windows builds. Some parts of `//clang/...` builds, but that will require more work.
2021-10-26[Bazel] link backtrace library when building llvm/lib/Support under FreeBSDWilliam Muir1-0/+6
Links the backtrace library which is required under FreeBSD when building llvm/lib/Support. This library is similarly linked by CMake on BSD builds at [llvm/lib/Support/CMakeLists.txt](https://github.com/llvm/llvm-project/blob/e158b5634aa67ea3039a62c3d8bda79b77b3b21c/llvm/lib/Support/CMakeLists.txt#L39-L46) Reviewed By: GMNGeoffrey Differential Revision: https://reviews.llvm.org/D110533
2021-10-25[bazel build] (manually) port da47ec3ca076Alina Sbirlea1-0/+1
2021-10-25[mlir][Linalg] Allow comprehensive bufferization to use callbacks for ↵MaheshRavishankar1-0/+1
alloc/dealloc. Using callbacks for allocation/deallocation allows users to override the default. Also add an option to comprehensive bufferization pass to use `alloca` instead of `alloc`s. Note that this option is just for testing. The option to use `alloca` does not work well with the option to allow for returning memrefs.
2021-10-25Revert "[mlir][Linalg] Allow comprehensive bufferization to use callbacks ↵MaheshRavishankar1-1/+0
for alloc/dealloc." This reverts commit c86f218fe4ca661a4348d20b66210324224870e8. Revert because it causes build failure.
2021-10-25[mlir][Linalg] Allow comprehensive bufferization to use callbacks for ↵MaheshRavishankar1-0/+1
alloc/dealloc. Using callbacks for allocation/deallocation allows users to override the default. Also add an option to comprehensive bufferization pass to use `alloca` instead of `alloc`s. Note that this option is just for testing. The option to use `alloca` does not work well with the option to allow for returning memrefs. Differential Revision: https://reviews.llvm.org/D112166
2021-10-25[mlir] support interfaces in Python bindingsAlex Zinenko1-0/+17
Introduce the initial support for operation interfaces in C API and Python bindings. Interfaces are a key component of MLIR's extensibility and should be available in bindings to make use of full potential of MLIR. This initial implementation exposes InferTypeOpInterface all the way to the Python bindings since it can be later used to simplify the operation construction methods by inferring their return types instead of requiring the user to do so. The general infrastructure for binding interfaces is defined and InferTypeOpInterface can be used as an example for binding other interfaces. Reviewed By: gysit Differential Revision: https://reviews.llvm.org/D111656
2021-10-23[mlir] Add polynomial approximation for vectorized math::RsqrtEmilio Cota2-0/+2
This patch adds a polynomial approximation that matches the approximation in Eigen. Note that the approximation only applies to vectorized inputs; the scalar rsqrt is left unmodified. The approximation is protected with a flag since it emits an AVX2 intrinsic (generated via the X86Vector). This is the only reasonably clean way that I could find to generate the exact approximation that I wanted (i.e. an identical one to Eigen's). I considered two alternatives: 1. Introduce a Rsqrt intrinsic in LLVM, which doesn't exist yet. I believe this is because there is no definition of Rsqrt that all backends could agree on, since hardware instructions that implement it have widely varying degrees of precision. This is something that the standard could mandate, but Rsqrt is not part of IEEE754, so I don't think this option is feasible. 2. Emit fdiv(1.0, sqrt) with fast math flags to allow reciprocal transformations. Although portable, this doesn't allow us to generate exactly the code we want; it is the LLVM backend, and not MLIR, who controls what code is generated based on the target CPU. Reviewed By: ezhulenev Differential Revision: https://reviews.llvm.org/D112192
2021-10-18Fix bazel build.Adrian Kuegel1-0/+2
This is a temporary fix, better would be to avoid including llvm/Option/ArgList.h from a Support source file. Differential Revision: https://reviews.llvm.org/D111974
2021-10-15Adds //mlir:GPUTransforms dependency to //llvm:MC as the former includesBogdan Graur1-0/+1
headers from the latter. Differential Revision: https://reviews.llvm.org/D111876
2021-10-14[bazel] Move MC header usage from Support to tblgenReid Kleckner1-1/+5
After the TargetRegistry.h move, nothing in Support includes headers from MC. However, files in tablegen use MC headers, so we must add an entry for them in tblgen srcs. Differential Revision: https://reviews.llvm.org/D111835
2021-10-13[MLIR] Replace std ops with arith dialect opsMogball2-2/+167
Precursor: https://reviews.llvm.org/D110200 Removed redundant ops from the standard dialect that were moved to the `arith` or `math` dialects. Renamed all instances of operations in the codebase and in tests. Reviewed By: rriddle, jpienaar Differential Revision: https://reviews.llvm.org/D110797
2021-10-11[Bazel] Update config for 070315d04c6bGeoffrey Martin-Noble4-7/+8
This updates the Bazel configuration for https://github.com/llvm/llvm-project/commit/070315d04c6b which moved `LLVM_SUPPORT_XCODE_SIGNPOSTS` from llvm-config.h.cmake to config.h.cmake. Also adds a comment for `HAVE_PROC_PID_RUSAGE`, that I spotted was missing. Differential Revision: https://reviews.llvm.org/D111569
2021-10-07[Bazel] Update config for 3b01cf9286Geoffrey Martin-Noble1-0/+20
Updates the Bazel config for changes from https://github.com/llvm/llvm-project/commit/3b01cf9286 by adding configuration for the new OpenMPOpsInterfaces tablegn target. Differential Revision: https://reviews.llvm.org/D111347
2021-10-06[MLIR] Split arith dialect from the std dialectMogball1-0/+112
Create the Arithmetic dialect that contains basic integer and floating point arithmetic operations. Ops that did not meet this criterion were moved to the Math dialect. First of two atomic patches to remove integer and floating point operations from the standard dialect. Ops will be removed from the standard dialect in a subsequent patch. Reviewed By: ftynse, silvas Differential Revision: https://reviews.llvm.org/D110200
2021-09-30[mlir][Linalg] Refactor comprehensive bufferize for external uses - NFCNicolas Vasilache1-0/+1
This revision exposes some minimal funcitonality to allow comprehensive bufferization to interop with external projects. Differential Revision: https://reviews.llvm.org/D110875
2021-09-30[mlir] Remove old "tc" linalg ods generator.Stella Laurenzo1-32/+0
* This could have been removed some time ago as it only had one op left in it, which is redundant with the new approach. * `matmul_i8_i8_i32` (the remaining op) can be trivially replaced by `matmul`, which natively supports mixed precision. Differential Revision: https://reviews.llvm.org/D110792
2021-09-29[Bazel] fix for aa53785f23b2b89a9a423af131697b1f7c92869fKrasimir Georgiev1-0/+1