intel/fs: Add a helper for emitting scan operations

This commit adds a helper to the builder for emitting "scan" operations.
Given a binary operation #, a scan takes the vector [a0, a1, ..., aN]
and returns the vector [a0, a0 # a1, ..., a0 # a1 # ... # aN] where each
channel contains the combination of all previous channels.  The sequence
of instructions to perform the scan is fairly optimal; a 16-wide scan on
a 32-bit type is only 6 instructions.  The subgroup scan and reduction
operations will be implemented in terms of this.

Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
This commit is contained in:
Jason Ekstrand
2017-08-31 21:50:31 -07:00
parent b0858c1cc6
commit 4150920b95
2 changed files with 148 additions and 0 deletions

View File

@@ -312,6 +312,13 @@ subscript(fs_reg reg, brw_reg_type type, unsigned i)
return byte_offset(retype(reg, type), i * type_sz(type));
}
static inline fs_reg
horiz_stride(fs_reg reg, unsigned s)
{
reg.stride *= s;
return reg;
}
static const fs_reg reg_undef;
class fs_inst : public backend_instruction {