[libc-commits] [PATCH] D158774: [libc] Add GPU support for `printf` and `fprintf`

Joseph Huber via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Sep 7 15:57:19 PDT 2023


jhuber6 added a comment.

In D158774#4641360 <https://reviews.llvm.org/D158774#4641360>, @michaelrj wrote:

> LGTM from the printf side, I don't know enough about GPU coding to review the RPC stuff

I'm actually having second thoughts about this approach. There were basically two options, we either parse it on the CPU and tell the GPU what to do, or we parse it on the GPU directly. I went with the latter because the former requires more cross-device communication (which is the really slow part). But looking at it now, it's basically doubling the amount of time it takes to process an argument (~5us to ~10us) but it does save us a lot of time. It would basically require yet another mock argument parser that goes through the list and encodes some enum for what type to use for `next_var()` in the `va_list`. I did a mock-up of this and it's much lighter weight. I would allow us to get rid of the ad-hoc parser I've created though, so you might like that. I could maybe hide some of the latency better... It's a tough choice. I might play around with it some more tomorrow.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158774/new/

https://reviews.llvm.org/D158774



More information about the libc-commits mailing list