[FFmpeg-devel] [PATCH] is_compiled flag not being cleared in av_opencl_uninit
When OpenCL kernels are compiled, is_compiled flag is being set for each kernel. But, in opencl uninit, this flag is not being cleared. This causes an error when an OpenCL kernel is tried on different OpenCL devices on same platform. Here is the patch with a fix --- libavutil/opencl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavutil/opencl.c b/libavutil/opencl.c index 36cb6fe..a56029c 100644 --- a/libavutil/opencl.c +++ b/libavutil/opencl.c @@ -611,6 +611,9 @@ void av_opencl_uninit(void) } opencl_ctx.context = NULL; } + for (i = 0; i < opencl_ctx.kernel_code_count; i++) { +opencl_ctx.kernel_code[i].is_compiled = 0; +} free_device_list(&opencl_ctx.device_list); end: if (opencl_ctx.init_count <= 0) Please incorporate this change. Let me know if more info is needed regarding this. Thanks, Srikanth ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] is_compiled flag not being cleared in av_opencl_uninit
When OpenCL kernels are compiled, is_compiled flag is being set for each kernel. But, in opencl uninit, this flag is not being cleared. This causes an error when an OpenCL kernel is tried on different OpenCL devices on same platform. Here is the patch with a fix >From df43e0aaad951c43fa7f4c9d9e074fd6b2d09792 Mon Sep 17 00:00:00 2001 From: srikanth Date: Wed, 4 Mar 2015 17:46:13 -0600 Subject: [PATCH] Bug Fix: When OpenCL kernels are compiled, is_compiled flag is being set. But, on opencl uninit, this flag is not being cleared. When openCl uninit is done and again use OpenCl for different device on same platform, we get an error as is_compiled flag stays set. --- libavutil/opencl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavutil/opencl.c b/libavutil/opencl.c index 36cb6fe..a56029c 100644 --- a/libavutil/opencl.c +++ b/libavutil/opencl.c @@ -611,6 +611,9 @@ void av_opencl_uninit(void) } opencl_ctx.context = NULL; } + for (i = 0; i < opencl_ctx.kernel_code_count; i++) { +opencl_ctx.kernel_code[i].is_compiled = 0; +} free_device_list(&opencl_ctx.device_list); end: if (opencl_ctx.init_count <= 0) -- 1.9.0.msysgit.0 Regards Srikanth 0001-Bug-Fix-When-OpenCL-kernels-are-compiled-is_compiled.patch Description: Binary data ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] is_compiled flag not being cleared in av_opencl_uninit
Hi Michael, Can you let me know the compilation errors? I tried with this fix and things were working for me. I will try again though. -Srikanth On Sat, Mar 7, 2015 at 3:24 AM, Michael Niedermayer wrote: > On Fri, Mar 06, 2015 at 03:30:00PM +0100, Michael Niedermayer wrote: > > On Fri, Mar 06, 2015 at 07:34:06PM +0800, Wei Gao wrote: > > > 2015-03-05 8:48 GMT+08:00 Srikanth G : > > > > > > > When OpenCL kernels are compiled, is_compiled flag is being set for > each > > > > kernel. But, in opencl uninit, this flag is not being cleared. > > > > This causes an error when an OpenCL kernel is tried on different > OpenCL > > > > devices on same platform. > > > > > > > > Here is the patch with a fix > > > > > > > > --- > > > > libavutil/opencl.c | 3 +++ > > > > 1 file changed, 3 insertions(+) > > > > > > > > diff --git a/libavutil/opencl.c b/libavutil/opencl.c > > > > index 36cb6fe..a56029c 100644 > > > > --- a/libavutil/opencl.c > > > > +++ b/libavutil/opencl.c > > > > @@ -611,6 +611,9 @@ void av_opencl_uninit(void) > > > > } > > > > opencl_ctx.context = NULL; > > > > } > > > > + for (i = 0; i < opencl_ctx.kernel_code_count; i++) { > > > > +opencl_ctx.kernel_code[i].is_compiled = 0; > > > > +} > > > > free_device_list(&opencl_ctx.device_list); > > > > end: > > > > if (opencl_ctx.init_count <= 0) > > > > > > > > Please incorporate this change. > > > > Let me know if more info is needed regarding this. > > > > > > > Looks good to me. > > > > applied > > reverted, this patch broke compilation with opencl > > [...] > > > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > During times of universal deceit, telling the truth becomes a > revolutionary act. -- George Orwell > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] is_compiled flag not being cleared in av_opencl_uninit
Hi Michael, I did the fix and verified compilation and run. Confirmed it works. Here is the patch --- libavutil/opencl.c | 4 1 file changed, 4 insertions(+) diff --git a/libavutil/opencl.c b/libavutil/opencl.c index 36cb6fe..2df5653 100644 --- a/libavutil/opencl.c +++ b/libavutil/opencl.c @@ -588,6 +588,7 @@ end: void av_opencl_uninit(void) { +int i; cl_int status; LOCK_OPENCL; opencl_ctx.init_count--; @@ -611,6 +612,9 @@ void av_opencl_uninit(void) } opencl_ctx.context = NULL; } +for (i = 0; i < opencl_ctx.kernel_code_count; i++) { +opencl_ctx.kernel_code[i].is_compiled = 0; +} free_device_list(&opencl_ctx.device_list); end: if (opencl_ctx.init_count <= 0) -- 1.9.0.msysgit.0 Thanks, Srikanth On Sat, Mar 7, 2015 at 12:14 PM, Michael Niedermayer wrote: > On Sat, Mar 07, 2015 at 10:53:05AM -0600, Srikanth G wrote: > > Hi Michael, > > > > Can you let me know the compilation errors? > > I tried with this fix and things were working for me. > > > > I will try again though. > > you can checkout a fresh ffmpeg and apply the patch > "i" is not declared in that function so it will not build > the fix is trivial but i expect code to be tested, which this > obviously has not been and would not magically be if i add int i > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. > User > questions about the command line tools should be sent to the ffmpeg-user > ML. > And questions about how to use libav* should be sent to the libav-user ML. > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] is_compiled flag not being cleared in av_opencl_uninit
Attaching the patch file per Wei's request -Srikanth On Mon, Mar 9, 2015 at 5:45 PM, Srikanth G wrote: > Hi Michael, > > I did the fix and verified compilation and run. > Confirmed it works. > > Here is the patch > > > --- > libavutil/opencl.c | 4 > 1 file changed, 4 insertions(+) > > diff --git a/libavutil/opencl.c b/libavutil/opencl.c > index 36cb6fe..2df5653 100644 > --- a/libavutil/opencl.c > +++ b/libavutil/opencl.c > @@ -588,6 +588,7 @@ end: > > void av_opencl_uninit(void) > { > +int i; > cl_int status; > LOCK_OPENCL; > opencl_ctx.init_count--; > @@ -611,6 +612,9 @@ void av_opencl_uninit(void) > } > opencl_ctx.context = NULL; > } > +for (i = 0; i < opencl_ctx.kernel_code_count; i++) { > +opencl_ctx.kernel_code[i].is_compiled = 0; > +} > free_device_list(&opencl_ctx.device_list); > end: > if (opencl_ctx.init_count <= 0) > -- > 1.9.0.msysgit.0 > > > Thanks, > Srikanth > > On Sat, Mar 7, 2015 at 12:14 PM, Michael Niedermayer > wrote: > >> On Sat, Mar 07, 2015 at 10:53:05AM -0600, Srikanth G wrote: >> > Hi Michael, >> > >> > Can you let me know the compilation errors? >> > I tried with this fix and things were working for me. >> > >> > I will try again though. >> >> you can checkout a fresh ffmpeg and apply the patch >> "i" is not declared in that function so it will not build >> the fix is trivial but i expect code to be tested, which this >> obviously has not been and would not magically be if i add int i >> >> [...] >> -- >> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB >> >> Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. >> User >> questions about the command line tools should be sent to the ffmpeg-user >> ML. >> And questions about how to use libav* should be sent to the libav-user ML. >> >> ___ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >> >> > 0001-OpenCL-uninit-bug-fix-clear-is_compiled-flag.patch Description: Binary data ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel