Commit Graph

2460 Commits

Author SHA1 Message Date
Jorge Gorbe Moya
82aac16ddd [bazel] Remove obsolete exclusion from glob.
lib/Tooling/NodeIntrospection.cpp was deleted in commit
371eccd5df so excluding it from the glob
does nothing.
2025-01-10 18:19:26 -08:00
Benjamin Kramer
d797d94185 [bazel] Port 0aa831e0ed 2025-01-09 21:39:14 +01:00
Benjamin Kramer
f791a4f19f [bazel] Add missing dependency for cbcb7ad32e 2025-01-09 21:38:29 +01:00
Benjamin Kramer
c3d1a50d6a [bazel] Add missing dependency for b79ed8729b 2025-01-09 13:22:02 +01:00
Alina Sbirlea
ac08f0dfef [bazel] Port 8e65940161 2025-01-08 13:18:50 -08:00
Alexey Samsonov
508398021d [libc] Add hardening for FixedVector data structure and fix exposed bug. (#122159)
Add LIBC_ASSERT statements to FixedVector implementation, and zero out
the memory when the elements are removed to flag out-of-bound access and
dangling pointer/reference access.

This change unmasks the bug in one of FixedVector uses for atexit
handlers: dangling reference use, which was actually led to crashes in
the wild (with prod blockstore implementation). Fix it in this CL.
2025-01-08 13:03:59 -08:00
Benjamin Kramer
0bfee00034 [bazel] Port afa8aeeeec 2025-01-07 23:07:08 +01:00
Benjamin Kramer
287a17de15 [bazel] Add missing dependency for 0d9cf2671e 2025-01-07 23:07:08 +01:00
Benjamin Kramer
1eed780a6a [bazel] Update dependency for a738d81cd2 2025-01-07 13:02:13 +01:00
NAKAMURA Takumi
4dc34b0d66 [bazel] Add BuiltinsSPIRV (for #121598) 2025-01-07 08:27:40 +09:00
Alexey Samsonov
4cceea1acc [libc][bazel] Remove customization from several libc BUILD rules. (#121843)
Get rid of the following arguments to libc_support_library and
libc_function rules:

* `defines` (for raw_mutex.h) - it wasn't used correctly (e.g. didn't
provide actual value for spin count), and we can instead fallback to
defaults set in the header itself (or rely on library-level configure
options).
* `features` - there's no need to disable sanitization for a subset of
memory functions -- it generally should be the vendor / user
responsibility to control it (e.g. don't include instrumented libc
functions in the build, since they would be provided by sanitizer
runtimes instead).
* `local_defines` (for printf_parser) - no longer needed, since
LIBC_COPT_MOCK_ARG_LIST has been removed in
e0be78be42

This also removes two ad-hoc BUILD rules (strcpy_sanitized and
printf_mock_parser) which are no longer needed and can be replaced by
strcpy and printf_parser, respectively.

Co-authored-by: Alexey Samsonov <samsonov@google.com>
2025-01-06 14:24:34 -08:00
Alexey Samsonov
c388da6ed3 [libc][bazel] Simplify libc_build_rules by grouping release copts (#121630)
Extract all compiler options used to build "release" versions of libc
API functions into a separate helper function, instead of burying this
logic inside libc_function() macro.

With this change, we further split two "flavors" of cc_library()
produced for each libc public function:

* `<function>.__internal__` library used in unit tests is *not* built
with release copts and is thus indistinguishable from regular
libc_support_library(). Arguably, it's a good thing, because all sources
in a unit test are built with the same set of compiler flags, instead of
"franken-build" when a subset of sources is always built with -O3. If a
user needs to run the tests in optimized mode, they should really be
using Bazel invocation-level compile flags instead.
* `<function>` library that libc users can use to construct their own
static archive *is* built with the same release copts as before. There
is a pre-existing problem that its libc_support_library() dependencies
are not built with the same copts. We're not addressing it here now.
2025-01-06 11:32:43 -08:00
JoelWee
27751c39d4 Update BUILD.bazel after #121482 2025-01-06 15:58:12 +00:00
JoelWee
f0247081fa Fix after #121482 (#121764) 2025-01-06 13:17:37 +00:00
NAKAMURA Takumi
743aee4951 [bazel] Fixup for #121043 2025-01-05 13:05:53 +09:00
Lukas Bergdoll
a738d81cd2 [libc] Improve qsort (with build fix) (#121482) 2025-01-05 06:10:41 +08:00
Alexey Samsonov
9a95c097d0 [libc] Remove some unused includes from headers under src/math/generic. (#121632)
These were indicated by Clang include-cleaner.
2025-01-04 10:02:48 -08:00
Haojian Wu
e4e47cef55 [bazel] Fix the broken llvm-tblgen build for 27f3002974 2025-01-03 10:35:49 +01:00
Angus Lees
bca92b1258 [bazel] Allow SupportTests to be built remotely and cached (#121375)
`SupportTests` fails in the bazel macOS sandbox, because
`FileSystemTest.permissions` expects to be able to modify file
permissions on some otherwise protected files.

Previously this test was marked `local` in bazel, which has
additional undesirable effects such as skipping remote build and cache.

Tighten the bazel tags to just `no-sandbox`.  Note in particular, that
this allows the test to build, execute, and cache remotely (if
configured).

Testing:
- Verified this test fails (as expected) on macOS with no tags, and
  passes with `no-sandbox`.
- Verified this test passes when executed remotely (using an Engflow RBE
  setup) with `no-sandbox`.
2025-01-02 11:33:06 -06:00
Bart Chrzaszcz
a9a3fb5b1a Update BUILD.bazel due to PR #121476
Breaks bazel builds due to missing dependency
2025-01-02 14:38:43 +00:00
Haojian Wu
91c5de7fb8 [bazel] Fix the broken bazel build for clang-tidy after e45e091b90 2024-12-30 09:05:21 +01:00
Schrodinger ZHU Yifan
0b96f1cf68 Revert "[libc] Improve qsort" (#121303)
Reverts llvm/llvm-project#120450
2024-12-29 16:03:53 -05:00
Lukas Bergdoll
d2e71c92b8 [libc] Improve qsort (#120450) 2024-12-29 14:55:44 -05:00
Pranav Kant
5d81b14900 [clang-tidy][bazel] Fix #120547 2024-12-25 06:14:04 +00:00
NAKAMURA Takumi
723aeaf336 [bazel] Fixup for #119199, FrontendAtomic 2024-12-24 00:16:26 +09:00
Peter Hawkins
5cd4274772 [mlir python] Port in-tree dialects to nanobind. (#119924)
This is a companion to #118583, although it can be landed independently
because since #117922 dialects do not have to use the same Python
binding framework as the Python core code.

This PR ports all of the in-tree dialect and pass extensions to
nanobind, with the exception of those that remain for testing pybind11
support.

This PR also:
* removes CollectDiagnosticsToStringScope from NanobindAdaptors.h. This
was overlooked in a previous PR and it is duplicated in Diagnostics.h.

---------

Co-authored-by: Jacques Pienaar <jpienaar@google.com>
2024-12-20 20:32:32 -08:00
Mikhail Goncharov
42873e0cf1 [bazel] port eb6c4197d5 2024-12-20 14:45:48 +01:00
Mikhail Goncharov
84f0098ad1 [bazel] port b03a09e74f 2024-12-20 12:30:05 +01:00
Mikhail Goncharov
fe85c71a7b [bazel] port 53d080c5b5 2024-12-20 10:52:37 +01:00
Mikhail Goncharov
10d84a86e5 [bazel] port 79e859e049 2024-12-19 10:45:20 +01:00
Peter Hawkins
b56d1ec6cb [mlir python] Port Python core code to nanobind. (#120473)
Relands #118583, with a fix for Python 3.8 compatibility. It was not
possible to set the buffer protocol accessers via slots in Python 3.8.

Why? https://nanobind.readthedocs.io/en/latest/why.html says it better
than I can, but my primary motivation for this change is to improve MLIR
IR construction time from JAX.

For a complicated Google-internal LLM model in JAX, this change improves
the MLIR
lowering time by around 5s (out of around 30s), which is a significant
speedup for simply switching binding frameworks.

To a large extent, this is a mechanical change, for instance changing
`pybind11::` to `nanobind::`.

Notes:
* this PR needs Nanobind 2.4.0, because it needs a bug fix
(https://github.com/wjakob/nanobind/pull/806) that landed in that
release.
* this PR does not port the in-tree dialect extension modules. They can
be ported in a future PR.
* I removed the py::sibling() annotations from def_static and def_class
in `PybindAdapters.h`. These ask pybind11 to try to form an overload
with an existing method, but it's not possible to form mixed
pybind11/nanobind overloads this ways and the parent class is now
defined in nanobind. Better solutions may be possible here.
* nanobind does not contain an exact equivalent of pybind11's buffer
protocol support. It was not hard to add a nanobind implementation of a
similar API.
* nanobind is pickier about casting to std::vector<bool>, expecting that
the input is a sequence of bool types, not truthy values. In a couple of
places I added code to support truthy values during casting.
* nanobind distinguishes bytes (`nb::bytes`) from strings (e.g.,
`std::string`). This required nb::bytes overloads in a few places.
2024-12-18 18:55:42 -08:00
Jacques Pienaar
6e8b3a3e0c Revert "[mlir python] Port Python core code to nanobind. (#118583)"
This reverts commit 41bd35b58b.

Breakage detected, rolling back.
2024-12-18 19:31:32 +00:00
Peter Hawkins
41bd35b58b [mlir python] Port Python core code to nanobind. (#118583)
Why? https://nanobind.readthedocs.io/en/latest/why.html says it better
than I can, but my primary motivation for this change is to improve MLIR
IR construction time from JAX.

For a complicated Google-internal LLM model in JAX, this change improves
the MLIR
lowering time by around 5s (out of around 30s), which is a significant
speedup for simply switching binding frameworks.

To a large extent, this is a mechanical change, for instance changing
`pybind11::`
to `nanobind::`.

Notes:
* this PR needs Nanobind 2.4.0, because it needs a bug fix
(https://github.com/wjakob/nanobind/pull/806) that landed in that
release.
* this PR does not port the in-tree dialect extension modules. They can
be ported in a future PR.
* I removed the py::sibling() annotations from def_static and def_class
in `PybindAdapters.h`. These ask pybind11 to try to form an overload
with an existing method, but it's not possible to form mixed
pybind11/nanobind overloads this ways and the parent class is now
defined in nanobind. Better solutions may be possible here.
* nanobind does not contain an exact equivalent of pybind11's buffer
protocol support. It was not hard to add a nanobind implementation of a
similar API.
* nanobind is pickier about casting to std::vector<bool>, expecting that
the input is a sequence of bool types, not truthy values. In a couple of
places I added code to support truthy values during casting.
* nanobind distinguishes bytes (`nb::bytes`) from strings (e.g.,
`std::string`). This required nb::bytes overloads in a few places.
2024-12-18 11:16:11 -08:00
Tristan Ross
7477b61b24 [libc] Add unistd overlay (#119312)
Reverts the revert #119295 of #118882 by expanding #118882 with
additional fixes which made CI unhappy.
2024-12-17 10:40:22 -08:00
Mikhail Goncharov
525c818f08 [bazel] port 6a7d6c5f69 2024-12-17 17:56:43 +01:00
Mikhail Goncharov
34c4f6f937 [MLIR][bazel] port 0693b9e9cc 2024-12-17 13:41:38 +01:00
Yifei Xu
e2a94a97bd Update BUILD.bazel
Fix bazel build after https://github.com/llvm/llvm-project/pull/120116
2024-12-16 22:39:10 -06:00
norx1991
dda1d16747 Update BUILD.bazel
Fix issue introduced by https://github.com/llvm/llvm-project/pull/118839.
2024-12-16 17:33:40 -06:00
Danial Klimkin
a21f9bfe29 [bazel]Fix Bazel build past bc29fc937c (#119874) 2024-12-13 13:56:28 +01:00
Jordan Rupprecht
eac1e13add [bzl][mlir][emitc] Add build targets for EmitC C-API/Python bindings (#119610)
Added by 3c464d2368
2024-12-11 14:31:29 -06:00
Nick Desaulniers
8c3a8c2619 [bazel][libc] fix typo in comment
Link: #119433
2024-12-10 14:40:12 -08:00
Keith Smiley
5d0957fc23 [bazel] Allow overriding py_test rule for lit_test (#119460)
This allows replacing this implementation with another one, such as the
one from aspect_rules_py
2024-12-10 14:22:15 -08:00
Keith Smiley
bedbafff2d [bazel] Fix lit tests with bazel 8.x (#119462)
https://github.com/llvm/llvm-project/issues/83066
2024-12-10 14:09:08 -08:00
Nick Desaulniers
5877e5bd12 [bazel] update .bazelversion to 8.0.0 (#119425)
Fixes:

ERROR: The project you're trying to build requires Bazel 7.3.0
(specified
    in llvm-project/utils/bazel/.bazelversion), but it wasn't found in
    /usr/bin.

    You can install the required Bazel version via apt:
      sudo apt update && sudo apt install bazel-7.3.0

If this doesn't work, check Bazel's installation instructions for help:
      https://bazel.build/install/ubuntu

Link: https://blog.bazel.build/2024/12/09/bazel-8-release.html
2024-12-10 13:07:52 -08:00
Jordan Rupprecht
b2cc66b4f2 [bzl][mlir][mlir-vulkan-runner] Add vulkan deps (#119457)
9735873009
2024-12-10 15:05:16 -06:00
Keith Smiley
f3c675feec [bazel] Port 9a9c1d4a61 (#119456) 2024-12-10 12:56:26 -08:00
Nick Desaulniers
1d0ca626d8 [bazel] fix libc build (#119433)
Due to moving strings out of string.

Link: #118899
2024-12-10 12:29:49 -08:00
Maksim Levental
392622d084 Revert "Revert "[mlir python] Add nanobind support (#119232)
Reverts revert #118517 after (hopefully) fixing builders
(https://github.com/llvm/llvm-zorg/pull/328,
https://github.com/llvm/llvm-zorg/pull/327)

This reverts commit 61bf308cf2.
2024-12-09 16:37:43 -05:00
Dmitri Gribenko
6f190cabe0 [bazel] Port e6cf5d2863 2024-12-06 10:30:09 +01:00
Dmitri Gribenko
e9fb0ad21d [bazel] Port 2ccf7ed277 2024-12-06 10:07:05 +01:00