Halide
Error.h File Reference
#include <sstream>
#include <stdexcept>
#include "Debug.h"
#include "runtime/HalideRuntime.h"

Go to the source code of this file.

Classes

struct  Halide::Error
 A base class for Halide errors. More...
 
struct  Halide::RuntimeError
 An error that occurs while running a JIT-compiled Halide pipeline. More...
 
struct  Halide::CompileError
 An error that occurs while compiling a Halide pipeline that Halide attributes to a user error. More...
 
struct  Halide::InternalError
 An error that occurs while compiling a Halide pipeline that Halide attributes to an internal compiler bug, or to an invalid use of Halide's internals. More...
 
class  Halide::CompileTimeErrorReporter
 CompileTimeErrorReporter is used at compile time (not runtime) when an error or warning is generated by Halide. More...
 
struct  Halide::Internal::ErrorReport
 
class  Halide::Internal::Voidifier
 

Namespaces

 Halide
 This file defines the class FunctionDAG, which is our representation of a Halide pipeline, and contains methods to using Halide's bounds tools to query properties of it.
 
 Halide::Internal
 

Macros

#define _halide_internal_assertion(condition, flags)   (condition) ? (void)0 : ::Halide::Internal::Voidifier() & ::Halide::Internal::ErrorReport(__FILE__, __LINE__, #condition, flags).ref()
 _halide_internal_assertion is used to implement our assertion macros in such a way that the messages output for the assertion are only evaluated if the assertion's value is false. More...
 
#define internal_error   Halide::Internal::ErrorReport(__FILE__, __LINE__, nullptr, 0)
 
#define user_error   Halide::Internal::ErrorReport(__FILE__, __LINE__, nullptr, Halide::Internal::ErrorReport::User)
 
#define user_warning   Halide::Internal::ErrorReport(__FILE__, __LINE__, nullptr, Halide::Internal::ErrorReport::User | Halide::Internal::ErrorReport::Warning)
 
#define halide_runtime_error   Halide::Internal::ErrorReport(__FILE__, __LINE__, nullptr, Halide::Internal::ErrorReport::User | Halide::Internal::ErrorReport::Runtime)
 
#define internal_assert(c)   _halide_internal_assertion(c, 0)
 
#define user_assert(c)   _halide_internal_assertion(c, Halide::Internal::ErrorReport::User)
 
#define _halide_user_assert(c)   _halide_internal_assertion(c, Halide::Internal::ErrorReport::User)
 

Functions

bool Halide::exceptions_enabled ()
 Query whether Halide was compiled with exceptions. More...
 
void Halide::set_custom_compile_time_error_reporter (CompileTimeErrorReporter *error_reporter)
 The default error reporter logs to stderr, then throws an exception (if HALIDE_WITH_EXCEPTIONS) or calls abort (if not). More...
 

Macro Definition Documentation

◆ _halide_internal_assertion

#define _halide_internal_assertion (   condition,
  flags 
)    (condition) ? (void)0 : ::Halide::Internal::Voidifier() & ::Halide::Internal::ErrorReport(__FILE__, __LINE__, #condition, flags).ref()

_halide_internal_assertion is used to implement our assertion macros in such a way that the messages output for the assertion are only evaluated if the assertion's value is false.

Note that this macro intentionally has no parens internally; in actual use, the implicit grouping will end up being

condition ? (void) : (Voidifier() & (ErrorReport << arg1 << arg2 ... << argN))

This (regrettably) requires a macro to work, but has the highly desirable effect that all assertion parameters are totally skipped (not ever evaluated) when the assertion is true.

Definition at line 130 of file Error.h.

◆ internal_error

#define internal_error   Halide::Internal::ErrorReport(__FILE__, __LINE__, nullptr, 0)

Definition at line 133 of file Error.h.

◆ user_error

#define user_error   Halide::Internal::ErrorReport(__FILE__, __LINE__, nullptr, Halide::Internal::ErrorReport::User)

Definition at line 134 of file Error.h.

◆ user_warning

Definition at line 135 of file Error.h.

◆ halide_runtime_error

#define halide_runtime_error   Halide::Internal::ErrorReport(__FILE__, __LINE__, nullptr, Halide::Internal::ErrorReport::User | Halide::Internal::ErrorReport::Runtime)

Definition at line 136 of file Error.h.

◆ internal_assert

#define internal_assert (   c)    _halide_internal_assertion(c, 0)

Definition at line 138 of file Error.h.

◆ user_assert

#define user_assert (   c)    _halide_internal_assertion(c, Halide::Internal::ErrorReport::User)

Definition at line 139 of file Error.h.

◆ _halide_user_assert

#define _halide_user_assert (   c)    _halide_internal_assertion(c, Halide::Internal::ErrorReport::User)

Definition at line 145 of file Error.h.