intel/fs: Use HF as destination type for F32TOF16 in fquantize2f16
authorIan Romanick <ian.d.romanick@intel.com>
Thu, 9 Dec 2021 23:25:20 +0000 (15:25 -0800)
committerMarge Bot <emma+marge@anholt.net>
Wed, 15 Dec 2021 20:03:51 +0000 (20:03 +0000)
commit2ca13abccebfaafe567f78ad40a04d1129e63942
tree038d072537719cb5fc9000ae52f4fc1ac63dc6e3
parent9c81de7df296fd3854c2a7cc3f2a994076b6a5f6
intel/fs: Use HF as destination type for F32TOF16 in fquantize2f16

Having an integer destination type instead of a float destination type
confuses the SWSB code.  This causes problems on some Intel GPUs.  Fix
this by using the correct type in the destination of the F32TOF16
opcode.

Gfx7 doesn't have the HF type, so continue to emit W on that platform.
The assertions in brw_F32TO16 (brw_eu_emit.c) are updated to reflect
this.  In scalar mode, UD is never emitted as a destination type for
this opcode, so remove it from the allowed types in the assertion.

I also condidered doing something like de55fd358fa ("intel/fs/xehp:
Teach SWSB pass about the exec pipeline of
FS_OPCODE_PACK_HALF_2x16_SPLIT."), but Curro recommended that just using
the correct types is a better fix.  I agree.

v2: Add missing changes to fs_generator::generate_pack_half_2x16_split.
I'm not sure how I (and the Intel CI) missed that the first time. :(

v3: Fix copy-and-paste issue in the v2 fix. Noticed by Tapani.

Reviewed-by: Francisco Jerez <currojerez@riseup.net> [v1]
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14181>
src/intel/compiler/brw_eu_emit.c
src/intel/compiler/brw_fs_generator.cpp
src/intel/compiler/brw_fs_nir.cpp