Re: [Mesa-dev] [PATCH] nv50/ra: let simplify return an error and handle that

2016-10-03 Thread Samuel Pitoiset



On 10/03/2016 06:55 PM, Karol Herbst wrote:

fixes a crash in the case simplify reports an error

Signed-off-by: Karol Herbst 
---
 src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp 
b/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
index 2d3486b..7e64f7c 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
@@ -771,7 +771,7 @@ private:
bool coalesce(ArrayList&);
bool doCoalesce(ArrayList&, unsigned int mask);
void calculateSpillWeights();
-   void simplify();
+   bool simplify();
bool selectRegisters();
void cleanup(const bool success);

@@ -1305,7 +1305,7 @@ GCRA::simplifyNode(RIG_Node *node)
 (node->degree < node->degreeLimit) ? "" : "(spill)");
 }

-void
+bool
 GCRA::simplify()
 {
for (;;) {
@@ -1330,11 +1330,11 @@ GCRA::simplify()
  }
  if (isinf(bestScore)) {
 ERROR("no viable spill candidates left\n");
-break;
+return false;
  }
  simplifyNode(best);
   } else {
- break;
+ return true;


I would suggest to move the "return true;" outside of the while(1) and 
keep the break as-is, but your call (purely cosmetic).



   }
}
 }
@@ -1493,7 +1493,9 @@ GCRA::allocateRegisters(ArrayList& insns)

buildRIG(insns);
calculateSpillWeights();
-   simplify();
+   ret = simplify();
+   if (!ret)
+  goto out;

ret = selectRegisters();
if (!ret) {


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] nv50/ra: let simplify return an error and handle that

2016-10-03 Thread Ilia Mirkin
Of course this only helps shader-db, right? Pretty sure you'll hit an
assert if you try to draw... Either way, that can be fixed later. This
is

Reviewed-by: Ilia Mirkin 

On Mon, Oct 3, 2016 at 12:55 PM, Karol Herbst  wrote:
> fixes a crash in the case simplify reports an error
>
> Signed-off-by: Karol Herbst 
> ---
>  src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp | 12 +++-
>  1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp 
> b/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
> index 2d3486b..7e64f7c 100644
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
> @@ -771,7 +771,7 @@ private:
> bool coalesce(ArrayList&);
> bool doCoalesce(ArrayList&, unsigned int mask);
> void calculateSpillWeights();
> -   void simplify();
> +   bool simplify();
> bool selectRegisters();
> void cleanup(const bool success);
>
> @@ -1305,7 +1305,7 @@ GCRA::simplifyNode(RIG_Node *node)
>  (node->degree < node->degreeLimit) ? "" : "(spill)");
>  }
>
> -void
> +bool
>  GCRA::simplify()
>  {
> for (;;) {
> @@ -1330,11 +1330,11 @@ GCRA::simplify()
>   }
>   if (isinf(bestScore)) {
>  ERROR("no viable spill candidates left\n");
> -break;
> +return false;
>   }
>   simplifyNode(best);
>} else {
> - break;
> + return true;
>}
> }
>  }
> @@ -1493,7 +1493,9 @@ GCRA::allocateRegisters(ArrayList& insns)
>
> buildRIG(insns);
> calculateSpillWeights();
> -   simplify();
> +   ret = simplify();
> +   if (!ret)
> +  goto out;
>
> ret = selectRegisters();
> if (!ret) {
> --
> 2.10.0
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] nv50/ra: let simplify return an error and handle that

2016-10-03 Thread Karol Herbst
fixes a crash in the case simplify reports an error

Signed-off-by: Karol Herbst 
---
 src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp 
b/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
index 2d3486b..7e64f7c 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
@@ -771,7 +771,7 @@ private:
bool coalesce(ArrayList&);
bool doCoalesce(ArrayList&, unsigned int mask);
void calculateSpillWeights();
-   void simplify();
+   bool simplify();
bool selectRegisters();
void cleanup(const bool success);
 
@@ -1305,7 +1305,7 @@ GCRA::simplifyNode(RIG_Node *node)
 (node->degree < node->degreeLimit) ? "" : "(spill)");
 }
 
-void
+bool
 GCRA::simplify()
 {
for (;;) {
@@ -1330,11 +1330,11 @@ GCRA::simplify()
  }
  if (isinf(bestScore)) {
 ERROR("no viable spill candidates left\n");
-break;
+return false;
  }
  simplifyNode(best);
   } else {
- break;
+ return true;
   }
}
 }
@@ -1493,7 +1493,9 @@ GCRA::allocateRegisters(ArrayList& insns)
 
buildRIG(insns);
calculateSpillWeights();
-   simplify();
+   ret = simplify();
+   if (!ret)
+  goto out;
 
ret = selectRegisters();
if (!ret) {
-- 
2.10.0

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev