Halide 22.0.0 Halide compiler and libraries

Loading...
Searching...
No Matches
Classes | Namespaces | Macros | Functions | Variables
Util.h File Reference

Various utility functions used internally Halide. More...

`#include <cassert>`
`#include <cmath>`
`#include <cstdint>`
`#include <cstring>`
`#include <functional>`
`#include <limits>`
`#include <sstream>`
`#include <string>`
`#include <utility>`
`#include <vector>`
`#include "runtime/HalideRuntime.h"`

Go to the source code of this file.

## Classes
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::StaticCast< TO >
struct | Halide::Internal::IsRoundtrippable< TO >
struct | Halide::Internal::reverse_adaptor< T >

## Namespaces
namespace | 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.
namespace | Halide::Internal

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

## Functions
void | Halide::load_plugin (const std::string &lib_name)
| Load a plugin in the form of a dynamic library (e.g.
template<typename DST , typename SRC , std::enable_if_t< std::is_floating_point_v< SRC > > * = 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.
template<typename DstType , typename SrcType >
DstType | Halide::Internal::reinterpret_bits (const SrcType &src)
| An aggressive form of reinterpret cast used for correct type-punning.
std::string | Halide::Internal::get_env_variable (char const *env_var_name)
| Get value of an environment variable.
std::string | Halide::Internal::running_program_name ()
| Get the name of the currently running executable.
std::string | Halide::Internal::unique_name (char prefix)
| Generate a unique name starting with the given prefix.
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.
bool | Halide::Internal::ends_with (const std::string &str, const std::string &suffix)
| Test if the first string ends with the second string.
std::string | Halide::Internal::replace_all (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.
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.
template<typename T >
std::string | Halide::Internal::join_strings (const std::vector< T > &sources, const std::string &delim)
| Join the source vector using 'delim' as the divider.
template<typename... Args>
std::string | Halide::Internal::concat_strings (Args &&...args)
template<typename T , typename Fn >
T | Halide::Internal::fold_left (const std::vector< T > &vec, Fn f)
| Perform a left fold of a vector.
template<typename T , typename Fn >
T | Halide::Internal::fold_right (const std::vector< T > &vec, Fn f)
| Returns a right fold of a vector.
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.
std::string | Halide::Internal::strip_namespaces (const std::string &name)
| Like extract_namespaces(), but strip and discard the namespaces, returning base name only.
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.
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.
bool | Halide::Internal::file_exists (const std::string &name)
| Wrapper for access().
void | Halide::Internal::assert_file_exists (const std::string &name)
| assert-fail if the file doesn't exist.
void | Halide::Internal::assert_no_file_exists (const std::string &name)
| assert-fail if the file DOES exist.
void | Halide::Internal::file_unlink (const std::string &name)
| Wrapper for unlink().
void | Halide::Internal::ensure_no_file_exists (const std::string &name)
| Ensure that no file with this path exists.
void | Halide::Internal::dir_rmdir (const std::string &name)
| Wrapper for rmdir().
FileStat | Halide::Internal::file_stat (const std::string &name)
| Wrapper for stat().
std::vector< char > | Halide::Internal::read_entire_file (const std::string &pathname)
| Read the entire contents of a file into a vector<char>.
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.
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.
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)
HALIDE_MUST_USE_RESULT bool | Halide::Internal::add_with_overflow (int bits, int64_t a, int64_t b, int64_t *result)
| Routines to perform arithmetic on signed types without triggering signed overflow.
HALIDE_MUST_USE_RESULT bool | Halide::Internal::sub_with_overflow (int bits, int64_t a, int64_t b, int64_t *result)
HALIDE_MUST_USE_RESULT bool | Halide::Internal::mul_with_overflow (int bits, int64_t a, int64_t b, int64_t *result)
void | Halide::Internal::halide_tic_impl (const char *file, int line)
void | Halide::Internal::halide_toc_impl (const char *file, int line)
template<typename T >
auto | Halide::Internal::begin (reverse_adaptor< T > i)
template<typename T >
auto | Halide::Internal::end (reverse_adaptor< T > i)
template<typename T >
reverse_adaptor< T > | Halide::Internal::reverse_view (T &&range)
| Reverse-order adaptor for range-based for-loops.
std::string | Halide::Internal::c_print_name (const std::string &name, bool prefix_underscore=true)
| Emit a version of a string that is a valid identifier in C (.
int | Halide::Internal::get_llvm_version ()
| Return the LLVM_VERSION against which this libHalide is compiled.
void | Halide::set_compiler_stack_size (size_t)
| Set how much stack the compiler should use for compilation in bytes.
size_t | Halide::get_compiler_stack_size ()
| Return how much stack size the compiler should use for calls that go through run_with_large_stack below.
void | Halide::Internal::run_with_large_stack (const std::function< void()> &action)
| Call the given action in a platform-specific context that provides at least the stack space returned by get_compiler_stack_size.
int | Halide::Internal::popcount64 (uint64_t x)
| Portable versions of popcount, count-leading-zeros, and count-trailing-zeros.
int | Halide::Internal::clz64 (uint64_t x)
int | Halide::Internal::ctz64 (uint64_t x)
int64_t | Halide::Internal::next_power_of_two (int64_t x)
| Return an integer 2^n, for some n, which is >= x.
template<typename T >
T | Halide::Internal::align_up (T x, int n)

## Variables
constexpr size_t | Halide::default_compiler_stack_size = 32 * 1024 * 1024
| The default amount of stack used for lowering and codegen.

## Detailed Description

Various utility functions used internally Halide.

Definition in file Util.h.

## Macro Definition Documentation

## ◆ HALIDE_EXPORT

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

Definition at line 39 of file Util.h.

## ◆ HALIDE_NO_USER_CODE_INLINE

#define HALIDE_NO_USER_CODE_INLINE HALIDE_NEVER_INLINE

Definition at line 47 of file Util.h.

## ◆ HALIDE_TIC

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

Definition at line 427 of file Util.h.

## ◆ HALIDE_TOC

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

Definition at line 428 of file Util.h.