//===- InlineModelFeatureMaps.h - common model runner defs ------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // #ifndef LLVM_ANALYSIS_INLINEMODELFEATUREMAPS_H #define LLVM_ANALYSIS_INLINEMODELFEATUREMAPS_H #include "llvm/Analysis/TensorSpec.h" #include <array> #include <vector> namespace llvm { // List of cost features. A "cost" feature is a summand of the heuristic-based // inline cost, and we define them separately to preserve the original heuristic // behavior. #define INLINE_COST_FEATURE_ITERATOR(M) … // clang-format off enum class InlineCostFeatureIndex : size_t { … }; // clang-format on InlineCostFeatures; constexpr bool isHeuristicInlineCostFeature(InlineCostFeatureIndex Feature) { … } // List of features. Each feature is defined through a triple: // - the name of an enum member, which will be the feature index // - a textual name, used for ML model binding (so it needs to match the // names used by the ML model). // - a documentation description. Currently, that is not used anywhere // programmatically, and serves as workaround to inability of inserting comments // in macros. #define INLINE_FEATURE_ITERATOR(M) … // clang-format off enum class FeatureIndex : size_t { … }; // clang-format on constexpr FeatureIndex inlineCostFeatureToMlFeature(InlineCostFeatureIndex Feature) { … } constexpr size_t NumberOfFeatures = …; extern const std::vector<TensorSpec> FeatureMap; extern const char *const DecisionName; extern const TensorSpec InlineDecisionSpec; extern const char *const DefaultDecisionName; extern const TensorSpec DefaultDecisionSpec; extern const char *const RewardName; InlineFeatures; } // namespace llvm #endif // LLVM_ANALYSIS_INLINEMODELFEATUREMAPS_H