Commit Graph

4234 Commits

Author SHA1 Message Date
Joseph Huber
0e2103ac5c [libc][NFC] Remove unused CMake for gpu math 2025-06-07 09:25:27 -05:00
Michael Jones
3695d6cdf9 [libc][GPU] clean up includes (#143203)
The GPU stdio functions were depending on indirect inclusion for some of
their dependencies. This patch should fix all of that.
2025-06-06 14:12:07 -07:00
Joseph Huber
356dc628cb [libc] Missing include in RPC test 2025-06-06 15:45:22 -05:00
William
a75fc765d3 [libc] Add definitions to embedded AArch32/AArch64 (#142597)
Add `CLOCKS_PER_SEC` and the older `CLK_TCK`. Allows the user to define
a `__CLK_TCK` to override if necessary.

Also add an extra column for embedded AArch64 in `time.rst`
2025-06-06 16:05:14 -04:00
Joseph Huber
5823e92749 [libc] Fix missing includes after transitive dependency changed 2025-06-06 14:34:27 -05: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
Michael Jones
d8bfb4719d [libc] clean up unused exp_utils (#143181)
This file's just left over from old code, but it doesn't compile
anymore. It's never used so this patch just removes it.
2025-06-06 11:02:55 -07:00
Joseph Huber
525726a520 [libc] Cleanup unimplemented math functions (#143173)
Summary:
This patch cleans up the leftoever files that were either implemented or
are still unimplemented stubs.
2025-06-06 12:27:13 -05:00
lntue
891a0abfc2 [libc] Correct x86_64 architecture for string(s) tests. (#143150) 2025-06-06 11:18:55 -04:00
Joseph Huber
59725c7486 [libc] Coalesce bitfield access in GPU malloc (#142692)
Summary:
This improves performance by reducing the amount of RMW operations we
need to do to a single slot. This improves repeated allocations without
much contention about ten percent.
2025-06-04 20:32:07 -05:00
Aly ElAshram
ff844df719 [libc] Expand usage of libc null checks. (#116262)
Fixes #111546

---------

Co-authored-by: alyyelashram <150528548+alyyelashram@users.noreply.github.com>
2025-06-04 13:08:27 -04:00
sribee8
22dd9a2483 [libc] wmemchr implementation (#142640)
Implemented wmemchr and tests.
Fixes: #121183

---------

Co-authored-by: Sriya Pratipati <sriyap@google.com>
2025-06-03 17:05:14 -07:00
sribee8
2ff2a076cc [libc] wcsncpy implementation (#142237)
Implemented wcsncpy and tests for the function.

---------

Co-authored-by: Sriya Pratipati <sriyap@google.com>
2025-06-03 16:37:14 -07:00
lntue
b994299e59 [libc] Also remove _FORTIFY_SOURCE before including <stdlib.h> in overlay mode. (#142647) 2025-06-03 14:25:46 -04:00
sribee8
3887c23059 [libc] wcscat implementation (#142243)
Implemented wcscat and tests.

---------

Co-authored-by: Sriya Pratipati <sriyap@google.com>
2025-06-03 09:58:08 -07:00
Michael Jones
cc68367bb9 [libc][obvious] fix wchar yaml formatting (#142506)
The yaml ended up with a typo, possibly due to merge issues. This patch
fixes it.
2025-06-02 17:00:23 -07:00
Uzair Nawaz
c8741851d1 [libc] Implemented wcsncmp (#142429)
Implemented wcsncmp and added tests
2025-06-02 16:05:47 -07:00
sribee8
e3d1a33b7e [libc] wcsstr implementation (#142440)
Implemented wcsstr and tests.
fixes #124348

---------

Co-authored-by: Sriya Pratipati <sriyap@google.com>
2025-06-02 16:05:12 -07:00
Uzair Nawaz
45c297428a [libc] added nullptr checks for wcspbrk (#142216)
Added CRASH_ON_NULLPTR macro to wcspbrk function and related test
2025-06-02 15:20:53 -07:00
sribee8
9422abf9eb [libc] wcsncat implementation (#142431)
Implemented wcsncat and tests.

---------

Co-authored-by: Sriya Pratipati <sriyap@google.com>
2025-06-02 15:20:10 -07:00
Uzair Nawaz
dabe983e7e [libc] Implemented wcsrchr (#142436)
fixes #124347 
Implemented wcsrchr and added tests
2025-06-02 15:18:44 -07:00
Uzair Nawaz
62af2a5ae2 [libc] Implemented wcscmp (#142423)
Implemented wcscmp and added tests
2025-06-02 15:16:14 -07:00
Uzair Nawaz
c80c452525 [libc] Implemented wmempcpy (#142067)
Implemented wmempcpy and added tests
2025-06-02 15:00:46 -07:00
sribee8
e38375310e [libc] wcscpy implementation (#142228)
Implemented wcscpy as well as tests for the function.

---------

Co-authored-by: Sriya Pratipati <sriyap@google.com>
2025-06-02 11:20:25 -07:00
wldfngrs
573545c712 [libc][math][c23] Add atanf16() function (#141612)
- Implementation of atan (tan inverse) function for 16-bit inputs.
- Exhaustive tests across the 16-bit input range
2025-06-01 13:36:16 +02:00
sribee8
339851e140 [libc][obvious] Fixed wchar.yaml (#142238)
Changed __restricted to __restrict for wmemcpy.

Co-authored-by: Sriya Pratipati <sriyap@google.com>
2025-05-30 16:41:11 -07:00
sribee8
328f40f408 [libc] wmemcmp nullptr handling (#142058)
Added nullptr handling for wmemcmp

---------

Co-authored-by: Sriya Pratipati <sriyap@google.com>
2025-05-30 14:38:01 -07:00
sribee8
226d06ba43 [libc] wmemcpy implementation (#142070)
Implemented wmemcpy and tests for the function.

---------

Co-authored-by: Sriya Pratipati <sriyap@google.com>
2025-05-30 14:23:18 -07:00
Uzair Nawaz
d721d4e280 [libc] Implemented wcspbrk (#142040)
Implemented wcspbrk and added tests
2025-05-30 14:12:22 -07:00
sribee8
d4791f56f3 [libc] wcsspn implementation (#142034)
Implemented wcsspn as well as tests for the function.

---------

Co-authored-by: Sriya Pratipati <sriyap@google.com>
2025-05-30 12:52:43 -07:00
lntue
6d3b72aa6e [libc] Pass config flags to unit tests. (#142085) 2025-05-30 10:00:14 -04:00
Aly ElAshram
bfd7024b0d [LibC] Refactor arm64 to aarch64 for darwin. (#141509)
Fixes [#141505](https://github.com/llvm/llvm-project/issues/141505)

The main intention behind this PR is to update the
LibCTargetArchitecture for arm64 to use the implementation of aarch64
architecture and not arm32.

This is a historical issue , and is a blocker to issue #138407. 

The intended fix is to set the `LibCTargetArchitecture` to aarch64 when
it matches arm64 , this in turn would help us run darwin/aarch64
specific code on our MacOs pipeline in the git actions.

Methods used to search and find "darwin/arm" directories was  

1. "find . -type d -path "*/libc/*/darwin/arm" in a linux terminal to
check for arm specifically
2. "find . -type d -path "*/libc/*/darwin/*" to ensure there are no
directories that are named "*arm*" where star is a wildcard for any
character.
2025-05-29 23:41:34 -04:00
sribee8
a8c6a5017d [libc] wmemcmp implementation (#141880)
Implemented wmemcmp as well as tests for the function.

Fixes Issue #141857

---------

Co-authored-by: Sriya Pratipati <sriyap@google.com>
2025-05-29 13:34:23 -07:00
lntue
637e92bf47 [libc] Fix asin_test smoke test for DAZ modes due to mis-optimization on newer clang. (#141996) 2025-05-29 13:59:15 -04:00
Uzair Nawaz
6cf53da79d [libc] Implemented wmemset and added tests (#141691)
Implemented and tests the wmemset function in libc.
2025-05-29 10:31:49 -07:00
lntue
062d24a7d6 [libc][math] Fix some mis-optimization issue with hypotf16. (#141960) 2025-05-29 11:34:50 -04:00
Alexey Samsonov
f22122aa7f [libc] Migrate sys/ tests to ErrnoCheckingTest. (#141871)
See PR #132823 for a previous change to sys/epoll tests, and prior
changes before that.

ErrnoCheckingTest ensures that errno is properly reset at the beginning
of the test case, and is validated at the end of it. This change removes
many instances of manual errno manipulation.
2025-05-28 22:18:22 -07:00
Michael Jones
3a0205ae06 [libc][NFC] Cleanup code for poll (#141802)
Ensure everything is defined inside the namespace, reduce number of
ifdefs.
2025-05-28 14:08:47 -07:00
sribee8
cfba7718d2 WCSChr Implementation (#141690)
implemented wcschr and tests

---------

Co-authored-by: Sriya Pratipati <sriyap@google.com>
2025-05-28 14:08:03 -07:00
Joseph Huber
b4bc8c6f83 [libc] Implement efficient 'malloc' on the GPU (#140156)
Summary:
This is the big patch that implements an efficient device-side `malloc`
on the GPU. This is the first pass and many improvements will be made
later.

The scheme revolves around using a global reference counted pointer to
hand out access to a dynamically created and destroyed slab interface.
The slab is simply a large bitfield with one bit for each slab. All
allocations are the same size in a slab, so different sized allocations
are done through different slabs.

Allocation is thus searching for or creating a slab for the desired
slab, reserving space, and then searching for a free bit. Freeing is
clearing the bit and then releasing the space.

This interface allows memory to dynamically grow and shrink. Future
patches will have different modes to allow fast first-time-use as well
as a non-RPC version.
2025-05-28 08:21:43 -05:00
Mikhail R. Gadelha
ba38e56c98 [libc] Enable setitimer and getitimer functions on riscv (#139182)
These functions don't have a _time64 variant, so we can't use time_t
directly (since our time_t is a uint64_t). The workaround is to use
longs when doing the syscall and write back when necessary.
2025-05-16 18:55:32 -03:00
Bill Wendling
00c5cd8a7a [libc] Fix typo: Configue -> Configure (#140166) 2025-05-16 11:48:36 -07:00
Kazu Hirata
c5229e92ce [libc] Fix typos in documentation (#139852) 2025-05-14 07:14:43 -07:00
OverMighty
6a125afdd5 [libc] Fix DyadicFloat::generic_as() using FPBits<float16> not FPBits<T> (#139899) 2025-05-14 15:59:24 +02:00
Joseph Huber
4e604d4668 [libc][NFC] Add u64 shuffle helpers to GPU
Summary:
Precommit for later use.
2025-05-13 18:00:53 -05:00
Mikhail R. Gadelha
36b4ffeb7e [libc] Enable utimes function for riscv (#139181)
RV32 uses SYS_utimensat_time64 instead of SYS_utimensat but the call is
the same.
2025-05-13 18:59:49 -03:00
Mikhail R. Gadelha
66bb445d5c [libc] Enable poll function for riscv (#139180)
RV32 uses SYS_ppoll_time64 instead of SYS_ppoll, but the call is the
same.
2025-05-13 18:59:28 -03:00
lntue
79e8e27bfe [libc] Add proxy header for ACTION type. (#139796)
https://github.com/llvm/llvm-project/issues/139561
2025-05-13 17:50:02 -04:00
lntue
3b62a3369a [libc] Add struct entry definition in addition to ENTRY according to POSIX. (#139773) 2025-05-13 15:48:30 -04:00
lntue
e581f1cc9a [libc] Add proxy header for ENTRY type. (#139746)
https://github.com/llvm/llvm-project/issues/139561
2025-05-13 14:07:21 -04:00