Skip to content

Initial stubs for the error handling overhaul. #630

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

Closed
wants to merge 4 commits into from

Conversation

diptorupd
Copy link
Contributor

@diptorupd diptorupd commented Oct 14, 2021

Fixes #35
Does not contain all the changes, more is coming. As of now I only added a new class to capture an "execution state" that for now is just an error handler. The next set of changes will include updating the API of all interfaces.

Fixes #330
Since we are changing the functions anyway, might as well implement the new naming convention proposed in #330.

@diptorupd diptorupd marked this pull request as draft October 14, 2021 23:51
@diptorupd diptorupd force-pushed the feature/error_handler branch 2 times, most recently from 89f994b to daaec1a Compare October 15, 2021 00:00
@coveralls
Copy link
Collaborator

coveralls commented Oct 15, 2021

Coverage Status

Coverage decreased (-0.3%) to 74.107% when pulling c384bdb on diptorupd:feature/error_handler into eff167b on IntelPython:master.

@diptorupd diptorupd force-pushed the feature/error_handler branch 3 times, most recently from 7c75f5d to 820ba1b Compare October 17, 2021 19:13
Diptorup Deb added 2 commits October 19, 2021 21:14
  - A new DPCTLExecState type and associated constructors
    and destructors are added.
  - The error_handler_callback is depracated and is superseded
    by the new error_handler_callback_fn type. The new function
    type allows passing in both an error code and an error
    message.
  - A default error handler function is defined that will
    print out an error code and optionally an associated error
    message, file name, func name, line number to std::cerr.
  - Renamed the dpctl_async_error_handler.{h|cpp} files to
    dpctl_error_handlers to include an implementation of the
    default error handler.
@diptorupd diptorupd force-pushed the feature/error_handler branch from 820ba1b to a592ba8 Compare October 20, 2021 02:16
@diptorupd
Copy link
Contributor Author

@oleksandr-pavlyk I force-pushed again as I cleaned up the interface a bit. Here on, we can have a clean commit log and then chose to squash as desired before merging.

I have modified a single function in the device_interface to demonstrate how I want to handle the errors in C++. The Python side is still TBD.

return nullptr;
}
try {
auto CopiedDevice = new device(*Device);
return wrap(CopiedDevice);
} catch (std::bad_alloc const &ba) {
// \todo log error
std::cerr << ba.what() << '\n';
handler(-1, ba.what(), __FILE__, __func__, __LINE__);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was not aware of __func__. Cool!

@diptorupd
Copy link
Contributor Author

@oleksandr-pavlyk The handler needs to be passed through both error code and error category if we want to properly work with SYCL exceptions. The current design is not quite up to that need.

* @brief Convenience macro to add deprecation attributes to functions.
*
*/
#define DEPRACATION_NOTICE(notice, FN) notice " " #FN
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#define DEPRACATION_NOTICE(notice, FN) notice " " #FN
#define DEPRECATION_NOTICE(notice, FN) notice " " #FN

@oleksandr-pavlyk
Copy link
Contributor

Subsumed by #683

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Project naming convention Fix the error handling and reporting
3 participants