From 6983c09937baac3ffb7d3a45c3c5009c0eba7e6c Mon Sep 17 00:00:00 2001 From: Tuowen Zhao Date: Tue, 20 Sep 2016 15:56:14 -0600 Subject: python loop & more doc --- include/chilldebug.h | 2 -- include/irtools.hh | 29 +++++++++++++++++++++++++++++ include/loop.hh | 32 +++++++++++++++++++++++++++++++- 3 files changed, 60 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/chilldebug.h b/include/chilldebug.h index 865f1f6..8678749 100644 --- a/include/chilldebug.h +++ b/include/chilldebug.h @@ -1,8 +1,6 @@ // a central place to turn on debugging messages -// enable the next line to get lots of output -//#define DEBUGCHILL #ifndef DEBUGCHILL_H #define DEBUGCHILL_H diff --git a/include/irtools.hh b/include/irtools.hh index a3b552a..6648847 100644 --- a/include/irtools.hh +++ b/include/irtools.hh @@ -33,12 +33,41 @@ struct ir_tree_node { } }; +//! Build IR tree from the source code +/*! + * Block type node can only be leaf, i.e., there is no further stuctures inside a block allowed + * @param control + * @param parent + * @return + */ std::vector build_ir_tree(IR_Control *control, ir_tree_node *parent = NULL); +//! Extract statements from IR tree +/*! + * Statements returned are ordered in lexical order in the source code + * @param ir_tree + * @return + */ std::vector extract_ir_stmts( const std::vector &ir_tree); bool is_dependence_valid(ir_tree_node *src_node, ir_tree_node *dst_node, const DependenceVector &dv, bool before); +//! test data dependeces between two statements +/*! + * The first statement in parameter must be lexically before the second statement in parameter. + * Returned dependences are all lexicographically positive + * @param ir + * @param repr1 + * @param IS1 + * @param repr2 + * @param IS2 + * @param freevar + * @param index + * @param i + * @param j + * @return Dependecies between the two statements. First vector is dependencies from first to second, + * second vector is the reverse + */ std::pair, std::vector > test_data_dependences( IR_Code *ir, const omega::CG_outputRepr *repr1, const omega::Relation &IS1, const omega::CG_outputRepr *repr2, diff --git a/include/loop.hh b/include/loop.hh index 9620489..e02b7e9 100644 --- a/include/loop.hh +++ b/include/loop.hh @@ -148,8 +148,38 @@ public: void tile(int stmt_num, int level, int tile_size, int outer_level = 1, TilingMethodType method = StridedTile, int alignment_offset = 0, int alignment_multiple = 1); std::set split(int stmt_num, int level, const omega::Relation &cond); std::set unroll(int stmt_num, int level, int unroll_amount, std::vector< std::vector >idxNames= std::vector< std::vector >(), int cleanup_split_level = 0); - + + //! Datacopy function by reffering arrays by numbers + /*! + * for example + * ~~~ + * A[i] = A[i-1] + B[i]; + * ~~~ + * parameter array_ref_num=[0,2] means to copy data touched by A[i-1] and A[i] + * + * @param array_ref_nums + * @param level + * @param allow_extra_read + * @param fastest_changing_dimension + * @param padding_stride + * @param padding_alignment + * @param memory_type + * @return + */ bool datacopy(const std::vector > > &array_ref_nums, int level, bool allow_extra_read = false, int fastest_changing_dimension = -1, int padding_stride = 1, int padding_alignment = 4, int memory_type = 0); + //! Datacopy function by reffering arrays by name + /*! + * parameter array_name=A means to copy data touched by A[i-1] and A[i] + * @param stmt_num + * @param level + * @param array_name + * @param allow_extra_read + * @param fastest_changing_dimension + * @param padding_stride + * @param padding_alignment + * @param memory_type + * @return + */ bool datacopy(int stmt_num, int level, const std::string &array_name, bool allow_extra_read = false, int fastest_changing_dimension = -1, int padding_stride = 1, int padding_alignment = 4, int memory_type = 0); bool datacopy_privatized(int stmt_num, int level, const std::string &array_name, const std::vector &privatized_levels, bool allow_extra_read = false, int fastest_changing_dimension = -1, int padding_stride = 1, int padding_alignment = 1, int memory_type = 0); bool datacopy_privatized(const std::vector > > &array_ref_nums, int level, const std::vector &privatized_levels, bool allow_extra_read = false, int fastest_changing_dimension = -1, int padding_stride = 1, int padding_alignment = 1, int memory_type = 0); -- cgit v1.2.3-70-g09d2