Commit Graph

693 Commits

Author SHA1 Message Date
Adrian Kuegel b0ac5d7be0 [mlir][Bazel] Port d85f6e5d57 2022-10-07 13:49:28 +02:00
Aart Bik d71dc357b1 [mlir][sparse] remove llvm dependence from sparse bazel
Reviewed By: wrengr, Peiming

Differential Revision: https://reviews.llvm.org/D135401
2022-10-06 14:22:24 -07:00
Alex Brachet d5090cd94a [llvm-driver] Add various tools to the llvm-driver
The llvm-driver, enabled with LLVM_TOOL_LLVM_DRIVER_BUILD combines many llvm executables
into one to save overall toolchain size. This patch adds a few more llvm tools to the
llvm-driver.

Differential Revision: https://reviews.llvm.org/D135281
2022-10-06 05:16:13 +00:00
Aart Bik 80902b72ef [mlir][bazel] fix VectorToGPU bazel breakage
NOTE: this is probably not the long term organization
      that you want to keep after the refactoring to new
      directories, but this fixes the breakage for now;
      I leave proper refactoring of build to the NVGPU
      bazel team.

Differential Revision: https://reviews.llvm.org/D135344
2022-10-05 21:12:01 -07:00
Rob Suderman 684e8bfabb [mlir][mlprogram] Add CAPI project for MLProgram
Reviewed By: jpienaar

Differential Revision: https://reviews.llvm.org/D135291
2022-10-05 10:55:29 -07:00
Aart Bik 02fd0e5de4 [mlir][sparse] fixed typo in fix of bazel fix
Reviewed By: cota

Differential Revision: https://reviews.llvm.org/D135184
2022-10-04 11:15:13 -07:00
Aart Bik 4d997217f4 [mlir][sparse] fix bazel breakage
Reviewed By: cota

Differential Revision: https://reviews.llvm.org/D135183
2022-10-04 10:59:45 -07:00
Guray Ozen 89bb0cae46 [mlir][transform] Create GPU transform dialect
This revision adds GPU transform dialect. It also introduce a prefix such as "transform.gpu" for all ops related to this dialect.

MLIR already had two GPU transform op in linalg. This revision moves these ops into GPUTransformOps. The Ops are as follows:

`transform.structured.map_nested_foreach_thread_to_gpu_blocks`  -> `transform.gpu.map_foreach_to_blocks`
This op selects the outermost (toplevel) foreach_thread and parallelize across GPU blocks. It can also generate `gpu_launch`.

`transform.structured.map_nested_foreach_thread_to_gpu_threads` -> `transform.gpu.map_nested_foreach_to_threads`
This op parallelizes nested foreach_thread that are inside `gpu_launch` across GPU threads.

It doesn't add new functionality, but there are some minor refactoring of the code.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D134800
2022-10-04 13:09:08 +02:00
Matthias Springer 81ca5aa452 [mlir][tensor][NFC] Rename linalg.init_tensor to tensor.empty
tensor.empty/linalg.init_tensor produces an uninititalized tensor that can be used as a destination operand for destination-style ops (ops that implement `DestinationStyleOpInterface`).

This change makes it possible to implement `TilingInterface` for non-destination-style ops without depending on the Linalg dialect.

RFC: https://discourse.llvm.org/t/rfc-add-tensor-from-shape-operation/65101

Differential Revision: https://reviews.llvm.org/D135129
2022-10-04 17:25:35 +09:00
Jordan Rupprecht de471fee27 [bazel] port d033ece0c9 2022-10-03 18:49:14 -07:00
Aart Bik fdadb5c146 [mlir] fix bazel build breakage
Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D135105
2022-10-03 14:39:27 -07:00
Aart Bik 83f2b19f3e [mlir] fix bazel file
Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D135104
2022-10-03 13:58:45 -07:00
Christian Sigg 2ddbe56b34 [Bazel] fixes for 9f77909. 2022-10-03 09:12:21 +02:00
Matthias Springer 598f5275c1 [mlir][interfaces] Add ShapedDimOpInterface
This interface is implemented by memref.dim and tensor.dim. This change makes it possible to remove a build dependency of the Affine dialect on the Tensor dialect (and maybe also the MemRef dialect in the future).

Differential Revision: https://reviews.llvm.org/D133595
2022-10-03 13:58:52 +09:00
wren romano 97bd83b51f [mlir][sparse] SparseTensorUtils post-refactoring cleanup
This differential corrects a few minor rebasing errors from the recent slew of differentials for factoring out the mlir_sparsetensor_utils library.

Reviewed By: aartbik, Peiming

Differential Revision: https://reviews.llvm.org/D134985
2022-09-30 13:29:46 -07:00
Adrian Kuegel e0d5012f6a [mlir][Bazel] Port 11069cbcb4 2022-09-30 08:34:14 +02:00
wren romano 0fca5c5f45 [mlir][sparse] refactoring SparseTensorUtils: (1 of 4) file-splitting
Previously, the SparseTensorUtils.cpp library contained a C++ core implementation, but hid it in an anonymous namespace and only exposed a C-API for accessing it. Now we are factoring out that C++ core into a standalone C++ library so that it can be used directly by downstream clients (per request of one such client). This refactoring has been decomposed into a stack of differentials in order to simplify the code review process, however the full stack of changes should be considered together.

