docc 0.8.3 (0d44999b)
C++ API Reference
Loading...
Searching...
No Matches
mlir::sdfg::SDFGTranslator Class Reference

#include <mlir/Target/SDFG/SDFGTranslator.h>

Public Member Functions

 SDFGTranslator ()
::sdfg::builder::StructuredSDFGBuilder & builder ()
bool builder_empty ()
void builder_empty (bool empty)
llvm::ScopedHashTable< Value, std::string > & value_map ()
::sdfg::structured_control_flow::Sequence & insertion_point ()
void enter_sequence (::sdfg::structured_control_flow::Sequence &sequence)
void exit_sequence (::sdfg::structured_control_flow::Sequence &sequence)
std::unordered_map< std::string, TensorInfo > & tensor_info_map ()
TensorInfo & get_or_create_tensor_info (const std::string &container, const TensorType &type)
std::string get_or_create_container (Value val, bool argument=false)
std::unique_ptr<::sdfg::types::IType > convertType (const Type mlir_type)
std::string convertTypedAttr (const TypedAttr attr)
void add_reference (const std::string &src_container, const std::string &dst_container, const ::sdfg::DebugInfo &deb_info=::sdfg::DebugInfo())
void handle_malloc (std::string container, const ::sdfg::symbolic::Expression size, const ::sdfg::DebugInfo &deb_info=::sdfg::DebugInfo())
void handle_frees (std::string return_container="", const ::sdfg::DebugInfo &deb_info=::sdfg::DebugInfo())
std::string get_or_copy_output_container (Value output, const ::sdfg::DebugInfo &deb_info=::sdfg::DebugInfo(), bool consumer_overwrites_output=false)
 If output is used as a DPS init by more than one linalg op, allocate a fresh copy via malloc + memcpy and return the new container name.
void record_constant_fill (Value result, Value value)
 Record that result is produced by a constant value linalg.fill whose materialization is deferred.
bool is_constant_fill (Value result) const
 Returns true if result was recorded via record_constant_fill.
std::string try_inplace_reuse_container (Value input, Value result)
 Returns the container of input if its buffer can be safely overwritten in place by an elementwise consumer producing result, otherwise the empty string.
std::string store_in_c_order (const std::string &container, const TensorInfo &tensor_info, const ::sdfg::types::Scalar &element_type, const ::sdfg::DebugInfo &deb_info=::sdfg::DebugInfo())
void set_output_args (const std::vector< std::string > &output_args)
 Set the output argument names for multi-output support.
const std::vector< std::string > & output_args () const
 Get the output argument names.
void copy_to_output (const std::string &src_container, const TensorInfo &tensor_info, const ::sdfg::types::Scalar &element_type, const std::string &output_container, const ::sdfg::DebugInfo &deb_info=::sdfg::DebugInfo())
 Copy tensor data to an output argument container in C-order.
void copy_scalar_to_output (const std::string &src_container, const std::string &output_container, const ::sdfg::DebugInfo &deb_info=::sdfg::DebugInfo())
 Copy scalar data to an output argument container.
::sdfg::DebugInfo get_debug_info (llvm::StringLiteral operation_name, Location loc)
 Creates an SDFG debug info from an operation.

Constructor & Destructor Documentation

◆ SDFGTranslator()

mlir::sdfg::SDFGTranslator::SDFGTranslator ( )

Member Function Documentation

◆ add_reference()

void mlir::sdfg::SDFGTranslator::add_reference ( const std::string & src_container,
const std::string & dst_container,
const ::sdfg::DebugInfo & deb_info = ::sdfg::DebugInfo() )

◆ builder()

::sdfg::builder::StructuredSDFGBuilder & mlir::sdfg::SDFGTranslator::builder ( )

◆ builder_empty() [1/2]

bool mlir::sdfg::SDFGTranslator::builder_empty ( )

◆ builder_empty() [2/2]

void mlir::sdfg::SDFGTranslator::builder_empty ( bool empty)

◆ convertType()

std::unique_ptr<::sdfg::types::IType > mlir::sdfg::SDFGTranslator::convertType ( const Type mlir_type)

◆ convertTypedAttr()

std::string mlir::sdfg::SDFGTranslator::convertTypedAttr ( const TypedAttr attr)

◆ copy_scalar_to_output()

void mlir::sdfg::SDFGTranslator::copy_scalar_to_output ( const std::string & src_container,
const std::string & output_container,
const ::sdfg::DebugInfo & deb_info = ::sdfg::DebugInfo() )

