Skip to content

Commit

Permalink
Add set_false_math to false to solve accuracy issue for gelu test. (#32)
Browse files Browse the repository at this point in the history
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 e04065c commit 9c748d7
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,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 @@ -1263,7 +1265,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 9c748d7

Please sign in to comment.