* (this): Part 1: split one file into several
* D133830: Part 2: Reorder chunks within files
* D133831: Part 3: General code cleanup
* D133833: Part 4: Update documentation

This part aims to make no changes other than the 1:N file splitting, and things which are forced to accompany that change.

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D133462
2022-09-29 14:35:27 -07:00
Jakub Kuderski abc362a107 [mlir][arith] Change dialect name from Arithmetic to Arith
Suggested by @lattner in https://discourse.llvm.org/t/rfc-define-precise-arith-semantics/65507/22.

Tested with:
`ninja check-mlir check-mlir-integration check-mlir-mlir-spirv-cpu-runner check-mlir-mlir-vulkan-runner check-mlir-examples`

and `bazel build --config=generic_clang @llvm-project//mlir:all`.

Reviewed By: lattner, Mogball, rriddle, jpienaar, mehdi_amini

Differential Revision: https://reviews.llvm.org/D134762
2022-09-29 11:23:28 -04:00
Benjamin Kramer 23132508d9 [bazel] Port 3f050f6ac4 2022-09-29 00:12:46 +02:00
Christian Sigg 0a14f73126 [Bazel] NFC: Move ParseUtilities.h from 'hdrs' to 'srcs'.
This is slightly cleaner.
2022-09-28 08:30:08 +02:00
Christian Sigg 39bf517e01 [Bazel] Fix after 4b27825ba3. 2022-09-28 08:18:30 +02:00
bixia1 4329ca61e8 [mlir][sparse] Add sparse_tensor.sort operator.
Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D134482
2022-09-27 12:00:08 -07:00
Lorenzo Chelini 4db3a649ea [MLIR] Expose `getAsValues` in `StaticValueUtils.h` (NFC) [reland]
The utility function should live in `StaticValueUtils.h` as it provides
a convenient way to convert a vector of OpFoldResults into a vector of
Values.

Reviewed By: nicolasvasilache, cota

Differential Revision: https://reviews.llvm.org/D134451
2022-09-27 11:18:25 -04:00
Christian Sigg 7876469c77 [Bazel] Remove template_rule and use @bazel_skylib's expand_template instead.
Reviewed By: GMNGeoffrey

Differential Revision: https://reviews.llvm.org/D134347
2022-09-26 15:29:59 +02:00
Guillaume Chatelet aec908f9b2 [libc][NFC] Move bzero_inline to separate file
This allows for easier discovery.
2022-09-26 12:57:51 +00:00
Oleg Shyshkov 4f1c124251 [mlir] Add IteratorType enum to StructuredOpsUtils.
Summary:
Use the new enum in TilingIterface and verify that `iterator_type` attribute in
LinalgOp interface is compatible with the enum values. Later IteratorType enum
will be used in LinalgInterface to replace the current `iterator_type` attribute
array of string.

Existing enums in Linalg are moved into a separate td file and tablegen build
target. This is necessary, have one I32EnumAttr in a shared space that generated
enum class definition and EnumAttrs is dialect-specific location. Otherwise
there might be a conflict that I32EnumAttr generates enum definitions in
multiple places.

Differential Revision: https://reviews.llvm.org/D134634
2022-09-26 11:09:46 +00:00
Adrian Kuegel 585010b4b0 Revert "[mlir][Bazel] Port 730ae80d3e1c47f93f725acb2d37f06fcba06953"
This reverts commit ec8f08ce08.

The change that needed this BUILD fix was reverted.
2022-09-26 10:09:02 +02:00
Adrian Kuegel a096164134 Revert "[mlir][Bazel] Port 730ae80d3e part 2."
This reverts commit b4cc363e86.

The change which needed this BUILD fix was reverted.
2022-09-26 10:04:56 +02:00
Adrian Kuegel b4cc363e86 [mlir][Bazel] Port 730ae80d3e part 2. 2022-09-26 09:51:22 +02:00
Adrian Kuegel ec8f08ce08 [mlir][Bazel] Port 730ae80d3e 2022-09-26 09:45:24 +02:00
Adrian Kuegel a3df255e9c [mlir][Bazel] Port afb0b21f24 2022-09-26 09:38:22 +02:00
Arthur Eubanks 7a8b9307ca [bazel] Always specify --strip=never 2022-09-25 18:49:49 -07:00
Arthur Eubanks 2698be0cc9 [bazel] Add some general build flags 2022-09-25 18:22:22 -07:00
Lei Zhang 465ec4e0b4 [mlir] NFC: move mergeOffsetsSizesAndStrides into Affine/Utils
So that these utility functions can also be used ViewLikeInterface
ops not in the memref dialect.

Reviewed By: mravishankar, christopherbate

Differential Revision: https://reviews.llvm.org/D134487
2022-09-23 13:28:11 -04:00
Arthur Eubanks 0de7c15c88 [bazel] Be consistent and say we don't support libfpm everywhere
We're inconsistent about saying whether or not we support libfpm in the bazel build.

