Kernel Formal parameter space overflowed

I am have real trouble with this code it will not compile for some reason and does not make any sense.

I am getting this error that says…

C:\DOCUME~1\alex\LOCALS~1\Temp/tmpxft_000016fc_00000000-21_stem.cpp3.i(0): E

rror: Formal parameter space overflowed in function _Z15kernel_stem21stem




I know this has to do with me passing too many parameters but I can’t get the the global variable to work either so I am forced to pass them through the kernel. I know this probably is not making sense to anyone but I am so lost.

I have about 60-70 variables, half of which are pointers, that need to be passed to the kerenl and I can’t seem to figure any of this out. Does anyone have any thoughts.

Just a thought…

  1. Define a struct that has fields for each of the necessary pointers.
  2. Create an instance of this structure on the host
  3. Populate the fields of this structure with the device pointers
  4. Allocate space for this struct on the device
  5. cudaMemCopy the structure to the device
  6. Pass the device address of the struct to the kernel
  7. You should now be able to use the pointer parameter to the struct to access the other pointers

Amount of shared memory reserved for arguments is 256 bytes.

Your code has exceeded that limit.

SO, condense them into a structure in GPU’s global memory and just pass one pointer to that structure as argument. – Just like what JPH has said in the prev post

so do something like this?

typedef struct{

 float *p1;




 float *p50;

} structName;

__global__ void kernel(structName);

int main(){

  __device__ structName d_sn; 

  structName h_sn;

// allocate and populate h_sn

  // allocate to device with cudaMalloc

  // copy memory with cudaMemcpy


  // copy back and do what ever

  return 0;


or should the structs be pointers? im just a little lost as to how to do in code what you just said.

the struct would be a pointer, yes.