Commit Graph

2249 Commits

Author SHA1 Message Date
Danial Klimkin
d6dc7cf71b Fix bazel build past 89e6a28867 (#106685) 2024-08-30 10:21:55 +02:00
JoelWee
c28b84e30b Update BUILD.bazel after e37d6d2a74 2024-08-29 10:49:59 +01:00
Jakub Kuderski
1bc7057a8e Revert "[mlir][spirv] Add an argmax integration test with mlir-vulkan-runner" (#106457)
Reverts llvm/llvm-project#106426.

This caused failures on nvidia:
https://lab.llvm.org/buildbot/#/builders/138/builds/2853
2024-08-28 17:27:06 -04:00
Angel Zhang
17b7a9da46 [mlir][spirv] Add an argmax integration test with mlir-vulkan-runner (#106426)
This PR adds an integration test for an argmax kernel with
`mlir-vulkan-runner`. This test exercises the `convert-to-spirv` pass
(landed in #95942) and demonstrates that we can use SPIR-V ops as
"intrinsics" among higher-level dialects.

The support for `index` dialect in `mlir-vulkan-runner` is also added.
2024-08-28 16:29:32 -04:00
Jakub Kuderski
b2f1d06986 [mlir][amdgpu] Improve Chipset version utility (#106169)
* Fix an OOB access
* Add comparison operators
* Add documentation
* Add unit tests
2024-08-28 09:55:38 -04:00
Jordan Rupprecht
c1a4896070 [bazel][test] Add missing transforms test dep (#106323)
For 73c3b7337b
2024-08-27 20:26:11 -05:00
Jordan Rupprecht
82db08e731 [bazel][mlir] Add missing ROCDLTarget srcs/deps (#106322)
For 016e1eb9c8
2024-08-27 20:21:02 -05:00
Jordan Rupprecht
2a3d735f91 [bazel][mlir] Add ConvertToSPIRV dep to mlir-vulkan-runner (#106285)
New dep needed for 2bf2468553
2024-08-27 15:54:39 -05:00
Angel Zhang
2bf2468553 [mlir][spirv] Integrate convert-to-spirv into mlir-vulkan-runner (#106082)
**Description**
This PR adds a new option for `convert-to-spirv` pass to clone and
convert only GPU kernel modules for integration testing. The reason for
using pass options instead of two separate passes is that they both
consist of `memref` types conversion and individual dialect patterns,
except they run on different scopes. The PR also replaces the
`gpu-to-spirv` pass with the `convert-to-spirv` pass (with the new
option) in `mlir-vulkan-runner`.

**Future Plan**
Use nesting pass pipelines in `mlir-vulkan-runner` instead of adding
this option.

---------

Co-authored-by: Jakub Kuderski <kubakuderski@gmail.com>
2024-08-27 12:16:54 -04:00
Benjamin Kramer
7fc67b5eb5 [bazel] Port 1387ba48a3 2024-08-26 20:11:43 +02:00
Keith Smiley
be8ee098c4 [bazel] Move lldb-dap cc_binary to lldb/BUILD.bazel (#105733)
On linux lldb-dap uses the location of the lldb-dap binary to search for
lldb-server. Previously these were produced in different directories
corresponding to the BUILD file paths. It's not ideal that the BUILD
file location matters for the binary at runtime but it doesn't hurt to
have this tool here too like the others.
2024-08-22 18:27:59 -07:00
Chenguang Wang
216d6a0652 [bazel] Fix mlir build broken by 681ae097. (#105552)
The cmake config creates two targets, `MLIRTensorMeshShardingExtensions`
and `MLIRTensorAllExtensions`; but for bazel, with the `Func` dialect we
only have a single `FuncExtensions`. Here I am following the `Func`
dialect convension to only create a single `TensorExtensions`.
2024-08-21 09:54:57 -07:00
Benjamin Kramer
3083459c1d [bazel] Port a3d41879ec 2024-08-21 11:47:48 +02:00
Benjamin Kramer
019e1a3a42 [bazel] Add missing dependencies for c8a678b1e4 2024-08-20 23:58:20 +02:00
Angel Zhang
93eda08bab [mlir][spirv] Support gpu in convert-to-spirv pass (#105010)
This PR adds conversion patterns for GPU to the `convert-to-spirv` pass,
introduced in #95942. Now the pass is able to convert each `gpu.module`
and its ops within a `builtin.module` into a `spirv.module`.

**Future Plans**
- Use `gpu.launch_func` to invoke kernel from host functions
- Potentially integrate into the `mlir-vulkan-runner` for e2e testing
2024-08-20 13:17:17 -04:00
Chenguang Wang
abd3a2ded3 [bazel] Add missing deps in {Arith,DLTI}DialectTdFiles (#105091) 2024-08-20 09:39:03 -07:00
Kunwar Grover
8ac924744e [bazel] Port bf68e9047f (#104907)
Add dep on ControlFlowInterfaces for arith td files
2024-08-20 09:33:18 -07:00
Fangrui Song
7c06786479 [CMake] Remove HAVE_LINK_H
We can remove the variable from https://reviews.llvm.org/D5610 since
link.h is available on Linux (glibc/musl/Bionic), FreeBSD, and NetBSD.
Use `__has_include(<link.h>)` before including it.

Pull Request: https://github.com/llvm/llvm-project/pull/104893
2024-08-20 08:50:24 -07:00
Billy Zhu
fbef911dc3 [bazel] Fix cyclic dependencies for macos (#104528)
Similar to https://github.com/llvm/llvm-project/pull/104481. Replace
more "Utility" dependencies with "UtilityHeaders" to avoid cyclic
dependency when building on macos.
2024-08-16 10:05:56 -07:00
Fangrui Song
e25f6b0fa6 [Bazel] Port AST/ByteCode #104552 2024-08-16 08:33:52 -07:00
Haojian Wu
7d77fb2971 [bazel] Port for 75cb9edf09 2024-08-16 12:22:54 +02:00
Keith Smiley
8ffdc87656 [bazel] Port 47721d4618 (#104481)
Made more difficult by many header circular dependencies
2024-08-15 11:50:16 -07:00
Keith Smiley
dd3f1313ae [bazel] Enable more lit self tests (#104285)
I assume the intent of the initial `*/*.py` was to also collect things
in `*.py`, but that's not what bazel does unless you use `**/*.py` which
is what we're doing now. A few of these tests fail so I explicitly
disabled them until someone has time to debug.
2024-08-15 09:59:29 -07:00
Haojian Wu
9a9ce9112f [bazel] Port for 141536544f 2024-08-15 11:01:26 +02:00
Keith Smiley
f1779ae53b [bazel] Port 4bac8fd890 (#104278) 2024-08-14 14:58:43 -07:00
quanwanandy
5eb6330ef6 Fix bazel build (#104054)
Tested w/ bazel locally.
2024-08-14 19:08:27 +02:00
Keith Smiley
c4cba6aa3d [bazel] Add support for tblgen-lsp-server (#103478) 2024-08-13 14:58:48 -07:00
Keith Smiley
f1fe451065 [bazel] Upgrade to 7.3.0 (#102991)
Most importantly this rc has a change that we had to revert for
previously
2024-08-12 18:06:05 -07:00
quanwanandy
290f7eacb9 Fix bazel build (#102960) 2024-08-12 12:27:54 -07:00
Yijia Gu
13fc9148ba [mlir][bazel] remove extra blanks in mlir-tblgen test 2024-08-09 14:09:15 -07:00
Yijia Gu
842789be6b [mlir][bazel] add missing td dependency in mlir-tblgen test 2024-08-09 13:50:12 -07:00
Yijia Gu
95820ca263 [mlir][bazel] revert bazel rule change for DLTITransformOps 2024-08-09 10:18:18 -07:00
Yijia Gu
6f19a7b94a [mlir][bazel] add bazel rule for DLTITransformOps 2024-08-09 10:00:53 -07:00
Haojian Wu
5c0eb1a6e4 [bazel] Add missing dep for the SPIRVToLLVM target 2024-08-09 16:52:09 +02:00
Haojian Wu
3bd63d4aa7 [bazel] Port for d45de8003a 2024-08-09 16:40:35 +02:00
Angel Zhang
93fc4590d9 [mlir][spirv] Support memref in convert-to-spirv pass (#102534)
This PR adds conversion patterns for MemRef to the `convert-to-spirv`
pass, introduced in #95942. Conversions from MemRef memory space to
SPIR-V storage class were also included, and would run before the final
dialect conversion phase.

**Future Plans**
- Add tests for ops other than `memref.load` and `memref.store`

---------

Co-authored-by: Jakub Kuderski <kubakuderski@gmail.com>
2024-08-09 10:14:37 -04:00
Haojian Wu
38e02059a7 [bazel] Port for 9b06e25e73 2024-08-09 13:18:26 +02:00
Haojian Wu
059e7be2d1 [bazel] Port for 3fffa6d486 2024-08-09 11:31:26 +02:00
Michael Jones
d851b5c12c [libc] Make str_to_float independent of fenv (#102369)
The str_to_float conversion code doesn't need the features provided by
fenv and the dependency is creating a blocker for hand-in-hand. This
patch uses a workaround to remove this dependency.
2024-08-08 14:39:07 -07:00
Joseph Huber
cf416e0a1b [libc] Use proxy headers for limits.h values (#102378)
Summary:
This defines some constants that may conflict with the system when in
overlay mode. Use the proxy header instead.

Fixes: https://github.com/llvm/llvm-project/issues/102368
2024-08-07 17:01:28 -05:00
Fangrui Song
72b73e23b6 Revert "demangle function names in trace files (#87626)"
This reverts commit 0fa20c55b5.

Storing raw symbol names is generally preferred in profile files.
Demangling might lose information. Language frontends might use
demangling schemes not supported by LLVMDemangle
(https://github.com/llvm/llvm-project/issues/45901#issuecomment-2008686663).
In addition, calling `demangle` for each function has a significant
performance overhead (#102222).

I believe that even if we decide to provide a producer-side demangling,
it would not be on by default.

Pull Request: https://github.com/llvm/llvm-project/pull/102274
2024-08-07 12:23:28 -07:00
RoseZhang03
0759508ff4 [libc] add sin/cos/tan functions to bazel build file (#101756)
Needed to add sin/cos/tan fuzz tests to google3
2024-08-05 21:16:25 +00:00
Fangrui Song
c4fac0ecd2 [Bazel] Port f3bfc56327 2024-08-01 17:50:14 -07:00
MaheshRavishankar
6740d701bd [mlir][Linalg] Deprecate linalg::tileToForallOp and linalg::tileToForallOpUsingTileSizes (#91878)
The implementation of these methods are legacy and they are removed in
favor of using the `scf::tileUsingSCF` methods as replacements. To get
the latter on par with requirements of the deprecated methods, the
tiling allows one to specify the maximum number of tiles to use instead
of specifying the tile sizes. When tiling to `scf.forall` this
specification is used to generate the `num_threads` version of the
operation.

A slight deviation from previous implementation is that the deprecated
method always generated the `num_threads` variant of the `scf.forall`
operation. Instead now this is driven by the tiling options specified.
This reduces the indexing math generated when the tile sizes are
specified.

**Moving from `linalg::tileToForallOp` to `scf::tileUsingSCF`**

```
OpBuilder b;
TilingInterface op;
ArrayRef<OpFoldResult> numThreads;
ArrayAttr mapping;
FailureOr<ForallTilingResult> result =linalg::tileToForallOp(b, op, numThreads, mapping);
```

can be replaced by
```
scf::SCFTilingOptions options;
options.setNumThreads(numThreads);
options.setLoopType(scf::SCFTilingOptions::LoopType::ForallOp);
options.setMapping(mapping.getValue()); /*note the difference that setMapping takes an ArrayRef<Attribute> */
FailureOr<scf::SCFTilingResult> result = scf::tileUsingSCF(b, op, options);
```

This generates the `numThreads` version of the `scf.forall` for the
inter-tile loops, i.e.

```
... = scf.forall (%arg0, %arg1) in (%nt0, %nt1) shared_outs(...)
```

**Moving from `linalg::tileToForallOpUsingTileSizes` to
`scf::tileUsingSCF`**

```
OpBuilder b;
TilingInterface op;
ArrayRef<OpFoldResult> tileSizes;
ArrayAttr mapping;
FailureOr<ForallTilingResult> result =linalg::tileToForallOpUsingTileSizes(b, op, tileSizes, mapping);
```

can be replaced by
```
scf::SCFTilingOptions options;
options.setTileSizes(tileSizes);
options.setLoopType(scf::SCFTilingOptions::LoopType::ForallOp);
options.setMapping(mapping.getValue()); /*note the difference that setMapping takes an ArrayRef<Attribute> */
FailureOr<scf::SCFTilingResult> result = scf::tileUsingSCF(b, op, options);
```

Also note that `linalg::tileToForallOpUsingTileSizes` would effectively
call the `linalg::tileToForallOp` by computing the `numThreads` from the
`op` and `tileSizes` and generate the `numThreads` version of the
`scf.forall`. That is not the case anymore. Instead this will directly
generate the `tileSizes` version of the `scf.forall` op

```
... = scf.forall(%arg0, %arg1) = (%lb0, %lb1) to (%ub0, %ub1) step(%step0, %step1) shared_outs(...)
```

If you actually want to use the `numThreads` version, it is upto the
caller to compute the `numThreads` and set `options.setNumThreads`
instead of `options.setTileSizes`. Note that there is a slight
difference in the num threads version and tile size version. The former
requires an additional `affine.max` on the tile size to ensure
non-negative tile sizes. When lowering to `numThreads` version this
`affine.max` is not needed since by construction the tile sizes are
non-negative. In previous implementations, the `numThreads` version
generated when using the `linalg::tileToForallOpUsingTileSizes` method
would avoid generating the `affine.max` operation. To get the same
state, downstream users will have to additionally normalize the
`scf.forall` operation.

**Changes to `transform.structured.tile_using_forall`**

The transform dialect op that called into `linalg::tileToForallOp` and
`linalg::tileToForallOpUsingTileSizes` have been modified to call
`scf::tileUsingSCF`. The transform dialect op always generates the
`numThreads` version of the `scf.forall` op. So when `tile_sizes` are
specified for the transform dialect op, first the `tile_sizes` version
of the `scf.forall` is generated by the `scf::tileUsingSCF` method which
is then further normalized to get back to the same state. So there is no
functional change to `transform.structured.tile_using_forall`. It always
generates the `numThreads` version of the `scf.forall` op (as it did
before this change).

---------

Signed-off-by: MaheshRavishankar <mahesh.ravishankar@gmail.com>
2024-07-31 12:32:07 -07:00
Adrian Kuegel
51681409ae [mlir][Bazel] Adapt to 2b23e6c8d6 2024-07-30 11:38:47 +00:00
Michael Jones
ee6d932b4f [libc][bazel] Remove tid tests from bazel (#101109)
In patch https://github.com/llvm/llvm-project/pull/100915 the tid code
was reverted. The bazel build wasn't updated, leaving some broken
targets. This patch fixes those.
2024-07-29 17:39:30 -07:00
NAKAMURA Takumi
25efb746d9 [Bazel] Use PACKAGE_VERSION for version string.
This enables "-rc" suffix in release branches.
2024-07-28 17:45:33 +09:00
Keith Smiley
06429a4fbc [bazel] Port 26d92826a5 (#100829) 2024-07-26 15:50:09 -07:00
Dmitry Chernenkov
67ad23fe17 [Bazel] Fix Bazel build for Bolt 2024-07-26 11:59:40 +00:00
Emilio Cota
f4be6812e2 [mlir][bazel] fix for c194bc77a2 2024-07-25 22:52:31 -04:00