Commit Graph

2789 Commits

Author SHA1 Message Date
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
Benjamin Kramer
0967fce646 [bazel] Port c474f8f240 2025-05-29 17:52:46 +02:00
google-yfyang
259fe01ace [bazel] Add the missing dependency for the introduced use of support/Utils.h (#141828)
#138066 adds the use of this unspecified dependency. 
This breaks bazel build. 

https://buildkite.com/llvm-project/upstream-bazel/builds/137154#01971745-cb44-4fd1-af59-ccef34c3f61e
2025-05-28 15:18:55 -04:00
Benjamin Kramer
7fb2590c1d [bazel] Port 6a477f6577 2025-05-28 14:56:34 +02:00
Christian Sigg
03fc480b9a [mlir][bazel] Adjust BUILD file to work with transform_build_files tool. 2025-05-27 10:39:06 +02:00
Adrian Kuegel
b231e5ff50 [Bazel] Followup fix for c76e28 2025-05-26 08:51:58 +00:00
Adrian Kuegel
3833513886 [Bazel] Adjust according to c76e2800e3 2025-05-26 08:38:17 +00:00
Adrian Kuegel
3d6f69873d [Bazel] Another followup fix for 97dee78 2025-05-26 06:16:17 +00:00
Pat Doyle
9c59946670 [bazel][test] Continue fixing bazel build from 97dee78 (#141336)
this continues the work in 0967a6f by generating a header from
clang-tools-extra/unittests/clang-doc/config.h.cmake

not clear all the tests pass yet, but fixes this build error at least:

ERROR:
/var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/6a1efeb401da192d3572f00e2f11245b/external/llvm-project/clang-tools-extra/unittests/BUILD.bazel:57:8:
Compiling
clang-tools-extra/unittests/clang-doc/HTMLMustacheGeneratorTest.cpp
failed: (Exit 1): clang failed: error executing CppCompile command (from
target @@llvm-project//clang-tools-extra/unittests:clang_doc_test)
/usr/lib/llvm-18/bin/clang -U_FORTIFY_SOURCE -fstack-protector -Wall
-Wthread-safety -Wself-assign -Wunused-but-set-parameter
-Wno-free-nonheap-object -fcolor-diagnostics -fno-omit-frame-pointer ...
(remaining 328 arguments skipped)
Use --sandbox_debug to see verbose messages from the sandbox and retain
the sandbox build root for debugging

external/llvm-project/clang-tools-extra/unittests/clang-doc/HTMLMustacheGeneratorTest.cpp:12:10:
fatal error: 'config.h' file not found
   12 | #include "config.h"
      |          ^~~~~~~~~~
1 error generated.
2025-05-26 07:56:48 +02:00
Benjamin Kramer
5efd1ae094 [bazel] Fix up fe30cde29e 2025-05-23 20:44:12 +02:00
Bart Chrzaszcz
fe30cde29e [mlir] Fix bazel build after 0fa3ba7. (#141241) 2025-05-23 20:39:52 +02:00
Bart Chrzaszcz
7239841263 [mlir] Fix bazel build after 61d5fdf v2. (#141235)
These files were deleted, and `AllToLLVMIRTranslations` compiles
successfully without them.
2025-05-23 15:46:29 +01:00
Bart Chrzaszcz
6db8490f03 [mlir] Fix bazel build after 61d5fdf50c. (#141224) 2025-05-23 12:03:12 +01:00
Adrian Kuegel
896ea58b8f [Bazel] Add back the clang-doc:lib dependency. Still needed. 2025-05-23 09:58:46 +00:00
Adrian Kuegel
127cc84441 [Bazel] Followup: avoid dependency cycle 2025-05-23 09:56:28 +00:00
Adrian Kuegel
0967a6f71c [Bazel] Adjust to 97dee78eb3
There is still one failing test, not sure yet how that can be fixed.
2025-05-23 09:53:32 +00:00
Benjamin Kramer
2bb5cc54be [bazel] Port 50127ac054 2025-05-22 16:52:35 +02:00
Adrian Kuegel
e8ecd2cf94 Revert "[llvm][Bazel] Adjust according to changes in 4cfbe55"
This reverts commit 67f4d841f0.
2025-05-22 05:58:26 +00:00
Adrian Kuegel
ad05543428 [Bazel] Also adapt test/BUILD for 9a553d3766 2025-05-21 07:51:38 +00:00
Adrian Kuegel
462cede350 [Bazel] Follow fixes for 9a553d3766 2025-05-21 07:41:19 +00:00
Adrian Kuegel
49a9bbba67 [Bazel] Port a9ee8e4a45 2025-05-21 07:05:48 +00:00
Srinivasa Ravi
9a553d3766 [MLIR][NVVM] Add NVVMRequiresSM op traits (#126886)
Motivation:
Currently, the NVVMOps are not verified against the supported SM
architectures. This can manifest as an ISel failure in the NVPTX LLVM
backend during CodeGen to PTX ISA. This PR addresses this issue by
adding verifier checks for Target-SM architectures in the NVVM Dialect
itself, thereby catching the errors early on.

Summary:
* Parametric traits named `NVVMRequiresSM` and `NVVMRequiresSMa` are
added to facilitate the version checks for typical and arch-accelerated
versions respectively.
* These traits can be attached to any NVVM Op to enable the checks for
the particular Op. (example shown below)
* An attribute interface called named `TargetAttrVerifyInterface` is
added to the GPU dialect which any target attribute seeking to perform
target-verification on the module can implement.
* The checks are performed by the `NVVMTargetAttr` (implementing the
`TargetAttrVerifyInterface` interface) when called from the GPU module
verifier where it walks through the module and performs the checks for
Ops with the `NVVMRequiresSM` traits.
* A few Ops in `NVVMOps.td` have been updated to serve as examples.

Example Usage:
```
       def NVVM_ReduxOp : NVVM_Op<"redux.sync"> {...} 
 ----> def NVVM_ReduxOp : NVVM_Op<"redux.sync", [NVVMRequiresSM<80>]> {...}

       def NVVM_WgmmaFenceAlignedOp : NVVM_Op<"wgmma.fence.aligned"> {...}
 ----> def NVVM_WgmmaFenceAlignedOp : NVVM_Op<"wgmma.fence.aligned", [NVVMRequiresSMa<[90]>]> {...}
```

---------

Co-authored-by: Guray Ozen <guray.ozen@gmail.com>
2025-05-21 08:53:00 +05:30
Pat Doyle
064912217c [bazel][mlir] Add missing dep for 747620d (#140830)
fixes the following errors:

ERROR:
/var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/6a1efeb401da192d3572f00e2f11245b/external/llvm-project/mlir/BUILD.bazel:3410:11:
Compiling mlir/lib/Dialect/XeGPU/Transforms/XeGPUWgToSgDistribute.cpp
failed: (Exit 1): clang failed: error executing CppCompile command (from
target @@llvm-project//mlir:XeGPUTransforms) /usr/lib/llvm-18/bin/clang
-U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign
-Wunused-but-set-parameter -Wno-free-nonheap-object -fcolor-diagnostics
-fno-omit-frame-pointer ... (remaining 130 arguments skipped)
Use --sandbox_debug to see verbose messages from the sandbox and retain
the sandbox build root for debugging

external/llvm-project/mlir/lib/Dialect/XeGPU/Transforms/XeGPUWgToSgDistribute.cpp:11:10:
error: module llvm-project//mlir:XeGPUTransforms does not depend on a
module exporting 'mlir/Dialect/Arith/Utils/Utils.h'
   11 | #include "mlir/Dialect/Arith/Utils/Utils.h"
      |          ^

external/llvm-project/mlir/lib/Dialect/XeGPU/Transforms/XeGPUWgToSgDistribute.cpp:13:10:
fatal error: 'mlir/Dialect/Index/IR/IndexDialect.h' file not found
   13 | #include "mlir/Dialect/Index/IR/IndexDialect.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
2025-05-20 20:55:20 -05:00
Adrian Kuegel
b565933fd7 [Bazel] Adapt to d561d595c4
Also restore ":Core" dependency, it is actually needed.
2025-05-20 07:42:11 +00:00
Adrian Kuegel
67f4d841f0 [llvm][Bazel] Adjust according to changes in 4cfbe55 2025-05-20 06:30:50 +00:00
Jorge Gorbe Moya
5c154277ef [bazel] Add missing dep after 6a0e626af5 2025-05-16 17:56:32 -07:00
Jorge Gorbe Moya
fec9be9f73 [bazel][mlir] Add missing dep and include after 9b63bdd154
This fixes issues when compiling SliceMatchers.h separately. In
particular, the missing include triggered a "member access into
incomplete type" error:

```
third_party/llvm/llvm-project/mlir/include/mlir/Query/Matcher/SliceMatchers.h:91:30: error: member access into incomplete type 'Operation'
   91 |     for (auto operand : subOp->getOperands()) {
      |                              ^
third_party/llvm/llvm-project/mlir/include/mlir/Analysis/SliceAnalysis.h:20:7: note: forward declaration of 'mlir::Operation'
   20 | class Operation;
      |       ^
```
2025-05-16 14:14:01 -07:00
James Y Knight
7fe1b43122 NFC: reformat bazel files with buildifier. 2025-05-16 12:12:03 -04:00