Could anybody please explain to me why there is a need for a special treatment of VRAM compared to a regular system RAM in this use case? Assuming, we can perform an allocation in VRAM (probably using OpenCL API), why can't we use tmpfs/ramfs code? Do I understand correctly that PCI maps VRAM to a certain memory region and it is accessible via regular CPU instructions? Is it because CPU caching is different or VRAM i…
VRAMfs – VRAM based file system for Linux
11–20 of 26 posts
Re: VRAMfs – VRAM based file system for Linux
#12Ideally then one should be able to use spare VRAM as a second level RAM - an area to page out things to before disk. I've played a bit with the different memory compression tools on Linux, zram, zswap, and zcache, and they all behave in interesting ways on workloads whose active set is well over 2x available RAM. I played with compiling the Glasgow Haskell Compiler on small and extra small instances of cloud services…
> Ideally then one should be able to use spare VRAM as a second level RAM - an area to page out things to before disk. It's already possible on Linux. You can use SWAP file instead of partition and there also SWAP priorities available.
I would trust more something that got rid of the VFS layer and simply allowed VRAM to be used directly as a second level below RAM using the transcendental memory model.
Re: VRAMfs – VRAM based file system for Linux
#13Earlier quoted context omitted.
> Ideally then one should be able to use spare VRAM as a second level RAM - an area to page out things to before disk. It's already possible on Linux. You can use SWAP file instead of partition and there also SWAP priorities available.
I've found that putting swap files on things that don't behave like filesystems can cause interesting behaviors. In this case, all writes to the file would go through the VFS. I imagine there could be some curious issues if that write path has any allocations or significant amount of mutation in it. I would trust more something that got rid of the VFS layer and simply allowed VRAM to be used directly as a second leve…
Re: VRAMfs – VRAM based file system for Linux
#14Re: VRAMfs – VRAM based file system for Linux
#15Earlier quoted context omitted.
Yes, it's owned by the GPU, but you can map it to the regular space. In fact, this is exactly how textures and other data gets loaded to the video card. See http://en.wikipedia.org/wiki/Memory-mapped_I/O
True -- you can use (in OpenCL) clEnqueueMapBuffer to get something that looks like memory-mapped IO, but the consistency guarantees are different from regular host-based MMIO. Specifically, if you map a GPU buffer for writes, there's no guarantee on what you'll get when you read that buffer until you unmap the region. (You can think of it as buffering up writes in host memory until you unmap the region, at which poi…
Re: VRAMfs – VRAM based file system for Linux
#16This is cool. Video card memory is not used when not playing game. Good use of unused resource.
You'd be surprised.
Re: VRAMfs – VRAM based file system for Linux
#17It's a cool idea; as other posters have mentioned, there have been other projects mapping VRAM for swap, etc. I'd personally be wary of putting anything too important into VRAM. About five years ago I did a bunch of work testing consumer GPU memory for reliability [1, 2]. Because until that time GPUs were primarily used for error-tolerant applications (graphics) storing only short-lived data (textures) in memory, the…
Re: VRAMfs – VRAM based file system for Linux
#18Re: VRAMfs – VRAM based file system for Linux
#19This is interesting. However, considering how 4GB to 8GB RAM is getting so common nowadays, using a ramdisk e.g. a tmpfs partition is quite useful. I've set Firefox and Google Chrome to use a 1 GB tmpfs partition for their cache and the performance improvement is clearly visible.