[Beignet] [PATCH V5] Backend: Add hole reuse in reg alloction

Ruiling Song ruiling.song83 at gmail.com
Thu Dec 22 02:42:18 UTC 2016


2016-12-14 15:00 GMT+08:00 Xiuli Pan <xiuli.pan at intel.com>:

> From: Pan Xiuli <xiuli.pan at intel.com>
>
> We first find regs that have pool in simple linear scale, and save them
> in HoleRegPool, when allocte regs we first try to search fit candidate
> in the pool and choose the most fit one to reuse.
>
> V2: Refine hole reuse only in one block.
> V3: Refine data structure with less variable, add OCL_REUSE_HOLE_REG to
> control the optimization.
> V4: Spilt the patch into instruction ID part and hole reuse, refine the
> blockID of the reg.
> V5: Refine some variable and function name. Add check for not spill the
> hole regs that already been used.
>
> Signed-off-by: Pan Xiuli <xiuli.pan at intel.com>
> ---
>  backend/src/backend/gen_reg_allocation.cpp | 125
> +++++++++++++++++++++++++----
>  backend/src/backend/gen_reg_allocation.hpp |  11 +++
>  2 files changed, 119 insertions(+), 17 deletions(-)
>
> diff --git a/backend/src/backend/gen_reg_allocation.cpp
> b/backend/src/backend/gen_reg_allocation.cpp
> index 2b76eee..26d4394 100644
> --- a/backend/src/backend/gen_reg_allocation.cpp
> +++ b/backend/src/backend/gen_reg_allocation.cpp
> @@ -50,12 +50,13 @@ namespace gbe
>    struct GenRegInterval {
>      INLINE GenRegInterval(ir::Register reg) :
>        reg(reg), minID(INT_MAX), maxID(-INT_MAX), accessCount(0),
> -      conflictReg(0), b3OpAlign(0) {}
> +      blockID(-1), conflictReg(0), b3OpAlign(0), usedHole(false),
> isHole(false){}
>      ir::Register reg;     //!< (virtual) register of the interval
>      int32_t minID, maxID; //!< Starting and ending points
>      int32_t accessCount;
> +    int32_t blockID; //!< blockID for in-block regs that can reuse hole
>      ir::Register conflictReg; // < has banck conflict with this register
> -    bool b3OpAlign;
>
the patch looks good. But I think we need some comment here.
// usedHole may indicates 1.) a register placed in another's liveness hole
or
// 2.) a register with its hole reused. So, you need to check isHole to
determine what really happens.

- Ruiling

> +    bool b3OpAlign,
>
usedHole, isHole;
>    };
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/beignet/attachments/20161222/7d432cfe/attachment.html>


More information about the Beignet mailing list