开发者

Is local memory slower than shared memory in CUDA?

开发者 https://www.devze.com 2023-04-01 12:06 出处:网络
I only found a remark that local memory is slower than register memory, the two-per-thread types. Shared memory is supposed to be fast, but is it faster than local memory [of the thread]?

I only found a remark that local memory is slower than register memory, the two-per-thread types.

Shared memory is supposed to be fast, but is it faster than local memory [of the thread]?

What I want to do is kind of a median filter, but with a given percentile instead of the median. Thus I need to take chunks of the list, sort them, and then pick a suitable one. But开发者_运维百科 I can't start sorting the shared memory list or things go wrong. Will I lose a lot of performance by just copying to local memory?


Local memory is just thread local global memory. It is much, much slower (both in terms of bandwidth and latency) than either registers or shared memory. It also consumes memory controller bandwidth that would otherwise be available for global memory transactions. The performance impact of spilling or deliberately using local memory can be anything from minor to severe, depending on the hardware you are using and how local memory is used.

According to Vasily Volkov's research - see Better performance at lower occupancy (pdf) -- there is about a factor of 8 difference in effective bandwidth between shared memory and register on Fermi GPUs (about 1000 Gb/s for shared memory and 8000 Gb/s for registers). This somewhat contradicts the CUDA documentation, which implies that shared memory is comparable in speed to registers.

0

精彩评论

暂无评论...
验证码 换一张
取 消