Size restrictions for cudaMalloc3DArray and cudaMemcpy3D? Problem with dimensions

Hello out there.

I run into some problems with 3D-arrays and copying data into these arrays.

Sometimes it works well, sometimes it fails.

While debugging i found a not documented behavior for the dimensions for the arrays.

Here is my sample code:


texture<int4, 3, cudaReadModeElementType> tex;

cudaChannelFormatDesc chanDesc = cudaCreateChannelDesc(32, 32, 32, 32, cudaChannelFormatKindSigned);

cudaArray* d_tex;

cudaExtent ex = make_cudaExtent(w, h, d);

cudaMalloc3DArray(&d_tex, &chanDesc , ex );

int4* test_data;

cudaMalloc((void **)&test_data, sizeof(int4) * ex .width * ex .height * ex .depth);

cudaMemcpy3DParms copyParams = {0};

copyParams.srcPtr = make_cudaPitchedPtr((void *)test_data, sizeof(int4) * ex.width, ex.width, ex.height);

copyParams.dstArray = d_tex;

copyParams.kind = cudaMemcpyDeviceToDevice;

copyParams.extent = ex;



After some test-runs I run this code in a loop with increasing numbers for each dimension.


If xdim = 4, 8, 12, 16, 20, 24, […] I got “cudaSuccess” for the copy operation, no matter how the other dimensions are.

Otherwise (if xdim != 4, 8, 12 […] ) only if the y dimension is 1 the copy operation works.

If ydim != 1 (no matter on z) the copying results in “cudaErrorInvalidValue”.

For example:

I can not copy data to an array with x=6, y=3, z=1

I can not copy data to an array with x=7, y=3, z=1

But i can copy data to an array with x=8, y=7, z=5

or with x=7, y=1, z=8

(The small dimension settings are just choosen for simplification, it seems there are the same problems for higher values)

Are there some known issues or restrictions I didnt found yet or am I just to stupid to get work correctly?

[My System]

MS Windows Vista 32bit

GeForce 9800 GTX+

Toolkit Version 2.1

SDK Version 2.1 Beta


Did not work either.