From 29e047fa2e87c6841e56f2a5fca55a336d839416 Mon Sep 17 00:00:00 2001 From: TimothyLottes Date: Sat, 12 Nov 2016 20:13:05 -0500 Subject: [PATCH] Add files via upload --- 20121229.html | 14 ++++++++++++++ index.html | 1 + 2 files changed, 15 insertions(+) create mode 100644 20121229.html diff --git a/20121229.html b/20121229.html new file mode 100644 index 0000000..8a8dee8 --- /dev/null +++ b/20121229.html @@ -0,0 +1,14 @@ +
+

20121229 - Practical Non-Atomic CPU/GPU Communication

+
+ + +Abusing GL_STREAM_DRAW as pinned memory on NVIDIA (or GL_AMD_pinned_memory on AMD) can be a great tool for reducing latency. I'm currently using this kind of system to send object updates to the GPU. A CPU thread can read network packets and just forward information directly to the GPU (which is managing the scene in my case). The reverse can be used to send back information to the CPU.
+
+(1.) CPU thread writes packets of information into a pinned memory buffer. The area of the buffer used to send packets to the GPU is effectively write only on the CPU, and read only on the GPU. (2.) Each packet includes a 32-bit word which is the hash of the packet. I'm using an integer sum of the 32-bit words as the hash. (3.) In a 256 byte packet, each 16 bytes is spaced out by a multiple of the maximum GPU SIMD width (which is 64 on AMD). 16 bytes for 64 packets are interleaved, then blocks of these interleaved 64 packets are layed out linearly in memory. This insures fast fully coalesced vec4 reads on the GPU. (4.) The GPU later reads the packets and can discard packets in which the hash fails. This effectively solves the problem of the GPU reading a partial update. (5.) CPU keeps each packet in at least 2 frames to insure the GPU gets the packet. + + + +
+ + diff --git a/index.html b/index.html index e946e67..cfdf4e1 100644 --- a/index.html +++ b/index.html @@ -208,6 +208,7 @@ and attempting to restore what I can from prior lost images. 20130119 - Understanding the Speed of Light of Game Input Latency

2012
+20121229 - Practical Non-Atomic CPU/GPU Communication
20121203 - Simple Custom Web Server Tricks

20121001 - Linux Distros and Compression