-1

I was reading this presentation document: http://on-demand.gputechconf.com/gtc-express/2011/presentations/register_spilling.pdf

In page 3 of the presentation, the author states:

A store always happens before a load –Only GPU threads can access LMEM addresses

Can anybody explain to me why? Does he mean when the local memory is first initialised?

einpoklum
  • 118,144
  • 57
  • 340
  • 684
  • 2
    I think it refers to the fact that it's a different memory space than the global memory one, so before you can use it, you need to initialize it with stores. – Hopobcn Mar 13 '17 at 17:47
  • 1
    Please don't go changing (and vastly expanding) your question after it had been answered. If you have a new, on-topic question, then ask it in a mew question. – talonmies Mar 14 '17 at 04:11

2 Answers2

3

In this respect, local memory is something like shared memory.

  1. In order to do anything useful with shared memory, you have to initialize (store something) first. The same is true for Local memory.

  2. Only CUDA thread code can access local memory. There are no CUDA API calls like cudaMemcpy that can access local memory. It is not possible to initialize local memory from host code.

The same comments are basically true for shared memory.

Robert Crovella
  • 143,785
  • 11
  • 213
  • 257
1

"Does he mean when the local memory is first initialised?" - Yes.

You cannot "cudaMemcpy()" to local memory, because it is outside of the global address space. If you try to explicitly initialise local variables, the compiler generates stores to local memory, because the initialisation needs to be repeated for each block. So there is no way to have a defined value in local memory without writing it there first.

tera
  • 7,080
  • 1
  • 21
  • 32
  • Thank you all for the confirmation. @tera, your answer is actually what i meant implicitely by "initialise" – Thierry Brown Mar 13 '17 at 22:34
  • to all the helpers, I have added few questions to my original query if you could help, thank you – Thierry Brown Mar 14 '17 at 00:27
  • 1
    @ThierryBrown: That isn't how [SO] works. You have asked a question. You have received two good answers to it. You should accept one of those answers. If you have a new question, then post a new question. This is not your personal help thread, it is a standalone question which exists to help everyone. – talonmies Mar 14 '17 at 05:15