Commit 6d86ff54 authored by umangyadav's avatar umangyadav
Browse files

move error/warnings in Finalize()

parent c7bb2fc3
...@@ -493,6 +493,10 @@ std::vector<argument> program::eval(parameter_map params, execution_environment ...@@ -493,6 +493,10 @@ std::vector<argument> program::eval(parameter_map params, execution_environment
return ret; return ret;
} }
inline std::string get_migraphx_version() {
return std::to_string(MIGRAPHX_VERSION_MAJOR) + "." +std::to_string(MIGRAPHX_VERSION_MINOR);
}
const int program_file_version = 5; const int program_file_version = 5;
value program::to_value() const value program::to_value() const
...@@ -633,8 +637,7 @@ void program::from_value(const value& v) ...@@ -633,8 +637,7 @@ void program::from_value(const value& v)
auto migx_version = v.at("migraphx_version").to<std::string>(); auto migx_version = v.at("migraphx_version").to<std::string>();
if(migx_version != get_migraphx_version()) if(migx_version != get_migraphx_version())
{ {
std::cerr << "MIGraphX version mismatch, consider recompiling model with environment " std::clog << "MIGraphX version mismatch, Operators may not be compatbile."
"variable MIOPEN_FIND_ENFORCE=3 to re-tune the model "
<< std::endl; << std::endl;
} }
......
...@@ -286,25 +286,13 @@ struct context ...@@ -286,25 +286,13 @@ struct context
std::string current_gfx_arch = this->current_device->get_device_name(); std::string current_gfx_arch = this->current_device->get_device_name();
std::size_t current_cu_count = this->current_device->get_cu_count(); std::size_t current_cu_count = this->current_device->get_cu_count();
std::string current_miopen_version = get_miopen_version();
if(n_cu_count != current_cu_count or v_gfx_arch != current_gfx_arch) if(n_cu_count != current_cu_count or v_gfx_arch != current_gfx_arch)
{ {
std::cerr << "MIGraphX model was compiled for gfx_arch: " << v_gfx_arch MIGRAPHX_THROW("MIGraphX model was compiled for gfx_arch: " + v_gfx_arch \
<< " with number of CUs=" << n_cu_count + " with number of CUs=" + std::to_string(n_cu_count) \
<< ", but current device has gfx_arch: " << current_gfx_arch + ", but current device has gfx_arch: " + current_gfx_arch \
<< " with number of CUs=" << current_cu_count + " with number of CUs=" + std::to_string(current_cu_count) \
<< ", performance may suffer. \ + ", performance may suffer. Consider re-compiling the model with environment variable MIOPEN_FIND_ENFORCE=3 to re-tune the model.");
Consider re-compiling the model with environment variable MIOPEN_FIND_ENFORCE=3 to re-tune the model."
<< std::endl;
}
if(current_miopen_version != v_miopen_version)
{
std::cerr << "MIGraphX model was compiled with MIOpen version : "
<< v_miopen_version
<< ", but this machine has MIOpen version: " << current_miopen_version
<< ", Performance may suffer.\
Consider re-compiling the model with environment variable MIOPEN_FIND_ENFORCE=3 to re-tune the model."
<< std::endl;
} }
} }
#endif #endif
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <migraphx/op/convolution.hpp> #include <migraphx/op/convolution.hpp>
#include <migraphx/op/quant_convolution.hpp> #include <migraphx/op/quant_convolution.hpp>
#include <migraphx/op/deconvolution.hpp> #include <migraphx/op/deconvolution.hpp>
#include <miopen/miopen.h>
#include <unordered_map> #include <unordered_map>
#include <migraphx/reflect.hpp> #include <migraphx/reflect.hpp>
#include <migraphx/gpu/context.hpp> #include <migraphx/gpu/context.hpp>
...@@ -288,6 +289,32 @@ struct miopen_convolution ...@@ -288,6 +289,32 @@ struct miopen_convolution
solution_ptr = miopen_solution{ptr}; solution_ptr = miopen_solution{ptr};
if(status != miopenStatusSuccess) if(status != miopenStatusSuccess)
MIGRAPHX_THROW("MIOpen " + op.name() + ": loading convolution solution failed"); MIGRAPHX_THROW("MIOpen " + op.name() + ": loading convolution solution failed");
if(status == miopenStatusVersionMismatch) {
std::clog << "MIOpen convolution was compiled with different MIOpen version. But this machine has MIOpen version: " <<
get_miopen_version()
<< ", Performance may suffer.\
Consider re-compiling the model with environment variable MIOPEN_FIND_ENFORCE=3 to re-tune the model."
<< std::endl;
}
auto v = ctx.to_value();
auto v_gfx_arch = v.at("gfx_arch").to<std::string>();
auto v_cu_count = v.at("cu_count");
std::size_t n_cu_count = v_cu_count.without_key().to<std::size_t>();
std::string v_miopen_version = v.at("miopen_version").to<std::string>();
auto current_device = ctx.get_current_device();
std::string current_gfx_arch = current_device.get_device_name();
std::size_t current_cu_count = current_device.get_cu_count();
if(n_cu_count != current_cu_count or v_gfx_arch != current_gfx_arch)
{
MIGRAPHX_THROW("MIGraphX model was compiled for gfx_arch: " + v_gfx_arch \
+ " with number of CUs=" + std::to_string(n_cu_count) \
+ ", but current device has gfx_arch: " + current_gfx_arch \
+ " with number of CUs=" + std::to_string(current_cu_count) \
+ ", performance may suffer. Consider re-compiling the model with environment variable MIOPEN_FIND_ENFORCE=3 to re-tune the model.");
}
} }
} }
#else #else
......
...@@ -27,8 +27,6 @@ ...@@ -27,8 +27,6 @@
#define MIGRAPHX_VERSION_MAJOR @PROJECT_VERSION_MAJOR@ #define MIGRAPHX_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
#define MIGRAPHX_VERSION_MINOR @PROJECT_VERSION_MINOR@ #define MIGRAPHX_VERSION_MINOR @PROJECT_VERSION_MINOR@
inline std::string get_migraphx_version() {
return std::to_string(MIGRAPHX_VERSION_MAJOR) + "." +std::to_string(MIGRAPHX_VERSION_MINOR);
}
// clang-format on // clang-format on
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment