Browse Source

update binary lib mark

pull/51/head
dabaiji 5 years ago
parent
commit
bb1952a9ea
4 changed files with 32 additions and 42 deletions
  1. +1
    -1
      build.sh
  2. +14
    -19
      third_party/incubator-tvm/include/tvm/arithmetic.h
  3. +7
    -7
      third_party/incubator-tvm/src/arithmetic/analyzer.cc
  4. +10
    -15
      third_party/incubator-tvm/src/arithmetic/const_int_bound.cc

+ 1
- 1
build.sh View File

@@ -72,7 +72,7 @@ acquire_lib_url()

os_arch="${os_name}_${arch_name}"
url_prefix="https://repo.mindspore.cn/public/ms-incubator/akg-binary/version"
lib_mark="202103/20210331/master_20210331180226_01098c6e93f2ba18ff01002987319d9532ece309"
lib_mark="202104/20210408/master_20210408100348_ff167085f4cf74432bf77e3cd5625d04f5789f09"
lib_url="${url_prefix}/${lib_mark}/lib/${os_arch}/libakg_ext.a"
echo "${lib_url}"
}


+ 14
- 19
third_party/incubator-tvm/include/tvm/arithmetic.h View File

@@ -112,18 +112,17 @@ class ConstIntBoundAnalyzer {
*
* \param var The variable of interest.
* \param info The bound information.
* \param override Whether do we allow override of existing information.
* \param allow_override Whether do we allow override of existing information.
*/
void Update(const Var& var,
const ConstIntBound& info,
bool override = false);
void Update(const Var& var, const ConstIntBound& info, bool allow_override = false);
/*!
* \brief Bind variable to a range.
*
* \param var The variable.
* \param range The range we bind to.
* \param allow_override Whether we allow overriding an existing var's range.
*/
void Bind(const Var& var, const Range& range);
void Bind(const Var& var, const Range& range, bool allow_override = false);

private:
friend class Analyzer;
@@ -198,11 +197,9 @@ class ModularSetAnalyzer {
*
* \param var The variable of interest.
* \param info The bound information.
* \param override Whether do we allow override of existing information.
* \param allow_override Whether do we allow override of existing information.
*/
void Update(const Var& var,
const ModularSet& info,
bool override = false);
void Update(const Var& var, const ModularSet& info, bool allow_override = false);

private:
friend class Analyzer;
@@ -239,11 +236,9 @@ class RewriteSimplifier {
*
* \param var The variable of interest.
* \param new_expr
* \param override Whether do we allow override of existing information.
* \param allow_override Whether do we allow override of existing information.
*/
void Update(const Var& var,
const Expr& new_expr,
bool override = false);
void Update(const Var& var, const Expr& new_expr, bool allow_override = false);

std::function<void()> EnterConstraint(const Expr& constraint);

@@ -275,11 +270,9 @@ class CanonicalSimplifier {
*
* \param var The variable of interest.
* \param new_expr
* \param override Whether do we allow override of existing information.
* \param allow_override Whether do we allow override of existing information.
*/
void Update(const Var& var,
const Expr& new_expr,
bool override = false);
void Update(const Var& var, const Expr& new_expr, bool allow_override = false);

private:
friend class Analyzer;
@@ -498,8 +491,9 @@ class Analyzer {
*
* \param var The variable.
* \param expr The expression we bind to.
* \param allow_override Whether we allow overriding an existing var's expression.
*/
void Bind(const VarExpr& var, const Expr& expr);
void Bind(const VarExpr& var, const Expr& expr, bool allow_override = false);
/*!
* \brief Notify all the sub-analyzers that var
* is created and binded to a range.
@@ -508,8 +502,9 @@ class Analyzer {
*
* \param var The variable.
* \param range The range we bind to.
* \param allow_override Whether we allow overriding an existing var's expression.
*/
void Bind(const VarExpr& var, const Range& range);
void Bind(const VarExpr& var, const Range& range, bool allow_override = false);
/*!
* \brief Whether can we prove expr >= val.



+ 7
- 7
third_party/incubator-tvm/src/arithmetic/analyzer.cc View File

@@ -40,21 +40,21 @@ Analyzer::Analyzer()
int_set(this) {
}

void Analyzer::Bind(const VarExpr& var, const Expr& expr) {
void Analyzer::Bind(const VarExpr& var, const Expr& expr, bool allow_override) {
Expr new_expr = expr;
new_expr = this->canonical_simplify(new_expr);
new_expr = this->rewrite_simplify(new_expr);

this->const_int_bound.Update(var, this->const_int_bound(new_expr));
this->modular_set.Update(var, this->modular_set(new_expr));
this->rewrite_simplify.Update(var, new_expr);
this->canonical_simplify.Update(var, new_expr);
this->const_int_bound.Update(var, this->const_int_bound(new_expr), allow_override);
this->modular_set.Update(var, this->modular_set(new_expr), allow_override);
this->rewrite_simplify.Update(var, new_expr, allow_override);
this->canonical_simplify.Update(var, new_expr, allow_override);
}

void Analyzer::Bind(const VarExpr& var, const Range& range) {
void Analyzer::Bind(const VarExpr& var, const Range& range, bool allow_override) {
// CCE Preserve this change instead of checking for extent of one
CHECK(range.defined());
this->const_int_bound.Bind(var, range);
this->const_int_bound.Bind(var, range, allow_override);
// skip modular_set
// skip rewrite simplify
}


+ 10
- 15
third_party/incubator-tvm/src/arithmetic/const_int_bound.cc View File

@@ -97,19 +97,18 @@ class ConstIntBoundAnalyzer::Impl :
}
};

void Bind(const Var& var, const Range& range) {
void Bind(const Var& var, const Range& range, bool allow_override) {
Entry a = VisitExpr(range->min);
Entry b = VisitExpr(range->extent);
Entry ret;
ret.min_value = a.min_value;
ret.max_value = InfAwareAdd(a.max_value, InfAwareAdd(b.max_value, -1));
// CCE requires override in update.
Update(var, ret, true);
}

void Update(const Var& var,
const Entry& info,
bool override) {
if (!override) {
void Update(const Var& var, const Entry& info, bool allow_override) {
if (!allow_override) {
auto it = var_map_.find(var);
if (it != var_map_.end()) {
CHECK(it->second == info)
@@ -122,10 +121,8 @@ class ConstIntBoundAnalyzer::Impl :
var_map_[var] = info;
}

void Update(const Var& var,
const ConstIntBound& info,
bool override) {
Update(var, MakeBound(info->min_value, info->max_value), override);
void Update(const Var& var, const ConstIntBound& info, bool allow_override) {
Update(var, MakeBound(info->min_value, info->max_value), allow_override);
}

// Override visitor behaviors
@@ -539,14 +536,12 @@ ConstIntBound ConstIntBoundAnalyzer::operator()(const Expr& expr) {
return ConstIntBound(ret.min_value, ret.max_value);
}

void ConstIntBoundAnalyzer::Update(const Var& var,
const ConstIntBound& info,
bool override) {
impl_->Update(var, info, override);
void ConstIntBoundAnalyzer::Update(const Var& var, const ConstIntBound& info, bool allow_override) {
impl_->Update(var, info, allow_override);
}

void ConstIntBoundAnalyzer::Bind(const Var& var, const Range& range) {
impl_->Bind(var, range);
void ConstIntBoundAnalyzer::Bind(const Var& var, const Range& range, bool allow_override) {
impl_->Bind(var, range, allow_override);
}

std::function<void()> ConstIntBoundAnalyzer::EnterConstraint(const Expr& constraint) {


Loading…
Cancel
Save