Document helper invocations being considered active
See https://swiftshader-review.googlesource.com/c/SwiftShader/+/42088/7#message-18bed01232babd6cf5b5770b138d9034073fec95
for rationale.
Bug: b/151137030
Change-Id: Ieef8636734be1dc19ced8f572daea4990231106b
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/45288
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/Pipeline/SpirvShaderGroup.cpp b/src/Pipeline/SpirvShaderGroup.cpp
index c9faa23..51db930 100644
--- a/src/Pipeline/SpirvShaderGroup.cpp
+++ b/src/Pipeline/SpirvShaderGroup.cpp
@@ -38,7 +38,7 @@
auto &type = shader->getType(SpirvShader::Type::ID(insn.word(1)));
for(auto i = 0u; i < type.componentCount; i++)
{
- auto mask = As<SIMD::UInt>(state->activeLaneMask());
+ auto mask = As<SIMD::UInt>(state->activeLaneMask()); // Considers helper invocations active. See b/151137030
auto identity = TYPE(identityValue);
SIMD::UInt v_uint = (value.UInt(i) & mask) | (As<SIMD::UInt>(identity) & ~mask);
TYPE v = As<TYPE>(v_uint);
@@ -93,7 +93,7 @@
{
// Result is true only in the active invocation with the lowest id
// in the group, otherwise result is false.
- SIMD::Int active = state->activeLaneMask();
+ SIMD::Int active = state->activeLaneMask(); // Considers helper invocations active. See b/151137030
// TODO: Would be nice if we could write this as:
// elect = active & ~(active.Oxyz | active.OOxy | active.OOOx)
auto v0111 = SIMD::Int(0, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
@@ -105,14 +105,14 @@
case spv::OpGroupNonUniformAll:
{
Operand predicate(this, state, insn.word(4));
- dst.move(0, AndAll(predicate.UInt(0) | ~As<SIMD::UInt>(state->activeLaneMask())));
+ dst.move(0, AndAll(predicate.UInt(0) | ~As<SIMD::UInt>(state->activeLaneMask()))); // Considers helper invocations active. See b/151137030
break;
}
case spv::OpGroupNonUniformAny:
{
Operand predicate(this, state, insn.word(4));
- dst.move(0, OrAll(predicate.UInt(0) & As<SIMD::UInt>(state->activeLaneMask())));
+ dst.move(0, OrAll(predicate.UInt(0) & As<SIMD::UInt>(state->activeLaneMask()))); // Considers helper invocations active. See b/151137030
break;
}
@@ -120,7 +120,7 @@
{
Operand value(this, state, insn.word(4));
auto res = SIMD::UInt(0xffffffff);
- SIMD::UInt active = As<SIMD::UInt>(state->activeLaneMask());
+ SIMD::UInt active = As<SIMD::UInt>(state->activeLaneMask()); // Considers helper invocations active. See b/151137030
SIMD::UInt inactive = ~active;
for(auto i = 0u; i < type.componentCount; i++)
{
@@ -155,7 +155,7 @@
Operand value(this, state, valueId);
// Result is true only in the active invocation with the lowest id
// in the group, otherwise result is false.
- SIMD::Int active = state->activeLaneMask();
+ SIMD::Int active = state->activeLaneMask(); // Considers helper invocations active. See b/151137030
// TODO: Would be nice if we could write this as:
// elect = active & ~(active.Oxyz | active.OOxy | active.OOOx)
auto v0111 = SIMD::Int(0, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
@@ -171,7 +171,7 @@
{
ASSERT(type.componentCount == 4);
Operand predicate(this, state, insn.word(4));
- dst.move(0, SIMD::Int(SignMask(state->activeLaneMask() & predicate.Int(0))));
+ dst.move(0, SIMD::Int(SignMask(state->activeLaneMask() & predicate.Int(0)))); // Considers helper invocations active. See b/151137030
dst.move(1, SIMD::Int(0));
dst.move(2, SIMD::Int(0));
dst.move(3, SIMD::Int(0));