2678 Commits

Author SHA1 Message Date
Christian Sigg
a71a2542a1 [clang][bazel] Port d1cce66469d0739f332b11fdb0fa2a441b1e0483 2025-04-19 07:59:43 +02:00
HighW4y2H3ll
ba273be3bd
[Bazel] Remove redundant gtest_main from codegen_tests, codegen_globalisel_tests, mi_tests (#135316)
For codegen_tests, codegen_globalisel_tests and mi_tests, they already
have their own `main` function defined, so there should be no need to
add `gtest_main` dependency for the main function...

- codegen_tests:
https://github.com/llvm/llvm-project/blob/main/llvm/unittests/CodeGen/TargetOptionsTest.cpp#L73
- codegen_globalisel_tests:
https://github.com/llvm/llvm-project/blob/main/llvm/unittests/CodeGen/GlobalISel/PatternMatchTest.cpp#L978
- mi_tests:
https://github.com/llvm/llvm-project/blob/main/llvm/unittests/MI/LiveIntervalTest.cpp#L933
2025-04-18 10:42:49 -07:00
Christian Sigg
1db03cab70
[mlir][bazel] Port 697aa9995c24a977425e672d76a4a434384b16e3 2025-04-18 10:31:33 +02:00
Alexey Samsonov
bb67de671e
[libc][bazel] Enforce that libc hand-in-hand libs are headers-only. (#136219)
Extend Bazel rule implementation to enforce that all transitive
dependencies of libc_header_library targets (used to implement
hand-in-hand code sharing via headers) indeed only contain header files.

This fixes Bazel portion of PR #133126.
2025-04-17 16:33:38 -07:00
Keith Smiley
1267facdc6
[bazel] Remove duplicate dependency (#136152)
AffineDialect was duplicated in the deps list since
47f4f39265b31e2249536b74d33d63508cdfb457
2025-04-17 09:06:41 -07:00
Zhuoran Yin
47f4f39265
[MLIR][AMDGPU] Fixing word alignment check for bufferload fastpath (#135982)
`delta_bytes % (32 ceilDiv elementBitwidth) != 0` condition is incorrect
in https://github.com/llvm/llvm-project/pull/135014

For example, last load is issued to load only one last element of fp16.
Then `delta bytes = 2`, `(32 ceildiv 16) = 2`. In this case it will be
judged as word aligned. It will send to fast path but get all zeros for
the fp16 because it cross the word boundary.

In reality the equation should be just `delta_bytes % 4` , since a word
is 4 bytes. This PR fix the bug by amending the mod target to 4.
2025-04-17 08:50:31 -04:00
Matthias Springer
23e3cbb2e8
[mlir][Transforms] Delete 1:N dialect conversion driver (#121389)
The 1:N dialect conversion driver has been deprecated. Use the regular
dialect conversion driver instead. This commit deletes the 1:N dialect
conversion driver.

Note for LLVM integration: If you are already using the regular dialect conversion, but still have argument materializations in your code base, simply delete all `addArgumentMaterialization` calls.

For details, see
https://discourse.llvm.org/t/rfc-merging-1-1-and-1-n-dialect-conversions/82513.
2025-04-17 14:37:20 +02:00
NAKAMURA Takumi
de893f87d2 Revert "[bazel] Fix build for 8ebdd9d8a19543992195f197de215c53d506fb72"
This reverts commit f8ea2ed59820a0bef3f23638ce7a5d10165f7109.
2025-04-17 11:31:30 +09:00
Jorge Gorbe Moya
f8ea2ed598 [bazel] Fix build for 8ebdd9d8a19543992195f197de215c53d506fb72 2025-04-16 16:18:34 -07:00
Benjamin Chetioui
8c04656c45
[bazel] Fix bazel build after 2b983a24583dd4e131d727717872a56712b5dd52. (#135976) 2025-04-16 17:19:47 +02:00
Benjamin Chetioui
fe4a31d59d
[bazel] Fix bazel build after 00eaff3e9c897c263a879416d0f151d7ca7eeaff. (#135949) 2025-04-16 14:29:44 +02:00
Alexey Samsonov
71d091699f
[libc][bazel] Fold "libc_function_deps" into "deps" for libc_tests. (#135835)
libc_function_deps and deps are now identical, as we no longer need or
have special treatment for libc_function targets. Merge these attributes
passed to the libc_test macro, and fix all relevant libc_test macro
invocations. This change is a no-op.

This concludes cleanup started in
9b13d345303d819bb83de7ebbeb826d704add0bc.
2025-04-15 20:12:17 -07:00
Zhuoran Yin
2b983a2458
[MLIR][AMDGPU] Adding dynamic size check to avoid subword buffer load (#135014)
Motivation: amdgpu buffer load instruction will return all zeros when
loading sub-word values. For example, assuming the buffer size is
exactly one word and we attempt to invoke
`llvm.amdgcn.raw.ptr.buffer.load.v2i32` starting from byte 2 of the
word, we will not receive the actual value of the buffer but all zeros
for the first word. This is because the boundary has been crossed for
the first word.

This PR come up with a fix to this problem, such that, it creates a
bounds check against the buffer load instruction. It will compare the
offset + vector size to see if the upper bound of the address will
exceed the buffer size. If it does, masked transfer read will be
optimized to `vector.load` + `arith.select`, else, it will continue to
fall back to default lowering of the masked vector load.
2025-04-15 16:36:25 -04:00
Alexey Samsonov
9b13d34530
[libc][bazel] Remove a no-op libc_internal_target macro. (#135818)
This macro is a no-op after 90c001ac9e1d92a1a95d191d1640ab5337a937e5:
libc_function macro now produce a "regular" cc_library target, without
modifying its name, and this target is intended to only be used in
tests.

Thus, libc_internal_target macro is no longer needed, and we can safely
treat libc_function rules and libc_support_library rules identically for
test purposes.

`libc_function_deps` attribute of a `libc_test` macro can also be
cleaned up, but I plan to do this in a subsequent change.
2025-04-15 10:49:52 -07:00
Christian Sigg
12a7155ee2 [mlir][bazel] Port mlir-translate bits of acf964b95f54. 2025-04-13 09:13:17 +02:00
Pranav Kant
a4fbc6f78f
[bazel] Fix a typo (#135460) 2025-04-11 17:05:52 -07:00
Pranav Kant
b74dbf7fb2
[bazel] Add support for SMT Dialect (#135454)
This fixes #131480
2025-04-11 16:34:49 -07:00
Pranav Kant
22c3dac454
[bazel] Fix for #134956 (#135233) 2025-04-10 11:52:33 -07:00
Pranav Kant
02fde3a651
[bazel] Fix for #134298 (#135114) 2025-04-09 18:54:48 -07:00
Pranav Kant
4d06d22da0
[bazel] Fix after #133692 (#135098)
Avoid failures like these:
https://buildkite.com/llvm-project/upstream-bazel/builds/131707#01961bb5-2a7b-4dea-a387-cdfd8bb4db48
2025-04-09 16:22:31 -07:00
Alexey Samsonov
90c001ac9e
[libc][bazel] Use Bazel aspects to implement libc_release_library. (#134948)
Instead of creating hundreds of implicit "filegroup" targets to keep
track of sources and textual headers required to build each libc
function or helper library, use Bazel aspects (see
https://bazel.build/versions/8.0.0/extending/aspects), which enable
transparent collection of transitive sources / textual headers while
walking the dependency DAG, and minimizes the Starlark overhead.

Co-authored-by: Jordan Rupprecht <rupprecht@google.com>
2025-04-09 15:36:48 -07:00
Jakub Kuderski
b92f4d4c33
[bazel][mlir] Add missing dep for X86Vector (#135069)
Follow up fix to https://github.com/llvm/llvm-project/pull/133692
2025-04-09 15:25:44 -04:00
Adam Siemieniuk
0c2a6f2d62
[mlir][x86vector] Simplify intrinsic generation (#133692)
Replaces separate x86vector named intrinsic operations with direct calls
to LLVM intrinsic functions.
    
This rework reduces the number of named ops leaving only high-level MLIR
equivalents of whole intrinsic classes e.g., variants of AVX512 dot on
BF16 inputs. Dialect conversion applies LLVM intrinsic name mangling
further simplifying lowering logic.
    
The separate conversion step translating x86vector intrinsics into LLVM
IR is also eliminated. Instead, this step is now performed by the
existing llvm dialect infrastructure.

RFC:
https://discourse.llvm.org/t/rfc-simplify-x86-intrinsic-generation/85581
2025-04-09 19:59:37 +02:00
lntue
c5e07fb861
[libc] Use correct instruction for arm32 sqrt inline asm. (#134968)
https://godbolt.org/z/3jT7jdrs9
2025-04-09 00:01:45 -04:00
lntue
cf7d34a54d
[libc] Extend fputil::sqrt to use floating point instructions for arm32. (#134499) 2025-04-08 22:14:38 -04:00
Yijia Gu
836476660e [mlir][bazel] add missing deps for LLVMOpsTdFiles 2025-04-08 11:36:18 -07:00
Yijia Gu
3b84b1e163 [clang][bazel] fix typo 2025-04-08 11:13:07 -07:00
Yijia Gu
a557550fa4 [clang][bazel] add missing target 2025-04-08 11:06:52 -07:00
Christian Sigg
4e9cfcf6af [llvm][bazel] Fix BUILD after 561506144531cf0a760bb437fd74c683931c60ae. 2025-04-08 17:28:20 +02:00
Christian Sigg
3a6b9b3a87 [mlir][bazel] Fix after dae0ef53a0b99c6c2b74143baee5896e8bc5c8e7
Remove unnecessary include.
2025-04-08 15:47:14 +02:00
Jorge Gorbe Moya
99d12ac172 [bazel] Fix build after 65813e0e94c0403dad61e8365b39d76d7b3bfc14 2025-04-07 17:03:30 -07:00
Pranav Kant
4607d39c7e
[bazel] Fix build (#134697)
Fixes fallback from #134439
2025-04-07 10:36:38 -07:00
Christian Sigg
9fe6f6a0d4
[bazel] Change gentbl_cc_library(tbl_outs) to dicts (#134349)
Follow up from https://github.com/llvm/llvm-project/pull/134271
2025-04-07 14:23:22 +02:00
Jorge Gorbe Moya
109566a3d0
[bazel] Fold "${Target}Analysis" targets into their respective CodeGen targets. (#134312)
After 3801bf6164f570a145e3ebd20cf9114782ae0329, SPIRVAnalysis needs to
include SPIRV.h provided by SPIRVCodegen, but the CodeGen target already
depends on Analysis, so that would cause a circular dependency.

Analysis is a subdirectory of CodeGen so it makes sense as a part of the
main CodeGen target too.
2025-04-03 15:21:26 -07:00
Jorge Gorbe Moya
158684a80f [bazel] Add missing dep after 586c5e3083428e7473e880dafd5939e8707bc1c9 2025-04-03 11:25:44 -07:00
Christian Sigg
6ddf7cf780
[mlir][bazel] Allow gentbl_cc_library(tbl_outs) to be a dict. (#134271)
This makes the BUILD file shorter and more readable.
I will follow up with converting the other instances.
2025-04-03 18:47:56 +02:00
Jorge Gorbe Moya
990a086d9d [bazel] Add missing dep after 51d1c7288662ea801b07133fd2d22aff6bac50e2 2025-04-02 15:17:06 -07:00
Amy Huang
f475ccd379
Fix to the libc BUILD.bazel file after changing atan_utils.h deps. (#134128)
Additional fix for libc BUILD.bazel after commit 8741412 (#133980)

This seems to match libc/src/math/generic/CMakeLists.txt.
2025-04-02 11:05:36 -07:00
NAKAMURA Takumi
3cc7148fe0 [bazel] Update for #134043 2025-04-02 20:29:52 +09:00
Alexey Samsonov
07504afc42
[libc] Stop depending on .cpp files in libcxx_shared_headers library. (#133999)
Fix two instances of libcxx_shared_headers depending on .cpp files (in
Bazel build):

* Don't depend on exit syscall in LIBC_ASSERT implementation. This
dependency is not used, since LIBC_ASSERT always uses system <assert.h>
in the overlay mode, which is the only mode supported by Bazel.
* Don't depend on libc_errno in str-to-float and str-to-integer
conversions. We only need the ERANGE value, which can be obtained from
the proxy header instead.
2025-04-01 16:23:19 -07:00
Amy Huang
537b6541e8
Fix libc BUILD.bazel after commit 8741412 (#133980)
Recent changes add dependencies to some atan functions. Edit bazel build
file to look more like the CMake file.


See
8741412bdf
2025-04-01 13:32:43 -07:00
Jeremy Kun
179062b2dc
[mlir][bazel] add alwayslink=True to mlir-runner utils (#133787)
MacOS platforms using mlir-runner in lit tests consistently hit the
following error:

```
# .---command stderr------------
# | JIT session error: Symbols not found: [ __mlir_ciface_printMemrefI32 ]
# | Error: Failed to materialize symbols: { (main, { __mlir_printMemrefI32, ... }) }
# `-----------------------------
```

https://github.com/google/heir/issues/1521#issuecomment-2751303404
confirms the issue is fixed by using `alwayslink` on these two targets,
and I confirmed on a separate Apple M1 (OSX version Sequoia 15.3.2.).

I'm not an expert on the mlir runner internals, but given the
mlir-runner is purely for testing, and alwayslink at worst adds some
overhead by not removing symbols, it seems low risk.
2025-04-01 08:58:32 -07:00
Keith Smiley
f30c6a047d
[bazel] Format BUILD files with buildifier (#133802) 2025-03-31 14:38:58 -07:00
Jorge Gorbe Moya
514536731f [bazel] Add missing dep after e4b9486056fab7a262fdafbe70acf393c9767d12 2025-03-31 11:29:09 -07:00
Benjamin Kramer
10dd404d9f [bazel] Make DeltaPasses.def available for fea6b388055284f37852e615fbf5b40a3ba34249 2025-03-30 13:12:18 +02:00
Alexey Samsonov
d724bab806
[libc][bazel] Create a libc_header_library macro for hand-in-hand. (#133131)
Create a proper way to build header-only libraries for llvm-libc code
sharing. Use it to group headers that can be shared with libcxx for
std::from_chars() implementation.

It mostly works, though the macro needs to be updated to enforce that no
.cpp files are listed in dependencies (it's not the case now) - see PR
#133126.
2025-03-26 14:10:41 -07:00
Alexey Samsonov
f0b752e921
[libc][bazel] Stop creatng "public" library targets in libc_function. (#132995)
All downstream users are migrated, so we no longer need to produce
"public"/"release" cc_library target for each libc_function macro
invocation. Instead, we only create internal target (for testing), and
some filegroups, which will be picked up by the libc_release_library
invocation.

This allows us to get rid of "weak" argument to libc_function - this
decision is also postponed to libc_release_library configuration.

Fixes #130327.
2025-03-25 14:38:37 -07:00
Walter Lee
6ddc07163d
Disable some tests on bazel (#132951)
These tests failed at Google after #130757. Disable them in bazel for the time being.
2025-03-25 13:06:20 -04:00
Karlo Basioli
cca9b55f54
Fix bazel test errors caused by #131462 (#132929) 2025-03-25 12:57:09 +00:00
Karlo Basioli
36b36060a1
[mlir][spirv] Fix cyclical dependency in bazel (#132785) 2025-03-25 10:39:04 +00:00