Commit 6878ea29 authored by umangyadav's avatar umangyadav
Browse files

fromatting

parent f840b994
......@@ -498,9 +498,9 @@ const int program_file_version = 5;
value program::to_value() const
{
value result;
result["version"] = program_file_version;
result["migraphx_version"] = get_migraphx_version();
result["target"] = this->impl->target_name;
result["version"] = program_file_version;
result["migraphx_version"] = get_migraphx_version();
result["target"] = this->impl->target_name;
if(not this->impl->target_name.empty())
result["context"] = this->impl->ctx.to_value();
......@@ -631,8 +631,11 @@ void program::from_value(const value& v)
MIGRAPHX_THROW("Warning: Program version mismatch");
}
auto migx_version = v.at("migraphx_version").to<std::string>();
if(migx_version != get_migraphx_version()) {
std::clog << "MIGraphX version mismatch, consider recompiling model with environment variable MIOPEN_FIND_ENFORCE=3 to re-tune the model " << std::endl;
if(migx_version != get_migraphx_version())
{
std::clog << "MIGraphX version mismatch, consider recompiling model with environment "
"variable MIOPEN_FIND_ENFORCE=3 to re-tune the model "
<< std::endl;
}
this->impl->target_name = v.at("target").to<std::string>();
......
......@@ -258,10 +258,10 @@ struct context
value to_value() const
{
value result;
result["events"] = events.size();
result["streams"] = current_device->nstreams();
result["gfx_arch"] = current_device->get_device_name();
result["cu_count"] = current_device->get_cu_count();
result["events"] = events.size();
result["streams"] = current_device->nstreams();
result["gfx_arch"] = current_device->get_device_name();
result["cu_count"] = current_device->get_cu_count();
result["miopen_version"] = get_miopen_version();
return result;
}
......@@ -277,28 +277,39 @@ struct context
auto v_gfx_arch = v.at("gfx_arch").to<std::string>();
auto v_cu_count = v.at("cu_count");
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>();
this->current_device = std::make_shared<hip_device>(0, n_streams);
#ifdef MIGRAPHX_HAS_FIND_2_API
#ifdef MIGRAPHX_HAS_FIND_2_API
{
std::string current_gfx_arch = this->current_device->get_device_name();
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 || v_gfx_arch != current_gfx_arch) {
std::clog << "MIGraphX model was compiled for gfx_arch: " << v_gfx_arch << " with number of CUs=" << n_cu_count << ", but current device has gfx_arch: " << current_gfx_arch << " with number of CUs=" << current_cu_count<<", performance may suffer. \
Consider re-compiling the model with environment variable MIOPEN_FIND_ENFORCE=3 to re-tune the model." << std::endl;
std::string current_gfx_arch = this->current_device->get_device_name();
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 || v_gfx_arch != current_gfx_arch)
{
std::clog << "MIGraphX model was compiled for gfx_arch: " << v_gfx_arch
<< " with number of CUs=" << n_cu_count
<< ", but current device has gfx_arch: " << current_gfx_arch
<< " with number of CUs=" << current_cu_count
<< ", performance may suffer. \
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::clog << "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;
if(current_miopen_version != v_miopen_version)
{
std::clog << "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
}
void wait_for(any_ptr queue)
......
......@@ -76,8 +76,6 @@ using miopen_find_options = MIGRAPHX_MANAGE_PTR(miopenFindOptions_t, miopenDestr
using miopen_problem = MIGRAPHX_MANAGE_PTR(miopenProblem_t, miopenDestroyProblem);
using miopen_solution = MIGRAPHX_MANAGE_PTR(miopenSolution_t, miopenDestroySolution);
inline miopen_solution find_solution(miopenHandle_t handle, miopenProblem_t problem)
{
miopenSolution_t solution;
......@@ -101,13 +99,16 @@ inline void set_tensor_descriptor(miopenTensorArgumentId_t name,
}
#endif
inline std::string get_miopen_version() {
size_t major=0, minor=0, patch=0;
inline std::string get_miopen_version()
{
size_t major = 0, minor = 0, patch = 0;
auto status = miopenGetVersion(&major, &minor, &patch);
if(status != miopenStatusSuccess) {
if(status != miopenStatusSuccess)
{
MIGRAPHX_THROW("MIOpen failed to retrieve miopen version info");
}
std::string version = std::to_string(major) +"."+ std::to_string(minor) +"."+ std::to_string(patch);
std::string version =
std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(patch);
return version;
}
......
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