Calculate which scopes are available to a given thread when debuggng

* This is conservative as it's not calculated per-entry point, but over-
  simulating threads is not expected to be a huge issue.
This commit is contained in:
baldurk
2025-01-21 11:30:03 +00:00
parent f287da5bdf
commit 6868b67747
4 changed files with 40 additions and 0 deletions
@@ -532,6 +532,26 @@ void Processor::RegisterOp(Iter it)
{
OpCapability decoded(it);
capabilities.insert(decoded.capability);
if(decoded.capability == Capability::GroupNonUniform ||
decoded.capability == Capability::GroupNonUniformVote ||
decoded.capability == Capability::GroupNonUniformArithmetic ||
decoded.capability == Capability::GroupNonUniformBallot ||
decoded.capability == Capability::GroupNonUniformShuffle ||
decoded.capability == Capability::GroupNonUniformShuffleRelative ||
decoded.capability == Capability::GroupNonUniformClustered ||
decoded.capability == Capability::GroupNonUniformQuad ||
decoded.capability == Capability::GroupNonUniformRotateKHR ||
decoded.capability == Capability::GroupUniformArithmeticKHR ||
decoded.capability == Capability::SubgroupBallotKHR ||
decoded.capability == Capability::SubgroupVoteKHR)
{
m_ThreadScope |= ThreadScope::Subgroup;
}
else if(decoded.capability == Capability::GroupNonUniformQuad)
{
m_ThreadScope |= ThreadScope::Quad;
}
}
else if(opdata.op == Op::Extension)
{
@@ -590,6 +610,9 @@ void Processor::RegisterOp(Iter it)
if(decoded.storageClass != rdcspv::StorageClass::Function)
globals.push_back(
Variable(decoded.resultType, decoded.result, decoded.storageClass, decoded.initializer));
if(decoded.storageClass == StorageClass::Workgroup)
m_ThreadScope |= ThreadScope::Workgroup;
}
else if(opdata.op == Op::ConstantNull)
{
@@ -532,6 +532,15 @@ struct Section
};
};
enum class ThreadScope : uint32_t
{
Quad = 0x1,
Subgroup = 0x2,
Workgroup = 0x4,
};
BITMASK_OPERATORS(ThreadScope);
class Processor
{
public:
@@ -623,6 +632,8 @@ protected:
LogicalSection m_Sections[Section::Count];
ThreadScope m_ThreadScope;
private:
struct DeferredMemberDecoration
{
@@ -1166,6 +1166,10 @@ void Reflector::MakeReflection(const GraphicsAPI sourceAPI, const ShaderStage st
for(Id id : usedIds)
patchData.usedIds.push_back(id);
patchData.threadScope = m_ThreadScope;
if(entry->executionModel == ExecutionModel::Fragment)
patchData.threadScope |= ThreadScope::Quad;
// arrays of elements, which can be appended to in any order and then sorted
rdcarray<SigParameter> inputs;
rdcarray<SigParameter> outputs;
@@ -77,6 +77,8 @@ struct SPIRVPatchData
// offset of a spec ID.
rdcarray<uint32_t> specIDs;
rdcspv::ThreadScope threadScope;
// for mesh shaders, the maximum number of vertices/primitives generated by each meshlet
uint32_t maxVertices = 0, maxPrimitives = 0;