cudnn_frontend_utils.h
exception
string
vector
cudnn_backend_base.h
cudnn_frontend_Logging.h
cudnn_frontend_ConvDesc.h
cudnn_frontend_PointWiseDesc.h
cudnn_frontend_MatMulDesc.h
cudnn_frontend_ReductionDesc.h
cudnn_frontend_Tensor.h
cudnn_frontend_Operation.h
cudnn_frontend_OperationGraph.h
cudnn_frontend_Engine.h
cudnn_frontend_EngineConfig.h
cudnn_frontend_Heuristics.h
cudnn_frontend_ExecutionPlan.h
cudnn_frontend_VariantPack.h
cudnn.h
string
cudnn_frontend_Logging.h
exception
fstream
ostream
vector
iostream
cstring
cudnn_frontend_utils.h
cudnn_backend_base.h
cudnn_frontend_VariantPack.h
cudnn_frontend_Engine.h
cudnn_frontend_EngineConfig.h
cudnn_frontend_MatMulDesc.h
cudnn_frontend_Heuristics.h
cudnn_frontend_PointWiseDesc.h
cudnn_frontend_get_plan.h
cudnn_frontend_Tensor.h
cudnn_frontend_EngineConfigGenerator.h
cudnn_frontend_ExecutionPlanCache.h
cudnn_frontend_Operation.h
cudnn_frontend_Reorder_Tensor.h
cudnn_frontend_ExecutionPlan.h
cudnn_frontend_ConvDesc.h
cudnn_frontend_OperationGraph.h
cudnn_frontend.h
cudnn_frontend_find_plan.h
cudnn_frontend_ReductionDesc.h
cudnn_frontend_utils.h
cudnn_frontend::cudnnException
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<exception>
    #include<string>
    #include<vector>

    #include"cudnn_backend_base.h"
    #include"cudnn_frontend_Logging.h"

    namespacecudnn_frontend{

    usingfeature_vector_t=std::vector<int64_t>;

    #ifndefNV_CUDNN_DISABLE_EXCEPTION
    classcudnnException:publicstd::runtime_error{
    public:
    cudnnException(constchar*message,cudnnStatus_tstatus)throw():std::runtime_error(message){
    error_status=status;
    }
    virtualconstchar*
    what()constthrow(){
    returnstd::runtime_error::what();
    }
    cudnnStatus_tgetCudnnStatus(){
    returnerror_status;
    }

    cudnnStatus_terror_status;
    };
    #endif

    staticinlinevoid
    throw_if(std::function<bool()>expr,constchar*message,cudnnStatus_tstatus){
    if(expr()){
    #ifndefNV_CUDNN_DISABLE_EXCEPTION
    throwcudnnException(message,status);
    #endif
    }
    }
    staticinlinevoid
    throw_if(boolexpr,constchar*message,cudnnStatus_tstatus){
    if(expr){
    #ifndefNV_CUDNN_DISABLE_EXCEPTION
    throwcudnnException(message,status);
    #endif
    }
    }

    staticinlinestd::string
    to_string(cudnnDataType_ttype){
    switch(type){
    caseCUDNN_DATA_FLOAT:
    returnstd::string("CUDNN_DATA_FLOAT");
    caseCUDNN_DATA_DOUBLE:
    returnstd::string("CUDNN_DATA_DOUBLE");
    caseCUDNN_DATA_HALF:
    returnstd::string("CUDNN_DATA_HALF");
    caseCUDNN_DATA_INT8:
    returnstd::string("CUDNN_DATA_INT8");
    caseCUDNN_DATA_INT32:
    returnstd::string("CUDNN_DATA_INT32");
    caseCUDNN_DATA_INT8x4://x4andx32arereplacedbyvectorizeddimensioninthev8API
    returnstd::string("CUDNN_DATA_INT8x4");
    caseCUDNN_DATA_UINT8:
    returnstd::string("CUDNN_DATA_UINT8");
    caseCUDNN_DATA_UINT8x4://x4andx32arereplacedbyvectorizeddimensioninthev8API
    returnstd::string("CUDNN_DATA_UINT8x4");
    caseCUDNN_DATA_INT8x32://x4andx32arereplacedbyvectorizeddimensioninthev8API
    returnstd::string("CUDNN_DATA_INT8x32");
    caseCUDNN_DATA_INT64:
    returnstd::string("CUDNN_DATA_INT64");
    caseCUDNN_DATA_BFLOAT16:
    returnstd::string("CUDNN_DATA_BFLOAT16");
    }
    returnstd::string("");
    }

    staticinlinestd::string
    to_string(cudnnStatus_tstatus){
    switch(status){
    caseCUDNN_STATUS_SUCCESS:
    returnstd::string("CUDNN_STATUS_SUCCESS");
    caseCUDNN_STATUS_NOT_INITIALIZED:
    returnstd::string("CUDNN_STATUS_NOT_INITIALIZED");
    caseCUDNN_STATUS_ALLOC_FAILED:
    returnstd::string("CUDNN_STATUS_ALLOC_FAILED");
    caseCUDNN_STATUS_BAD_PARAM:
    returnstd::string("CUDNN_STATUS_BAD_PARAM");
    caseCUDNN_STATUS_INTERNAL_ERROR:
    returnstd::string("CUDNN_STATUS_INTERNAL_ERROR");
    caseCUDNN_STATUS_INVALID_VALUE:
    returnstd::string("CUDNN_STATUS_INVALID_VALUE");
    caseCUDNN_STATUS_ARCH_MISMATCH:
    returnstd::string("CUDNN_STATUS_ARCH_MISMATCH");
    caseCUDNN_STATUS_MAPPING_ERROR:
    returnstd::string("CUDNN_STATUS_MAPPING_ERROR");
    caseCUDNN_STATUS_EXECUTION_FAILED:
    returnstd::string("CUDNN_STATUS_EXECUTION_FAILED");
    caseCUDNN_STATUS_NOT_SUPPORTED:
    returnstd::string("CUDNN_STATUS_NOT_SUPPORTED");
    caseCUDNN_STATUS_LICENSE_ERROR:
    returnstd::string("CUDNN_STATUS_LICENSE_ERROR");
    caseCUDNN_STATUS_RUNTIME_PREREQUISITE_MISSING:
    returnstd::string("CUDNN_STATUS_RUNTIME_PREREQUISITE_MISSING");
    caseCUDNN_STATUS_RUNTIME_IN_PROGRESS:
    returnstd::string("CUDNN_STATUS_RUNTIME_IN_PROGRESS");
    caseCUDNN_STATUS_RUNTIME_FP_OVERFLOW:
    returnstd::string("CUDNN_STATUS_RUNTIME_FP_OVERFLOW");
    caseCUDNN_STATUS_VERSION_MISMATCH:
    returnstd::string("CUDNN_STATUS_VERSION_MISMATCH");
    }
    returnstd::string("");
    }

    staticinlinevoid
    set_error_and_throw_exception(BackendDescriptorconst*desc,cudnnStatus_tstatus,constchar*message){
    if(desc!=nullptr){
    desc->set_status(status);
    desc->set_error(message);
    }
    #ifndefNV_CUDNN_DISABLE_EXCEPTION
    throwcudnnException(
    std::string(std::string(message)+std::string("cudnn_status:")+to_string(status)).c_str(),status);
    #endif
    }

    }