From d114b38ccdaa8e58d967599efae7590abc9efaca Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Thu, 9 Dec 2021 13:52:56 -0800 Subject: [PATCH 1/2] Fail if no_bounds_query specified for HL_JIT_TARGET JIT requires the use of bounds_query; disabling it will almost certainly fail in JIT mode, either with a confusing assert message, or a crash (if you also specify no_asserts). This adds a more useful failure message. --- src/Target.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Target.cpp b/src/Target.cpp index 4c5672f91cda..4c96486e8d4e 100644 --- a/src/Target.cpp +++ b/src/Target.cpp @@ -431,6 +431,8 @@ Target get_jit_target_from_environment() { << "HL_JIT_TARGET must match the host OS, architecture, and bit width.\n" << "HL_JIT_TARGET was " << target << ". " << "Host is " << host.to_string() << ".\n"; + user_assert(!t.has_feature(Target::NoBoundsQuery)) + << "The Halide JIT requires the use of bounds query, but HL_JIT_TARGET was specified with no_bunds_query: " << target; return t; } } @@ -441,7 +443,7 @@ bool merge_string(Target &t, const std::string &target) { vector tokens; size_t first_dash; while ((first_dash = rest.find('-')) != string::npos) { - //Internal::debug(0) << first_dash << ", " << rest << "\n"; + // Internal::debug(0) << first_dash << ", " << rest << "\n"; tokens.push_back(rest.substr(0, first_dash)); rest = rest.substr(first_dash + 1); } From d9b10b7a4cdf5d422c7b9214f51522ef1128c006 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Thu, 9 Dec 2021 15:05:47 -0800 Subject: [PATCH 2/2] Update Target.cpp --- src/Target.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Target.cpp b/src/Target.cpp index 4c96486e8d4e..0a06936c22c3 100644 --- a/src/Target.cpp +++ b/src/Target.cpp @@ -432,7 +432,7 @@ Target get_jit_target_from_environment() { << "HL_JIT_TARGET was " << target << ". " << "Host is " << host.to_string() << ".\n"; user_assert(!t.has_feature(Target::NoBoundsQuery)) - << "The Halide JIT requires the use of bounds query, but HL_JIT_TARGET was specified with no_bunds_query: " << target; + << "The Halide JIT requires the use of bounds query, but HL_JIT_TARGET was specified with no_bounds_query: " << target; return t; } }