Skip to content

Commit

Permalink
ENV variable MIGRAPHX_VERIFY_DUMP_DIFF (#3290)
Browse files Browse the repository at this point in the history
  • Loading branch information
lakhinderwalia authored Jul 23, 2024
1 parent faa2efe commit ee26a33
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions docs/dev/env_vars.rst
Original file line number Diff line number Diff line change
Expand Up @@ -319,3 +319,8 @@ Prints the reference and target programs even if the verify tests pass.

Set to "1", "enable", "enabled", "yes", or "true" to use.
Dumps verify tests to ``.mxr`` files.

.. envvar:: MIGRAPHX_VERIFY_DUMP_DIFF

Set to "1", "enable", "enabled", "yes", or "true" to use.
Dumps the output of the test (and the reference) results when they differ.
6 changes: 4 additions & 2 deletions src/verify_args.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

#include <migraphx/verify_args.hpp>

MIGRAPHX_DECLARE_ENV_VAR(MIGRAPHX_VERIFY_DUMP_DIFF);

namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS {

Expand All @@ -42,9 +44,9 @@ bool verify_args(const std::string& name,
// TODO: Check for nans
std::cout << "FAILED: " << name << std::endl;
std::cout << "RMS Error: " << rms_error << std::endl;
if(ref.size() < 32)
if(ref.size() < 32 or enabled(MIGRAPHX_VERIFY_DUMP_DIFF{}))
std::cout << "ref:" << ref << std::endl;
if(target.size() < 32)
if(target.size() < 32 or enabled(MIGRAPHX_VERIFY_DUMP_DIFF{}))
std::cout << "target:" << target << std::endl;
if(verify::range_zero(ref))
std::cout << "Ref data is all zeros" << std::endl;
Expand Down

0 comments on commit ee26a33

Please sign in to comment.