40 const char * err_json = std::getenv(
"CUDNN_ERRATA_JSON_FILE");
41 if (err_json == NULL && errata_json ==
"") {
return;}
42 if (err_json == NULL) { err_json = errata_json.c_str();}
43 std::ifstream ifs(err_json, std::ifstream::in);
44 if (!ifs.is_open() || !ifs.good()) {
return;}
52 cudnnHandle_t handle, T fn) {
53 std::string operation = json_handle[
"operation"];
54 std::string engine = json_handle[
"engine"];
55 uint64_t cudnn_start = 0;
56 uint64_t cudnn_end = -1;
57 if (json_handle.
contains(
"cudnn_version_start")) {
58 cudnn_start = json_handle[
"cudnn_version_start"];
60 if (json_handle.
contains(
"cudnn_version_end")) {
61 cudnn_end = json_handle[
"cudnn_version_end"];
63 std::string tag_prefix = operation +
"_" + engine;
65 std::equal(tag_prefix.begin(), tag_prefix.end(), executionPlanTag.begin()) &&
66 CUDNN_VERSION >= cudnn_start &&
67 CUDNN_VERSION < cudnn_end;
69 if (blocked && json_handle.
contains(
"knob")) {
70 for (
auto& kv : json_handle[
"knob"]) {
72 (executionPlanTag.find(kv) != std::string::npos);
76 blocked = blocked && fn();
88 cudnnHandle_t handle, T fn) {
90 for (
auto const &rule : json_handle[
"rules"]) {
91 if (check_rule<T>(rule, executionPlanTag, handle, fn)) {
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 void load_from_config(json &json_handle, const std::string &errata_json)
static bool check_rule(const json &json_handle, const std::string &executionPlanTag, cudnnHandle_t handle, T fn)
basic_json<> json
default JSON class