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
{{ message }}
Repository navigation
Introduce error handler function to be used in places of std::cerr output #679
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::exception const &e) {
error_handler(e, __FILE__, __func__, __LINE__);
returnnullptr;
}
}
Activity