Commit f840b994 authored by umangyadav's avatar umangyadav
Browse files

warnings

(cherry picked from commit 46898ea4e6fde58b279778a557b44441827512ab)
parent 5ba656a3
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#include <migraphx/version.h>
#include <migraphx/program.hpp> #include <migraphx/program.hpp>
#include <migraphx/stringutils.hpp> #include <migraphx/stringutils.hpp>
#include <migraphx/instruction.hpp> #include <migraphx/instruction.hpp>
...@@ -498,6 +499,7 @@ value program::to_value() const ...@@ -498,6 +499,7 @@ value program::to_value() const
{ {
value result; value result;
result["version"] = program_file_version; result["version"] = program_file_version;
result["migraphx_version"] = get_migraphx_version();
result["target"] = this->impl->target_name; result["target"] = this->impl->target_name;
if(not this->impl->target_name.empty()) if(not this->impl->target_name.empty())
result["context"] = this->impl->ctx.to_value(); result["context"] = this->impl->ctx.to_value();
...@@ -628,6 +630,10 @@ void program::from_value(const value& v) ...@@ -628,6 +630,10 @@ void program::from_value(const value& v)
{ {
MIGRAPHX_THROW("Warning: Program version mismatch"); 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;
}
this->impl->target_name = v.at("target").to<std::string>(); this->impl->target_name = v.at("target").to<std::string>();
if(not this->impl->target_name.empty()) if(not this->impl->target_name.empty())
......
...@@ -260,7 +260,9 @@ struct context ...@@ -260,7 +260,9 @@ struct context
value result; value result;
result["events"] = events.size(); result["events"] = events.size();
result["streams"] = current_device->nstreams(); 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; return result;
} }
...@@ -273,7 +275,30 @@ struct context ...@@ -273,7 +275,30 @@ struct context
auto v_streams = v.at("streams"); auto v_streams = v.at("streams");
std::size_t n_streams = v_streams.without_key().to<std::size_t>(); std::size_t n_streams = v_streams.without_key().to<std::size_t>();
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>();
this->current_device = std::make_shared<hip_device>(0, n_streams); this->current_device = std::make_shared<hip_device>(0, n_streams);
#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;
}
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
} }
void wait_for(any_ptr queue) void wait_for(any_ptr queue)
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <migraphx/config.hpp> #include <migraphx/config.hpp>
#include <sstream> #include <sstream>
#include <string>
#ifdef MIGRAPHX_HAS_FIND_MODE_API #ifdef MIGRAPHX_HAS_FIND_MODE_API
extern "C" miopenStatus_t extern "C" miopenStatus_t
...@@ -75,6 +76,8 @@ using miopen_find_options = MIGRAPHX_MANAGE_PTR(miopenFindOptions_t, miopenDestr ...@@ -75,6 +76,8 @@ using miopen_find_options = MIGRAPHX_MANAGE_PTR(miopenFindOptions_t, miopenDestr
using miopen_problem = MIGRAPHX_MANAGE_PTR(miopenProblem_t, miopenDestroyProblem); using miopen_problem = MIGRAPHX_MANAGE_PTR(miopenProblem_t, miopenDestroyProblem);
using miopen_solution = MIGRAPHX_MANAGE_PTR(miopenSolution_t, miopenDestroySolution); using miopen_solution = MIGRAPHX_MANAGE_PTR(miopenSolution_t, miopenDestroySolution);
inline miopen_solution find_solution(miopenHandle_t handle, miopenProblem_t problem) inline miopen_solution find_solution(miopenHandle_t handle, miopenProblem_t problem)
{ {
miopenSolution_t solution; miopenSolution_t solution;
...@@ -98,6 +101,16 @@ inline void set_tensor_descriptor(miopenTensorArgumentId_t name, ...@@ -98,6 +101,16 @@ inline void set_tensor_descriptor(miopenTensorArgumentId_t name,
} }
#endif #endif
inline std::string get_miopen_version() {
size_t major=0, minor=0, patch=0;
auto status = miopenGetVersion(&major, &minor, &patch);
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);
return version;
}
inline tensor_descriptor make_tensor(const migraphx::shape& os, bool pack = false) inline tensor_descriptor make_tensor(const migraphx::shape& os, bool pack = false)
{ {
auto s = os.normalize_standard(); auto s = os.normalize_standard();
......
...@@ -22,6 +22,13 @@ ...@@ -22,6 +22,13 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
// clang-format off // clang-format off
#include <string>
#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