Commit 79dcb2a5 by Nicolas Capens Committed by Nicolas Capens

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: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com>
parent d2af84ff
...@@ -38,7 +38,7 @@ struct SpirvShader::Impl::Group ...@@ -38,7 +38,7 @@ struct SpirvShader::Impl::Group
auto &type = shader->getType(SpirvShader::Type::ID(insn.word(1))); auto &type = shader->getType(SpirvShader::Type::ID(insn.word(1)));
for(auto i = 0u; i < type.componentCount; i++) 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); auto identity = TYPE(identityValue);
SIMD::UInt v_uint = (value.UInt(i) & mask) | (As<SIMD::UInt>(identity) & ~mask); SIMD::UInt v_uint = (value.UInt(i) & mask) | (As<SIMD::UInt>(identity) & ~mask);
TYPE v = As<TYPE>(v_uint); TYPE v = As<TYPE>(v_uint);
...@@ -93,7 +93,7 @@ SpirvShader::EmitResult SpirvShader::EmitGroupNonUniform(InsnIterator insn, Emit ...@@ -93,7 +93,7 @@ SpirvShader::EmitResult SpirvShader::EmitGroupNonUniform(InsnIterator insn, Emit
{ {
// Result is true only in the active invocation with the lowest id // Result is true only in the active invocation with the lowest id
// in the group, otherwise result is false. // 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: // TODO: Would be nice if we could write this as:
// elect = active & ~(active.Oxyz | active.OOxy | active.OOOx) // elect = active & ~(active.Oxyz | active.OOxy | active.OOOx)
auto v0111 = SIMD::Int(0, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF); auto v0111 = SIMD::Int(0, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
...@@ -105,14 +105,14 @@ SpirvShader::EmitResult SpirvShader::EmitGroupNonUniform(InsnIterator insn, Emit ...@@ -105,14 +105,14 @@ SpirvShader::EmitResult SpirvShader::EmitGroupNonUniform(InsnIterator insn, Emit
case spv::OpGroupNonUniformAll: case spv::OpGroupNonUniformAll:
{ {
Operand predicate(this, state, insn.word(4)); 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; break;
} }
case spv::OpGroupNonUniformAny: case spv::OpGroupNonUniformAny:
{ {
Operand predicate(this, state, insn.word(4)); 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; break;
} }
...@@ -120,7 +120,7 @@ SpirvShader::EmitResult SpirvShader::EmitGroupNonUniform(InsnIterator insn, Emit ...@@ -120,7 +120,7 @@ SpirvShader::EmitResult SpirvShader::EmitGroupNonUniform(InsnIterator insn, Emit
{ {
Operand value(this, state, insn.word(4)); Operand value(this, state, insn.word(4));
auto res = SIMD::UInt(0xffffffff); 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; SIMD::UInt inactive = ~active;
for(auto i = 0u; i < type.componentCount; i++) for(auto i = 0u; i < type.componentCount; i++)
{ {
...@@ -155,7 +155,7 @@ SpirvShader::EmitResult SpirvShader::EmitGroupNonUniform(InsnIterator insn, Emit ...@@ -155,7 +155,7 @@ SpirvShader::EmitResult SpirvShader::EmitGroupNonUniform(InsnIterator insn, Emit
Operand value(this, state, valueId); Operand value(this, state, valueId);
// Result is true only in the active invocation with the lowest id // Result is true only in the active invocation with the lowest id
// in the group, otherwise result is false. // 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: // TODO: Would be nice if we could write this as:
// elect = active & ~(active.Oxyz | active.OOxy | active.OOOx) // elect = active & ~(active.Oxyz | active.OOxy | active.OOOx)
auto v0111 = SIMD::Int(0, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF); auto v0111 = SIMD::Int(0, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
...@@ -171,7 +171,7 @@ SpirvShader::EmitResult SpirvShader::EmitGroupNonUniform(InsnIterator insn, Emit ...@@ -171,7 +171,7 @@ SpirvShader::EmitResult SpirvShader::EmitGroupNonUniform(InsnIterator insn, Emit
{ {
ASSERT(type.componentCount == 4); ASSERT(type.componentCount == 4);
Operand predicate(this, state, insn.word(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(1, SIMD::Int(0));
dst.move(2, SIMD::Int(0)); dst.move(2, SIMD::Int(0));
dst.move(3, SIMD::Int(0)); dst.move(3, SIMD::Int(0));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment