-
Notifications
You must be signed in to change notification settings - Fork 139
Handle benchmark MXR dump as successful compile #5021
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| /* | ||
| * The MIT License (MIT) | ||
| * | ||
| * Copyright (c) 2015-2022 Advanced Micro Devices, Inc. All rights reserved. | ||
| * Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. | ||
| * | ||
| * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| * of this software and associated documentation files (the "Software"), to deal | ||
|
|
@@ -41,6 +41,11 @@ struct exception : std::runtime_error | |
| } | ||
| }; | ||
|
|
||
| struct benchmark_mxr_dumped : exception | ||
| { | ||
| benchmark_mxr_dumped(unsigned int e = 0, const std::string& msg = "") : exception(e, msg) {} | ||
| }; | ||
|
|
||
| /** | ||
| * @brief Create an exception object | ||
| * | ||
|
|
@@ -59,6 +64,19 @@ make_exception(const std::string& context, unsigned int e, const std::string& me | |
| return {e, context + ": " + message}; | ||
| } | ||
|
|
||
| inline benchmark_mxr_dumped make_benchmark_mxr_dumped_exception(const std::string& context, | ||
| const std::string& message = "") | ||
| { | ||
| return {0, context + ": " + message}; | ||
| } | ||
|
|
||
| inline benchmark_mxr_dumped make_benchmark_mxr_dumped_exception(const std::string& context, | ||
| unsigned int e, | ||
| const std::string& message = "") | ||
| { | ||
| return {e, context + ": " + message}; | ||
| } | ||
|
|
||
| /** | ||
| * @brief Create a message of a file location | ||
| * | ||
|
|
@@ -79,6 +97,8 @@ inline std::string make_source_context(const std::string& file, int line, const | |
| * @brief Throw an exception with context information | ||
| */ | ||
| #define MIGRAPHX_THROW(...) throw migraphx::make_exception(MIGRAPHX_MAKE_SOURCE_CTX(), __VA_ARGS__) | ||
| #define MIGRAPHX_THROW_BENCHMARK_MXR_DUMPED(...) \ | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This shouldn't be added to the errors. This a gpu-specific error. |
||
| throw migraphx::make_benchmark_mxr_dumped_exception(MIGRAPHX_MAKE_SOURCE_CTX(), __VA_ARGS__) | ||
|
|
||
| } // namespace MIGRAPHX_INLINE_NS | ||
| } // namespace migraphx | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,7 @@ | |
| #include <migraphx/filesystem.hpp> | ||
| #include <migraphx/load_save.hpp> | ||
| #include <migraphx/logger.hpp> | ||
| #include <migraphx/errors.hpp> | ||
| #include <iostream> | ||
| #include <sstream> | ||
| #include <algorithm> | ||
|
|
@@ -180,6 +181,11 @@ struct module_pm : module_pass_manager | |
| { | ||
| f(); | ||
| } | ||
| catch(const benchmark_mxr_dumped& e) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The pass_manager shouldn't be catching gpu-specific exceptions. |
||
| { | ||
| log::info() << "Benchmark MXR dump " << p.name() << ": " << e.what(); | ||
| throw; | ||
| } | ||
| catch(const std::exception& e) | ||
| { | ||
| log::error() << "Error " << p.name() << ": " << e.what(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,6 +34,7 @@ | |
| #include <migraphx/dead_code_elimination.hpp> | ||
| #include <migraphx/memory_coloring.hpp> | ||
| #include <migraphx/logger.hpp> | ||
| #include <migraphx/errors.hpp> | ||
| #include <migraphx/op/identity.hpp> | ||
| #include <migraphx/builtin.hpp> | ||
| #include <migraphx/load_save.hpp> | ||
|
|
@@ -586,7 +587,7 @@ struct compile_manager | |
| // root module has had a chance to dump its benchmark MXR files. | ||
| if(dump_mxr and is_root) | ||
| { | ||
| MIGRAPHX_THROW( | ||
| MIGRAPHX_THROW_BENCHMARK_MXR_DUMPED( | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of throwing an exception we can just print a message with |
||
| "Benchmark MXR files dumped to " + mxr_path + | ||
| ". Run the MXR files to create a problem cache, then recompile with the cache."); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont really like catching exceptions in the driver as it reduces stopping at the exception in the debugger.
This also gpu-specific and the driver is for all targets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stop reading my mind. I think this would be fine though if we caught a specific execption this is trying to block out vs a catch-all here?