This should perhaps be configurable via a --config.

This allows the buildbots to see when llvm-exegesis-related breakages occur.

Differential Revision: https://reviews.llvm.org/D134510
2022-09-23 09:27:55 -07:00
Jordan Rupprecht 892260d7f3 [bazel] Respect llvm_target_list in llvm-exegesis
- 47afaf2eb0 changed llvm-exegesis cmake rules
- 5b2f838db4 ported them to bazel, but did so by adding all the `lib/{target}/*.cpp` sources in exegesis to the build rule
- c7bf9d084d removed it, because it breaks users who don't build Mips and fail when building `lib/Mips/*.cpp`. But that in turn breaks those who *do* build the Mips target.

This should hopefully fix it for the final time by using selectively build subdirectories of exegesis target libs using llvm_target_exegesis, which is derived from llvm_targets, and is the list that can vary based on the downstream user.

I verified this builds with and without `Mips` in the `DEFAULT_TARGETS` configure list, and also double checked with `bazel query --output=build @llvm-project//llvm:Exegesis` that `lib/Mips/Target.cpp` is being included if and only if `Mips` is in the target list.

Reviewed By: aeubanks

Differential Revision: https://reviews.llvm.org/D134512
2022-09-22 19:20:04 -07:00
Arthur Eubanks c068ea230b [bazel] Remove "nobuildkite" flag for targets depending on libxml2
The buildbots do have libxml2 installed.
2022-09-22 18:30:44 -07:00
Caroline Tice c7bf9d084d [bazel] Remove Mips from Exegesis cc_library definition
Recent update added 'tools/llvm-exegesis/lib/Mips/*.cpp' to srcs for Exegesis cc_library. This was not needed, and in fact breaks things. This CL removes that one change.

Reviewed By: aeubanks

Differential Revision: https://reviews.llvm.org/D134505
2022-09-22 17:39:53 -07:00
Jordan Rupprecht 5b2f838db4 [bazel] Port 47afaf2eb0 to bazel 2022-09-22 15:00:15 -07:00
Adrian Kuegel 539fa1df46 [mlir][Bazel] Port f5fe92f693 2022-09-21 07:51:36 +02:00
Frederik Gossen 6e50d66419 [MLIR] Update bazel build files after 242d558658
Differential Revision: https://reviews.llvm.org/D134301
2022-09-20 15:20:22 -04:00
Peiming Liu 52887071ea [mlir][scf] Support simple symbolic expression without depending on AffineDialect to simply trivial loops.
Remove dependence of AffineDialect

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D134291
2022-09-20 18:13:05 +00:00
Peiming Liu d518fc28b6 [mlir][scf] Support simple symbolic expression when simplify loops
Reviewed By: aartbik, ThomasRaoux

Differential Revision: https://reviews.llvm.org/D134204
2022-09-19 21:50:01 +00:00
Dmitri Gribenko 7b7559aa43 [bazel] Port ba8424a251 2022-09-19 21:21:08 +02:00
Benjamin Kramer 9b2a3d20f2 [bazel] Port 233de4e808 2022-09-19 16:38:20 +02:00
Christian Sigg a6e91040ea [Bazel] Allow lit_test() macro to be used from other repos.
Wrap implicit dependencies in Label() so that they refer to @llvm-project, see https://bazel.build/rules/lib/Label#Label.

This change allows lit_test() to be used from other bazel repositories.
2022-09-17 11:06:07 +02:00
Groverkss 8c867f7827 [MLIR][Presburger] Improve unittest parsing
This patch adds better functions for parsing MultiAffineFunctions and
PWMAFunctions in Presburger unittests.

A PWMAFunction can now be parsed as:

```
PWMAFunction result = parsePWMAF({
    {"(x, y) : (x >= 10, x <= 20, y >= 1)", "(x, y) -> (x + y)"},
    {"(x, y) : (x >= 21)", "(x, y) -> (x + y)"},
    {"(x, y) : (x <= 9)", "(x, y) -> (x - y)"},
    {"(x, y) : (x >= 10, x <= 20, y <= 0)", "(x, y) -> (x - y)"},
});
```

which is much more readable than the old format since the output can be
described as an AffineMap, instead of coefficients.

This patch also adds support for parsing divisions in MultiAffineFunctions
and PWMAFunctions which was previously not possible.

Reviewed By: arjunp

Differential Revision: https://reviews.llvm.org/D133654
2022-09-15 19:28:49 +01:00
Haojian Wu 6c9d2ee490 Revert "Fix bazel build after 84d07d021333f7b5716f0444d5c09105557272e0."
This reverts commit 10250c5a2a as the
related patch is being reverted.
2022-09-15 20:02:27 +02:00
Haojian Wu 10250c5a2a Fix bazel build after 84d07d0213. 2022-09-15 13:52:46 +02:00
Christian Sigg 70ac466676 [Bazel] Add lit tests to bazel builds.
Add BUILD.bazel files for most of the MLIR tests and lit tests itself.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D133455
2022-09-15 07:49:37 +02:00