Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
8428a242
Unverified
Commit
8428a242
authored
Jul 09, 2023
by
Umang Yadav
Committed by
GitHub
Jul 09, 2023
Browse files
Add MIGraphX version inside MXR file (#1866)
parent
0e144f05
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
6 deletions
+31
-6
src/program.cpp
src/program.cpp
+31
-6
No files found.
src/program.cpp
View file @
8428a242
...
@@ -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/compile_options.hpp>
#include <migraphx/compile_options.hpp>
#include <migraphx/program.hpp>
#include <migraphx/program.hpp>
#include <migraphx/stringutils.hpp>
#include <migraphx/stringutils.hpp>
...
@@ -610,15 +611,27 @@ void program::finish() const
...
@@ -610,15 +611,27 @@ void program::finish() const
ctx
.
finish
();
ctx
.
finish
();
}
}
std
::
string
get_migraphx_version
()
{
std
::
stringstream
ss
;
ss
<<
std
::
to_string
(
MIGRAPHX_VERSION_MAJOR
)
<<
"."
<<
std
::
to_string
(
MIGRAPHX_VERSION_MINOR
)
<<
"."
<<
std
::
to_string
(
MIGRAPHX_VERSION_PATCH
);
return
ss
.
str
();
}
/*
program file version is for the data structure or format of the MXR file. Version should be bumped
if any changes occur to the format of the MXR file.
*/
const
int
program_file_version
=
6
;
const
int
program_file_version
=
6
;
value
program
::
to_value
()
const
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
[
"targets"
]
=
migraphx
::
to_value
(
this
->
impl
->
targets
);
result
[
"targets"
]
=
migraphx
::
to_value
(
this
->
impl
->
targets
);
result
[
"contexts"
]
=
migraphx
::
to_value
(
this
->
impl
->
contexts
);
result
[
"contexts"
]
=
migraphx
::
to_value
(
this
->
impl
->
contexts
);
value
module_vals
=
value
::
object
{};
value
module_vals
=
value
::
object
{};
std
::
unordered_map
<
instruction_ref
,
std
::
string
>
names
;
std
::
unordered_map
<
instruction_ref
,
std
::
string
>
names
;
for
(
auto
&
mod
:
this
->
get_modules
())
for
(
auto
&
mod
:
this
->
get_modules
())
...
@@ -743,7 +756,19 @@ void program::from_value(const value& v)
...
@@ -743,7 +756,19 @@ void program::from_value(const value& v)
auto
version
=
v
.
at
(
"version"
).
to
<
int
>
();
auto
version
=
v
.
at
(
"version"
).
to
<
int
>
();
if
(
version
!=
program_file_version
)
if
(
version
!=
program_file_version
)
{
{
MIGRAPHX_THROW
(
"Warning: Program version mismatch"
);
MIGRAPHX_THROW
(
"Error: Program version mismatch. MXR file was created using program file version: "
+
std
::
to_string
(
version
)
+
", while installed MIGraphX is using program file version: "
+
std
::
to_string
(
program_file_version
)
+
", Try regenerating MXR file using installed MIGraphX and running again."
);
}
auto
migx_version
=
v
.
at
(
"migraphx_version"
).
to
<
std
::
string
>
();
if
(
migx_version
!=
get_migraphx_version
())
{
std
::
cout
<<
"WARNING: MXR File was created using MIGraphX version: "
<<
migx_version
<<
", while installed MIGraphX is at version: "
<<
get_migraphx_version
()
<<
", operators implementation could be mismatched."
;
}
}
migraphx
::
from_value
(
v
.
at
(
"targets"
),
this
->
impl
->
targets
);
migraphx
::
from_value
(
v
.
at
(
"targets"
),
this
->
impl
->
targets
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment