intel / beignet

Beignet is an open source implementation of the OpenCL specification - a generic compute oriented API. Here is Beignet Source Code Mirror in github- This is a publish-only repository and all pull requests are ignored. Please follow https://wiki.freedesktop.org/www/Software/Beignet/ for any of your improvements
GNU Lesser General Public License v2.1
95 stars 40 forks source link

in-order command execution bug #13

Open xrataj00 opened 5 years ago

xrataj00 commented 5 years ago

Following OPENCV test code outputs "fail" every few seconds based on GPU usage. It is using clEnqueueNDRangeKernel internally.

#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>

#include <iostream>
#include <unistd.h>

using namespace cv;
using namespace std;

int main( int argc, char** argv ) {    
    UMat uimage = cv::UMat::zeros(640,640, CV_8U);

    while(1) {
        UMat uimage_res, uimage_canny;
        Mat image;

        uimage_canny = cv::UMat(uimage.rows,uimage.cols, CV_8U,255);
        Canny(uimage, uimage_canny, 20,50, 3);

        resize(uimage_canny,uimage_res, Size(500,500));        
        uimage_res.copyTo(image);

        if(image.at<uchar>(0,0) != 0) cout << "fail" << endl;
    }    

    return 0;
}

I have tested following debian packages: 1.3.0 OK 1.3.1 OK 1.3.2 FAIL

And last 3 commits: e1b2419 OK ab45f14 FAIL fc5f430 FAIL

Looks like it has something to do with out of order execution which was added in last two commits because when I change: https://github.com/intel/beignet/blob/master/src/cl_api_kernel.c#L226 to:

cl_bool allow_immediate_submit = false;

It is running fine. But that does not explain why release 1.3.2 is failing too.

Because compute-runtime is still quite far away for debian it would be nice if you can take a look on that. Thanks.