Skip to content

Commit

Permalink
LLVM_Util: add support for masked operations (1248)
Browse files Browse the repository at this point in the history
Work by Alex Wells.

This will be used extensively by the SIMD batched shading.

* Added support for masked operations by managing a stack of masks
  that were created by conditionals or control flow. Detailed
  explanation of the Masking Strategy in llvm_util.h.

* Added support for logically masked functions (handling of masked
  return from inside OSL functions)

* Added support for masked loops (handling of masked break and or
  masked continue).

* Added support for masked exit (handling of masked exit from entire
  shader).

* Added support for management of when masking is required with a
  ScopedMasking object to allow nesting during code gen.

* op_store (and other store variations) respect the current masking
  requirement and current top of the mask stack (not just the top
  entry, but a combined view of the entire mask stack).

* Added support for results of conditional operations to remain
  boolean.  Most masking operations are expecting vector of bool
  values, not a vector of integers., e.g. when vector width is 16, for
  scalar or <16 x i1> for wide. When a conditional result is used by
  another operation a numerical value it is automatically converted to
  an integer.

* Added `llvm::Type *type_native_mask() const;` because different
  ISA's may have different representations of a mask from llvm's
  vector of bits that comparison operations emit.  And we need varying
  boolean symbols to have the correct data type (size) on the stack
  and in data structures.

* Added gather and scatter operations.

* Added helpers to convert from bool<->int, native_mask<->llvm_mask

Signed-off-by: Larry Gritz <[email protected]>
  • Loading branch information
AlexMWells authored and lgritz committed Sep 10, 2020
1 parent a977bd7 commit 9a85e6f
Show file tree
Hide file tree
Showing 2 changed files with 2,292 additions and 57 deletions.
Loading

0 comments on commit 9a85e6f

Please sign in to comment.