24 #include <unordered_map> 84 for (uint32_t i = 0u; i < fv1.size(); i++) {
85 if (fv1[i] < fv2[i]) {
92 std::string
name =
"plan_cache_[unnamed]";
96 using FeatureVectorToPlanMap = std::map<cudnn_frontend::feature_vector_t, cudnn_frontend::ExecutionPlan, cudnn_frontend::ExecutionPlanCache_v1::compare>;
104 const std::string & tag) {
110 std::lock_guard<std::mutex> guard(cache_mutex);
112 getLogger() <<
"[cudnn_frontend] Added to " << name <<
" " << op_graph.
getTag() << std::endl;
127 std::lock_guard<std::mutex> guard(cache_mutex);
130 if (it == cache.end()) {
131 getLogger() <<
"[cudnn_frontend] Cached Plan Not Found in " << name << std::endl;
134 plan = &(it->second);
136 getLogger() <<
"[cudnn_frontend] Cached Plan Found in " << name << std::endl;
143 using SaturationTracker = std::map<std::pair<cudnn_frontend::feature_vector_t, std::string>, int32_t>;
146 int32_t saturationCount = 1;
151 const std::string & tag) {
152 if (saturationCount == 1) {
return true;}
158 getLogger() <<
"[cudnn_frontend] SaturationTracker " <<
name <<
" " << op_graph.
getTag() <<
" " << tag <<
" plan already in cache." << std::endl;
165 getLogger() <<
"[cudnn_frontend] SaturationTracker " <<
name <<
" " << op_graph.
getTag() <<
" " << tag <<
" " << cnt << std::endl;
166 return cnt >= saturationCount;
170 saturationCount = count;
std::vector< int64_t > feature_vector_t
Detailed feature_vector. Generally the Tensor and Operation properties.
ConditionalStreamer & getLogger()
ExecutionPlanCache_v1(const char *name_)
Plan Cache structure for the above table.
virtual bool is_fastest_plan_stable(const cudnn_frontend::OperationGraph &op_graph, const std::string &tag)
bool operator()(const feature_vector_t &fv1, const feature_vector_t &fv2) const
FeatureVectorToPlanMap cache
std::map< std::pair< cudnn_frontend::feature_vector_t, std::string >, int32_t > SaturationTracker
std::string const & getTag() const
feature_vector_t getFeatureVector() const
void add_plan_to_cache(const cudnn_frontend::OperationGraph &op_graph, const cudnn_frontend::ExecutionPlan &plan)
virtual bool is_fastest_plan_stable(const cudnn_frontend::OperationGraph &op_graph, const std::string &tag)
const std::string & get_name() const
SaturationTracker tracker
bool get_plan_from_cache(const cudnn_frontend::OperationGraph &op_graph, const cudnn_frontend::ExecutionPlan *&plan) const
void set_saturation_count(int32_t count)
ExecutionPlanCache_v2(const char *name_)
std::map< cudnn_frontend::feature_vector_t, cudnn_frontend::ExecutionPlan, cudnn_frontend::ExecutionPlanCache_v1::compare > FeatureVectorToPlanMap