1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
#include "Halide.h"
using namespace Halide;
int main(int argc, char **argv) {
#ifndef HALIDE_WITH_EXCEPTIONS
printf("[SKIP] bad_partition_always_throws requires exceptions\n");
return 0;
#else
try {
Func f("f");
Var x("x");
f(x) = 0;
f.partition(x, Partition::Always);
f.realize({10});
} catch (const CompileError &e) {
const std::string_view msg = e.what();
constexpr std::string_view expected_msg =
"Loop Partition Policy is set to Always for f.s0.x, "
"but no loop partitioning was performed.";
if (msg.find(expected_msg) == std::string_view::npos) {
std::cerr << "Expected error containing (" << expected_msg << "), but got (" << msg << ")\n";
return 1;
}
printf("Success!\n");
return 0;
}
printf("Did not see any exception!\n");
return 1;
#endif
}
|