Copy scalar data to an output argument container.

◆ copy_to_output()

void mlir::sdfg::SDFGTranslator::copy_to_output ( const std::string & src_container,
const TensorInfo & tensor_info,
const ::sdfg::types::Scalar & element_type,
const std::string & output_container,
const ::sdfg::DebugInfo & deb_info = ::sdfg::DebugInfo() )

Copy tensor data to an output argument container in C-order.

◆ enter_sequence()

void mlir::sdfg::SDFGTranslator::enter_sequence ( ::sdfg::structured_control_flow::Sequence & sequence)

◆ exit_sequence()

void mlir::sdfg::SDFGTranslator::exit_sequence ( ::sdfg::structured_control_flow::Sequence & sequence)

◆ get_debug_info()

::sdfg::DebugInfo mlir::sdfg::SDFGTranslator::get_debug_info ( llvm::StringLiteral operation_name,
Location loc )

Creates an SDFG debug info from an operation.

◆ get_or_copy_output_container()

std::string mlir::sdfg::SDFGTranslator::get_or_copy_output_container ( Value output,
const ::sdfg::DebugInfo & deb_info = ::sdfg::DebugInfo(),
bool consumer_overwrites_output = false )

If output is used as a DPS init by more than one linalg op, allocate a fresh copy via malloc + memcpy and return the new container name.

Otherwise return the original container for output. If consumer_overwrites_output is true, the caller guarantees it fully overwrites the returned buffer before reading it (e.g. matmul with beta=0), so the init copy is skipped and a fresh uninitialized buffer is handed out (the malloc still happens).

◆ get_or_create_container()

std::string mlir::sdfg::SDFGTranslator::get_or_create_container ( Value val,
bool argument = false )

◆ get_or_create_tensor_info()

TensorInfo & mlir::sdfg::SDFGTranslator::get_or_create_tensor_info ( const std::string & container,
const TensorType & type )

◆ handle_frees()

void mlir::sdfg::SDFGTranslator::handle_frees ( std::string return_container = "",
const ::sdfg::DebugInfo & deb_info = ::sdfg::DebugInfo() )

◆ handle_malloc()

void mlir::sdfg::SDFGTranslator::handle_malloc ( std::string container,
const ::sdfg::symbolic::Expression size,
const ::sdfg::DebugInfo & deb_info = ::sdfg::DebugInfo() )

◆ insertion_point()

::sdfg::structured_control_flow::Sequence & mlir::sdfg::SDFGTranslator::insertion_point ( )

◆ is_constant_fill()

bool mlir::sdfg::SDFGTranslator::is_constant_fill ( Value result) const

Returns true if result was recorded via record_constant_fill.

◆ output_args()

const std::vector< std::string > & mlir::sdfg::SDFGTranslator::output_args ( ) const

Get the output argument names.

◆ record_constant_fill()

void mlir::sdfg::SDFGTranslator::record_constant_fill ( Value result,
Value value )

Record that result is produced by a constant value linalg.fill whose materialization is deferred.

Each consumer regenerates a freshly-filled array on demand instead of copying from a single shared buffer (saving the source buffer and turning per-use memcpys into fills).

◆ set_output_args()

void mlir::sdfg::SDFGTranslator::set_output_args ( const std::vector< std::string > & output_args)

Set the output argument names for multi-output support.

◆ store_in_c_order()

std::string mlir::sdfg::SDFGTranslator::store_in_c_order ( const std::string & container,
const TensorInfo & tensor_info,
const ::sdfg::types::Scalar & element_type,
const ::sdfg::DebugInfo & deb_info = ::sdfg::DebugInfo() )

◆ tensor_info_map()

std::unordered_map< std::string, TensorInfo > & mlir::sdfg::SDFGTranslator::tensor_info_map ( )

◆ try_inplace_reuse_container()

std::string mlir::sdfg::SDFGTranslator::try_inplace_reuse_container ( Value input,
Value result )

Returns the container of input if its buffer can be safely overwritten in place by an elementwise consumer producing result, otherwise the empty string.

Conservatively limited to inputs produced by a matmul/batch_matmul: a fresh, fully-written, owned buffer used exactly once and matching the result's shape and element type. Lets the consumer reuse that buffer instead of allocating a new output, saving a malloc (and its free).

◆ value_map()

llvm::ScopedHashTable< Value, std::string > & mlir::sdfg::SDFGTranslator::value_map ( )

The documentation for this class was generated from the following file: