[llvm] [SPIRV] Do not remove capability from all caps (PR #68194)
Paulo Matos via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 30 04:29:57 PDT 2023
https://github.com/pmatos updated https://github.com/llvm/llvm-project/pull/68194
>From a82a27aa567fcef3c4d6490a13e37595efe3b93f Mon Sep 17 00:00:00 2001
From: Paulo Matos <pmatos at igalia.com>
Date: Mon, 30 Oct 2023 12:29:09 +0100
Subject: [PATCH] [SPIRV] Fix test SPV_KHR_bit_instructions
Use AllCAps instead of AvailableCaps as initial implementation
confused these two.
Also document their purpose and difference.
---
llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp | 4 ++--
llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.h | 8 +++++++-
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp b/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp
index e8529496b07e4c4..779036016560e8c 100644
--- a/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp
@@ -528,8 +528,8 @@ void SPIRV::RequirementHandler::addAvailableCaps(const CapabilityList &ToAdd) {
void SPIRV::RequirementHandler::removeCapabilityIf(
const Capability::Capability ToRemove,
const Capability::Capability IfPresent) {
- if (AvailableCaps.contains(IfPresent))
- AvailableCaps.erase(ToRemove);
+ if (AllCaps.contains(IfPresent))
+ AllCaps.erase(ToRemove);
}
namespace llvm {
diff --git a/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.h b/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.h
index 9eea9ac5bda5b08..57d0a7416342a66 100644
--- a/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.h
+++ b/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.h
@@ -60,11 +60,17 @@ struct Requirements {
struct RequirementHandler {
private:
CapabilityList MinimalCaps;
+
+ // AllCaps and AvailableCaps are related but different. AllCaps is a subset of
+ // AvailableCaps. AvailableCaps is the complete set of capabilities that are available
+ // to the current target. AllCaps is the set of capabilities that are required
+ // by the current module.
SmallSet<Capability::Capability, 8> AllCaps;
+ DenseSet<unsigned> AvailableCaps;
+
SmallSet<Extension::Extension, 4> AllExtensions;
unsigned MinVersion; // 0 if no min version is defined.
unsigned MaxVersion; // 0 if no max version is defined.
- DenseSet<unsigned> AvailableCaps;
// Remove a list of capabilities from dedupedCaps and add them to AllCaps,
// recursing through their implicitly declared capabilities too.
void pruneCapabilities(const CapabilityList &ToPrune);
More information about the llvm-commits
mailing list