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

Function run_target

src/driver/verify.cpp:111–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111static std::vector<argument> run_target(program p,
112 const target& t,
113 const compile_options& options,
114 const verify_options& vo,
115 const parameter_map& inputs)
116{
117 if(vo.compiled_model.empty())
118 {
119 if(vo.quantize == precision::fp16)
120 {
121 quantize_fp16(p);
122 }
123 if(vo.quantize == precision::bf16)
124 {
125 quantize_bf16(p);
126 }
127 p.compile(t, options);
128 }
129 else
130 {
131 p = load(vo.compiled_model);
132 }
133
134 parameter_map m;
135 for(auto&& x : p.get_parameter_shapes())
136 {
137 auto arg = inputs.count(x.first) == 0 ? generate_argument(x.second) : inputs.at(x.first);
138 m[x.first] = options.offload_copy ? arg : t.copy_to(arg);
139 }
140 auto gpu_out = p.eval(m);
141 std::vector<argument> output(gpu_out.size());
142 std::cout << p << std::endl;
143 std::transform(gpu_out.begin(), gpu_out.end(), output.begin(), [&](auto& argu) {
144 return options.offload_copy ? argu : t.copy_from(argu);
145 });
146 return output;
147}
148
149bool verify_program(const std::string& name,
150 const program& p,

Callers 2

verifyMethod · 0.85
verify_programFunction · 0.85

Calls 15

generate_argumentFunction · 0.85
atMethod · 0.80
quantize_fp16Function · 0.50
quantize_bf16Function · 0.50
loadClass · 0.50
transformFunction · 0.50
emptyMethod · 0.45
compileMethod · 0.45
get_parameter_shapesMethod · 0.45
copy_toMethod · 0.45
evalMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected