Commit Graph

1142 Commits

Author SHA1 Message Date
Adrian Kuegel
a91f44271b [clang][Bazel] Add missing dependency after 310ee08d5d 2023-04-19 07:56:28 +02:00
Aart Bik
ec42398e8a bazel patch for OpenACC changes
Reviewed By: razvanlupusoru, anlunx

Differential Revision: https://reviews.llvm.org/D148678
2023-04-18 18:43:22 -07:00
Siva Chandra Reddy
447d59e071 [libc][NFC] Move RoundingModeUtils to LibcFPTestHelpers.
Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D148602
2023-04-18 18:37:30 +00:00
Siva Chandra Reddy
e3645eadb8 [libc][NFC] Move ExecuteFunction test util to test/UnitTest.
Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D148611
2023-04-18 16:17:42 +00:00
Alex Brachet
c2423a3345 [clang-scan-deps] Add clang-scan-deps to llvm-driver build
Differential Revision: https://reviews.llvm.org/D148583
2023-04-18 15:02:23 +00:00
Guillaume Chatelet
b3c696fb86 [libc] Add debug messages to bcmp and memcmp tests 2023-04-18 13:35:34 +00:00
Matthias Springer
d5b631240a [mlir][Arith] ValueBoundsOpInterface: Reify with Arith ops
This revision adds an additional `reifyValueBounds` helper that reifies the IR with Arith ops instead of Affine ops. This is needed to support value bounds for integer types different from `index` in a subsequent revision.

Differential Revision: https://reviews.llvm.org/D146524
2023-04-18 16:54:56 +09:00
Aaron Siddhartha Mondal
459420c33a [Bazel] Use dynamic workspace root determination
The `clang:ast` and `clang:builtin_headers_gen` targets currently use hardcoded `external/llvm-project`
paths to access generated headers.

With bzlmod this path becomes dependent on the module name, module version and module extension,
so we need a more dynamic approach.

Does not affect the WORKSPACE build.

Reviewed By: GMNGeoffrey, #bazel_build

Differential Revision: https://reviews.llvm.org/D137007
2023-04-18 01:54:49 +02:00
Sterling Augustine
3a6c66a4ec Make gentable outputs and strip_include_prefix match llvm directory. 2023-04-17 16:51:52 -07:00
Michael Jones
e3d764597f [libc][Bazel][NFC] add missing string deps
With the recent move away from StringStream some tests were given a
dependency on cpp::string. Some of these were missed for the bazel
build, causing build failures.

Differential Revision: https://reviews.llvm.org/D148572
2023-04-17 14:37:33 -07:00
Nick Desaulniers
b3dd9041e6 [arcanist] rm -f for write protected temp files
When running `arc diff` on a newly added file,
utils/arcanist/clang-format.sh is run. For new files there is no change,
but the script will bail. Without the use of the -f flag, we get
interactive prompts like:
rm: remove write-protected regular file '/tmp/tmp.ReMybrBw35'?

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D148555
2023-04-17 13:19:02 -07:00
Siva Chandra Reddy
fc121d0c73 [libc][NFC] Remove the unused FDReader testutil.
Differential Revision: https://reviews.llvm.org/D148454
2023-04-17 17:44:47 +00:00
NAKAMURA Takumi
8b8571106c [Bazel] Move InstCombineTableGen from InstCombine to AMDGPUCodeGen 2023-04-18 01:23:20 +09:00
Siva Chandra Reddy
dcf296b541 [libc][NFC] Remove the StreamWrapper class and use the new test logger.
Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D148452
2023-04-17 15:48:18 +00:00
Alex Brachet
384fca554a Reland "[clang-scan-deps] Migrate to OptTable"
Differential Revision: https://reviews.llvm.org/D139949
2023-04-14 19:16:10 +00:00
Christian Sigg
c2bba2d260 [bazel] Fix build after 33468a5
Add missing dependency.
2023-04-14 20:44:19 +02:00
Christian Sigg
684914f47c [bazel] Fix build after e5f50bd and 62ef97e 2023-04-14 13:39:00 +02:00
Christian Sigg
d45888ec91 Fix bazel build after e5f50bd268 2023-04-14 11:13:41 +02:00
Fangrui Song
200f82c2d9 [bazel] Remove remnant HAVE_LSEEK64 after 5cd554303e 2023-04-13 23:54:08 -07:00
NAKAMURA Takumi
fcc5f9ef50 Generate staging MachineValueType.h (partially) from ValueTypes.td
- Implement `VTEmitter` as `llvm-tblgen -gen-vt`.
- Create a copy of `llvm/Support/MachineValueType.h` into `unittests/Support`.
  It includes `GenVT.inc` generated by `VTEmitter`.
