From ee26a334e3f8d25c7f95df8d905cde30eec7bd2d Mon Sep 17 00:00:00 2001 From: Lakhinder Walia <139581206+lakhinderwalia@users.noreply.github.com> Date: Tue, 23 Jul 2024 13:00:15 -0700 Subject: [PATCH] ENV variable MIGRAPHX_VERIFY_DUMP_DIFF (#3290) --- docs/dev/env_vars.rst | 5 +++++ src/verify_args.cpp | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/dev/env_vars.rst b/docs/dev/env_vars.rst index b739a82072c..6295593db0a 100644 --- a/docs/dev/env_vars.rst +++ b/docs/dev/env_vars.rst @@ -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. diff --git a/src/verify_args.cpp b/src/verify_args.cpp index 8e0925e78c1..00b85137b33 100644 --- a/src/verify_args.cpp +++ b/src/verify_args.cpp @@ -24,6 +24,8 @@ #include +MIGRAPHX_DECLARE_ENV_VAR(MIGRAPHX_VERIFY_DUMP_DIFF); + namespace migraphx { inline namespace MIGRAPHX_INLINE_NS { @@ -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;