Halide 14.0.0
Halide compiler and libraries
ASLog.h
Go to the documentation of this file.
1#ifndef ASLOG_H
2#define ASLOG_H
3
4// This class is used by train_cost_model, which doesn't link to
5// libHalide, so (despite the namespace) we are better off not
6// including Halide.h, lest we reference something we won't have available
7
8#include <cstdlib>
9#include <iostream>
10#include <utility>
11
12namespace Halide {
13namespace Internal {
14
15class aslog {
16 const bool logging;
17
18public:
19 aslog(int verbosity)
20 : logging(verbosity <= aslog_level()) {
21 }
22
23 template<typename T>
24 aslog &operator<<(T &&x) {
25 if (logging) {
26 std::cerr << std::forward<T>(x);
27 }
28 return *this;
29 }
30
31 static int aslog_level();
32};
33
34} // namespace Internal
35} // namespace Halide
36
37#endif
aslog & operator<<(T &&x)
Definition: ASLog.h:24
aslog(int verbosity)
Definition: ASLog.h:19
static int aslog_level()
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
@ Internal
Not visible externally, similar to 'static' linkage in C.