1#ifndef HALIDE_RUNTIME_PRINTER_H
2#define HALIDE_RUNTIME_PRINTER_H
9#ifndef HALIDE_RUNTIME_PRINTER_LOG_THREADID
10#define HALIDE_RUNTIME_PRINTER_LOG_THREADID 0
13#if HALIDE_RUNTIME_PRINTER_LOG_THREADID
14extern "C" int pthread_threadid_np(
long thread,
uint64_t *thread_id);
65 end(start_ ? start_ + size_ - 1 : start_),
170 template<
typename... Args>
172 ((*
this << args), ...);
184template<Pr
interType pr
inter_type, u
int64_t buffer_length = default_pr
inter_buffer_length>
193#if HALIDE_RUNTIME_PRINTER_LOG_THREADID
195 pthread_threadid_np(0, &tid);
196 *
this <<
"(TID:" << tid <<
")";
224template<u
int64_t buffer_length = default_pr
inter_buffer_length>
225using BasicPrinter = HeapPrinter<BasicPrinterType, buffer_length>;
227template<u
int64_t buffer_length = default_pr
inter_buffer_length>
228using ErrorPrinter = HeapPrinter<ErrorPrinterType, buffer_length>;
230template<u
int64_t buffer_length = default_pr
inter_buffer_length>
231using StringStreamPrinter = HeapPrinter<StringStreamPrinterType, buffer_length>;
233using print = BasicPrinter<>;
234using error = ErrorPrinter<>;
235using stringstream = StringStreamPrinter<>;
238using debug = BasicPrinter<>;
240using debug = SinkPrinter;
245template<Pr
interType pr
inter_type, u
int64_t buffer_length>
246class StackPrinter :
public PrinterBase {
247 char scratch[buffer_length];
250 explicit StackPrinter(
void *user_context_)
251 : PrinterBase(user_context_, scratch, buffer_length) {
252 static_assert(buffer_length <= 256,
"StackPrinter is meant only for small buffer sizes; you are probably making a mistake.");
256template<u
int64_t buffer_length = default_pr
inter_buffer_length>
257using StackBasicPrinter = StackPrinter<BasicPrinterType, buffer_length>;
259template<u
int64_t buffer_length = default_pr
inter_buffer_length>
260using StackErrorPrinter = StackPrinter<ErrorPrinterType, buffer_length>;
262template<u
int64_t buffer_length = default_pr
inter_buffer_length>
263using StackStringStreamPrinter = StackPrinter<StringStreamPrinterType, buffer_length>;
This file declares the routines used by Halide internally in its runtime.
double halide_float16_bits_to_double(uint16_t)
Read bits representing a half precision floating point number and return the double that represents t...
int halide_msan_annotate_memory_is_initialized(void *user_context, const void *ptr, uint64_t len)
Annotate that a given range of memory has been initialized; only used when Target::MSAN is enabled.
void halide_print(void *user_context, const char *)
Print a message to stderr.
void halide_error(void *user_context, const char *)
Halide calls this function on runtime errors (for example bounds checking failures).
NEVER_INLINE void clear()
NEVER_INLINE void erase(int n)
PrinterBase & operator=(PrinterBase &&)=delete
uint64_t capacity() const
NEVER_INLINE PrinterBase & operator<<(float arg)
void append(const Args &...args)
NEVER_INLINE void allocation_error() const
NEVER_INLINE PrinterBase & operator<<(uint32_t arg)
NEVER_INLINE PrinterBase(void *user_context_, char *start_, uint64_t size_)
NEVER_INLINE PrinterBase & operator<<(uint64_t arg)
NEVER_INLINE PrinterBase & operator<<(int32_t arg)
PrinterBase & operator=(const PrinterBase &)=delete
PrinterBase(PrinterBase &&)=delete
NEVER_INLINE PrinterBase & operator<<(const char *arg)
PrinterBase(const PrinterBase ©)=delete
NEVER_INLINE PrinterBase & operator<<(const halide_type_t &t)
NEVER_INLINE PrinterBase & operator<<(const void *arg)
NEVER_INLINE PrinterBase & operator<<(const halide_buffer_t &buf)
NEVER_INLINE const char * str()
NEVER_INLINE PrinterBase & operator<<(Float16Bits arg)
NEVER_INLINE PrinterBase & operator<<(int64_t arg)
NEVER_INLINE PrinterBase & operator<<(double arg)
@ StringStreamPrinterType
constexpr uint64_t default_printer_buffer_length
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
std::ostream & operator<<(std::ostream &stream, const Expr &)
Emit an expression on an output stream (such as std::cout) in human-readable form.
Expr print(const std::vector< Expr > &values)
Create an Expr that prints out its value whenever it is evaluated.
unsigned __INT64_TYPE__ uint64_t
signed __INT64_TYPE__ int64_t
WEAK char * halide_uint64_to_string(char *dst, char *end, uint64_t arg, int digits)
#define halide_debug_assert(user_context, cond)
halide_debug_assert() is like halide_assert(), but only expands into a check when DEBUG_RUNTIME is de...
WEAK char * halide_type_to_string(char *dst, char *end, const halide_type_t *arg)
signed __INT32_TYPE__ int32_t
unsigned __INT16_TYPE__ uint16_t
WEAK char * halide_int64_to_string(char *dst, char *end, int64_t arg, int digits)
WEAK char * halide_pointer_to_string(char *dst, char *end, const void *arg)
unsigned __INT32_TYPE__ uint32_t
WEAK char * halide_double_to_string(char *dst, char *end, double arg, int scientific)
WEAK char * halide_buffer_to_string(char *dst, char *end, const halide_buffer_t *arg)
WEAK char * halide_string_to_string(char *dst, char *end, const char *arg)
The raw representation of an image passed around by generated Halide code.
A runtime tag for a type in the halide type system.