MCPcopy Create free account
hub / github.com/ROCm/AMDMIGraphX / time_program

Function time_program

src/targets/gpu/time_op.cpp:106–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104}
105
106double time_program(const context& ictx,
107 program p,
108 const std::unordered_map<std::string, double>& fill_map,
109 int bundle,
110 int nruns)
111{
112 std::vector<migraphx::context> ctx_vec = {ictx};
113 auto& gctx = any_cast<migraphx::gpu::context>(ctx_vec.front());
114 auto* mm = p.get_main_module();
115 mm->finalize(ctx_vec);
116 auto in_shapes = p.get_parameter_shapes();
117 std::unordered_map<std::string, migraphx::argument> param_map;
118 unsigned long seed = 0;
119 for(const auto& [name, shape] : in_shapes)
120 {
121 std::string id = "";
122 if(shape.type() != migraphx::shape::tuple_type)
123 id = shape.type_string() + migraphx::shape::to_sizes_string({shape.as_standard()});
124
125 if(contains(fill_map, id))
126 param_map[name] = to_gpu(fill_argument(shape, fill_map.at(id)));
127 else
128 param_map[name] = to_gpu(generate_argument(shape, seed++, random_mode::random));
129 }
130 auto run = [&] { p.eval_with_context(ctx_vec, param_map); };
131 return time_loop(gctx, bundle, nruns, run);
132}
133
134} // namespace gpu
135} // namespace MIGRAPHX_INLINE_NS

Callers 1

compile_planClass · 0.85

Calls 14

containsFunction · 0.85
to_gpuFunction · 0.85
fill_argumentFunction · 0.85
generate_argumentFunction · 0.85
time_loopFunction · 0.85
frontMethod · 0.80
get_main_moduleMethod · 0.80
type_stringMethod · 0.80
as_standardMethod · 0.80
atMethod · 0.80
eval_with_contextMethod · 0.80
finalizeMethod · 0.45

Tested by

no test coverage detected