Strange error doing 2-d convolution

Strange error doing 2-d convolution

Hi, I'm attempting to do a 2-d convolution of a 1024x1024 array with a 3x3 kernel with 1024x1024 output. The vslsConvNewTask returns a status of 0, indicating the task was created successfully. However, vslsConvExec returns a status of 1048576, which isn't even a valid error code as far as I can find. I have tried running the convolution under the direct, fft, and auto modes and they all return the same result. Here's what the code itself looks like:

dims = 2;
status = vslsConvNewTask(&task, mode, dims, xShape, yShape, zShape);
status2 = vslsConvExec(&task, input, xstride, kernel, xstride, output, xstride);

The code executes, but my output is an array of all 0s and I get the strange status code from vslsConvExec. I'm really at a loss to understand what's happening

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.


Please excuse me for the long delay; Ive overlooked your request.

About that piece of code you provide, I see two points which must cause C/C++ compiler to raise warnings.

First, the function vslsConvExec() expects the 1st parameter to be VSLConvTaskPtr, not the reference to VSLConvTaskPtr. That is, you need to replace the call:

status2 = vslsConvExec(&task, );


status2 = vslsConvExec(task, );

Second, the functions vslsConvNewTask() and vslsConvExec() expect the shape and stride parameters to be integer arrays of the type int[], not scalars. In your example, the code might look like following:

int xShape[] = {1024,1024};

int yShape[] = {3,3};

int zShape[] = {1026,1026}; // 1026 = 1024 + 3 - 1

int mode = VSL_CONV_MODE_AUTO;

int dims = 2;

VSLConvTaskPtr task;

int status = vslsConvNewTask(&task, mode, dims, xShape, yShape, zShape);

int staus2 = vslsConvExec(task, input, NULL, kernel, NULL, output, NULL);

The NULL arrays instead of stride parameters cause MKL to process the da
ta arrays with trivial strides. If you prefer assigning the strides explicitly, the code modification might look like following:

int xStride[] = {1,1024};

int yStride[] = {1,3};

int zStride[] = {1,1026};

int staus2 = vslsConvExec(task, input, zStride, kernel, yStride, output, zStride);

I hope these hints must help. Anyway, please let me know (via this Forum thread) if you have more questions about the MKL convolution and correlation software.


Yevgeny Latkin

Leave a Comment

Please sign in to add a comment. Not a member? Join today