structuralize bug fix: check the loop successor before merge.

Submitted by Luo, Xionghu on July 6, 2015, 6:51 a.m.

Details

Message ID 1436165499-26516-1-git-send-email-xionghu.luo@intel.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Luo, Xionghu July 6, 2015, 6:51 a.m.
From: Luo Xionghu <xionghu.luo@intel.com>

self loop header should have a successor to itself, check this before merge.
this could fix Opencv case opencv_perf_imgproc/OCL_CvtColorFixture_CvtColor causes GPU hang.

Signed-off-by: Luo Xionghu <xionghu.luo@intel.com>
---
 backend/src/ir/structurizer.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

Patch hide | download patch | download mbox

diff --git a/backend/src/ir/structurizer.cpp b/backend/src/ir/structurizer.cpp
index 82bb56b..6c4e455 100644
--- a/backend/src/ir/structurizer.cpp
+++ b/backend/src/ir/structurizer.cpp
@@ -812,6 +812,13 @@  namespace ir {
     if(loopBBs.empty())
       return 0;
 
+    if(loopSets.size() == 1) {
+    //self loop header should have a successor to itself, check this before merged.
+      Block* lblock = *loopSets.begin();
+      if(lblock->successors().find(lblock) == lblock->successors().end())
+        return 0;
+    }
+
     Block* mergedBB = mergeLoopBlock(loopBBs);
     if(mergedBB == NULL)
       return 0;

Comments

LGTM, pushed, thanks.

> -----Original Message-----

> From: Beignet [mailto:beignet-bounces@lists.freedesktop.org] On Behalf Of

> xionghu.luo@intel.com

> Sent: Monday, July 6, 2015 14:52

> To: beignet@lists.freedesktop.org

> Cc: Luo, Xionghu

> Subject: [Beignet] [PATCH] structuralize bug fix: check the loop successor

> before merge.

> 

> From: Luo Xionghu <xionghu.luo@intel.com>

> 

> self loop header should have a successor to itself, check this before merge.

> this could fix Opencv case

> opencv_perf_imgproc/OCL_CvtColorFixture_CvtColor causes GPU hang.

> 

> Signed-off-by: Luo Xionghu <xionghu.luo@intel.com>

> ---

>  backend/src/ir/structurizer.cpp | 7 +++++++

>  1 file changed, 7 insertions(+)

> 

> diff --git a/backend/src/ir/structurizer.cpp b/backend/src/ir/structurizer.cpp

> index 82bb56b..6c4e455 100644

> --- a/backend/src/ir/structurizer.cpp

> +++ b/backend/src/ir/structurizer.cpp

> @@ -812,6 +812,13 @@ namespace ir {

>      if(loopBBs.empty())

>        return 0;

> 

> +    if(loopSets.size() == 1) {

> +    //self loop header should have a successor to itself, check this before

> merged.

> +      Block* lblock = *loopSets.begin();

> +      if(lblock->successors().find(lblock) == lblock->successors().end())

> +        return 0;

> +    }

> +

>      Block* mergedBB = mergeLoopBlock(loopBBs);

>      if(mergedBB == NULL)

>        return 0;

> --

> 1.9.1

> 

> _______________________________________________

> Beignet mailing list

> Beignet@lists.freedesktop.org

> http://lists.freedesktop.org/mailman/listinfo/beignet