Util.h File Reference
#include <assert.h>
#include <cstdint>
#include <cstring>
#include <limits>
#include <string>
#include <utility>
#include <vector>
#include "runtime/HalideRuntime.h"

Go to the source code of this file.


struct  Halide::Internal::meta_and< T >
struct  Halide::Internal::meta_and< T1, Args... >
struct  Halide::Internal::meta_or< T >
struct  Halide::Internal::meta_or< T1, Args... >
struct  Halide::Internal::all_are_convertible< To, Args >
struct  Halide::Internal::FileStat
class  Halide::Internal::TemporaryFile
 A simple utility class that creates a temporary file in its ctor and deletes that file in its dtor; this is useful for temporary files that you want to ensure are deleted when exiting a certain scope. More...
struct  Halide::Internal::ScopedValue< T >
 Helper class for saving/restoring variable values on the stack, to allow for early-exit that preserves correctness. More...
struct  Halide::Internal::integer_sequence< T, Ints >
struct  Halide::Internal::next_integer_sequence< T >
struct  Halide::Internal::next_integer_sequence< integer_sequence< T, Ints... > >
struct  Halide::Internal::make_integer_sequence_helper< T, I, N >
struct  Halide::Internal::make_integer_sequence_helper< T, N, N >
struct  Halide::Internal::StaticCast< TO >
struct  Halide::Internal::IsRoundtrippable< TO >


 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.


#define HALIDE_EXPORT   __attribute__((visibility("default")))
#define HALIDE_TIC   Halide::Internal::halide_tic_impl(__FILE__, __LINE__)
#define HALIDE_TOC   Halide::Internal::halide_toc_impl(__FILE__, __LINE__)


template<typename T , T N>
using Halide::Internal::make_integer_sequence = typename make_integer_sequence_helper< T, 0, N >::type
template<size_t... Ints>
using Halide::Internal::index_sequence = integer_sequence< size_t, Ints... >
template<size_t N>
using Halide::Internal::make_index_sequence = make_integer_sequence< size_t, N >


void Halide::load_plugin (const std::string &lib_name)
 Load a plugin in the form of a dynamic library (e.g. More...
template<typename DST , typename SRC , typename std::enable_if< std::is_floating_point< SRC >::value >::type * = nullptr>
DST Halide::Internal::safe_numeric_cast (SRC s)
 Some numeric conversions are UB if the value won't fit in the result; safe_numeric_cast<>() is meant as a drop-in replacement for a C/C++ cast that adds well-defined behavior for the UB cases, attempting to mimic common implementation behavior as much as possible. More...
template<typename DstType , typename SrcType >
DstType Halide::Internal::reinterpret_bits (const SrcType &src)
 An aggressive form of reinterpret cast used for correct type-punning. More...
std::string Halide::Internal::make_entity_name (void *stack_ptr, const std::string &type, char prefix)
 Make a unique name for an object based on the name of the stack variable passed in. More...
std::string Halide::Internal::get_env_variable (char const *env_var_name)
 Get value of an environment variable. More...
std::string Halide::Internal::running_program_name ()
 Get the name of the currently running executable. More...
std::string Halide::Internal::unique_name (char prefix)
 Generate a unique name starting with the given prefix. More...
std::string Halide::Internal::unique_name (const std::string &prefix)
bool Halide::Internal::starts_with (const std::string &str, const std::string &prefix)
 Test if the first string starts with the second string. More...
bool Halide::Internal::ends_with (const std::string &str, const std::string &suffix)
 Test if the first string ends with the second string. More...
std::string Halide::Internal::replace_all (const std::string &str, const std::string &find, const std::string &replace)
 Replace all matches of the second string in the first string with the last string. More...
std::vector< std::string > Halide::Internal::split_string (const std::string &source, const std::string &delim)
 Split the source string using 'delim' as the divider. More...
template<typename T , typename Fn >
Halide::Internal::fold_left (const std::vector< T > &vec, Fn f)
 Perform a left fold of a vector. More...
template<typename T , typename Fn >
Halide::Internal::fold_right (const std::vector< T > &vec, Fn f)
 Returns a right fold of a vector. More...
std::string Halide::Internal::extract_namespaces (const std::string &name, std::vector< std::string > &namespaces)
 Returns base name and fills in namespaces, outermost one first in vector. More...
std::string Halide::Internal::file_make_temp (const std::string &prefix, const std::string &suffix)
 Create a unique file with a name of the form prefixXXXXXsuffix in an arbitrary (but writable) directory; this is typically /tmp, but the specific location is not guaranteed. More...
std::string Halide::Internal::dir_make_temp ()
 Create a unique directory in an arbitrary (but writable) directory; this is typically somewhere inside /tmp, but the specific location is not guaranteed. More...
bool Halide::Internal::file_exists (const std::string &name)
 Wrapper for access(). More...
void Halide::Internal::assert_file_exists (const std::string &name)
 assert-fail if the file doesn't exist. More...
void Halide::Internal::assert_no_file_exists (const std::string &name)
 assert-fail if the file DOES exist. More...
void Halide::Internal::file_unlink (const std::string &name)
 Wrapper for unlink(). More...
void Halide::Internal::ensure_no_file_exists (const std::string &name)
 Ensure that no file with this path exists. More...
void Halide::Internal::dir_rmdir (const std::string &name)
 Wrapper for rmdir(). More...
FileStat Halide::Internal::file_stat (const std::string &name)
 Wrapper for stat(). More...
std::vector< char > Halide::Internal::read_entire_file (const std::string &pathname)
 Read the entire contents of a file into a vector<char>. More...
void Halide::Internal::write_entire_file (const std::string &pathname, const void *source, size_t source_len)
 Create or replace the contents of a file with a given pointer-and-length of memory. More...
void Halide::Internal::write_entire_file (const std::string &pathname, const std::vector< char > &source)
bool Halide::Internal::add_would_overflow (int bits, int64_t a, int64_t b)
 Routines to test if math would overflow for signed integers with the given number of bits. More...
bool Halide::Internal::sub_would_overflow (int bits, int64_t a, int64_t b)
bool Halide::Internal::mul_would_overflow (int bits, int64_t a, int64_t b)
void Halide::Internal::halide_tic_impl (const char *file, int line)
void Halide::Internal::halide_toc_impl (const char *file, int line)
std::string Halide::Internal::c_print_name (const std::string &name)
 Emit a version of a string that is a valid identifier in C (. More...
int Halide::Internal::get_llvm_version ()
 Return the LLVM_VERSION against which this libHalide is compiled. More...

Detailed Description

Various utility functions used internally Halide.

Definition in file Util.h.

Macro Definition Documentation


#define HALIDE_EXPORT   __attribute__((visibility("default")))

Definition at line 36 of file Util.h.



Definition at line 44 of file Util.h.


#define HALIDE_TIC   Halide::Internal::halide_tic_impl(__FILE__, __LINE__)

Definition at line 413 of file Util.h.


#define HALIDE_TOC   Halide::Internal::halide_toc_impl(__FILE__, __LINE__)

Definition at line 414 of file Util.h.