25 #include "../include/cudnn_frontend_Logging.h" 41 const char * err_json = std::getenv(
"CUDNN_ERRATA_JSON_FILE");
42 if (err_json == NULL && errata_json ==
"") {
return false;}
43 if (err_json == NULL) { err_json = errata_json.c_str();}
44 std::ifstream ifs(err_json, std::ifstream::in);
45 if (!ifs.is_open() || !ifs.good()) {
return false;}
53 cudnnHandle_t handle, T fn) {
54 std::string operation = json_handle[
"operation"];
55 int64_t engine = json_handle[
"engine"];
56 uint64_t cudnn_start = 0;
57 uint64_t cudnn_end = -1;
58 if (json_handle.
contains(
"cudnn_version_start")) {
59 cudnn_start = json_handle[
"cudnn_version_start"];
61 if (json_handle.
contains(
"cudnn_version_end")) {
62 cudnn_end = json_handle[
"cudnn_version_end"];
64 std::string tag_prefix = operation +
"_eng" +
std::to_string(engine) +
"_";
65 std::string mod_tag = executionPlanTag +
"_";
67 tag_prefix.size() <= mod_tag.size() &&
68 std::equal(tag_prefix.begin(), tag_prefix.end(), mod_tag.begin()) &&
69 CUDNN_VERSION >= cudnn_start &&
70 CUDNN_VERSION < cudnn_end;
72 if (blocked && json_handle.
contains(
"knob")) {
73 for (
auto& kv : json_handle[
"knob"]) {
75 (executionPlanTag.find(kv) != std::string::npos);
79 blocked = blocked && fn();
91 cudnnHandle_t handle, T fn) {
94 for (
auto const &rule : json_handle[
"rules"]) {
95 if (check_rule<T>(rule, executionPlanTag, handle, fn)) {
ConditionalStreamer & getLogger()
NLOHMANN_BASIC_JSON_TPL_DECLARATION std::string to_string(const NLOHMANN_BASIC_JSON_TPL &j)
user-defined to_string function for JSON values
bool contains(KeyT &&key) const
check the existence of an element in a JSON object
a class to store JSON values
static bool check_errata(const json &json_handle, const std::string &executionPlanTag, cudnnHandle_t handle, T fn)
static bool check_rule(const json &json_handle, const std::string &executionPlanTag, cudnnHandle_t handle, T fn)
basic_json<> json
default JSON class
static bool load_from_config(json &json_handle, const std::string &errata_json)