-
Notifications
You must be signed in to change notification settings - Fork 372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LLVM_Util: add support for masked operations #1248
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just a few minor notes below
Quite right on the typos and other comments, @fpsunflower . Pushed an update and will merge after all the CI tests pass. |
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]>
64c4778
to
9a85e6f
Compare
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 differentISA'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]