From be358906254ef43f8e4013915f5e842c47456a7c Mon Sep 17 00:00:00 2001 From: Peter Caday Date: Mon, 4 Nov 2024 14:09:03 -0800 Subject: [PATCH] xe: jit: ngen: store logical offsets for int2/int4 --- src/gpu/intel/jit/ngen/ngen_core.hpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/gpu/intel/jit/ngen/ngen_core.hpp b/src/gpu/intel/jit/ngen/ngen_core.hpp index a9f69537d2c..20681eb08d7 100644 --- a/src/gpu/intel/jit/ngen/ngen_core.hpp +++ b/src/gpu/intel/jit/ngen/ngen_core.hpp @@ -613,8 +613,8 @@ class RegData { constexpr bool isInvalid() const { return invalid; } constexpr bool isValid() const { return !invalid; } constexpr int getOffset() const { return off; } - constexpr14 int getByteOffset() const { return off * getBytes(); } - constexpr14 int getLogicalOffset() const { return off * elementsPerByte(getType()); } + constexpr14 int getByteOffset() const { return (off * getBits()) >> 3; } + constexpr14 int getLogicalOffset() const { return off; } /* Deprecated; use getOffset */ constexpr DataType getType() const { return static_cast(type); } constexpr int getVS() const { return vs; } constexpr int getWidth() const { return width; } @@ -622,6 +622,7 @@ class RegData { constexpr bool getNeg() const { return mods & 2; } constexpr bool getAbs() const { return mods & 1; } constexpr int getMods() const { return mods; } + constexpr14 int getBits() const { return NGEN_NAMESPACE::getBits(getType()); } constexpr14 int getBytes() const { return NGEN_NAMESPACE::getBytes(getType()); } constexpr14 int getDwords() const { return NGEN_NAMESPACE::getDwords(getType()); } constexpr bool isScalar() const { return hs == 0 && vs == 0 && width == 1; } @@ -799,7 +800,7 @@ class Subregister : public RegData constexpr Subregister() : RegData() {} constexpr14 Subregister(RegData reg_, int offset_, DataType type_) { *static_cast(this) = reg_; - off = offset_ >> log2ElementsPerByte(type_); + off = offset_; type = static_cast(type_); hs = vs = 0; width = 1; @@ -1293,8 +1294,6 @@ inline Subregister Subregister::reinterpret(int offset, DataType type_) const Subregister r = *this; r.setType(type_); - offset >>= log2ElementsPerByte(type_); - int o = getOffset(); int oldbytes = getBytes(), newbytes = r.getBytes(); int bitdiff = (oldbytes == 0) ? 0