[Beignet] [PATCH 1/2] Revert "GBE: No need to compute liveout again in value.cpp."

Zhigang Gong zhigang.gong at linux.intel.com
Tue Jun 3 18:57:38 PDT 2014


You are right. This iterateLiveOut could not be eliminated. Altough
we have full liveIn set for each block when compute liveOut defset.
But we can't get all of the liveIn's definitions by using one pass
as some values in liveIn may haven't been processed. Two passes are
unavoid for this case.
Will push latter. Thanks.

On Tue, Jun 03, 2014 at 01:53:14PM +0800, Ruiling Song wrote:
> We need to transfer ValueDef from predecessors to their successors.
> Consider a register defined in BB0, and used in BB3. we need to
> iterate over liveout to pass the def in BB0 to BB3, so the use
> in BB3 could get that correct def. Otherwise, the UD/DU graph is incomplete.
> 
> This reverts commit 89b490b5a17cfda2d9816dc1c246ce5bbff12648.
> ---
>  backend/src/ir/value.cpp |   33 +++++++++++++++++++++++++++++++++
>  1 file changed, 33 insertions(+)
> 
> diff --git a/backend/src/ir/value.cpp b/backend/src/ir/value.cpp
> index cdc1a4c..1dbd4f4 100644
> --- a/backend/src/ir/value.cpp
> +++ b/backend/src/ir/value.cpp
> @@ -66,6 +66,8 @@ namespace ir {
>       *  registers
>       */
>      void initializeOtherDef(void);
> +    /*! Iterate to completely transfer the liveness and get the def sets */
> +    void iterateLiveOut(void);
>      /*! Use custom allocators */
>      GBE_CLASS(LiveOutSet);
>    };
> @@ -78,6 +80,7 @@ namespace ir {
>    {
>      this->initializeInstructionDef();
>      this->initializeOtherDef();
> +    this->iterateLiveOut();
>    }
>  
>    LiveOutSet::RegDefSet &LiveOutSet::getDefSet(const BasicBlock *bb, Register reg)
> @@ -224,6 +227,36 @@ namespace ir {
>      }
>    }
>  
> +  void LiveOutSet::iterateLiveOut(void) {
> +    bool changed = true;
> +
> +    while (changed) {
> +      changed = false;
> +
> +      // Compute the union of the current liveout definitions with the previous
> +      // ones. Do not take into account the killed values though
> +      liveness.foreach<DF_PRED>([&](Liveness::BlockInfo &curr,
> +                                    const Liveness::BlockInfo &pred)
> +      {
> +        const BasicBlock &bb = curr.bb;
> +        const BasicBlock &pbb = pred.bb;
> +        for (auto reg : curr.liveOut) {
> +          if (pred.inLiveOut(reg) == false) continue;
> +          if (curr.inVarKill(reg) == true) continue;
> +          RegDefSet &currSet = this->getDefSet(&bb, reg);
> +          RegDefSet &predSet = this->getDefSet(&pbb, reg);
> +
> +          // Transfer the values
> +          for (auto def : predSet) {
> +            if (currSet.contains(def)) continue;
> +            changed = true;
> +            currSet.insert(def);
> +          }
> +        }
> +      });
> +    }
> +  }
> +
>    LiveOutSet::~LiveOutSet(void) {
>      for (const auto pair : defMap) {
>        BlockDefMap *block = pair.second;
> -- 
> 1.7.10.4
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list