Skip to content
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

[CUDA][HIP][L0][NATIVECPU][OpenCL] Remove usage of die/terminate #1127

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions source/adapters/cuda/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,6 @@ std::string getCudaVersionString() {
return stream.str();
}

void detail::ur::die(const char *Message) {
std::cerr << "ur_die: " << Message << std::endl;
std::terminate();
}

void detail::ur::assertion(bool Condition, const char *Message) {
if (!Condition)
die(Message);
}

void detail::ur::cuPrint(const char *Message) {
std::cerr << "ur_print: " << Message << std::endl;
}
Expand Down
18 changes: 10 additions & 8 deletions source/adapters/cuda/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@
#include <cuda.h>
#include <ur/ur.hpp>

/**
* Call a UR API and, if the result is not UR_RESULT_SUCCESS, automatically
* return from the current function.
*/
#define UR_RETURN_ON_FAILURE(urCall) \
if (const ur_result_t ur_result_macro = urCall; \
ur_result_macro != UR_RESULT_SUCCESS) { \
return ur_result_macro; \
}

ur_result_t mapErrorUR(CUresult Result);

/// Converts CUDA error into UR error codes, and outputs error information
Expand Down Expand Up @@ -46,16 +56,8 @@ void setPluginSpecificMessage(CUresult cu_res);
namespace detail {
namespace ur {

// Report error and no return (keeps compiler from printing warnings).
// TODO: Probably change that to throw a catchable exception,
// but for now it is useful to see every failure.
//
[[noreturn]] void die(const char *Message);

// Reports error messages
void cuPrint(const char *Message);

void assertion(bool Condition, const char *Message = nullptr);

} // namespace ur
} // namespace detail
Loading
Loading