2999 Commits

Author SHA1 Message Date
Muhammad Bassiouni
bb3cd6221b
[libc][math] Refactor atanhf16 implementation to header-only in src/__support/math folder. (#151779)
Part of #147386

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-08-02 23:04:02 +03:00
Muhammad Bassiouni
99cd1d8aef
[libc][math] Refactor atanhf implementation to header-only in src/__support/math folder. (#151399)
Part of #147386

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-08-02 02:54:13 +03:00
Muhammad Bassiouni
920079b793
[libc][math] Refactor atan2f128 implementation to header-only in src/__support/math folder. (#151012)
Part of #147386

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-08-02 00:18:57 +03:00
Muhammad Bassiouni
9af2c21be4
[libc][math] Refactor atan2f implementation to header-only in src/__support/math folder. (#150993)
Part of #147386

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-08-01 16:06:09 +03:00
Adrian Kuegel
067f87c583 [lldb][Bazel] Add missing dependency. 2025-08-01 09:20:58 +00:00
Jordan Rupprecht
c05611f191
[bazel] Port #150633 HLSLBinding.h (#151546) 2025-07-31 11:04:14 -05:00
Jordan Rupprecht
d520daeb82
[bazel] Port #145358: LIBC_THREAD_MODE (#151539)
I'm not sure how libc should be configuring this in bazel, but for now
it seems like `LIBC_THREAD_MODE_PLATFORM` restores the default behavior.

Defining this param is required:
```
ERROR: /var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/c9d34ded3a9d94cc250207948aceadfc/external/llvm-project/libc/BUILD.bazel:5788:14: Compiling libc/src/stdio/generic/vprintf.cpp failed: (Exit 1): clang failed: error executing CppCompile command (from target @@llvm-project//libc:vprintf) /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 31 arguments skipped)
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
In file included from external/llvm-project/libc/src/stdio/generic/vprintf.cpp:11:
In file included from external/llvm-project/libc/src/__support/File/file.h:19:
external/llvm-project/libc/src/__support/threads/mutex.h:25:2: error: LIBC_THREAD_MODE is undefined
   25 | #error LIBC_THREAD_MODE is undefined
      |  ^
```

As an alternative to this PR, we could make the libc header default to
`LIBC_THREAD_MODE_PLATFORM` if not provided, instead of an `#error`
2025-07-31 10:39:34 -05:00
Muhammad Bassiouni
c8b6ddf3a3
[libc][math] Refactor atan2 implementation to header-only in src/__support/math folder. (#150968)
Part of #147386

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-07-31 01:07:55 +03:00
Muhammad Bassiouni
729b0d1b61
[libc][math] Refactor atanf16 implementation to header-only in src/__support/math folder. (#150868)
Part of #147386

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-07-30 23:31:07 +03:00
Jordan Rupprecht
c56be46c1c
[bazel] Port #151010: DW_OP_WASM_location (#151364) 2025-07-30 12:38:19 -05:00
Jordan Rupprecht
c9e2ad7da8
[bazel][mlir] Add build files for transform examples (#151351) 2025-07-30 11:43:33 -05:00
Jordan Rupprecht
55cdbda58d
[bazel] Port #151324 (#151345)
This was included in #151125 but somehow lost in the second time the
patch was re-applied
2025-07-30 09:52:14 -05:00
Mehdi Amini
97fa9a1f53
Revert "Reland "[mlir][llvm] Add intrinsic arg and result attribute support (…" (#151316)
Reverts llvm/llvm-project#151125

Broke the gcc-7 build:

include/mlir/Target/LLVMIR/ModuleTranslation.h:318:34: error: no type
named 'CallBase' in namespace 'llvm'
                           llvm::CallBase *call,
                           ~~~~~~^
2025-07-30 13:50:12 +02:00
Tobias Gysi
b7bfbc0c4c
Reland "[mlir][llvm] Add intrinsic arg and result attribute support (… (#151125)
…… (#151099)

This reverts commit 2780b8f22058b35a8e70045858b87a1966df8df3 to reland
59013d44058ef423a117f95092150e16e16fdb09.

In addition to the original commit this one includes:
- This includes a bazel fix
- Use `let methods` instead of `list<InterfaceMethod> methods`

The original commit message was:

This patch extends the LLVM dialect's intrinsic infra to support
argument and result attributes. Initial support is added for the memory
intrinsics llvm.intr.memcpy, llvm.intr.memmove, and llvm.intr.memset.

Additionally, an ArgAndResultAttrsOpInterface is factored out of
CallOpInterface and CallableOpInterface, enabling operations to have
argument and result attributes without requiring them to be a call or a
callable operation.
2025-07-30 13:35:20 +02:00
Muhammad Bassiouni
f2a476d79a
[libc][math] Refactor atanf implementation to header-only in src/__support/math folder. (#150854)
Part of #147386

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-07-30 07:24:49 +03:00
wenzhi-cui
ee1ecf3245
Update BUILD.bazel to add RegisterAllPasses/Dialects/Extensions (#151233) 2025-07-29 21:26:24 -05:00
Jordan Rupprecht
86f74c4d01
[bazel] Use rules_cc everywhere and reformat (#149584)
We already use cc rules from `@rules_cc//cc:defs.bzl` in a few files,
but this uses it everywhere. Done automatically by running `buildifier
--lint=fix
--warnings=native-cc-binary,native-cc-library,native-cc-test,load` over
all the files. I also ran `buildifier` once more to ensure there wasn't
any missing formatting, so that caused a few unrelated diffs.
2025-07-29 16:30:25 -05:00
Jordan Rupprecht
052b836d23
[bazel] Port #150696: XeVM to LLVMIR (#151207) 2025-07-29 13:25:14 -05:00
Muhammad Bassiouni
551dcc3e82
[libc][math] Refactor atan implementation to header-only in src/__support/math folder. (#150852)
Part of #147386

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-07-29 21:16:57 +03:00
Jordan Rupprecht
bc605f4ce8
[bazel] Port #151150: Move InitAll*** implementation into static library (#151183)
And prune deps when splitting
2025-07-29 12:25:32 -05:00
Muhammad Bassiouni
efbbc0b319
[libc][math] Refactor asinhf16 implementation to header-only in src/__support/math folder. (#150849)
Part of #147386

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-07-29 20:19:01 +03:00
Ingo Müller
4745637e44
[libc] Fix bazel build by build by adding missing deps. (#151093)
This adds two dependencies that I wanted to be part of #151090 but
forgot to add them before the last push, which related to `wcschr.cpp`
and were originally broken by #150661.

Signed-off-by: Ingo Müller <ingomueller@google.com>
2025-07-29 09:30:46 +02:00
Ingo Müller
8c8749608b
[libc] Fix bazel build by build by adding missing deps. (#151090)
This was broken by #150661, which added includes to `wcspbrk.cpp` and
`wcschr.cpp` that weren't in the dependencies of the corresponding
targets.

Signed-off-by: Ingo Müller <ingomueller@google.com>
2025-07-29 06:56:38 +00:00
Davide Grohmann
0121a8e431
Reland "[mlir][spirv] Fix int type declaration duplication when serializing" (#145687)
This relands PRs #143108 and #144538.

The original PR was reverted due to a mistake that made all the mlir
tests run only if SPIRV target was enabled. This is now resolved since
enabling spirv-tools does not required SPIRV target any longer.

spirv-tools are not required by default to run SPIRV mlir tests, but
they can be optionally enabled in some SPIRV mlir test to verify that
the produced SPIRV assembly pass validation.

The other reverted PR #144685 is not longer needed and not part of this
relanding.

Original commit message:

> At the MLIR level unsigned integer and signless integers are different
types. Indeed when looking up the two types in type definition cache
they do not match.
> Hence when translating a SPIR-V module which contains both usign and
signless integers will contain the same type declaration twice
(something like OpTypeInt 32 0) which is not permitted in SPIR-V and
such generated modules fail validation.
> This patch solves the problem by mapping unisgned integer types to
singless integer types before looking up in the type definition cache.

---------

Signed-off-by: Davide Grohmann <davide.grohmann@arm.com>
2025-07-28 12:34:30 -04:00
Muhammad Bassiouni
5bcbcf8d53
[libc][math] Refactor asinhf implementation to header-only in src/__support/math folder. (#150843)
Part of #147386

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-07-28 18:14:47 +03:00
Ingo Müller
5ad7ef6fec
[bazel] add new cmakedefine from #147418 to bazel config file (#150912)
This PR adds the `#cmakedefine LLVM_ENABLE_PROFCHECK` in
`llvm-config.h.cmake` introduced in #147418 to the copy of that file in
the bazel overlay directory such that that define is also avalable in
the bazel build. Not having the define broke the bazel build.

Signed-off-by: Ingo Müller <ingomueller@google.com>
2025-07-28 12:38:57 +02:00
Muhammad Bassiouni
85213f2f88
[libc][math] Refactor asinf16 implementation to header-only in src/__support/math folder. (#150800)
Part of #147386

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-07-27 20:03:10 +03:00
Muhammad Bassiouni
2eb112d78d
[libc][math] Refactor asinf implementation to header-only in src/__support/math folder. (#150697)
Part of #147386

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-07-26 02:05:09 +03:00
Alexey Samsonov
1d81dfaa8f
[libc][bazel] Allow building llvm_libc_types_float128 on Windows. (#150704)
This target was marked as Linux-only in
51a4ab287f43c129dd531867be880480a85ecb1e to make "bazel build
@llvm-project//libc/..." clean (which it still is).

There's nothing Linux-specific about this header library, we just use
"target_incompatible_with" clause here to ensure that all libc functions
for float128 types won't be built on Mac, in lieu of a better exclusion
mechanism in Bazel.

However, since llvm_libc_types_float128 is now a transitive dependency
of ":libcxx_shared_headers" used for hand-in-hand code sharing with
libc++, we may need to build this target even on platforms that don't
have float128.

Fow now, mark this target Windows-compatible to unlock the downstream
Windows Bazel build of ":libcxx_shared_headers".
2025-07-25 14:27:34 -07:00
Jorge Gorbe Moya
207b9a78f0 [bazel] Fix build after 34a08cb89c5e50c22be05555529ce84eaa3e4d3c 2025-07-25 14:26:19 -07:00
Muhammad Bassiouni
bc19aedba2
[libc][math] Refactor asin implementation to header-only in src/__support/math folder. (#148578)
Part of #147386

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-07-25 22:46:43 +03:00
Muhammad Bassiouni
47e2de0d50
[libc][math] Refactor acospif16 implementation to header-only in src/__support/math folder. (#148574)
Part of #147386

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-07-25 21:28:27 +03:00
Frank Schlimbach
b2d4963ee9
[NFC][mlir][mesh,shard] Fixing misnomers in mesh dialect, renaming 'mesh' dialect to 'shard' (#150177)
Dialect to 'shard' (discourse 87053)
  - dialect name mesh -> shard
  - (device) mesh -> (device) grid
  - spmdize -> partition

A lot of diffs, but simple renames only.

@tkarna @yaochengji
2025-07-25 16:53:08 +02:00
Alexey Samsonov
dc58a08f4f
[libc][bazel] Enable parse_headers feature for llvm-libc. (#150538)
See https://bazel.build/docs/bazel-and-cpp#toolchain-features for why
this feature is recommended for C++ projects.
215dbcb2bc5c1b1bc8775db2a7c22f67f3949fd7 added the necessary default
Bazel flag to make this feature functional. It can be enabled on a
per-project basis. Do this now for llvm-libc.

After enabling this feature, Blaze tries to parse headers from all
header-only libraries, even if the headers are not explicitly used in
tests, which allows to detect the issues early on.

Fix a couple of -Wunused-function warnings by marking the static
functions as constexpr or inline.
2025-07-25 07:47:25 -07:00
Alexey Samsonov
5e01797cd0
[libc] Don't rely on LIBC_HAS_SANITIZER when enabling null checks. (#150341)
LIBC_HAS_SANITIZER (which is defined if ASan, MSan, or UBSan is enabled)
is currently used to implicitly disable null checks, normally enabled
via LIBC_ADD_NULL_CHECKS config value. Remove this condition, and rely
purely on the config value instead:

* LIBC_HAS_SANITIZER will be true even for UBSan modes which doesn't
rely on null checks at all (e.g. -fsanitize=alignment)
* null checks today (implemented via __builtin_trap) should function
normally today even when sanitizer is enabled - trap is still a trap
* tests have been migrated to WITH_SIGNAL(-1) which doesn't prescript a
particular signal / exit-code, and thus should pass even if sanitizers
override the default ones.
2025-07-24 14:15:46 -07:00
Jordan Rupprecht
74ce508517
[bazel] Add missing clang/unittests targets (#150491)
Mostly just adding tests that are in clang/unittests/CMakeLists.txt, but
there a couple other cleanups here:
* Add `directory_watcher` targets in clang so we can add tests for it
* Add some library targets (e.g. `dataflow_testing_support`) for
downstream use (e.g. unit tests outside of LLVM that use these headers
in tests)
* Remove `rename_tests_tooling_hdrs` which has been unused since
`rename_tests` itself was deleted

The InterpreterTest target added here passes on our internal CI, but
fails when I run it w/ bazel for some reason:
```
[ RUN      ] InterpreterTest.InstantiateTemplate
JIT session error: Symbols not found: [ __clang_Interpreter_SetValueWithAlloc, _ZnwmPv26__clang_Interpreter_NewTag ]
Failure value returned from cantFail wrapped call
Failed to materialize symbols: { (main, { __orc_init_func.incr_module_133, $.incr_module_133.__inits.0 }) }
```
I'd like to figure out what's going on, but for now I just excluded it
w/ a test filter
2025-07-24 15:11:48 -05:00
Jordan Rupprecht
d82d502ae5
[bazel] Port #149148 (#150435) 2025-07-24 09:58:34 -05:00
Alan Li
1c3e4e994b
Reapply "[AMDGPU] fold memref.subview/expand_shape/collapse_shape into amdgpu.gather_to_lds" (#150334)
This is a reapply of patch #149851. The reapply also fixes a CMake/Bazel
build issue, which was the reason of the revert. (Thanks @rupprecht )

Original patch (#149851) message:
-----
This PR adds a new optimization pass to fold
`memref.subview/expand_shape/collapse_shape` ops into consumer
`amdgpu.gather_to_lds` operations.
* Implements a new pass `AmdgpuFoldMemRefOpsPass` with pattern
`FoldMemRefOpsIntoGatherToLDSOp`
* Adds corresponding folding tests
2025-07-24 09:23:15 -04:00
Jordan Rupprecht
8e9912a1a2
[bazel] Port #150303 some more (#150358) 2025-07-23 21:03:41 -05:00
Jordan Rupprecht
7f66a83c12
[bazel] Port #149198 (#150352) 2025-07-23 20:24:44 -05:00
Jordan Rupprecht
f509b0c33a
[bazel] Port #150303 (#150351) 2025-07-23 20:24:18 -05:00
Jordan Rupprecht
b61695e3eb
[bazel] Port #149221 (#150347) 2025-07-23 20:01:54 -05:00
lntue
66603dd1f1
[libc][NFC] Add stdint.h proxy header to fix dependency issue with <stdint.h> includes. (#150303)
https://github.com/llvm/llvm-project/issues/149993
2025-07-23 20:19:52 -04:00
Jordan Rupprecht
07af740999
[bazel][libc] Add missing parse headers deps (#150295)
I believe this is from #150087 and #144983, but I didn't confirm
specific commits.
2025-07-23 14:29:36 -05:00
Jordan Rupprecht
d174743674
[bazel] Port #150087 and #144983 (#150255) 2025-07-23 11:41:44 -05:00
Jordan Rupprecht
eb0c863c44
[bazel] Port #147408 (#150154)
Add deps for 45d0750dac528ea7e1fcfda34cc9faca3c5454e6
2025-07-22 21:13:35 -05:00
sribee8
45d0750dac
[libc] Cleaned up wcsspn and wcscspn (#147408)
created internal wcsspn to avoid duplicated code

---------

Co-authored-by: Sriya Pratipati <sriyap@google.com>
2025-07-22 21:23:19 +00:00
Jorge Gorbe Moya
22b0835390 [bazel] Add missing dep after 688ea048affe8e79221ea1a8c376bcf20ef8f3bb 2025-07-22 11:45:46 -07:00
Jorge Gorbe Moya
5062fe5692 [bazel] Add missing dep after 9052a85da803b246fa6a6f8b3b5bcbfc2e9de7a8 2025-07-21 14:45:56 -07:00
Muhammad Bassiouni
520398e752
[libc][math] Refactor acoshf16 implementation to header-only in src/__support/math folder. (#148568)
Part of #147386

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-07-22 00:18:15 +03:00