MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / TEST

Function TEST

src/jit/test/fusion.cpp:768–794  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

766
767#if MGB_JIT_HALIDE
768TEST(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
796TEST(TestJITFusionHalide, JITExecutor) {
797 REQUIRE_GPU(1);

Callers

nothing calls this directly

Calls 15

unpack_vectorFunction · 0.85
make_callback_copyFunction · 0.85
output_fileFunction · 0.85
gradFunction · 0.85
make_func_pairFunction · 0.85
jit_stopFunction · 0.85
resizeMethod · 0.80
apply_inplaceMethod · 0.80
make_scalar_dtMethod · 0.80
run_mlirFunction · 0.70
makeFunction · 0.50
genFunction · 0.50

Tested by

no test coverage detected