Halide
Util.h File Reference

Various utility functions used internally Halide. More...

#include <assert.h>
#include <cstdint>
#include <utility>
#include <vector>
#include <string>
#include <cstring>

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::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 >
 

Namespaces

 Halide
 Defines methods for manipulating and analyzing boolean expressions.
 
 Halide::Internal
 

Macros

#define EXPORT   __attribute__((visibility("default")))
 
#define NO_INLINE   __attribute__((noinline))
 

Typedefs

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 >
 

Functions

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...
 
EXPORT 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...
 
EXPORT std::string Halide::Internal::get_env_variable (char const *env_var_name)
 Get value of an environment variable. More...
 
EXPORT std::string Halide::Internal::running_program_name ()
 Get the name of the currently running executable. More...
 
EXPORT bool Halide::Internal::starts_with (const std::string &str, const std::string &prefix)
 Test if the first string starts with the second string. More...
 
EXPORT bool Halide::Internal::ends_with (const std::string &str, const std::string &suffix)
 Test if the first string ends with the second string. More...
 
EXPORT 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...
 
EXPORT 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...
 
template<typename T1 , typename T2 , typename T3 , typename T4 >
NO_INLINE void Halide::Internal::collect_paired_args (std::vector< std::pair< T1, T2 >> &collected_args, const T3 &a1, const T4 &a2)
 
template<typename T1 , typename T2 , typename T3 , typename T4 , typename ... Args>
NO_INLINE void Halide::Internal::collect_paired_args (std::vector< std::pair< T1, T2 >> &collected_args, const T3 &a1, const T4 &a2, Args &&... args)
 
EXPORT 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...
 
EXPORT 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...
 
EXPORT 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...
 
EXPORT bool Halide::Internal::file_exists (const std::string &name)
 Wrapper for access(). More...
 
EXPORT void Halide::Internal::assert_file_exists (const std::string &name)
 assert-fail if the file doesn't exist. More...
 
EXPORT void Halide::Internal::assert_no_file_exists (const std::string &name)
 assert-fail if the file DOES exist. More...
 
EXPORT void Halide::Internal::file_unlink (const std::string &name)
 Wrapper for unlink(). More...
 
EXPORT void Halide::Internal::ensure_no_file_exists (const std::string &name)
 Ensure that no file with this path exists. More...
 
EXPORT void Halide::Internal::dir_rmdir (const std::string &name)
 Wrapper for rmdir(). More...
 
EXPORT FileStat Halide::Internal::file_stat (const std::string &name)
 Wrapper for stat(). More...
 
EXPORT std::string Halide::Internal::unique_name (char prefix)
 Generate a unique name starting with the given prefix. More...
 
EXPORT std::string Halide::Internal::unique_name (const std::string &prefix)
 Generate a unique name starting with the given prefix. More...
 
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)
 Routines to test if math would overflow for signed integers with the given number of bits. More...
 
bool Halide::Internal::mul_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...
 

Detailed Description

Various utility functions used internally Halide.

Definition in file Util.h.

Macro Definition Documentation

◆ EXPORT

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

Definition at line 30 of file Util.h.

Referenced by Halide::Pipeline::add_custom_lowering_pass(), Halide::Func::add_custom_lowering_pass(), Halide::Internal::CodeGen_GLSL::CodeGen_GLSL(), Halide::Internal::collect_print_args(), Halide::BoundaryConditions::constant_exterior(), Halide::Func::define_extern(), Halide::Internal::div_imp< double >(), Halide::RVar::domain(), Halide::Type::element_of(), Halide::Internal::enum_from_string(), Halide::erf(), Halide::Internal::ExprWithCompareCache::ExprWithCompareCache(), Halide::Func::Func(), Halide::BoundaryConditions::Internal::func_like_to_func(), Halide::Internal::FuncSchedule::FuncSchedule(), Halide::Func::function(), Halide::Internal::GeneratorOutputBase::get_c_type(), Halide::Internal::Function::get_contents(), Halide::Internal::Introspection::get_introspection_helper(), Halide::Stage::get_schedule(), Halide::Internal::CodeGen_C::get_target(), Halide::Internal::halide_looplevel_to_enum_string(), Halide::Internal::halide_type_to_enum_string(), Halide::ImageParam::ImageParam(), Halide::Type::is_handle(), Halide::Internal::Function::is_pure(), Halide::Internal::GeneratorParamBase::is_synthetic_param(), Halide::Internal::RefCount::is_zero(), Halide::MachineParams::MachineParams(), Halide::Internal::Variable::make(), Halide::Internal::make_const(), Halide::Target::maximum_buffer_size(), Halide::BoundaryConditions::mirror_image(), Halide::Internal::GeneratorBase::natural_vector_size(), Halide::Internal::Function::operator ExternFuncArgument(), Halide::Func::operator ExternFuncArgument(), Halide::float16_t::operator!=(), Halide::Target::operator!=(), Halide::ImageParam::operator()(), Halide::Internal::Function::Compare::operator()(), Halide::Func::operator()(), Halide::Internal::debug::operator<<(), Halide::Internal::ErrorReport::operator<<(), Halide::float16_t::operator<=(), Halide::Internal::Interval::operator==(), Halide::Var::outermost(), Halide::OutputImageParam::OutputImageParam(), Halide::Internal::Function::outputs(), Halide::Internal::parse_scalar(), Halide::Func::prefetch(), Halide::print(), Halide::print_when(), Halide::RDom::RDom(), Halide::Internal::GeneratorBase::realize(), Halide::Internal::ReductionDomain::ReductionDomain(), Halide::Internal::reinterpret_bits(), Halide::Stage::reorder(), Halide::Func::reorder(), Halide::Func::reorder_storage(), Halide::BoundaryConditions::repeat_edge(), Halide::BoundaryConditions::repeat_image(), Halide::RVar::RVar(), Halide::Var::same_as(), Halide::Internal::Definition::same_as(), Halide::Internal::Interval::same_as(), Halide::Internal::ReductionDomain::same_as(), Halide::RDom::same_as(), Halide::Internal::Function::same_as(), Halide::saturating_cast(), Halide::Internal::Parameter::scalar(), Halide::Internal::Parameter::set_scalar(), Halide::Internal::AssociativeOp::size(), Halide::Internal::Shuffle::slice_stride(), Halide::Internal::StageSchedule::StageSchedule(), Halide::Target::supports_type(), Halide::Internal::JITModule::Symbol::Symbol(), Halide::Target::Target(), Halide::Internal::GeneratorStub::to_stub_input_vector(), Halide::Tuple::Tuple(), Halide::undef(), Halide::Internal::ValueTracker::ValueTracker(), Halide::CompileTimeErrorReporter::~CompileTimeErrorReporter(), and Halide::Internal::GeneratorStub::~GeneratorStub().

◆ NO_INLINE

#define NO_INLINE   __attribute__((noinline))