From 7c6faf62158eed309f01bbef8a7b88e0c36459c7 Mon Sep 17 00:00:00 2001 From: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> Date: Fri, 7 Jun 2024 09:48:24 -0400 Subject: Precompute UIntSet from individual capabilities inside generator (#4269) * fixes: #4163 Precompute UIntSet from individual capabilities inside generator (removes intermediate form of capabilities). note: 1. I still expand capabilities which are missing `target` and `stage` atoms. * fix compile warning<->error with clang * address review preallocate the pregenerated UIntSet's * disable incorrect warning of 'unreachable code' The warning is wrong since, when `out` has 0 elements (does not start `for` loop), the `return` is reached. * fix clang warnings 1. use unsigned long for the buffer serializer 2. braces around scalar init * address review added work around to avoid warning with `for(...) return; return;` pattern `else if constexpr` addition instead of cascading blocks * push fix for use of `_BitScanForward` * cleanup * move around assert for proper checking * syntax error * use SLANG_ASSERT instead of assert * test for why SLANG_ASSERT caused CI to fail with linux-arm builds * test if `SLANG_ASSERT` really is causing a build issue for linux-arm --- source/slang/slang-capability.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'source/slang/slang-capability.h') diff --git a/source/slang/slang-capability.h b/source/slang/slang-capability.h index 5ee79670b..6e123a9a6 100644 --- a/source/slang/slang-capability.h +++ b/source/slang/slang-capability.h @@ -173,11 +173,12 @@ public: /// Find any capability sets which are in 'available' but not in 'required'. Return false if this situation occurs. static bool checkCapabilityRequirement(CapabilitySet const& available, CapabilitySet const& required, CapabilityAtomSet& outFailedAvailableSet); - inline void addToTargetCapabilityWithValidUIntSetAndTargetAndStage(CapabilityName target, CapabilityName stage, CapabilityAtomSet setToAdd); - inline void addToTargetCapabilityWithTargetAndStageAtom(CapabilityName target, CapabilityName stage, const ArrayView& canonicalRepresentation); - inline void addToTargetCapabilityWithTargetAndOrStageAtom(CapabilityName target, CapabilityName stage, const ArrayView& canonicalRepresentation); - inline void addToTargetCapabilityWithStageAtom(CapabilityName stage, const ArrayView& canonicalRepresentation); - inline void addToTargetCapabilitesWithCanonicalRepresentation(const ArrayView& atom); + // For each element in `elementsToPermutateWith`, create and add a different conjunction permutation by adding to `setToPermutate`. + template + void addPermutationsOfConjunctionForEachInContainer(CapabilityAtomSet& setToPermutate, const CapabilityAtomSet& elementsToPermutateWith, CapabilityAtom knownTargetAtom, CapabilityAtom knownStageAtom); + // This is used for adding conjunctions directly and efficently, this is not functionally a join. + // if `knownStage`/`knownTarget` is not CapabilityAtom::Invalid, the given atom will be assumed as an assigned key atom (faster) + inline void addConjunction(CapabilityAtomSet conjunction, CapabilityAtom knownTarget, CapabilityAtom knownStage); inline void addUnexpandedCapabilites(CapabilityName atom); CapabilityTargetSets& getCapabilityTargetSets() { return m_targetSets; } -- cgit v1.2.3