Skip to content

Commit

Permalink
Fix static check error
Browse files Browse the repository at this point in the history
  • Loading branch information
qiaojbao committed Oct 30, 2024
1 parent 7ce9050 commit 658aed4
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion lgc/util/RegStackUsage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,21 @@ struct Usage {
bool memOrdered;
};

struct UsageTemp {
unsigned maxRecursionDepth;
unsigned callableShaderCount;
unsigned backendStackSize;
unsigned frontendStackSize;
unsigned stackFrameSizeInBytes;
unsigned scratchMemorySize;
unsigned ldsSize;
unsigned sgprCount;
unsigned vgprCount;
bool cpsGlobal;
bool scratchEn;
bool memOrdered;
};

// =====================================================================================================================
// Output Usage textually, for debug.
[[maybe_unused]] static raw_ostream &operator<<(raw_ostream &stream, const Usage &usage) {
Expand Down Expand Up @@ -296,7 +311,20 @@ RegStackUsageImpl::RegStackUsageImpl(const llvm::Module &module) : m_msgPackScan
if (namedNode && namedNode->getNumOperands() >= 1) {
StringRef str = dyn_cast<MDString>(namedNode->getOperand(0)->getOperand(0))->getString();
assert(str.size() == sizeof(m_usage));
memcpy(&m_usage, str.data(), sizeof(m_usage));
UsageTemp usage;
memcpy(&usage, str.data(), sizeof(m_usage));
m_usage.maxRecursionDepth = usage.maxRecursionDepth;
m_usage.callableShaderCount = usage.callableShaderCount;
m_usage.backendStackSize = usage.backendStackSize;
m_usage.frontendStackSize = usage.frontendStackSize;
m_usage.stackFrameSizeInBytes = usage.stackFrameSizeInBytes;
m_usage.scratchMemorySize = usage.scratchMemorySize;
m_usage.ldsSize = usage.ldsSize;
m_usage.sgprCount = usage.sgprCount;
m_usage.vgprCount = usage.vgprCount;
m_usage.cpsGlobal = usage.cpsGlobal;
m_usage.scratchEn = usage.scratchEn;
m_usage.memOrdered = usage.memOrdered;
}
}

Expand Down

0 comments on commit 658aed4

Please sign in to comment.