[Beignet] [PATCH] GBE: fix the overflow bug in register spilling.

Zhigang Gong zhigang.gong at linux.intel.com
Wed Feb 19 01:22:49 PST 2014


After this fix, we can run the luxmark with medium scene correctly.

> -----Original Message-----
> From: beignet-bounces at lists.freedesktop.org
> [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of Zhigang Gong
> Sent: Wednesday, February 19, 2014 4:41 PM
> To: beignet at lists.freedesktop.org
> Cc: Zhigang Gong
> Subject: [Beignet] [PATCH] GBE: fix the overflow bug in register spilling.
> 
> Change to use int32 to represent the maxID.
> 
> Signed-off-by: Zhigang Gong <zhigang.gong at intel.com>
> ---
>  backend/src/backend/gen_reg_allocation.cpp |   11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/backend/src/backend/gen_reg_allocation.cpp
> b/backend/src/backend/gen_reg_allocation.cpp
> index 726b78c..8243f19 100644
> --- a/backend/src/backend/gen_reg_allocation.cpp
> +++ b/backend/src/backend/gen_reg_allocation.cpp
> @@ -53,19 +53,16 @@ namespace gbe
>    };
> 
>    typedef struct GenRegIntervalKey {
> -    GenRegIntervalKey(uint16_t reg, uint16_t maxID) {
> -      if (maxID == INT_MAX)
> -        maxID = 0xFFFF;
> -      GBE_ASSERT(reg <= 0xFFFF && maxID <= 0xFFFF);
> -      key = (maxID << 16) | reg;
> +    GenRegIntervalKey(uint16_t reg, int32_t maxID) {
> +      key = ((uint64_t)maxID << 16) | reg;
>      }
>      const ir::Register getReg() const {
>        return (ir::Register)(key & 0xFFFF);
>      }
> -    const uint16_t getMaxID() const {
> +    const int32_t getMaxID() const {
>        return key >> 16;
>      }
> -    uint32_t key;
> +    uint64_t key;
>    } GenRegIntervalKey;
> 
>    struct spillCmp {
> --
> 1.7.9.5
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet



More information about the Beignet mailing list