Skip to content

Commit

Permalink
Add set_false_math to false to solve accuracy issue for gelu test. (m…
Browse files Browse the repository at this point in the history
…icrosoft#33)

Add ORT_MIGRAPHX_SET_FAST_MATH env option and api hooks

Allow users to set the fast math option for MIGraphX compilation for quantized data types (fp16)
This allows us to toggle whether we can use faster math with the tradeoff of accuracy.

Revert "fixup! Add ORT_MIGRAPHX_SET_FAST_MATH env option and api hooks"

This reverts commit d369a15.

Revert "Add ORT_MIGRAPHX_SET_FAST_MATH env option and api hooks"

This reverts commit 3819961.

Co-authored-by: Ted Themistokleous <[email protected]>
  • Loading branch information
TedThemistokleous and Ted Themistokleous authored Apr 30, 2024
1 parent 9f0ff16 commit 328bc48
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1147,7 +1147,9 @@ Status MIGraphXExecutionProvider::Compile(const std::vector<FusedNodeAndGraph>&
// perform static quantization on the programs
migraphx::quantize_int8(prog, t_, quant_opts);
}
prog.compile(t_);
migraphx::compile_options co;
co.set_fast_math(false);
prog.compile(t_, co);
auto prog_output_shapes = prog.get_output_shapes();
for (std::size_t i = 0; i < output_names.size(); ++i) {
auto out_len = prog_output_shapes[i].lengths();
Expand Down Expand Up @@ -1265,7 +1267,9 @@ Status MIGraphXExecutionProvider::Compile(const std::vector<FusedNodeAndGraph>&
migraphx::quantize_int8(prog, t, quant_opts);
}

prog.compile(t);
migraphx::compile_options co;
co.set_fast_math(false);
prog.compile(t, co);
mgx_state->prog = prog;
param_shapes = prog.get_parameter_shapes();
no_input_shape = false;
Expand Down

0 comments on commit 328bc48

Please sign in to comment.