<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/libc/src/stdlib/gpu, branch main</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>[libc] Efficiently implement `aligned_alloc` for AMDGPU (#146585)</title>
<updated>2025-07-02T14:25:57+00:00</updated>
<author>
<name>Joseph Huber</name>
<email>huberjn@outlook.com</email>
</author>
<published>2025-07-02T14:25:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=24828c8c45d7f258159afca251aa853a5fc59150'/>
<id>24828c8c45d7f258159afca251aa853a5fc59150</id>
<content type='text'>
Summary:
This patch uses the actual allocator interface to implement
`aligned_alloc`. We do this by simply rounding up the amount allocated.
Because of how index calculation works, any offset within an allocated
pointer will still map to the same chunk, so we can just adjust
internally and it will free all the same.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Summary:
This patch uses the actual allocator interface to implement
`aligned_alloc`. We do this by simply rounding up the amount allocated.
Because of how index calculation works, any offset within an allocated
pointer will still map to the same chunk, so we can just adjust
internally and it will free all the same.</pre>
</div>
</content>
</entry>
<entry>
<title>[libc] Efficiently implement 'realloc' for AMDGPU devices (#145960)</title>
<updated>2025-06-30T13:39:40+00:00</updated>
<author>
<name>Joseph Huber</name>
<email>huberjn@outlook.com</email>
</author>
<published>2025-06-30T13:39:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=10445acfa64a80800272e09f70be4799877a237f'/>
<id>10445acfa64a80800272e09f70be4799877a237f</id>
<content type='text'>
Summary:
Now that we have `malloc` we can implement `realloc` efficiently. This
uses the known chunk sizes to avoid unnecessary allocations. We just
return nullptr for NVPTX. I'd remove the list for the entrypoint but
then the libc++ code would stop working. When someone writes the NVPTX
support this will be trivial.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Summary:
Now that we have `malloc` we can implement `realloc` efficiently. This
uses the known chunk sizes to avoid unnecessary allocations. We just
return nullptr for NVPTX. I'd remove the list for the entrypoint but
then the libc++ code would stop working. When someone writes the NVPTX
support this will be trivial.</pre>
</div>
</content>
</entry>
<entry>
<title>[libc] Use the NVIDIA device allocator for GPU malloc (#124277)</title>
<updated>2025-01-24T16:17:20+00:00</updated>
<author>
<name>Joseph Huber</name>
<email>huberjn@outlook.com</email>
</author>
<published>2025-01-24T16:17:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=256f40d0e6b2beb0e951b0f5f836847223c5695c'/>
<id>256f40d0e6b2beb0e951b0f5f836847223c5695c</id>
<content type='text'>
Summary:
This is a blocker on another patch in the OpenMP runtime. The problem is
that NVIDIA truly doesn't handle RPC-based allocations very well. It
cannot reliably update the MMU while a kernel is running and it will
usually deadlock if called from a separate thread due to internal use of
TLS.

This patch just removes the definition of `malloc` and `free` for NVPTX.
The result here is that they will be undefined, which is the cue for the
`nvlink` linker to define them for us. So, as far as `libc` is concerned
it still implements malloc.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Summary:
This is a blocker on another patch in the OpenMP runtime. The problem is
that NVIDIA truly doesn't handle RPC-based allocations very well. It
cannot reliably update the MMU while a kernel is running and it will
usually deadlock if called from a separate thread due to internal use of
TLS.

This patch just removes the definition of `malloc` and `free` for NVPTX.
The result here is that they will be undefined, which is the cue for the
`nvlink` linker to define them for us. So, as far as `libc` is concerned
it still implements malloc.</pre>
</div>
</content>
</entry>
<entry>
<title>[libc][NFC] Rename RPC opcodes to better reflect their usage</title>
<updated>2024-12-02T21:35:08+00:00</updated>
<author>
<name>Joseph Huber</name>
<email>huberjn@outlook.com</email>
</author>
<published>2024-12-02T21:34:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=a6ef0debb1d60966b5bcc69f7d58a2b75c9c621d'/>
<id>a6ef0debb1d60966b5bcc69f7d58a2b75c9c621d</id>
<content type='text'>
Summary:
RPC_ is a generic prefix here, use LIBC_ to indicate that these are
opcodes used to implement the C library
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Summary:
RPC_ is a generic prefix here, use LIBC_ to indicate that these are
opcodes used to implement the C library
</pre>
</div>
</content>
</entry>
<entry>
<title>[libc] Replace usage of GPU helpers with ones from 'gpuintrin.h' (#116454)</title>
<updated>2024-11-19T17:40:02+00:00</updated>
<author>
<name>Joseph Huber</name>
<email>huberjn@outlook.com</email>
</author>
<published>2024-11-19T17:40:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=197e0125c3ed991f11d97d27e529c02af06e9f37'/>
<id>197e0125c3ed991f11d97d27e529c02af06e9f37</id>
<content type='text'>
Summary:
These are provided by a resource header now, cut these from the
dependencies and only provide the ones we use for RPC.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Summary:
These are provided by a resource header now, cut these from the
dependencies and only provide the ones we use for RPC.</pre>
</div>
</content>
</entry>
<entry>
<title>[libc] Remove dependency on `cpp::function` in `rpc.h` (#112422)</title>
<updated>2024-10-15T19:31:06+00:00</updated>
<author>
<name>Joseph Huber</name>
<email>huberjn@outlook.com</email>
</author>
<published>2024-10-15T19:31:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=be0c67c90e045b03b0ffecc06ca6f93e440f48d8'/>
<id>be0c67c90e045b03b0ffecc06ca6f93e440f48d8</id>
<content type='text'>
Summary:
I'm going to attempt to move the `rpc.h` header to a separate folder
that we can install and include outside of `libc`. Before doing this I'm
going to try to trim up the file so there's not as many things I need to
copy to make it work. This dependency on `cpp::functional` is a low
hanging fruit. I only did it so that I could overload the argument of
the work function so that passing the id was optional in the lambda,
that's not a *huge* deal and it makes it more explicit I suppose.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Summary:
I'm going to attempt to move the `rpc.h` header to a separate folder
that we can install and include outside of `libc`. Before doing this I'm
going to try to trim up the file so there's not as many things I need to
copy to make it work. This dependency on `cpp::functional` is a low
hanging fruit. I only did it so that I could overload the argument of
the work function so that passing the id was optional in the lambda,
that's not a *huge* deal and it makes it more explicit I suppose.</pre>
</div>
</content>
</entry>
<entry>
<title>[libc] Add GPU support for the 'system' function (#109687)</title>
<updated>2024-09-23T21:04:28+00:00</updated>
<author>
<name>Joseph Huber</name>
<email>huberjn@outlook.com</email>
</author>
<published>2024-09-23T21:04:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=16d11e26f36fa0de8ef6e402bb85e32bf7c7acd6'/>
<id>16d11e26f36fa0de8ef6e402bb85e32bf7c7acd6</id>
<content type='text'>
Summary:
This function can easily be implemented by forwarding it to the host
process. This shows up in a few places that we might want to test the
GPU so it should be provided. Also, I find the idea of the GPU
offloading work to the CPU via `system` very funny.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Summary:
This function can easily be implemented by forwarding it to the host
process. This shows up in a few places that we might want to test the
GPU so it should be provided. Also, I find the idea of the GPU
offloading work to the CPU via `system` very funny.</pre>
</div>
</content>
</entry>
<entry>
<title>[libc] Implement placeholder memory functions on the GPU (#101082)</title>
<updated>2024-07-30T15:15:30+00:00</updated>
<author>
<name>Joseph Huber</name>
<email>huberjn@outlook.com</email>
</author>
<published>2024-07-30T15:15:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=bf42a7860a208439a0a29f5dcc7a33949c484efb'/>
<id>bf42a7860a208439a0a29f5dcc7a33949c484efb</id>
<content type='text'>
Summary:
These functions are needed for `libc++` to link successfully. We can't
implement them well currently, so simply provide some stand-in
implementations. `realloc` will currently copy garbage and potentially
fault and `aligned_alloc` will work unless your alignment is more than
4K alignment. However, these should work in practice to get tests
running. I will write a real allocator soon™.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Summary:
These functions are needed for `libc++` to link successfully. We can't
implement them well currently, so simply provide some stand-in
implementations. `realloc` will currently copy garbage and potentially
fault and `aligned_alloc` will work unless your alignment is more than
4K alignment. However, these should work in practice to get tests
running. I will write a real allocator soon™.</pre>
</div>
</content>
</entry>
<entry>
<title>[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration (#98597)</title>
<updated>2024-07-12T16:28:41+00:00</updated>
<author>
<name>Petr Hosek</name>
<email>phosek@google.com</email>
</author>
<published>2024-07-12T16:28:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=5ff3ff33ff930e4ec49da7910612d8a41eb068cb'/>
<id>5ff3ff33ff930e4ec49da7910612d8a41eb068cb</id>
<content type='text'>
This is a part of #97655.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is a part of #97655.</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration" (#98593)</title>
<updated>2024-07-12T07:12:13+00:00</updated>
<author>
<name>Mehdi Amini</name>
<email>joker.eph@gmail.com</email>
</author>
<published>2024-07-12T07:12:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=ce9035f5bd3aa09cbd899489cdbc7f6c18acf1e3'/>
<id>ce9035f5bd3aa09cbd899489cdbc7f6c18acf1e3</id>
<content type='text'>
Reverts llvm/llvm-project#98075

bots are broken</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reverts llvm/llvm-project#98075

bots are broken</pre>
</div>
</content>
</entry>
</feed>
