Skip to content
  • Faith Ekstrand's avatar
    intel/nir: Lower 8-bit ops to 16-bit in NIR on Gen11+ · 68092df8
    Faith Ekstrand authored
    
    
    Intel hardware supports 8-bit arithmetic but it's tricky and annoying:
    
      - Byte operations don't actually execute with a byte type.  The
        execution type for byte operations is actually word.  (I don't know
        if this has implications for the HW implementation.  Probably?)
    
      - Destinations are required to be strided out to at least the
        execution type size.  This means that B-type operations always have
        a stride of at least 2.  This means wreaks havoc on the back-end in
        multiple ways.
    
      - Thanks to the strided destination, we don't actually save register
        space by storing things in bytes.  We could, in theory, interleave
        two byte values into a single 2B-strided register but that's both a
        pain for RA and would lead to piles of false dependencies pre-Gen12
        and on Gen12+, we'd need some significant improvements to the SWSB
        pass.
    
      - Also thanks to the strided destination, all byte writes are treated
        as partial writes by the back-end and we don't know how to copy-prop
        them.
    
      - On Gen11, they added a new hardware restriction that byte types
        aren't allowed in the 2nd and 3rd sources of instructions.  This
        means that we have to emit B->W conversions all over to resolve
        things.  If we emit said conversions in NIR, instead, there's a
        chance NIR can get rid of some of them for us.
    
    We can get rid of a lot of this pain by just asking NIR to get rid of
    8-bit arithmetic for us.  It may lead to a few more conversions in some
    cases but having back-end copy-prop actually work is probably a bigger
    bonus.  There is still a bit we have to handle in the back-end.  In
    particular, basic MOVs and conversions because 8-bit load/store ops
    still require 8-bit types.
    
    Reviewed-by: Kenneth Graunke's avatarKenneth Graunke <kenneth@whitecape.org>
    Part-of: <!7482>
    68092df8