Commit Graph

705 Commits

Author SHA1 Message Date
Guillaume Chatelet e431731e08 Revert "[libc] New version of the mem* framework"
This reverts commit 4c19439d24.
2022-10-12 15:35:18 +00:00
Guillaume Chatelet 4c19439d24 [libc] New version of the mem* framework
This version is more composable and also simpler at the expense of being more explicit and more verbose.
This patch is not meant to be submitted but gives an idea of the change.
Codegen can be checked in https://godbolt.org/z/6z1dEoWbs by removing the "static inline" before individual functions.

Unittests are coming.

Suggested review order:
 - utils
 - op_base
 - op_builtin
 - op_generic
 - op_x86 / op_aarch64
 - *_implementations.h

Differential Revision: https://reviews.llvm.org/D135134
2022-10-12 15:26:26 +00:00
Adrian Kuegel b781ef890f [mlir][Bazel] Port 8446f24ef0 2022-10-12 14:07:31 +02:00
wren romano 6206692931 [mlir][sparse] Renaming mlir_sparse_tensor_utils library to SparseTensorRuntime
The "mlir_xxx_utils" naming scheme is reserved/intended for shared libraries, whereas this library must be static due to issues of linking DLLs on Windows.  So we rename the library to avoid any potential confusion.   In addition we also rename the ExecutionEngine/SparseTensorUtils.{h,cpp} files to match the new library name.

Reviewed By: aartbik, stella.stamenova

Differential Revision: https://reviews.llvm.org/D135613
2022-10-11 15:00:11 -07:00
Adrian Kuegel 7407419233 [mlir][Bazel] Remove unused dependency. 2022-10-11 15:39:28 +02:00
Alex Zinenko 3e1f6d02f7 [mlir] add OperationType to the Transform dialect
Add a new OperationType handle type to the Transform dialect. This
transform type is parameterized by the name of the payload operation it
can point to. It is intended as a constraint on transformations that are
only applicable to a specific kind of payload operations. If a
transformation is applicable to a small set of operation classes, it can
be wrapped into a transform op by using a disjunctive constraint, such
as `Type<Or<[Transform_ConcreteOperation<"foo">.predicate,
Transform_ConcreteOperation<"bar">.predicate]>>` for its operand without
modifying this type. Broader sets of accepted operations should be
modeled as specific types.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D135586
2022-10-11 09:55:19 +00:00
Alex Zinenko 6fe0309602 [mlir] switch transform dialect ops to use TransformTypeInterface
Use the recently introduced TransformTypeInterface instead of hardcoding
the PDLOperationType. This will allow the operations to use more
specific transform types to express pre/post-conditions in the future.
It requires the syntax and Python op construction API to be updated.
Dialect extensions will be switched separately.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D135584
2022-10-11 09:55:13 +00:00
Alex Zinenko bba85ebdfe [mlir] add types to the transform dialect
Introduce a type system for the transform dialect. A transform IR type
captures the expectations of the transform IR on the payload IR
operations that are being transformed, such as being of a certain kind
or implementing an interface that enables the transformation. This
provides stricter checking and better readability of the transform IR
than using the catch-all "handle" type.

This change implements the basic support for a type system amendable to
dialect extensions and adds a drop-in replacement for the unrestricted
"handle" type. The actual switch of transform dialect ops to that type
will happen in a separate commit.

See https://discourse.llvm.org/t/rfc-type-system-for-the-transform-dialect/65702

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D135164
2022-10-11 09:55:07 +00:00
Diego Caballero 2d10f81d46 [mlir][Vector] Introduce 'vector.mask' operation and MaskableOpInterface
This patch introduces the `vector.mask` operation and the MaskableOpInterface
as described in https://discourse.llvm.org/t/rfc-vector-masking-representation-in-mlir/64964.
The `vector.mask` operation is used to predicate the execution of operations
implementing the MaskableOpInterface. This interface will be implemented by maskable
operations and provides information about its masking constraints and semantics.

For now, only vector transfer and reduction ops implement the MaskableOpInterface
for illustration and testing purposes.

Reviewed By: nicolasvasilache, rriddle

Differential Revision: https://reviews.llvm.org/D134939
2022-10-10 21:25:43 +00:00
wren romano 1aa06aeb1a [mlir][sparse] Removing DLL attributes from ExecutionEngine/SparseTensor/Enums.h
This differential attempts to resolve certain issues on Windows (e.g., https://reviews.llvm.org/D134933#3843372 and https://reviews.llvm.org/D133462#3844195).

Reviewed By: stella.stamenova, aganea

Differential Revision: https://reviews.llvm.org/D135502
2022-10-10 11:22:12 -07:00
Goran Flegar c7545de9b4 [mlir][Bazel] Fix for reviews.llvm.org/D135559 2022-10-10 16:28:38 +02:00
Simon Giesecke 2f46f50907 Add llvm-gsymutil to the Bazel build files.
Differential Revision: https://reviews.llvm.org/D135568
2022-10-10 13:11:40 +02:00
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