This provides some basic motivation behind the GPU libc. Suggests are welcome.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Honestly, I feel this is too pessimistic and short sighted. I understand we likely don't want everything on a GPU, maybe event can't, but I would not be so eager to guess for some of the things mentioned here. File I/O, for one, is on my TODO list. The entire "we do not want dependencies" is nice, but also somewhat irrelevant given that the vendor libs are linked in (to this day) anyway. Sure, we do not link them into libcgpu, but that is not because of some grant design, IMHO, but rather because we didn't need to (yet). Once libmgpu arrives, we will have to (or link libdevice later), so we will do what the motivation now states we don't want to.
libc/docs/gpu/motivation.rst | ||
---|---|---|
17 | typo | |
55 | 2x currently FWIW, GPUs have thread local variables, aka. local |
Way back I started down this path because I thought running N lua virtual machines on a gpu would be an interesting programming model and the reference lua machine is written in C. Whether that's motivation for anyone else is not totally clear to me.
In principle I'd like to be able to do things like put a sqlite database instance in a persistent kernel. In general a persistent kernel that spawns other threads on the GPU and occasionally calls into the CPU is an interesting alternative to the current offload in batches model. Perhaps we'll be able to DMA from a nic into GPU memory, do some maths, push results back without the host cpu doing anything much.
Today my primary interest in libc is as a precise and comprehensive vehicle for stress testing the GPU back ends, so that when people try to use them for general purpose software things they have a better experience, but tomorrow I hope it'll be the layer below more complicated GPU applications.
libc/docs/gpu/motivation.rst | ||
---|---|---|
21 | Libc isn't really here to provide host services. It's to provide a familiar userspace. It's also a reasonable foundation for bigger userspace stuff, notably libc++. Weve just started with the host services part because without syscall a lot of libc can't do anything. |
I think that File I/O should be mostly straightforward. The existing interface I pushed for puts support pretty much just keeps a reference to a FILE * on the host. Using newer CUDA with asyncs in a separate stream we should be able to generically support H2D or D2H memcpy, so we should probably have some logic that lets us use that if the device pointer is global
The entire "we do not want dependencies" is nice, but also somewhat irrelevant given that the vendor libs are linked in (to this day) anyway. Sure, we do not link them into libcgpu, but that is not because of some grant design, IMHO, but rather because we didn't need to (yet). Once libmgpu arrives, we will have to (or link libdevice later), so we will do what the motivation now states we don't want to.
So, a long-term goal of this project is to provide a lot of those facilities in a more complete way. I think the initial invocation of libmgpu.a will simply map to the vendor libraries, but we can easily extend it further using a more generic implementation.
I still think it's too negative but OK for now
libc/docs/gpu/motivation.rst | ||
---|---|---|
38 | @tianshilei1992 Can you link the IWOMP paper here please. In a follow up. | |
47–48 |
typo