444 return base_name +
"f";
450 return base_name +
"l";
455 return base_name +
"f";
490 bool approximate_ =
false;
521 std::unique_ptr<data_flow::DataFlowNode>
Dispatchers for dataflow blocks and library nodes.
size_t element_id() const
const DebugInfo & debug_info() const
Definition exceptions.h:8
Note: Even though the class references unique_ptr, it will never delete an SDFG it has a reference to...
Definition structured_sdfg_builder.h:44
Originally started out as a handler for additional source files, like hardware-accelerator kernels th...
Definition code_snippet_factory.h:69
Definition language_extension.h:39
Base class for library node code generation dispatchers.
Definition block_dispatcher.h:163
Definition data_flow_graph.h:29
graph::Vertex vertex() const
Get the graph vertex for this node.
Base class for all library nodes in the dataflow graph.
Definition library_node.h:106
Edge in the dataflow graph representing data movement.
Definition memlet.h:131
CMathNodeDispatcher(codegen::LanguageExtension &language_extension, const Function &function, const data_flow::DataFlowGraph &data_flow_graph, const CMathNode &node)
void dispatch_code(codegen::PrettyPrinter &stream, codegen::PrettyPrinter &globals_stream, codegen::CodeSnippetFactory &library_snippet_factory) override
Generate the operation-specific code.
Definition cmath_node.h:532
data_flow::LibraryNode & deserialize(const nlohmann::json &j, builder::StructuredSDFGBuilder &builder, structured_control_flow::Block &parent) override
Deserialize a library node from JSON.
nlohmann::json serialize(const data_flow::LibraryNode &library_node) override
Serialize a library node to JSON.
Definition cmath_node.h:485
virtual symbolic::Expression flop() const override
Calculate floating point operations for this node.
data_flow::PointerAccessType pointer_access_type(int input_idx) const override
Describes what a pointer is used for.
data_flow::EdgeRemoveOption can_remove_out_edge(const data_flow::DataFlowGraph &graph, const data_flow::Memlet *memlet) const override
Is the edge in question removable, or will this make the node its an output on invalid?
void replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) override
void validate(const Function &function) const override
Validates the element.
CMathNode(size_t element_id, const DebugInfo &debug_info, const graph::Vertex vertex, data_flow::DataFlowGraph &parent, CMathFunction function, types::PrimitiveType primitive_type, bool approximate=false)
void replace(const symbolic::ExpressionMapping &replacements) override
void approximate(bool approximate)
types::PrimitiveType primitive_type() const
symbolic::SymbolSet symbols() const override
Get all symbols used in this node.
std::unique_ptr< data_flow::DataFlowNode > clone(size_t element_id, const graph::Vertex vertex, data_flow::DataFlowGraph &parent) const override
Clone this node for graph transformations.
CMathFunction function() const
std::string toStr() const override
Convert node to string representation.
Base class for library node serialization.
Definition json_serializer.h:195
A control flow node representing a basic block with dataflow computations.
Definition block.h:42
SymEngine::RCP< const SymEngine::Basic > Expression
Reference-counted pointer to a symbolic expression (SymEngine Basic).
Definition symbolic.h:83
std::set< Symbol, SymEngine::RCPBasicKeyLess > SymbolSet
Ordered set of symbols.
Definition symbolic.h:95
SymEngine::map_basic_basic ExpressionMapping
Definition symbolic.h:109
Library node definitions for calling functions beyond simple instructions.
Definition function_builder.h:10
EdgeRemoveOption
Definition data_flow_node.h:71
StringEnum LibraryNodeCode
Definition library_node.h:65
std::unique_ptr< PointerAccessMeta, PtrAccessDeleter > PointerAccessType
Definition pointer_metadata.h:32
boost::graph_traits< Graph >::vertex_descriptor Vertex
Definition graph.h:25
Definition cmath_node.h:12
std::string get_cmath_intrinsic_name(CMathFunction func, types::PrimitiveType prim_type)
Get the correct C math intrinsic name for a given function and primitive type.
Definition cmath_node.h:439
constexpr size_t cmath_function_to_arity(CMathFunction func)
Get arity of CMathFunction enum.
Definition cmath_node.h:103
data_flow::LibraryNodeCode LibraryNodeType_CMath("CMath")
constexpr const char * cmath_function_to_stem(CMathFunction func)
Convert CMathFunction enum to function name stem (without type suffix).
Definition cmath_node.h:306
data_flow::LibraryNodeCode LibraryNodeType_CMath_Deprecated("Intrinsic")
CMathFunction string_to_cmath_function(const std::string &name)
constexpr uint64_t cmath_function_to_flop(CMathFunction func)
Approximate flop-equivalent cost of a libm call.
Definition cmath_node.h:230
std::string get_cmath_approximate_intrinsic_name(CMathFunction func, types::PrimitiveType prim_type)
Fast, approximate CUDA/HIP device intrinsic for a function, if one exists.
Definition cmath_node.h:465
CMathFunction
Enumeration of C math library functions.
Definition cmath_node.h:21
@ atanh
Definition cmath_node.h:37
@ lgamma
Definition cmath_node.h:59
@ cbrt
Definition cmath_node.h:52
@ cosh
Definition cmath_node.h:33
@ acosh
Definition cmath_node.h:36
@ llround
Definition cmath_node.h:68
@ nearbyint
Definition cmath_node.h:70
@ erf
Definition cmath_node.h:56
@ pow
Definition cmath_node.h:50
@ fabs
Definition cmath_node.h:62
@ hypot
Definition cmath_node.h:53
@ lround
Definition cmath_node.h:67
@ fdim
Definition cmath_node.h:92
@ lrint
Definition cmath_node.h:72
@ scalbln
Definition cmath_node.h:82
@ cos
Definition cmath_node.h:24
@ tan
Definition cmath_node.h:25
@ tanh
Definition cmath_node.h:34
@ nexttoward
Definition cmath_node.h:86
@ asin
Definition cmath_node.h:26
@ fmax
Definition cmath_node.h:90
@ scalbn
Definition cmath_node.h:81
@ atan
Definition cmath_node.h:28
@ ceil
Definition cmath_node.h:63
@ floor
Definition cmath_node.h:64
@ expm1
Definition cmath_node.h:43
@ log2
Definition cmath_node.h:46
@ sin
Definition cmath_node.h:23
@ rint
Definition cmath_node.h:71
@ tgamma
Definition cmath_node.h:58
@ erfc
Definition cmath_node.h:57
@ fma
Definition cmath_node.h:95
@ remainder
Definition cmath_node.h:75
@ frexp
Definition cmath_node.h:78
@ fmin
Definition cmath_node.h:91
@ fmod
Definition cmath_node.h:74
@ modf
Definition cmath_node.h:80
@ round
Definition cmath_node.h:66
@ log1p
Definition cmath_node.h:47
@ logb
Definition cmath_node.h:84
@ nextafter
Definition cmath_node.h:85
@ sinh
Definition cmath_node.h:32
@ exp
Definition cmath_node.h:40
@ roundeven
Definition cmath_node.h:69
@ acos
Definition cmath_node.h:27
@ atan2
Definition cmath_node.h:29
@ llrint
Definition cmath_node.h:73
@ ilogb
Definition cmath_node.h:83
@ exp10
Definition cmath_node.h:42
@ log10
Definition cmath_node.h:45
@ copysign
Definition cmath_node.h:87
@ log
Definition cmath_node.h:44
@ sqrt
Definition cmath_node.h:51
@ trunc
Definition cmath_node.h:65
@ exp2
Definition cmath_node.h:41
@ ldexp
Definition cmath_node.h:79
@ asinh
Definition cmath_node.h:35
Definition batched_gemm_node.h:12
PrimitiveType
Enumeration of all primitive data types supported by sdfglib.
Definition type.h:35
@ Half
16-bit floating-point (IEEE 754 half precision)
Definition type.h:48
@ FP128
128-bit floating-point (IEEE 754 quadruple precision)
Definition type.h:53
@ Double
64-bit floating-point (IEEE 754 double precision)
Definition type.h:51
@ PPC_FP128
128-bit floating-point (PowerPC double-double)
Definition type.h:54
@ BFloat
16-bit brain floating-point
Definition type.h:49
@ X86_FP80
80-bit extended precision floating-point (x86)
Definition type.h:52
@ Float
32-bit floating-point (IEEE 754 single precision)
Definition type.h:50
Symbolic system for integer-based symbol analysis.
Core type system definitions for sdfglib.