- Implement `MVTTest` in `SupportTests`. It checks equivalence between
  `llvm/Support/MachineValueType.h` and the generated header.

Differential Revision: https://reviews.llvm.org/D146906
2023-04-14 08:41:44 +09:00
Alex Zinenko
842879b3b1 [mlir] fix mismerge in bazel 2023-04-13 14:58:11 +02:00
Alex Zinenko
3fe7127d48 [mlir] add structured (Linalg) transform op matchers
Add a set of transform operations into the "structured" extension of the
Transform dialect that allow one to select transformation targets more
specifically than the currently available matching. In particular, add
the mechanism for identifying the producers of operands (input and init
in destination-passing style) and users of results, as well as
mechanisms for reasoning about the shape of the iteration space.

Additionally, add several transform operations to manipulate parameters
that could be useful to implement more advanced selectors. Specifically,
new operations let one produce and compare parameter values to implement
shape-driven transformations.

New operations are placed in separate files to decrease compilation
time. Some relayering of the extension is necessary to avoid repeated
generation of enums.

Depends on D148013
Depends on D148014
Depends on D148015

Reviewed By: chelini

Differential Revision: https://reviews.llvm.org/D148017
2023-04-13 12:37:51 +00:00
Alex Zinenko
63c9d2b14e [mlir] Add transform.foreach_match
Add a new transform op combinator that implements an "if-then-else"
style of mechanism for applying transformations. Its main purpose is to
serve as a higher-level driver when applying multiple transform scripts
to potentially overlapping pieces of the payload IR. This is similar to
how the various rewrite drivers operate in C++, but at a higher level
and with more declarative expressions. This is not intended to replace
existing pattern-based rewrites, but to to drive more complex
transformations that are exposed in the transform dialect and are too
complex to be expressed as simple declarative rewrites.

Reviewed By: springerm

Differential Revision: https://reviews.llvm.org/D148013
2023-04-12 11:01:38 +00:00
Aart Bik
bdea9b960d [mlir][sparse][gpu] put sparse compiler GPU end-to-end tests back
SM80 flag guards the test for targets that do not support A100 GPUs

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D147863
2023-04-11 15:37:13 -07:00
Fangrui Song
da5bea948d [bazel] Disable layering_check for llvm/unittests:mi_tests after D145707 2023-04-11 14:44:43 -07:00
Caslyn Tonelli
718729e997 [libc] Add memmem implementation
Introduce the `memmem` libc string function.

`memmem_implementation` performs shared logic for `strstr`,
`strcasestr`, and `memmem`; essentially reconfiguring what was the
`strstr_implementation` to support length parameters.

Differential Revision: https://reviews.llvm.org/D147822
2023-04-11 20:49:25 +00:00
Matthias Springer
eabb6ccdc8 [mlir][linalg] Replace getUpperBoundForIndex implementation
Use `reifyValueBound` instead, which is more general not hard-coded to a specific list supported ops.

Also add a `closedUB` parameter to the ValueBoundsOpInterface API.

