363 template<jit::
float_scalar T,
bool SAFE_MATH=false>
364 class leaf_node :
public std::enable_shared_from_this<leaf_node<T, SAFE_MATH>> {
371 std::map<size_t, std::shared_ptr<leaf_node<T, SAFE_MATH>>>
df_cache;
408 virtual std::shared_ptr<leaf_node>
reduce() = 0;
416 virtual std::shared_ptr<leaf_node<T, SAFE_MATH>>
458 virtual std::shared_ptr<leaf_node<T, SAFE_MATH>>
471 return this == x.get();
497 virtual void set(
const size_t index,
505 virtual void set(
const std::vector<T> &
d) {}
526 virtual std::shared_ptr<leaf_node<T, SAFE_MATH>>
to_vizgraph(std::stringstream &stream,
553 return this->
evaluate().is_normal();
637 virtual void endline(std::ostringstream &stream,
639#ifndef SHOW_USE_COUNT
645 <<
" // used " <<
usage.at(
this)
659 std::map<size_t, std::shared_ptr<leaf_node<T, SAFE_MATH>>>
nodes;
672 template<jit::
float_scalar T,
bool SAFE_MATH=false>
682 template<jit::
float_scalar T,
bool SAFE_MATH=false>
687 template<jit::
float_scalar T,
bool SAFE_MATH=false>
691 template<jit::
float_scalar T,
bool SAFE_MATH=false>
694 template<jit::
float_scalar T,
bool SAFE_MATH=false>
702 template<jit::
float_scalar T,
bool SAFE_MATH=false>
704 std::stringstream stream;
708 stream <<
"graph \"\" {" << std::endl;
709 stream <<
" node [fontname = \"Helvetica\", ordering = out]" << std::endl << std::endl;
710 node->to_vizgraph(stream, registers);
711 stream <<
"}" << std::endl;
713 std::cout << stream.str() << std::endl;
725 template<jit::
float_scalar T,
bool SAFE_MATH=false>
733 static std::string to_string(
const T
d) {
734 return jit::format_to_string<T> (
d);
749 assert(
d.size() == 1 &&
"Constants need to be scalar functions.");
796 if (registers.find(
this) == registers.end()) {
797#ifdef USE_CONSTANT_CACHE
800 jit::add_type<T> (stream);
803 stream <<
" " << registers[
this] <<
" = ";
805 jit::add_type<T> (stream);
811 registers[
this] = jit::get_type_string<T> () +
"("
815 registers[
this] =
"(" + jit::get_type_string<T> () +
")"
831 if (
this == x.get()) {
847 return data.
size() == 1 && data.
at(0) ==
d;
855 return std::imag(
temp) == 0 &&
863 std::cout << data.
at(0);
875 if (registers.find(
this) == registers.end()) {
877 registers[
this] =
name;
878 stream <<
" " <<
name
879 <<
" [label = \"" << this->
evaluate().at(0)
880 <<
"\", shape = box, style = \"rounded,filled\", fillcolor = black, fontcolor = white];" << std::endl;
950 template<jit::
float_scalar T,
bool SAFE_MATH=false>
952 auto temp = std::make_shared<constant_node<T, SAFE_MATH>> (
d);
963#if defined(__clang__) || defined(__GNUC__)
966 assert(
false &&
"Should never reach.");
979 template<jit::
float_scalar T,
bool SAFE_MATH=false>
993 template<jit::
float_scalar T,
bool SAFE_MATH>
1006 template<jit::
float_scalar T,
bool SAFE_MATH>
1019 template<jit::
float_scalar T,
bool SAFE_MATH=false>
1025 template<jit::complex_scalar T>
1026 constexpr T
i = T(0.0, 1.0);
1029 template<jit::
float_scalar T,
bool SAFE_MATH=false>
1041 template<jit::
float_scalar T,
bool SAFE_MATH=false>
1043 return std::dynamic_pointer_cast<constant_node<T, SAFE_MATH>> (x);
1058 template<jit::
float_scalar T,
bool SAFE_MATH=false>
1072 const std::string
s) :
1082 return this->arg->evaluate();
1104 this->arg->compile_preamble(stream, registers,
1109#ifdef SHOW_USE_COUNT
1131 return this->arg->compile(stream, registers,
indices,
usage);
1147 return this->arg->is_all_variables();
1172 template<jit::
float_scalar T,
bool SAFE_MATH=false>
1191 const std::string
s) :
1207 const std::string
s,
1232 this->left->compile_preamble(stream, registers,
1236 this->right->compile_preamble(stream, registers,
1241#ifdef SHOW_USE_COUNT
1269 return this->left->is_all_variables() &&
1270 this->right->is_all_variables();
1278 virtual std::shared_ptr<leaf_node<T, SAFE_MATH>>
1296 template<jit::
float_scalar T,
bool SAFE_MATH=false>
1315 const std::string
s) :
1344 this->
left->compile_preamble(stream, registers,
1348 this->middle->compile_preamble(stream, registers,
1352 this->
right->compile_preamble(stream, registers,
1357#ifdef SHOW_USE_COUNT
1378 return this->
left->is_all_variables() &&
1379 this->middle->is_all_variables() &&
1380 this->
right->is_all_variables();
1393 template<jit::
float_scalar T,
bool SAFE_MATH=false>
1399 const std::string symbol;
1419 const std::string &symbol) :
1421 buffer(
s), symbol(symbol) {}
1431 const std::string &symbol) :
1433 buffer(
s,
d), symbol(symbol) {
1444 const std::string &symbol) :
1446 buffer(
d), symbol(symbol) {
1457 const std::string &symbol) :
1459 buffer(
d), symbol(symbol) {
1516#ifdef SHOW_USE_COUNT
1555 virtual void set(
const size_t index,
const T
d) {
1564 virtual void set(
const std::vector<T> &
d) {
1600 if (registers.find(
this) == registers.end()) {
1602 registers[
this] =
name;
1603 stream <<
" " <<
name
1605 <<
"\", shape = box];" << std::endl;
1615 return buffer.
size();
1624 return buffer.
data();
1673 template<jit::
float_scalar T,
bool SAFE_MATH=false>
1675 const std::string &symbol) {
1676 return std::make_shared<variable_node<T, SAFE_MATH>> (
s, symbol);
1689 template<jit::
float_scalar T,
bool SAFE_MATH=false>
1691 const std::string &symbol) {
1692 return std::make_shared<variable_node<T, SAFE_MATH>> (
s,
d, symbol);
1704 template<jit::
float_scalar T,
bool SAFE_MATH=false>
1706 const std::string &symbol) {
1707 return std::make_shared<variable_node<T, SAFE_MATH>> (
d, symbol);
1719 template<jit::
float_scalar T,
bool SAFE_MATH=false>
1721 const std::string &symbol) {
1722 return std::make_shared<variable_node<T, SAFE_MATH>> (
d, symbol);
1726 template<jit::
float_scalar T,
bool SAFE_MATH=false>
1729 template<jit::
float_scalar T,
bool SAFE_MATH=false>
1732 template<jit::
float_scalar T,
bool SAFE_MATH=false>
1733 using map_nodes = std::vector<std::pair<shared_leaf<T, SAFE_MATH>,
1745 template<jit::
float_scalar T,
bool SAFE_MATH=false>
1747 return std::dynamic_pointer_cast<variable_node<T, SAFE_MATH>> (x);
1763 template<jit::
float_scalar T,
bool SAFE_MATH=false>
1810 std::cout <<
"\\left(";
1811 this->
arg->to_latex();
1812 std::cout <<
"\\right)";
1839 return this->
arg->get_power_base();
1848 return this->
arg->get_power_exponent();
1878 if (registers.find(
this) == registers.end()) {
1880 registers[
this] =
name;
1881 stream <<
" " <<
name
1882 <<
" [label = \"pseudo_variable\", shape = oval, style = filled, fillcolor = blue, fontcolor = white];" << std::endl;
1884 auto a = this->
arg->to_vizgraph(stream, registers);
1885 stream <<
" " <<
name <<
" -- " << registers[
a.get()] <<
";" << std::endl;
1901 template<jit::
float_scalar T,
bool SAFE_MATH=false>
1903 return std::make_shared<pseudo_variable_node<T, SAFE_MATH>> (x);
1907 template<jit::
float_scalar T,
bool SAFE_MATH=false>
1919 template<jit::
float_scalar T,
bool SAFE_MATH=false>
1921 return std::dynamic_pointer_cast<pseudo_variable_node<T, SAFE_MATH>> (x);
Class signature to impliment compute backends.
Class representing a generic buffer.
Definition backend.hpp:29
bool is_normal() const
Check for normal values.
Definition backend.hpp:279
const T at(const size_t index) const
Get value at.
Definition backend.hpp:91
bool has_zero() const
Is any element zero.
Definition backend.hpp:156
size_t size() const
Get size of the buffer.
Definition backend.hpp:116
void set(const T d)
Assign a constant value.
Definition backend.hpp:100
T * data()
Get a pointer to the basic memory buffer.
Definition backend.hpp:270
Class representing a branch node.
Definition node.hpp:1173
shared_leaf< T, SAFE_MATH > get_left()
Get the left branch.
Definition node.hpp:1252
virtual bool is_all_variables() const
Test if node acts like a variable.
Definition node.hpp:1268
virtual void compile_preamble(std::ostringstream &stream, jit::register_map ®isters, jit::visiter_map &visited, jit::register_usage &usage, jit::texture1d_list &textures1d, jit::texture2d_list &textures2d, int &avail_const_mem)
Compile preamble.
Definition node.hpp:1224
branch_node(shared_leaf< T, SAFE_MATH > l, shared_leaf< T, SAFE_MATH > r, const std::string s, const size_t count, const bool pseudo)
Assigns the left and right branches.
Definition node.hpp:1205
shared_leaf< T, SAFE_MATH > get_right()
Get the right branch.
Definition node.hpp:1259
virtual std::shared_ptr< leaf_node< T, SAFE_MATH > > get_power_exponent() const
Get the exponent of a power.
Definition node.hpp:1279
branch_node(shared_leaf< T, SAFE_MATH > l, shared_leaf< T, SAFE_MATH > r, const std::string s)
Assigns the left and right branches.
Definition node.hpp:1189
shared_leaf< T, SAFE_MATH > right
Right branch of the tree.
Definition node.hpp:1178
shared_leaf< T, SAFE_MATH > left
Left branch of the tree.
Definition node.hpp:1176
Class representing data that cannot change.
Definition node.hpp:726
virtual shared_leaf< T, SAFE_MATH > get_power_exponent() const
Get the exponent of a power.
Definition node.hpp:936
virtual void to_latex() const
Convert the node to latex.
Definition node.hpp:862
virtual shared_leaf< T, SAFE_MATH > compile(std::ostringstream &stream, jit::register_map ®isters, jit::register_map &indices, const jit::register_usage &usage)
Compile the node.
Definition node.hpp:792
virtual shared_leaf< T, SAFE_MATH > get_power_base()
Get the base of a power.
Definition node.hpp:927
bool is(const T d)
Check if the constant is value.
Definition node.hpp:846
virtual backend::buffer< T > evaluate()
Evaluate method.
Definition node.hpp:757
virtual bool is_all_variables() const
Test if node acts like a variable.
Definition node.hpp:909
virtual bool is_match(shared_leaf< T, SAFE_MATH > x)
Querey if the nodes match.
Definition node.hpp:830
constant_node(const backend::buffer< T > &d)
Construct a constant node from a vector.
Definition node.hpp:747
virtual shared_leaf< T, SAFE_MATH > to_vizgraph(std::stringstream &stream, jit::register_map ®isters)
Convert the node to vizgraph.
Definition node.hpp:873
virtual shared_leaf< T, SAFE_MATH > df(shared_leaf< T, SAFE_MATH > x)
Transform node to derivative.
Definition node.hpp:778
virtual bool is_constant() const
Test if node is a constant.
Definition node.hpp:891
virtual bool has_constant_zero() const
Test the constant node has a zero.
Definition node.hpp:900
virtual shared_leaf< T, SAFE_MATH > reduce()
Reduction method.
Definition node.hpp:768
bool is_integer()
Check if the value is an integer.
Definition node.hpp:853
virtual bool is_power_like() const
Test if the node acts like a power of variable.
Definition node.hpp:918
Class representing a node leaf.
Definition node.hpp:364
virtual ~leaf_node()
Destructor.
Definition node.hpp:392
virtual void endline(std::ostringstream &stream, const jit::register_usage &usage) const final
End a line in the kernel source.
Definition node.hpp:637
virtual void set(const std::vector< T > &d)
Set the value of variable data.
Definition node.hpp:505
virtual bool is_power_like() const
Test if the node acts like a power of variable.
Definition node.hpp:570
virtual bool is_match(std::shared_ptr< leaf_node< T, SAFE_MATH > > x)
Querey if the nodes match.
Definition node.hpp:470
virtual std::shared_ptr< leaf_node< T, SAFE_MATH > > compile(std::ostringstream &stream, jit::register_map ®isters, jit::register_map &indices, const jit::register_usage &usage)=0
Compile the node.
virtual std::shared_ptr< leaf_node< T, SAFE_MATH > > get_power_exponent() const =0
Get the exponent of a power.
virtual void to_latex() const =0
Convert the node to latex.
T base
Type def to retrieve the backend type.
Definition node.hpp:668
virtual std::shared_ptr< leaf_node< T, SAFE_MATH > > df(std::shared_ptr< leaf_node< T, SAFE_MATH > > x)=0
Transform node to derivative.
const bool contains_pseudo
Node contains pseudo variables.
Definition node.hpp:373
virtual std::shared_ptr< leaf_node< T, SAFE_MATH > > remove_pseudo()
Remove pseudo variable nodes.
Definition node.hpp:627
virtual void set(const backend::buffer< T > &d)
Set the value of variable data.
Definition node.hpp:512
static thread_local caches_t caches
A per thread instance of the cache structure.
Definition node.hpp:665
virtual bool is_constant() const
Test if node is a constant.
Definition node.hpp:534
virtual void set(const size_t index, const T d)
Set the value of variable data.
Definition node.hpp:497
virtual std::shared_ptr< leaf_node< T, SAFE_MATH > > to_vizgraph(std::stringstream &stream, jit::register_map ®isters)=0
Convert the node to vizgraph.
virtual std::shared_ptr< leaf_node< T, SAFE_MATH > > get_power_base()
Get the base of a power.
Definition node.hpp:581
leaf_node(const std::string s, const size_t count, const bool pseudo)
Construct a basic node.
Definition node.hpp:383
virtual bool has_constant_zero() const
Test the constant node has a zero.
Definition node.hpp:543
virtual void set(const T d)
Set the value of variable data.
Definition node.hpp:489
const size_t complexity
Graph complexity.
Definition node.hpp:369
virtual backend::buffer< T > evaluate()=0
Evaluate method.
std::map< size_t, std::shared_ptr< leaf_node< T, SAFE_MATH > > > df_cache
Cache derivative terms.
Definition node.hpp:371
bool is_power_base_match(std::shared_ptr< leaf_node< T, SAFE_MATH > > x)
Check if the base of the powers match.
Definition node.hpp:480
virtual bool is_all_variables() const =0
Test if all the subnodes terminate in variables.
virtual std::shared_ptr< leaf_node > reduce()=0
Reduction method.
size_t get_complexity() const
Get the number of nodes in the subgraph.
Definition node.hpp:609
virtual bool has_pseudo() const
Query if the node contains pseudo variables.
Definition node.hpp:618
const size_t hash
Hash for node.
Definition node.hpp:367
virtual void compile_preamble(std::ostringstream &stream, jit::register_map ®isters, jit::visiter_map &visited, jit::register_usage &usage, jit::texture1d_list &textures1d, jit::texture2d_list &textures2d, int &avail_const_mem)
Compile preamble.
Definition node.hpp:433
bool is_normal()
Test if the result is normal.
Definition node.hpp:552
size_t get_hash() const
Get the hash for the node.
Definition node.hpp:600
Class representing a subexpression that acts like a variable.
Definition node.hpp:1764
virtual void to_latex() const
Convert the node to latex.
Definition node.hpp:1809
virtual shared_leaf< T, SAFE_MATH > df(shared_leaf< T, SAFE_MATH > x)
Transform node to derivative.
Definition node.hpp:1802
virtual bool is_power_like() const
Test if the node acts like a power of variable.
Definition node.hpp:1829
virtual shared_leaf< T, SAFE_MATH > to_vizgraph(std::stringstream &stream, jit::register_map ®isters)
Convert the node to vizgraph.
Definition node.hpp:1876
virtual shared_leaf< T, SAFE_MATH > get_power_exponent() const
Get the exponent of a power.
Definition node.hpp:1847
virtual bool is_all_variables() const
Test if node acts like a variable.
Definition node.hpp:1820
virtual shared_leaf< T, SAFE_MATH > remove_pseudo()
Remove pseudo variable nodes.
Definition node.hpp:1865
virtual shared_leaf< T, SAFE_MATH > get_power_base()
Get the base of a power.
Definition node.hpp:1838
virtual bool has_pseudo() const
Query if the node contains pseudo variables.
Definition node.hpp:1856
virtual shared_leaf< T, SAFE_MATH > reduce()
Reduction method.
Definition node.hpp:1792
pseudo_variable_node(shared_leaf< T, SAFE_MATH > a)
Construct a pseudo variable node.
Definition node.hpp:1782
Class representing a straight node.
Definition node.hpp:1059
virtual shared_leaf< T, SAFE_MATH > get_power_exponent() const
Get the exponent of a power.
Definition node.hpp:1155
shared_leaf< T, SAFE_MATH > arg
Argument.
Definition node.hpp:1062
virtual backend::buffer< T > evaluate()
Evaluate method.
Definition node.hpp:1081
shared_leaf< T, SAFE_MATH > get_arg()
Get the argument.
Definition node.hpp:1137
virtual void compile_preamble(std::ostringstream &stream, jit::register_map ®isters, jit::visiter_map &visited, jit::register_usage &usage, jit::texture1d_list &textures1d, jit::texture2d_list &textures2d, int &avail_const_mem)
Compile preamble.
Definition node.hpp:1096
straight_node(shared_leaf< T, SAFE_MATH > a, const std::string s)
Construct a straight node.
Definition node.hpp:1071
virtual bool is_all_variables() const
Test if node acts like a variable.
Definition node.hpp:1146
virtual shared_leaf< T, SAFE_MATH > compile(std::ostringstream &stream, jit::register_map ®isters, jit::register_map &indices, const jit::register_usage &usage)
Compile the node.
Definition node.hpp:1127
Class representing a triple branch node.
Definition node.hpp:1297
virtual void compile_preamble(std::ostringstream &stream, jit::register_map ®isters, jit::visiter_map &visited, jit::register_usage &usage, jit::texture1d_list &textures1d, jit::texture2d_list &textures2d, int &avail_const_mem)
Compile preamble.
Definition node.hpp:1336
shared_leaf< T, SAFE_MATH > get_middle()
Get the right branch.
Definition node.hpp:1368
virtual bool is_all_variables() const
Test if node acts like a variable.
Definition node.hpp:1377
triple_node(shared_leaf< T, SAFE_MATH > l, shared_leaf< T, SAFE_MATH > m, shared_leaf< T, SAFE_MATH > r, const std::string s)
Reduces and assigns the left and right branches.
Definition node.hpp:1312
shared_leaf< T, SAFE_MATH > middle
Middle branch of the tree.
Definition node.hpp:1300
Class representing data that can change.
Definition node.hpp:1394
virtual shared_leaf< T, SAFE_MATH > get_power_base()
Get the base of a power.
Definition node.hpp:1650
variable_node(const backend::buffer< T > &d, const std::string &symbol)
Construct a variable node from backend buffer.
Definition node.hpp:1456
virtual bool is_all_variables() const
Test if node acts like a variable.
Definition node.hpp:1632
virtual shared_leaf< T, SAFE_MATH > df(shared_leaf< T, SAFE_MATH > x)
Transform node to derivative.
Definition node.hpp:1489
variable_node(const size_t s, const T d, const std::string &symbol)
Construct a variable node from a scalar.
Definition node.hpp:1430
virtual void to_latex() const
Convert the node to latex.
Definition node.hpp:1587
virtual shared_leaf< T, SAFE_MATH > reduce()
Reduction method.
Definition node.hpp:1479
size_t size()
Get the size of the variable buffer.
Definition node.hpp:1614
virtual shared_leaf< T, SAFE_MATH > compile(std::ostringstream &stream, jit::register_map ®isters, jit::register_map &indices, const jit::register_usage &usage)
Compile the node.
Definition node.hpp:1533
virtual shared_leaf< T, SAFE_MATH > to_vizgraph(std::stringstream &stream, jit::register_map ®isters)
Convert the node to vizgraph.
Definition node.hpp:1598
virtual void compile_preamble(std::ostringstream &stream, jit::register_map ®isters, jit::visiter_map &visited, jit::register_usage &usage, jit::texture1d_list &textures1d, jit::texture2d_list &textures2d, int &avail_const_mem)
Compile preamble.
Definition node.hpp:1507
virtual backend::buffer< T > evaluate()
Evaluate method.
Definition node.hpp:1468
T * data()
Get a pointer to raw buffer.
Definition node.hpp:1623
virtual void set(const T d)
Set the value of variable data.
Definition node.hpp:1545
virtual bool is_power_like() const
Test if the node acts like a power of variable.
Definition node.hpp:1641
virtual void set(const backend::buffer< T > &d)
Set the value of variable data.
Definition node.hpp:1573
virtual void set(const size_t index, const T d)
Set the value of variable data.
Definition node.hpp:1555
variable_node(const size_t s, const std::string &symbol)
Construct a variable node with a size.
Definition node.hpp:1418
virtual void set(const std::vector< T > &d)
Set the value of variable data.
Definition node.hpp:1564
variable_node(const std::vector< T > &d, const std::string &symbol)
Construct a variable node from a vector.
Definition node.hpp:1443
std::string get_symbol() const
Get Symbol.
Definition node.hpp:1580
virtual shared_leaf< T, SAFE_MATH > get_power_exponent() const
Get the exponent of a power.
Definition node.hpp:1659
Complex scalar concept.
Definition register.hpp:24
subroutine assert(test, message)
Assert check.
Definition f_binding_test.f90:38
Name space for graph nodes.
Definition arithmetic.hpp:13
constexpr shared_leaf< T, SAFE_MATH > zero()
Forward declare for zero.
Definition node.hpp:994
std::shared_ptr< variable_node< T, SAFE_MATH > > shared_variable
Convenience type alias for shared variable nodes.
Definition node.hpp:1727
constexpr shared_leaf< T, SAFE_MATH > none()
Create a one constant.
Definition node.hpp:1020
void make_vizgraph(shared_leaf< T, SAFE_MATH > node)
Build the vizgraph input.
Definition node.hpp:703
constexpr shared_leaf< T, SAFE_MATH > one()
Forward declare for one.
Definition node.hpp:1007
std::vector< shared_variable< T, SAFE_MATH > > input_nodes
Convenience type alias for a vector of inputs.
Definition node.hpp:1730
shared_constant< T, SAFE_MATH > constant_cast(shared_leaf< T, SAFE_MATH > x)
Cast to a constant node.
Definition node.hpp:1042
shared_variable< T, SAFE_MATH > variable_cast(shared_leaf< T, SAFE_MATH > x)
Cast to a variable node.
Definition node.hpp:1746
constexpr T i
Convinece type for imaginary constant.
Definition node.hpp:1026
shared_leaf< T, SAFE_MATH > constant(const backend::buffer< T > &d)
Construct a constant.
Definition node.hpp:951
shared_leaf< T, SAFE_MATH > variable(const size_t s, const std::string &symbol)
Construct a variable.
Definition node.hpp:1674
std::shared_ptr< pseudo_variable_node< T, SAFE_MATH > > shared_pseudo_variable
Convenience type alias for shared pseudo variable nodes.
Definition node.hpp:1908
std::shared_ptr< leaf_node< T, SAFE_MATH > > shared_leaf
Convenience type alias for shared leaf nodes.
Definition node.hpp:673
std::vector< std::pair< shared_leaf< T, SAFE_MATH >, shared_variable< T, SAFE_MATH > > > map_nodes
Convenience type alias for maping end codes back to inputs.
Definition node.hpp:1734
constexpr shared_leaf< T, SAFE_MATH > null_leaf()
Create a null leaf.
Definition node.hpp:683
std::shared_ptr< constant_node< T, SAFE_MATH > > shared_constant
Convenience type alias for shared constant nodes.
Definition node.hpp:1030
std::vector< shared_leaf< T, SAFE_MATH > > output_nodes
Convenience type alias for a vector of output nodes.
Definition node.hpp:688
shared_leaf< T, SAFE_MATH > pseudo_variable(shared_leaf< T, SAFE_MATH > x)
Define pseudo variable convience function.
Definition node.hpp:1902
shared_pseudo_variable< T, SAFE_MATH > pseudo_variable_cast(shared_leaf< T, SAFE_MATH > &x)
Cast to a pseudo variable node.
Definition node.hpp:1920
std::map< void *, size_t > texture1d_list
Type alias for indexing 1D textures.
Definition register.hpp:262
std::string format_to_string(const T value)
Convert a value to a string while avoiding locale.
Definition register.hpp:211
std::map< void *, std::array< size_t, 2 > > texture2d_list
Type alias for indexing 2D textures.
Definition register.hpp:264
std::map< void *, size_t > register_usage
Type alias for counting register usage.
Definition register.hpp:258
std::map< void *, std::string > register_map
Type alias for mapping node pointers to register names.
Definition register.hpp:256
std::set< void * > visiter_map
Type alias for listing visited nodes.
Definition register.hpp:260
std::string to_string(const char prefix, const NODE *pointer)
Convert a graph::leaf_node pointer to a string.
Definition register.hpp:245
Data structure to contain the two caches.
Definition node.hpp:657
std::map< size_t, std::shared_ptr< leaf_node< T, SAFE_MATH > > > nodes
Cache of node.
Definition node.hpp:659
std::map< size_t, backend::buffer< T > > backends
Cache of backend buffers.
Definition node.hpp:661