Commit Graph

725 Commits

Author SHA1 Message Date
wren romano
e0401d2252 [mlir][sparse] Removing the DimLvlType and DimLevelFormat types
This removes another massive source of redundancy, and instead has the Merger.{h,cpp} reuse the SparseTensorEnums library.

Depends On D136005

Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D136123
2022-10-18 15:47:40 -07:00
wren romano
062f29c8d0 [mlir][sparse] Moving Enums.h into Dialect/SparseTensor/IR
Move the SparseTensorEnums library out of the ExecutionEngine directory and into Dialect/SparseTensor/IR.

Depends On D136002

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D136005
2022-10-18 15:15:18 -07:00
wren romano
181b04d276 [mlir][sparse] Factoring out SparseTensorEnums library
This differential splits the SparseTensorEnums library out from the SparseTensorRuntime library. The actual moving of files will be handled in the next differential.

Depends On D135996

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D136002
2022-10-18 14:20:33 -07:00
wren romano
0e77b63bc0 [mlir][sparse] Use the runtime DimLevelType instead of a separate tablegen enum
This differential replaces all uses of SparseTensorEncodingAttr::DimLevelType with DimLevelType.  The next differential will break out a separate library for the DimLevelType enum, so that the Dialect code doesn't need to depend on the rest of the runtime

Depends On D135995

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D135996
2022-10-18 13:45:26 -07:00
Jordan Rupprecht
a096131545 [Bazel] Add target for llvm-debuginfo-analyzer binary 2022-10-18 08:45:10 -07:00
Matthias Springer
cfc9ddaafc [mlir][interfaces][NFC] Move DestinationStyleOpInterface to mlir/Interfaces
This is the second (and final) step of making "destination style" usable without depending on the Linalg dialect. (The first step was D135129.)

This change allows us to provide default bufferization implementations for all destination-style ops. It also allows us to simplify `TilingInterface`. (E.g., `getDestinationOperands` can be removed.)

Differential Revision: https://reviews.llvm.org/D136179
2022-10-18 17:39:06 +02:00
Guillaume Chatelet
5e9945f624
[libc] Fix missing bazel dependency
This fixes breakage introduced in a786096f9d
2022-10-18 16:37:08 +02:00
Jordan Rupprecht
4758cd5ae7 [bazel] Port dd38f89980 and fix 7732c97f52. 2022-10-17 16:54:37 -07:00
Jacques Pienaar
7732c97f52 [mlir][quant] Initial bytecode encoding for quantized types
Add bytecode encoding for quantized types. These mostly follow the
storage representation of these.

Differential Revision: https://reviews.llvm.org/D136004
2022-10-17 16:28:46 -07:00
Fangrui Song
3baadff896 [CMake] Remove CLANG_DEFAULT_STD_C/CLANG_DEFAULT_STD_CXX
When Clang is used as a cross compiler, it should respect the target
platform default. Defaulting to a configure-time CLANG_DEFAULT_STD_C/CLANG_DEFAULT_STD_CXX
does not make much sense.

When Clang is used as a single-platform compiler, we should use Clang
configuration file (https://discourse.llvm.org/t/configuration-files/42529
https://clang.llvm.org/docs/UsersManual.html#configuration-files).

The Gentoo needs from D34365 has been satisfied by a configuration file.

Reviewed By: mgorny

Differential Revision: https://reviews.llvm.org/D133375
2022-10-16 13:15:44 -07:00
Sterling Augustine
d8415b02a5 Revert "[libc] New version of the mem* framework"
This reverts commit https://reviews.llvm.org/D135134 (b3f1d58a13)

That revision appears to have broken Arm memcpy in some subtle
ways. Am communicating with the original author to get a
good reproduction.
2022-10-14 12:32:20 -07:00
Benjamin Kramer
08ec744d4d [bazel] Port 911d2dc (LLVMFrontendHLSL) 2022-10-14 21:08:44 +02:00
Guillaume Chatelet
b3f1d58a13 [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. It also provides minimal implementations for ARM platforms.

    Codegen can be checked here https://godbolt.org/z/chf1Y6eGM

    Differential Revision: https://reviews.llvm.org/D135134
2022-10-14 13:46:42 +00:00
Guillaume Chatelet
6d252a4888 Revert "[libc] New version of the mem* framework"
This reverts commit 9721687835.
2022-10-14 13:21:52 +00:00
Guillaume Chatelet
9721687835 [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. It also provides minimal implementations for ARM platforms.

Codegen can be checked here https://godbolt.org/z/x19zvE59v

Differential Revision: https://reviews.llvm.org/D135134
2022-10-14 12:42:54 +00:00
Guillaume Chatelet
4fed4b0943 Revert "[libc] New version of the mem* framework"
This reverts commit 98bf836f31.
2022-10-14 12:27:04 +00:00
Guillaume Chatelet
98bf836f31 [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. It also provides minimal implementations for ARM platforms.

Codegen can be checked here https://godbolt.org/z/x19zvE59v

Differential Revision: https://reviews.llvm.org/D135134
2022-10-14 12:25:03 +00:00
Alex Brachet
1fda6f6859 [llvm-driver] Add lld
The llvm-driver, enabled with LLVM_TOOL_LLVM_DRIVER_BUILD combines many llvm executables
into one to save overall toolchain size. This patch adds the capability for lld to be part of the
llvm-driver.

Differential Revision: https://reviews.llvm.org/D127472
2022-10-13 19:23:25 +00:00
Guillaume Chatelet
9d1f6466e5 Revert "[libc] New version of the mem* framework"
This reverts commit d55f2d8ab0.
2022-10-13 14:49:58 +00:00
Guillaume Chatelet
d55f2d8ab0 [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. It also provides minimal implementations for ARM platforms.

Codegen can be checked here https://godbolt.org/z/x19zvE59v

Differential Revision: https://reviews.llvm.org/D135134
2022-10-13 14:44:03 +00:00
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