cudnn_frontend_EngineConfigGenerator.h
cudnn_frontend.h
cudnn_frontend_find_plan.h
cudnn_frontend_get_plan.h
valarray
functional
cudnn_frontend_VariantPack.h
limits
iterator
cudnn_frontend_Engine.h
cstdint
cudnn_frontend_EngineConfig.h
cudnn_frontend_MatMulDesc.h
cudnn_frontend_Heuristics.h
cudnn.h
cmath
cassert
cudnn_frontend_PointWiseDesc.h
stdexcept
numeric
string
map
cudnn_frontend_Errata.h
cudnn_frontend_Logging.h
cudnn_frontend_Tensor.h
cudnn_frontend_EngineConfigGenerator.h
exception
fstream
cudnn_frontend_Filters.h
ostream
cudnn_frontend_ExecutionPlanCache.h
cudnn_frontend_Operation.h
cudnn_frontend_Reorder_Tensor.h
ios
cstdio
cudnn_frontend_ExecutionPlan.h
contrib/nlohmann/json/json.hpp
tuple
vector
cudnn_frontend_ConvDesc.h
cudnn_frontend_OperationGraph.h
cudnn_backend.h
utility
array
sstream
cudnn_frontend.h
cudnn_frontend_ReductionDesc.h
iosfwd
cstdlib
clocale
cctype
iostream
cstddef
unordered_map
mutex
type_traits
set
forward_list
algorithm
cstring
cudnn_frontend_utils.h
memory
istream
initializer_list
cudnn_frontend_EngineFallbackList.h
cudnn_backend_base.h
cudnn_frontend_get_plan.h
cudnn_frontend_EngineConfigGenerator.h
cudnn_frontend_find_plan.h
cudnn_frontend::EngineConfigGenerator
cudnn_frontend

    /*
    *Copyright(c)2021,NVIDIACORPORATION.Allrightsreserved.
    *
    *Permissionisherebygranted,freeofcharge,toanypersonobtaininga
    *copyofthissoftwareandassociateddocumentationfiles(the"Software"),
    *todealintheSoftwarewithoutrestriction,includingwithoutlimitation
    *therightstouse,copy,modify,merge,publish,distribute,sublicense,
    *and/orsellcopiesoftheSoftware,andtopermitpersonstowhomthe
    *Softwareisfurnishedtodoso,subjecttothefollowingconditions:
    *
    *Theabovecopyrightnoticeandthispermissionnoticeshallbeincludedin
    *allcopiesorsubstantialportionsoftheSoftware.
    *
    *THESOFTWAREISPROVIDED"ASIS",WITHOUTWARRANTYOFANYKIND,EXPRESSOR
    *IMPLIED,INCLUDINGBUTNOTLIMITEDTOTHEWARRANTIESOFMERCHANTABILITY,
    *FITNESSFORAPARTICULARPURPOSEANDNONINFRINGEMENT.INNOEVENTSHALL
    *THEAUTHORSORCOPYRIGHTHOLDERSBELIABLEFORANYCLAIM,DAMAGESOROTHER
    *LIABILITY,WHETHERINANACTIONOFCONTRACT,TORTOROTHERWISE,ARISING
    *FROM,OUTOFORINCONNECTIONWITHTHESOFTWAREORTHEUSEOROTHER
    *DEALINGSINTHESOFTWARE.
    */

    #pragmaonce

    #include<cudnn_frontend.h>

    namespacecudnn_frontend{

    usingexecutionPlans_t=std::vector<cudnn_frontend::ExecutionPlan>;
    usingPredicate=std::function<bool(cudnn_frontend::ExecutionPlanconst&plan)>;
    usingGeneratorSource=std::function<cudnn_frontend::EngineConfigList(cudnn_frontend::OperationGraph&)>;

    enumclassCudnnFindSamplingTechnique{
    CUDNN_FIND_SAMPLE_ONCE,
    CUDNN_FIND_SAMPLE_MEDIAN_OF_THREE,
    CUDNN_FIND_SAMPLE_TILL_STABLE
    };

    classEngineConfigGenerator{
    private:
    std::vector<GeneratorSource>engine_config_generators;

    public:
    EngineConfigGenerator(intconstsourceSize,GeneratorSourceconst*sources){
    for(inti=0;i<sourceSize;i++){
    engine_config_generators.push_back(sources[i]);
    }
    };

    auto
    generate_engine_config(cudnn_frontend::OperationGraph&opGraph)->cudnn_frontend::EngineConfigList{
    cudnn_frontend::EngineConfigListengine_configs;
    for(autofn:engine_config_generators){
    cudnn_frontend::EngineConfigListnew_engine_config=fn(opGraph);
    getLogger()<<"[cudnn_frontend]Calledengineconfiggeneratorandproduced"
    <<new_engine_config.size()<<"configs."<<std::endl;
    std::copy(new_engine_config.begin(),new_engine_config.end(),std::back_inserter(engine_configs));
    new_engine_config.clear();
    }
    returnengine_configs;
    }

    auto
    cudnnGetPlan(cudnnHandle_thandle,cudnn_frontend::OperationGraph&opGraph,Predicatepred)->executionPlans_t;
    auto
    cudnnGetPlan(cudnnHandle_thandle,cudnn_frontend::OperationGraph&opGraph)->executionPlans_t;

    template<CudnnFindSamplingTechniquesamplingTechnique>
    auto
    cudnnFindPlan(cudnnHandle_thandle,
    cudnn_frontend::OperationGraph&opGraph,
    cudnn_frontend::VariantPackconst&variantPack,
    Predicatepred)->executionPlans_t;

    template<CudnnFindSamplingTechniquesamplingTechnique>
    auto
    cudnnFindPlan(cudnnHandle_thandle,
    cudnn_frontend::OperationGraph&opGraph,
    cudnn_frontend::VariantPackconst&variantPack)->executionPlans_t;

    template<CudnnFindSamplingTechniquesamplingTechnique>
    auto
    cudnnFindPlanAndCache(cudnnHandle_thandle,
    cudnn_frontend::OperationGraph&opGraph,
    cudnn_frontend::VariantPackconst&variantPack,
    cudnn_frontend::ExecutionPlanCache&cache,
    Predicatepred=[](constcudnn_frontend::ExecutionPlan&){returnfalse;})->cudnn_frontend::ExecutionPlan;
    };

    staticauto
    filter(Predicatepred,executionPlans_t&plans)->executionPlans_t{
    executionPlans_tfiltered_plans;
    for(auto&plan:plans){
    getLogger()<<"[cudnn_frontend]"<<"Filtered";
    if(!pred(plan)){
    getLogger()<<"andAdded";
    filtered_plans.emplace_back(std::move(plan));
    }
    getLogger()<<filtered_plans.back().getTag()<<std::endl;
    }
    getLogger()<<"[cudnn_frontend]Filteredplanscount"<<filtered_plans.size()<<std::endl;
    returnfiltered_plans;
    }
    }