[Beignet] [PATCH] GBE: Fix bitcast between long and other type.
Zhigang Gong
zhigang.gong at linux.intel.com
Fri May 30 01:43:50 PDT 2014
LGTM, pushed, thanks.
On Fri, May 30, 2014 at 04:22:30PM +0800, Ruiling Song wrote:
> As we store long low/high 32bits separately, when we do bitcast
> like int64 --> int16, the horizontal stride of the int64's low/high
> half should be set as 2 instead of 4.
>
> This fix an regression of opencv test:
> Imgproc/Threshold.Mat/40, where GetParam() = (16SC1, 0, 0, false)
>
> Signed-off-by: Ruiling Song <ruiling.song at intel.com>
> ---
> backend/src/backend/gen_insn_selection.cpp | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/backend/src/backend/gen_insn_selection.cpp b/backend/src/backend/gen_insn_selection.cpp
> index 74f7cfe..6e6e6eb 100644
> --- a/backend/src/backend/gen_insn_selection.cpp
> +++ b/backend/src/backend/gen_insn_selection.cpp
> @@ -3081,7 +3081,7 @@ namespace gbe
> wideReg = sel.selReg(insn.getDst(index/multiple), narrowType);
> narrowReg = sel.selReg(insn.getSrc(i), narrowType); //retype to narrow type
> }
> - if(wideReg.hstride != GEN_VERTICAL_STRIDE_0) {
> + if(wideReg.hstride != GEN_HORIZONTAL_STRIDE_0) {
> if(multiple == 2) {
> wideReg = sel.unpacked_uw(wideReg.reg());
> wideReg = GenRegister::retype(wideReg, getGenType(narrowType));
> @@ -3098,6 +3098,15 @@ namespace gbe
> wideReg.subphysical = 1;
> }
> if(isInt64) {
> + if(wideReg.hstride != GEN_HORIZONTAL_STRIDE_0) {
> + // as we store long by bottom & high part separately, we have to divide hstride by 2
> + if (wideReg.hstride == GEN_HORIZONTAL_STRIDE_2)
> + wideReg.hstride = GEN_HORIZONTAL_STRIDE_1;
> + else if (wideReg.hstride == GEN_HORIZONTAL_STRIDE_4)
> + wideReg.hstride = GEN_HORIZONTAL_STRIDE_2;
> + else
> + GBE_ASSERT(0);
> + }
> // offset to next half
> wideReg.subphysical = 1;
> if(i >= multiple/2)
> --
> 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