Commit Graph

2805 Commits

Author SHA1 Message Date
Karlo Basioli
8fc20bffab Fix bazel build issue caused by 142986 (#144721) 2025-06-18 16:07:56 +01:00
Karlo Basioli
5a9cc93a20 Fix for bazel build #142079 (#144665) 2025-06-18 10:57:03 +01:00
Karlo Basioli
58c4fa96cb Fix bazel build for #142771 (#144659) 2025-06-18 10:21:37 +01:00
Yijia Gu
0cfc59ff51 [mlir][bazel] remove extra empty space for XeGPUTransforms 2025-06-17 10:56:31 -07:00
Yijia Gu
030b5519ec [mlir][bazel] add missing deps for XeGPUTransforms 2025-06-17 10:52:34 -07:00
Karlo Basioli
7ec103a984 Port #143108 to bazel (#144538) 2025-06-17 15:52:33 +01:00
Benjamin Kramer
de3339063a [bazel] Port b4e39e4ff9 2025-06-17 15:44:30 +02:00
Karlo Basioli
dfd00edbab Fix for #144391 not fully addressed by #144484 (#144488) 2025-06-17 10:37:18 +01:00
Karlo Basioli
64bd4858dc Amend enviroment variables in bazel - change from #144391 (#144484) 2025-06-17 10:09:10 +01:00
Jorge Gorbe Moya
199428e047 [bazel][lld] Remove unneeded dependencies. (#144455)
As far as I can tell these are not used in any includes in their
respective targets, and building all of LLD with
```
bazel build --config=generic_clang @llvm-project//lld/...
```
still works.
2025-06-16 20:41:40 -07:00
Jacques Pienaar
9e16792639 [mlir][bzl] Add CAPIIndex rule. (#144248) 2025-06-14 23:35:20 -07:00
Jorge Gorbe Moya
15f100d144 [bazel] fix mlir/tblgen.bzl formatting after 6e988bd33f 2025-06-13 17:17:20 -07:00
Jorge Gorbe Moya
2c440232e2 [bazel][libc] Add missing deps after 51689c9df2 2025-06-13 15:07:14 -07:00
Reid Kleckner
52a6492136 [bazel] Add missing errno deps one more time 2025-06-13 20:32:21 +00:00
Reid Kleckner
acc58ac8bf [bazel] Add missing dep for 52d34865b9 (#144147) 2025-06-13 12:37:20 -07:00
Reid Kleckner
f6bf3bd5e0 [bazel] Fix XeGpu deps for 5578bcbcfd (#144133) 2025-06-13 11:08:15 -07:00
Michael Jones
51689c9df2 [libc][NFC] clean internal fd handling (#143991)
The previous internal fcntl implementation modified errno directly, this
patch fixes that. This patch also moves open and close into OSUtil since
they are used in multiple places. There are more places that need
similar cleanup but only got comments in this patch to keep it
relatively reviewable.

Related to: https://github.com/llvm/llvm-project/issues/143937
2025-06-13 10:31:47 -07:00
Reid Kleckner
ec330cf670 [bazel] Update llvm-config.h and disable DebugLoc tracking (#144125)
In c588224ca7, @chapuni set
LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING to 1, but from what I can tell,
this is not the default setting for CMake builds. I think the intention
was mostly just to update llvm-config.h to fix the Bazel build.

I'm adding LLVM_ENABLE_DEBUGLOC_ORIGIN_TRACKING as well to fix the build
for the same purpose.
2025-06-13 10:31:35 -07:00
Reid Kleckner
6e988bd33f [mlir] Forward **kwargs through gentbl_shard_rule (#144001)
This allows clients to pass additional cc_library arguments through this
macro to the build rules it calls.
2025-06-13 09:56:57 -07:00
Reid Kleckner
e1bb35d067 [bazel] Fix modules build for llvm-libc (speculative) (#143995) 2025-06-12 16:52:32 -07:00
lntue
d1ca8d891f [libc][math] Refactor expf implementation to header-only in src/__support/math folder. (#143790)
This is a step in preparation for:
https://discourse.llvm.org/t/rfc-make-clang-builtin-math-functions-constexpr-with-llvm-libc-to-support-c-23-constexpr-math-functions/86450
2025-06-12 13:18:30 -04:00
Jorge Gorbe Moya
6c72084a57 [bazel] port 1ecd108cb7 2025-06-11 16:57:14 -07:00
lntue
d87eea35fa [libc] Move libc_errno.h to libc/src/__support and make LIBC_ERRNO_MODE_SYSTEM to be header-only. (#143187)
This is the first step in preparation for:
https://discourse.llvm.org/t/rfc-make-clang-builtin-math-functions-constexpr-with-llvm-libc-to-support-c-23-constexpr-math-functions/86450
2025-06-11 16:25:27 -04:00
Jorge Gorbe Moya
c70658e32d [bazel] port 5dafe9dca8 2025-06-11 13:09:11 -07:00
Jorge Gorbe Moya
d5f68cb145 [bazel] Port fe7bf4b90b 2025-06-11 12:10:09 -07:00
Yifei Xu
8d7da9a2a4 Update BUILD.bazel
Add missing dependency after https://github.com/llvm/llvm-project/pull/142916.
2025-06-11 13:33:23 -05:00
NAKAMURA Takumi
ee3f50939d [bazel] Turn on LLVM_ENABLE_PLUGINS on posix
Since #141650, `LLVM_ABI inline` has had different linkage regarding
to LLVM_ENABLE_PLUGINS.

This was introduced in 8830e3802a (llvmorg-21-init-14426-g8830e3802a92)
but reverted in #143419 due to breakage of msvc build.
2025-06-10 21:41:33 +09:00
Yifei Xu
787efa78a4 [bazel] Revert "[bazel] llvm-config.h: Turn on LLVM_ENABLE_PLUGINS" as it fails TensorFlow Windows build (#143419)
Here is the error message

[3,466 / 5,762] 1 / 149 tests; [Sched] Compiling
llvm/lib/Support/BinaryStreamError.cpp ... (456 actions, 2 running)
ERROR: C:/t/g5cdusdm/external/llvm-project/llvm/BUILD.bazel:253:11:
Compiling llvm/lib/Support/ExtensibleRTTI.cpp [for tool] failed: (Exit
1): clang-cl.exe failed: error executing CppCompile command (from target
@@llvm-project//llvm:Support)
  cd /d C:/t/g5cdusdm/execroot/org_tensorflow
SET INCLUDE=C:\Program Files\Microsoft Visual
Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include;C:\Program
Files\Microsoft Visual
Studio\2022\Community\VC\Auxiliary\VS\include;C:\Program Files
(x86)\Windows Kits\10\include\10.0.22621.0\ucrt;C:\Program Files
(x86)\Windows Kits\10\\include\10.0.22621.0\\um;C:\Program Files
(x86)\Windows Kits\10\\include\10.0.22621.0\\shared;C:\Program Files
(x86)\Windows Kits\10\\include\10.0.22621.0\\winrt;C:\Program Files
(x86)\Windows
Kits\10\\include\10.0.22621.0\\cppwinrt;C:\tools\LLVM\lib\clang\18\include
SET PATH=C:\Program Files\Microsoft Visual
Studio\2022\Community\VC\Tools\MSVC\14.42.34433\bin\HostX64\x64;C:\Program
Files\Microsoft Visual
Studio\2022\Community\Common7\IDE\VC\VCPackages;C:\Program
Files\Microsoft Visual
Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program
Files\Microsoft Visual
Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team
Explorer;C:\Program Files\Microsoft Visual
Studio\2022\Community\MSBuild\Current\bin\Roslyn;C:\Program Files
(x86)\Windows Kits\10\bin\10.0.22621.0\\x64;C:\Program Files
(x86)\Windows Kits\10\bin\\x64;C:\Program Files\Microsoft Visual
Studio\2022\Community\\MSBuild\Current\Bin\amd64;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Program
Files\Microsoft Visual Studio\2022\Community\Common7\IDE\;C:\Program
Files\Microsoft Visual
Studio\2022\Community\Common7\Tools\;;C:\Windows\system32;C:\Program
Files\Microsoft Visual
Studio\2022\Community\Common7\IDE\VC\Linux\bin\ConnectionManagerExe
    SET PWD=/proc/self/cwd
    SET TEMP=C:\TMP
    SET TMP=C:\TMP
    SET VSLANG=1033
C:\tools\LLVM\bin\clang-cl.exe /nologo /DCOMPILER_MSVC /DNOMINMAX
/D_WIN32_WINNT=0x0601 /D_CRT_SECURE_NO_DEPRECATE
/D_CRT_SECURE_NO_WARNINGS /bigobj /Zm500 /EHsc /wd4351 /wd4291 /wd4250
/wd4996 /Iexternal/llvm-project
/Ibazel-out/x64_windows-opt-exec-ST-766941a09caf/bin/external/llvm-project
/Iexternal/llvm-project/llvm/include
/Ibazel-out/x64_windows-opt-exec-ST-766941a09caf/bin/external/llvm-project/llvm/include
/D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS
/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_NONSTDC_NO_WARNINGS
/D_SCL_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_WARNINGS /DUNICODE
/D_UNICODE /DLTDL_SHLIB_EXT=".dll" /DLLVM_PLUGIN_EXT=".dll"
/DLLVM_NATIVE_ARCH="X86"
/DLLVM_NATIVE_ASMPARSER=LLVMInitializeX86AsmParser
/DLLVM_NATIVE_ASMPRINTER=LLVMInitializeX86AsmPrinter
/DLLVM_NATIVE_DISASSEMBLER=LLVMInitializeX86Disassembler
/DLLVM_NATIVE_TARGET=LLVMInitializeX86Target
/DLLVM_NATIVE_TARGETINFO=LLVMInitializeX86TargetInfo
/DLLVM_NATIVE_TARGETMC=LLVMInitializeX86TargetMC
/DLLVM_NATIVE_TARGETMCA=LLVMInitializeX86TargetMCA
/DLLVM_HOST_TRIPLE="x86_64-pc-win32"
/DLLVM_DEFAULT_TARGET_TRIPLE="x86_64-pc-win32" /DLLVM_VERSION_MAJOR=21
/DLLVM_VERSION_MINOR=0 /DLLVM_VERSION_PATCH=0
/DLLVM_VERSION_STRING="21.0.0git" /D__STDC_LIMIT_MACROS
/D__STDC_CONSTANT_MACROS /D__STDC_FORMAT_MACROS
/DLLVM_HAS_AArch64_TARGET=1 /DLLVM_HAS_AMDGPU_TARGET=1
/DLLVM_HAS_ARM_TARGET=1 /DLLVM_HAS_NVPTX_TARGET=1
/DLLVM_HAS_PowerPC_TARGET=1 /DLLVM_HAS_RISCV_TARGET=1
/DLLVM_HAS_SystemZ_TARGET=1 /DLLVM_HAS_X86_TARGET=1 /DBLAKE3_USE_NEON=0
/DBLAKE3_NO_AVX2 /DBLAKE3_NO_AVX512 /DBLAKE3_NO_SSE2 /DBLAKE3_NO_SSE41
/showIncludes /MD /O2 /Oy- /DNDEBUG /wd4117 -D__DATE__="redacted"
-D__TIMESTAMP__="redacted" -D__TIME__="redacted"
-Wno-builtin-macro-redefined /Gy /Gw /W0 /Zc:__cplusplus
/D_USE_MATH_DEFINES /d2ReducedOptimizeHugeFunctions
-D_ENABLE_EXTENDED_ALIGNED_STORAGE -DWIN32_LEAN_AND_MEAN -DNOGDI
/Zc:preprocessor /clang:-Weverything /clang:-Weverything
/d2ReducedOptimizeHugeFunctions /std:c++17
/Fobazel-out/x64_windows-opt-exec-ST-766941a09caf/bin/external/llvm-project/llvm/_objs/Support/ExtensibleRTTI.obj
/c external/llvm-project/llvm/lib/Support/ExtensibleRTTI.cpp
# Configuration:
f85b29406574d83c673497718f542456050c5649ae41eb37a803b7085e15c4ef
# Execution platform:
//tensorflow/tools/toolchains/win2022:windows_ltsc2022_clang
external/llvm-project/llvm/lib/Support/ExtensibleRTTI.cpp(12,22): error:
definition of dllimport static field not allowed
   12 | char llvm::RTTIRoot::ID = 0;
      |                      ^
external/llvm-project/llvm/include\llvm/Support/ExtensibleRTTI.h(71,7):
note: attribute is here
   71 | class LLVM_ABI RTTIRoot {
      |       ^
external/llvm-project/llvm/include\llvm/Support/Compiler.h(205,29):
note: expanded from macro 'LLVM_ABI'
  205 | #define LLVM_ABI __declspec(dllimport)
      |                             ^
1 error generated.
2025-06-09 12:41:47 -07:00
Chenguang Wang
b7ef3e7a85 [bazel] Fix llvm-min-tblgen bazel build (#143213)
Broken by 7b2aa02a. Tested with:

    bazelisk build \
        @llvm-project//llvm:llvm-min-tblgen \
        @llvm-project//llvm:FrontendOpenACC \
        @llvm-project//llvm:FrontendOpenMP \
        @llvm-project//llvm:TableGen
2025-06-06 15:33:23 -07:00
Michael Jones
59f88a8e92 [libc] clean up string_utils memory functions (#143031)
The string_utils.h file previously included both memcpy and bzero. There
were no uses of bzero, and only one use of memcpy which was replaced
with __builtin_memcpy.

Also fix strsep which was broken by this change, fix a useless assert of
"sizeof(char) == sizeof(cpp::byte)", and update the bazel.
2025-06-06 11:16:54 -07:00
Jordan Rupprecht
5537733a04 [bazel] Port #140572 (#143110)
Commit b9d3a644c2
2025-06-06 06:06:46 -05:00
Jordan Rupprecht
fb5baef89b [bazel] Port #135636 (#143109)
Commit 44a047c929
2025-06-06 05:52:30 -05:00
Chenguang Wang
9eb90c2139 [bazel] Fix LLVM plugin tests under Analysis. (#142999)
Those tests were broken on bazel as a side effect of 8830e380.

This commit is tested with this command on Linux:

    bazelisk test \
        @llvm-project//llvm/unittests:analysis_tests \
@llvm-project//llvm/unittests:plugin_inline_advisor_analysis_test \
        @llvm-project//llvm/unittests:plugin_inline_order_analysis_test
2025-06-05 09:58:17 -07:00
Jordan Rupprecht
578c75e9f7 Revert "[libc][bazel] Support generating public libc headers in Bazel builds. (#141256)" (#143001)
This reverts commit 27143f2929. It causes
some downstream failures when bootstrapping builds.
2025-06-05 11:24:47 -05:00
NAKAMURA Takumi
8830e3802a [bazel] llvm-config.h: Turn on LLVM_ENABLE_PLUGINS
Since #141650, `LLVM_ABI inline` has had different linkage regarding
to LLVM_ENABLE_PLUGINS. This doesn't intend Bazel build would
introduce plugins.
2025-06-05 22:38:55 +09:00
Rahul Joshi
e53ccb78e4 [LLVM][MC] Introduce OrFail variants of MCD ops (#138614)
Introduce `OrFail` variants for all MCD Decoder Ops that have
`NumToSKip` encoded with them. This is intended to capture the common
case of jumps to the end of the decoder table which has a `OP_Fail` at
the end. Using the `OrFail` variants of these ops avoid encoding the
`NumToSkip` jump offset for these cases, resulting in a reduction in the
size of the decoder tables (from 5 - 17%). Additionally, for the AArch64
target, the table size reduces enough to switch to using 2-byte
`NumToSkip` encoding instead of existing 3-bytes, resulting in a net 30%
reduction in the size of the decoder table.

The total reduction in the size of the decoder tables for different
targets is as follows (computed using the following command: `for i in
*.inc; do echo -n ``basename $i: ``; grep "MCD::OPC_Fail," $i | awk
'{sum += $2} END { print sum}'; done`)

```
Target         Old Size   New Size   % Reduction
================================================
AArch64           153268     106987       30.20
AMDGPU            412056     340856       17.28
ARC                 5061       4605        9.01
ARM                73831      60847       17.59
AVR                 1306       1158       11.33
BPF                 1927       1795        6.85
CSKY                8692       6922       20.36
Hexagon            41965      34759       17.17
Lanai                982        924        5.91
LoongArch          21629      20035        7.37
M68k               13461      11689       13.16
MSP430              3716       3384        8.93
Mips               31415      25771       17.97
PPC                28931      24771       14.38
RISCV              34800      28352       18.53
Sparc               7432       6236       16.09
SystemZ            32248      29716        7.85
VE                 42873      36923       13.88
XCore               2316       2196        5.18
Xtensa              3443       2793       18.88
```
2025-06-05 06:17:50 -07:00
Jordan Rupprecht
2917040642 [bazel] Port #141332 (#142890)
Commit e4c8ff94e7
2025-06-04 22:20:49 -05:00
Jordan Rupprecht
7578922d71 [bazel] Fix one missed target also broken by ff844df719 (#142854)
a4320ba67b fixed most targets but missed
one.
2025-06-04 16:09:58 -05:00
Chenguang Wang
a4320ba67b [bazel] fix libc bazel build broken by ff844df7. (#142848)
Fixes `bazelisk test @llvm-project//libc/test/src/string/...`
2025-06-04 13:42:45 -07:00
Chenguang Wang
6dd3891b72 [bazel] fix bazel build broken by d96447b4. (#142841) 2025-06-04 13:09:52 -07:00
Jordan Rupprecht
90e906a5a8 Revert "[bazel] Port c3746ff3229c57110f7895ff5b93e520cead0d1b" (#142791)
This reverts commit d31ace4abc.

That commit was a fix for c3746ff322,
which was later reverted in 15dff71cac.
2025-06-04 10:23:33 -05:00
Benjamin Kramer
d31ace4abc [bazel] Port c3746ff322 2025-06-04 16:08:04 +02:00
Jordan Rupprecht
0c0e7a35d0 [bazel] Port 0a3e9aa336 (#142680)
llvm/lib/IR/RuntimeLibcalls.cpp needs to include
llvm/lib/IR/ZOSLibcallNames.def
2025-06-03 17:34:34 -05:00
jtstogel
27143f2929 [libc][bazel] Support generating public libc headers in Bazel builds. (#141256)
This requires adding a new dependency on PyYAML so that Bazel is able to
run the `hdrgen` tool hermetically. This PR uses PyYAML version 5.1 due
to keep in line with the docs:
b878e0d118/libc/docs/dev/header_generation.rst (L22)

See https://github.com/llvm/llvm-project/issues/134780.
2025-06-03 10:15:14 -07:00
Jordan Rupprecht
6565e07a17 [bazel] Port ArmNeon after #140251 (#142569)
Commit be9334a68e
2025-06-03 05:23:04 -05:00
Benjamin Kramer
f99e76b004 [bazel] Port 0210750d5a 2025-06-02 21:38:26 +02:00
Jordan Rupprecht
76423133ef [bazel] Add missing deps for #141864 (#142437)
Added in 150d466994.

```
external/llvm-project/llvm/include/llvm/Frontend/Driver/CodeGenOptions.h:16:10: error: module llvm-project//llvm:FrontendDriver does not depend on a module exporting 'llvm/Support/Compiler.h'
#include "llvm/Support/Compiler.h"
```
2025-06-02 12:39:28 -05:00
Jordan Rupprecht
3290d625d2 [bazel] Add TestingDemangle target for #137947 (#142419)
Added in f7e172da4c
2025-06-02 10:56:37 -05:00
Jacques Pienaar
e49738b3ac [mlir][lsp] Enable registering dialects based on URI. (#141331)
Previously the dialects registered were fixed per LSP binary. This works
as long as all the dialects of interest from the different projects
across which one uses the LSP, are disjoint. This expands this to
support cases where there are dialects that overlap in dialect name but
usage of these are separate wrt projects. The alternative is multiple
binaries and switching LSP used in editor per project (there is some
extra complexity in hosted instances).

This handles a simple (I believe common case) where one can determine
based on path and have single binary - the cost of dynamically doing so
based on path would be either keeping different registries to return or
repopulating dialect & extension maps.
2025-06-01 23:55:32 -07:00
Walter Lee
fc1484b30e [bazel] Fix build for 5fe9aea6d1 (#142065) 2025-05-29 19:54:11 -04:00