Page 2 of 2

Re: Spring engine future tech updates

Posted: 27 Feb 2014, 00:02
by jK
Guys guys guys ...
I have never read such many half-truths, you should read up before posting something as fact ...
  • Virtual Address Space != Physical Address Space
    Even without PAE the OS uses a Virtual Address Space, and only maps SysRAM, PCI, ... on-demand.
  • There is a 2GB barrier on Windows (on linux it is done differently so the limit can be much higher there even w/o PAE)
    -> see Image from http://blogs.technet.com/b/markrussinov ... 92070.aspx
    -> so when enough memory is installed max 2GB are available for the applications, the rest is system.
  • When using PAE you run into the 3GB barrier, which isn't as hard as the 2GB one (some have only 2.7GB available, others got 3.2GB). This is cause even with PAE you cannot access the full 4GB technical possible, the system still needs some address space. So only ~1GB can be moved into locations outside of the applications address space.
    Also under Windows PAE only works when the application defines IMAGE_FILE_LARGE_ADDRESS_AWARE (under linux this is not needed), see memory_limits. And yes, Spring sets that since 89. And yes, it was needed because multiple zerok players reported matches where all windows users crashed but not a single linux user.
    Never the less, Spring marginally uses more than 2GB, but not cause of itself, see the last item.
  • Video ram is not mapped into virtual address space, there are a few pci pages mapped to it, but those are needed for communication with the pci-devices, they aren't memory. Still video ram _can_ on request mapped, this way a CPU is able to send vertex & texture data directly to a gpu, but those address spaces are normally freed after usage. So GPU drivers only keep ~128MB for this feature locked (duno if in user or system space).
    I.e. the link above mentions an example of 2x GTX280 with 1GB vram each, mapping 512MB (2x256MB).
  • There is AGP Memory, that eats your available memory. AGP Memory despite its name is allocated for any GPU (APU, PCI, AGP, PCI-E, ...), and is sometimes configurable in the BIOS. It's a locked block in the SysRAM only available to the GPU. I.e. when the video ram is to small to render a frame, the GPU is able to cache out texture data from video ram to agp memory.
    These days with increasing video ram sizes this becomes redundant, also a fixed size is not state of the art, so when possible it's worth to set AGP Memory to 0MB (also many mainboards started to block the memory only when really used).
  • Even w/o AGP Memory your GPU is able to allocate pages in SysRAM these days via DMA, used for modern OpenGL BufferObjects (VBO,PBO,UBO,...). For this your GPU driver maps 128-512MB in the virtual address space (for each gpu!). Still this is only virtual, no SysRAM is locked till it really gets used (never the less in 32bit it eats the already rare address space and limits so the accessible RAM).
  • The GPU driver also allocates SysRAM itself, for other purposes.
  • So Spring itself uses quite less memory 400-1400MB, the reason why Spring breaks the 2GB barrier is the GPU driver that can address upto 1GB (in user space!). And this 3rd party allocated memory also depends on the maximum available memory (drivers like to allocate more when more is available).
    -> nearly 50% of Spring's allocated memory is done by the gpu driver!
PS: I never inspected the virtual address space of Spring (also that would differ a lot under windows & linux), I only profiled the actual allocated sysram via tools like memprof under linux.

Re: Spring engine future tech updates

Posted: 27 Feb 2014, 08:14
by Dark_Ansem
jK wrote:Guys guys guys ...
I have never read such many half-truths, you should read up before posting something as fact ...
  • Virtual Address Space != Physical Address Space
    Even without PAE the OS uses a Virtual Address Space, and only maps SysRAM, PCI, ... on-demand.
  • There is a 2GB barrier on Windows (on linux it is done differently so the limit can be much higher there even w/o PAE)
    -> see Image from http://blogs.technet.com/b/markrussinov ... 92070.aspx
    -> so when enough memory is installed max 2GB are available for the applications, the rest is system.
  • When using PAE you run into the 3GB barrier, which isn't as hard as the 2GB one (some have only 2.7GB available, others got 3.2GB). This is cause even with PAE you cannot access the full 4GB technical possible, the system still needs some address space. So only ~1GB can be moved into locations outside of the applications address space.
    Also under Windows PAE only works when the application defines IMAGE_FILE_LARGE_ADDRESS_AWARE (under linux this is not needed), see memory_limits. And yes, Spring sets that since 89. And yes, it was needed because multiple zerok players reported matches where all windows users crashed but not a single linux user.
    Never the less, Spring marginally uses more than 2GB, but not cause of itself, see the last item.
  • Video ram is not mapped into virtual address space, there are a few pci pages mapped to it, but those are needed for communication with the pci-devices, they aren't memory. Still video ram _can_ on request mapped, this way a CPU is able to send vertex & texture data directly to a gpu, but those address spaces are normally freed after usage. So GPU drivers only keep ~128MB for this feature locked (duno if in user or system space).
    I.e. the link above mentions an example of 2x GTX280 with 1GB vram each, mapping 512MB (2x256MB).
  • There is AGP Memory, that eats your available memory. AGP Memory despite its name is allocated for any GPU (APU, PCI, AGP, PCI-E, ...), and is sometimes configurable in the BIOS. It's a locked block in the SysRAM only available to the GPU. I.e. when the video ram is to small to render a frame, the GPU is able to cache out texture data from video ram to agp memory.
    These days with increasing video ram sizes this becomes redundant, also a fixed size is not state of the art, so when possible it's worth to set AGP Memory to 0MB (also many mainboards started to block the memory only when really used).
  • Even w/o AGP Memory your GPU is able to allocate pages in SysRAM these days via DMA, used for modern OpenGL BufferObjects (VBO,PBO,UBO,...). For this your GPU driver maps 128-512MB in the virtual address space (for each gpu!). Still this is only virtual, no SysRAM is locked till it really gets used (never the less in 32bit it eats the already rare address space and limits so the accessible RAM).
  • The GPU driver also allocates SysRAM itself, for other purposes.
  • So Spring itself uses quite less memory 400-1400MB, the reason why Spring breaks the 2GB barrier is the GPU driver that can address upto 1GB (in user space!). And this 3rd party allocated memory also depends on the maximum available memory (drivers like to allocate more when more is available).
    -> nearly 50% of Spring's allocated memory is done by the gpu driver!
PS: I never inspected the virtual address space of Spring (also that would differ a lot under windows & linux), I only profiled the actual allocated sysram via tools like memprof under linux.
thanks :) even more than I was looking for