You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
voiderror_handler(
const std::exception &e,
constchar *file_name,
constchar *func_name,
int line_num,
int level = 0/* or an enum */
);
voiderror_handler(
const std::string &what,
constchar *file_name,
constchar *func_name,
int line_num,
int level = 0/* or an enum */
);
Change all functions in dpctl_sycl_plaftorm_interface.cpp to use the handler.
For example,
// function as it is now
__dpctl_give DPCTLSyclPlatformRef
DPCTLPlatform_Copy(__dpctl_keep const DPCTLSyclPlatformRef PRef)
{
auto Platform = unwrap(PRef);
if (!Platform) {
std::cerr << "Cannot copy DPCTLSyclPlatformRef as input is a nullptr\n";
returnnullptr;
}
try {
auto CopiedPlatform = newplatform(*Platform);
returnwrap(CopiedPlatform);
} catch (std::bad_alloc const &ba) {
// \todo log error
std::cerr << ba.what() << '\n';
returnnullptr;
}
}
could be changed to:
__dpctl_give DPCTLSyclPlatformRef
DPCTLPlatform_Copy(__dpctl_keep const DPCTLSyclPlatformRef PRef)
{
auto Platform = unwrap(PRef);
if (!Platform) {
error_handler("Cannot copy DPCTLSyclPlatformRef as input is a nullptr", __FILE__, __func__, __LINE__);
returnnullptr;
}
try {
auto CopiedPlatform = newplatform(*Platform);
returnwrap(CopiedPlatform);
} catch (std::exceptionconst &e) {
error_handler(e, __FILE__, __func__, __LINE__);
returnnullptr;
}
}
The text was updated successfully, but these errors were encountered:
handler
function inlibsyclinterface/helper
as discussed in Improving exception handling and logging inlibsyclinterface
#677.dpctl_sycl_plaftorm_interface.cpp
to use the handler.For example,
could be changed to:
The text was updated successfully, but these errors were encountered: