[llvm] Set shader analysis flags EnableRawAndStructuredBuffers and ComputeShadersPlusRawAndStructuredBuffers for RWBuffers (PR #114449)
Damyan Pepper via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 1 14:10:57 PDT 2024
================
@@ -36,8 +39,35 @@ static void updateFlags(ComputedShaderFlags &Flags, const Instruction &I) {
}
}
-ComputedShaderFlags ComputedShaderFlags::computeFlags(Module &M) {
+static void updateResourceFlags(ComputedShaderFlags &Flags, Module &M,
+ ModuleAnalysisManager *AM) {
+ if (!AM)
+ return;
+
+ const DXILResourceMap &DRM = AM->getResult<DXILResourceAnalysis>(M);
+ if (DRM.empty())
+ return;
+
+ const dxil::ModuleMetadataInfo &MMDI = AM->getResult<DXILMetadataAnalysis>(M);
+ VersionTuple SM = MMDI.ShaderModelVersion;
+ Triple::EnvironmentType SP = MMDI.ShaderProfile;
+
+ // RWBuffer
+ for (const ResourceInfo &RI : DRM.uavs()) {
+ if (RI.getResourceKind() == ResourceKind::TypedBuffer) {
+ Flags.EnableRawAndStructuredBuffers = true;
+ Flags.ComputeShadersPlusRawAndStructuredBuffers =
+ (SP == Triple::EnvironmentType::Compute && SM.getMajor() == 4);
----------------
damyanp wrote:
Probably should get some more opinions on this. If we were to ever support SM 4.0 via DXBC in the future then having this in here would likely be helpful to that effort.
https://github.com/llvm/llvm-project/pull/114449
More information about the llvm-commits
mailing list