| 766 | |
| 767 | #if MGB_JIT_HALIDE |
| 768 | TEST(TestJITFusionHalide, SimpleReduce) { |
| 769 | REQUIRE_GPU(1); |
| 770 | set_backend(Backend::HALIDE); |
| 771 | |
| 772 | auto graph = ComputingGraph::make(); |
| 773 | graph->options().graph_opt_level = 3; |
| 774 | graph->options().graph_opt.jit = 2; |
| 775 | HostTensorGenerator<> gen; |
| 776 | auto host_x0 = gen({3, 3}), host_x1 = gen({3, 1}); |
| 777 | auto a = opr::Host2DeviceCopy::make(*graph, host_x0), |
| 778 | b = opr::Host2DeviceCopy::make(*graph, host_x1), |
| 779 | y = opr::reduce_sum(a + b, opr::GetVarShape::make(b)), |
| 780 | z = opr::reduce_sum(a * b, opr::GetVarShape::make(a)) + y; |
| 781 | |
| 782 | SymbolVar z_opt; |
| 783 | unpack_vector( |
| 784 | gopt::GraphOptimizer{} |
| 785 | .add_preset_passes(true, nullptr, &(graph->options())) |
| 786 | .apply({{z}}) |
| 787 | .endpoint_vars(), |
| 788 | z_opt); |
| 789 | ASSERT_EQ(2u, find_opr_num<mgb::jit::JITExecutor>(z_opt)); |
| 790 | HostTensorND h; |
| 791 | graph->compile({make_callback_copy(z_opt, h)}) |
| 792 | ->to_json() |
| 793 | ->writeto_fpath(output_file("TestJITFusionHalide.SimpleReduce.json")); |
| 794 | } |
| 795 | |
| 796 | TEST(TestJITFusionHalide, JITExecutor) { |
| 797 | REQUIRE_GPU(1); |
nothing calls this directly
no test coverage detected