[Mlir-commits] [mlir] [mlir][tosa] Move profile compliance metadata to static constexpr tables (PR #232857)
Luke Hutton
llvmlistbot at llvm.org
Tue Oct 20 02:42:07 PDT 2026
================
@@ -47,23 +76,40 @@ enum CheckCondition {
allOf
};
-using VersionedTypeInfo =
- std::pair<SmallVector<TypeInfo>, SpecificationVersion>;
+template <typename T, size_t Capacity>
+struct ComplianceInlineArray {
+ T storage[Capacity]{};
+ uint8_t numElements = 0;
+
+ constexpr ComplianceInlineArray() = default;
+
+ template <typename... Ts,
+ typename = std::enable_if_t<(sizeof...(Ts) >= 1) &&
+ (sizeof...(Ts) <= Capacity) &&
+ (std::is_convertible_v<Ts, T> && ...)>>
+ constexpr ComplianceInlineArray(Ts... elems)
+ : storage{static_cast<T>(elems)...},
+ numElements(static_cast<uint8_t>(sizeof...(Ts))) {}
+
+ constexpr ArrayRef<T> asArrayRef() const {
+ return ArrayRef<T>(storage, numElements);
+ }
+ constexpr operator ArrayRef<T>() const { return asArrayRef(); }
+ constexpr bool empty() const { return numElements == 0; }
+ constexpr size_t size() const { return numElements; }
+};
template <typename T>
struct OpComplianceInfo {
+ llvm::StringLiteral opName;
// Certain operations require multiple modes enabled.
// e.g. cast bf16 to fp8e4m3 requires EXT-BF16 and EXT-FP8E4M3.
- SmallVector<T> mode;
- SmallVector<VersionedTypeInfo> operandTypeInfoSet;
+ ComplianceInlineArray<T, 4> mode;
+ ComplianceInlineArray<TypeInfo, 7> operandTypes;
+ SpecificationVersion specVersion = SpecificationVersion::V_1_0;
----------------
lhutton1 wrote:
nit: Better to require the version to be explicitly specified. A new entry to the table should never be set to V_1_0
https://github.com/llvm/llvm-project/pull/232857
More information about the Mlir-commits
mailing list