Warning: Potential store to read-only data.

I’m currently trying to move a code to GPUs that, like all my code, is quite complex. With this latest attempt, I am seeing a new Warning on the command line that I’ve never seen before:

/tmp/pgnvdAajboYFMJOOT.nv4(1608): Warning: Potential store to read-only data.
/tmp/pgnvdAajboYFMJOOT.nv4(1604): Warning: Potential store to read-only data.
/tmp/pgnvdAajboYFMJOOT.nv4(1698): Warning: Potential store to read-only data.
/tmp/pgnvdAajboYFMJOOT.nv4(1694): Warning: Potential store to read-only data.

Since I can’t see those .nv4 files after it compiles, I don’t know if this warning is dire or not. Maybe it relates to the other warning I get with this compile?


Hi Matt,

This seems to indicate the code is trying to write to constant memory from a device routine, or at least the NVIDIA compiler thinks it might be. Can you send us a reproducing example?



I’m sending some code via email to you. It will also demonstrate the issue I had in my other thread.

Thanks for the help,

Problem possibly solved (or at least, warnings not there anymore).

The issue seems to have been due to the use of named keyword arguments (or whatever they are called) in calling these functions.

For example, in my code I had this:


which is correct for the CPU because the DQSAT it calls has many optional arguments (as well as being overloaded for 0-, 1-, 2-, and 3-D input/outputs). For the GPU I had stripped this functionality out and kept only the bare code needed for DQSAT to replicate what was going on. Likewise, in the DQSAT code I had:


where the original QSATICE0 also had optional arguments. I imagine I made mistakes in this, or the compiler was just getting confused somehow.

So, I went through all the code here and got rid of all this X=Y jazz and just did “normal” function references. Doing this meant no more warnings thrown and (promisingly?) the compile time for the GPU is now c. 2 minutes instead of c. 15s.

I’m still not sure the code works, but it compiles differently at least.