[Beignet] [PATCH V2] GBE: Implement liveness dump.

Zhigang Gong zhigang.gong at linux.intel.com
Thu Sep 24 17:51:18 PDT 2015


LGTM.

On Thu, Sep 24, 2015 at 03:47:30PM +0800, Ruiling Song wrote:
> v2:
> remove old printf debug code.
> Signed-off-by: Ruiling Song <ruiling.song at intel.com>
> ---
>  backend/src/ir/liveness.cpp | 58 ++++++++++++++++-----------------------------
>  1 file changed, 20 insertions(+), 38 deletions(-)
> 
> diff --git a/backend/src/ir/liveness.cpp b/backend/src/ir/liveness.cpp
> index c5a6374..9f456a3 100644
> --- a/backend/src/ir/liveness.cpp
> +++ b/backend/src/ir/liveness.cpp
> @@ -190,25 +190,6 @@ namespace ir {
>            workSet.insert(prevInfo);
>        }
>      };
> -#if 0
> -    fn.foreachBlock([this](const BasicBlock &bb){
> -      printf("label %d:\n", bb.getLabelIndex());
> -      BlockInfo *info = liveness[&bb];
> -      auto &outVarSet = info->liveOut;
> -      auto &inVarSet = info->upwardUsed;
> -      printf("\n\tin Lives: ");
> -      for (auto inVar : inVarSet) {
> -        printf("%d ", inVar);
> -      }
> -      printf("\n");
> -      printf("\tout Lives: ");
> -      for (auto outVar : outVarSet) {
> -        printf("%d ", outVar);
> -      }
> -      printf("\n");
> -
> -    });
> -#endif
>     }
>  /*
>    As we run in SIMD mode with prediction mask to indicate active lanes.
> @@ -252,27 +233,28 @@ namespace ir {
>          }
>        }
>      }
> -#if 0
> -    fn.foreachBlock([this](const BasicBlock &bb){
> -      printf("label %d:\n", bb.getLabelIndex());
> -      BlockInfo *info = liveness[&bb];
> -      auto &outVarSet = info->liveOut;
> -      auto &inVarSet = info->upwardUsed;
> -      printf("\n\tLive Ins: ");
> -      for (auto inVar : inVarSet) {
> -        printf("%d ", inVar);
> -      }
> -      printf("\n");
> -      printf("\tLive outs: ");
> -      for (auto outVar : outVarSet) {
> -        printf("%d ", outVar);
> -      }
> -      printf("\n");
> -
> -    });
> -#endif
>     }
>  
> +  std::ostream &operator<< (std::ostream &out, const Liveness &live) {
> +    const Function &fn = live.getFunction();
> +    fn.foreachBlock([&] (const BasicBlock &bb) {
> +      out << std::endl;
> +      out << "Label $" << bb.getLabelIndex() << std::endl;
> +      const Liveness::BlockInfo &bbInfo = live.getBlockInfo(&bb);
> +      out << "liveIn:" << std::endl;
> +      for (auto &x: bbInfo.upwardUsed) {
> +        out << x << " ";
> +      }
> +      out << std::endl << "liveOut:" << std::endl;
> +      for (auto &x : bbInfo.liveOut)
> +        out << x << " ";
> +      out << std::endl << "varKill:" << std::endl;
> +      for (auto &x : bbInfo.varKill)
> +        out << x << " ";
> +      out << std::endl;
> +    });
> +    return out;
> +  }
>  
>    /*! To pretty print the livfeness info */
>    static const uint32_t prettyInsnStrSize = 48;
> -- 
> 2.3.1
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list