Differential Revision: https://reviews.llvm.org/D146356
2023-04-11 10:32:34 +09:00
Alex Brachet
82ca29ce54 [libc] Move str{,r}chr implementation to headers
Differential Revision: https://reviews.llvm.org/D147463
2023-04-11 01:16:56 +00:00
Jordan Rupprecht
5e57f1bf52 [bazel][NFC] Replace @bazel_tools//src/conditions with equivalent @platforms rules
Followup to D147354. Using src/conditions is discouraged in favor of using rules from the `@platforms` repository directly.

This replaces three conditions:
* `@bazel_tools//src/conditions:windows` -> `@platforms//os:windows`
* `@bazel_tools//src/conditions:darwin` -> `@platforms//os:macos`
* `@bazel_tools//src/conditions:freebsd` -> `@platforms//os:freebsd`

`llvm/config.bzl` has a non-trivial OS+CPU selection config, so that is omitted from this patch. There is intentionally no equivalent for that in `@platforms` because every project will have their own opinions about what a platform is, and it is not feasible for the bazel selection list to include every possible combination. The recommended idiom there is for projects to define their own supported platforms list, e.g. in a separate BUILD file or platform mapping.

Reviewed By: GMNGeoffrey

Differential Revision: https://reviews.llvm.org/D147948
2023-04-10 11:42:58 -07:00
Jeremy Kun
bfbccfa17c Add support for math.ctlz in convert-math-to-funcs
This change adds a software implementation of the `math.ctlz` operation
and includes it in `--convert-math-to-funcs`.

This is my first change to MLIR, so please bear with me as I'm still learning
the idioms of the codebase.

The context for this change is that I have some larger scale project in which
I'd like to lower from a mix of MLIR dialects to CIRCT, but many of the CIRCT
passes don't support the `math` dialect.

I noticed the content of `convert-math-to-funcs` was limited entirely to
the `pow` functions, but otherwise provided the needed structure to implement
this feature with minimal changes.

Highlight of the changes:

- Add a dependence on the SCF dialect for this lower. I could have lowered
  directly to cf, following the pow lowerings in the same pass, but I felt it
  was not necessary given the existing support for lowering scf to cf.
- Generalize the DenseMap storing op implementations: modify the callback
  function hashmap to be keyed by both OperationType (for me this effectively
  means the name of the op being implemented in software) and the type
  signature of the resulting function.
- Implement the ctlz function as a loop. I had researched a variety of
  implementations that claimed to be more efficient (such as those based on a
  de Bruijn sequence), but it seems to me that the simplest approach would make
  it easier for later compiler optimizations to do a better (platform-aware)
  job optimizing this than I could do by hand.

Questions I had for the reviewer:

- [edit: found mlir-cpu-runner and added two tests] What would I add to the filecheck invocation to actually run the resulting MLIR on a value and assert the output is correct? I have done this manually with the C implementation but I'm not confident my port to MLIR is correct.
- Should I add a test for a vectorized version of this lowering? I followed suit with the ` VecOpToScalarOp` but I admit I don't fully understand what it's doing.

Reviewed By: vzakhari

Differential Revision: https://reviews.llvm.org/D146261
2023-04-10 10:02:00 -07:00
Aart Bik
7fff3bfe78 [bazel build] pull in cubin only when needed
Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D147826
2023-04-07 17:00:33 -07:00
Tomás Longeri
eee3477722 Fix Bazel build after "Implement Pass and Dialect plugins for mlir-opt"
Differential Revision: https://reviews.llvm.org/D147766
2023-04-07 10:10:46 +02:00
Matthias Springer
c3f5fd76d6 [mlir][SCF] ValueBoundsOpInterface: Support scf.for results and iter_args
If an `scf.for` loop yields an equal index-typed value or a shaped value with the same dimension sizes (in comparison to the corresponding iter_arg), bounds can be computed for the iter_arg and the OpResult of the `scf.for` op.

Differential Revision: https://reviews.llvm.org/D146306
2023-04-07 11:57:44 +09:00
Matthias Springer
edc8b602f9 [mlir][linalg] ValueBoundsOpInterface: Add LinalgOps
Also add a few more complex test cases.

Differential Revision: https://reviews.llvm.org/D145806
2023-04-07 11:12:45 +09:00
Matthias Springer
0d88777525 [mlir][SCF] Add ValueBoundsOpInterface impl for scf.for
Only induction variables are supported. iter_args will be supported in a
subsequent change.

Differential Revision: https://reviews.llvm.org/D145804
2023-04-07 10:57:09 +09:00
NAKAMURA Takumi
ff1b820c7d [Bazel] Rework llvm-tblgen for X86ManualFoldTables.def
It is easier to introduce header-only library.
2023-04-06 22:48:10 +09:00
Dmitri Gribenko
203cd159b6 [bazel] Port f3d9abf1f8 2023-04-06 15:00:26 +02:00
Matthias Springer
3fecf9a5c3 [mlir][arith] Add ValueBoundsOpInterface impls
These ops are useful for unit testing. (They do not fold/canonicalize with affine.apply etc.)

Differential Revision: https://reviews.llvm.org/D145696
2023-04-06 10:53:08 +09:00
Matthias Springer
6510fa90a0 [mlir][memref] Add ValueBoundsOpInterface impls
Differential Revision: https://reviews.llvm.org/D145695
2023-04-06 10:35:52 +09:00
Matthias Springer
4f8f01b76c [mlir][linalg] ValueBoundsOpInterface: Add affine.apply op
Differential Revision: https://reviews.llvm.org/D145694
2023-04-06 10:23:06 +09:00
Matthias Springer
8c885658ed [mlir][Interfaces] Add ValueBoundsOpInterface
Ops can implement this interface to specify lower/upper bounds for their result values and block arguments. Bounds can be specified for:
* Index-type values
* Dimension sizes of shapes values

The bounds are added to a constraint set. Users can query this constraint set to compute bounds wrt. to a user-specified set of values. Only EQ bounds are supported at the moment.

This revision also contains interface implementations for various tensor dialect ops, which illustrates how to implement this interface.

Differential Revision: https://reviews.llvm.org/D145681
2023-04-06 02:57:14 +02:00
Aart Bik
61c1ed86a5 [mlir][sparse][gpu] sparse GPU code generator pipeline setup
Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D147571
2023-04-05 15:12:54 -07:00
Aart Bik
19466ebc7f [mlir][sparse][gpu] a first prototype sparse GPU code generator
This implements a proof-of-concept GPU code generator
to the sparse compiler pipeline, currently only capable
of generating CUDA threads for outermost parallel loops.

The objective, obviously, is to grow this concept
to a full blown GPU code generator, capable of the
right combinaton of code generation as well as exploiting
idiomatic kernels or vector specific libraries (think cuSparse).

Reviewed By: ThomasRaoux

Differential Revision: https://reviews.llvm.org/D147483
2023-04-05 11:32:06 -07:00
Alex Zinenko
b7f9bb7188 [mlir] update Bazel bulid for 1ef51e0452 2023-04-05 15:42:33 +02:00
Tomás Longeri
71401f0f98 Fix bazel overlay after "[mlir] Introduce IRDL dialect"
Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D147583
2023-04-05 01:08:54 +00:00
David Blaikie
96c23c9c99 Bazel: Try alwayslink 2023-04-04 17:45:27 +00:00
David Blaikie
d7526d3bbf Bazel: Try textual hdrs for tblgen .def file 2023-04-04 17:37:49 +00:00
David Blaikie
d8ac430c51 Bazel fix spelling 2023-04-04 17:35:26 +00:00
David Blaikie
61e1ed4bb3 Bazel add missing comma 2023-04-04 17:32:34 +00:00
David Blaikie
0f2b57b5f5 Bazel fix - try splitting out llvm-tblgen into a library to support .def files 2023-04-04 17:30:56 +00:00