-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add extract constrains * refactor buffer schedule * add Razor.Templating.Core * reorder SwapBinaryArgs * Apply code-format changes * Update NuGet.Config --------- Co-authored-by: zhengqihang <[email protected]> Co-authored-by: xhuohai <[email protected]> Co-authored-by: sunnycase <[email protected]>
- Loading branch information
1 parent
bdaf0b1
commit 2498b1b
Showing
26 changed files
with
297 additions
and
454 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright (c) Canaan Inc. All rights reserved. | ||
// Licensed under the Apache license. See LICENSE file in the project root for full license information. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using Google.OrTools.Sat; | ||
using Nncase.CostModel; | ||
using Nncase.Diagnostics; | ||
using Nncase.IR; | ||
using Nncase.PatternMatch; | ||
using static Nncase.PatternMatch.F.Math; | ||
using static Nncase.PatternMatch.Utility; | ||
|
||
namespace Nncase.Passes; | ||
|
||
/// <summary> | ||
/// EGraph extract extensions. | ||
/// </summary> | ||
public static class EGraphExtensions | ||
{ | ||
/// <summary> | ||
/// Extract egraph. | ||
/// </summary> | ||
/// <param name="eGraph">egraph.</param> | ||
/// <param name="root">Root eclass.</param> | ||
/// <param name="basefunc_cost_evaluator">base func cost evaluator.</param> | ||
/// <param name="constrains">the cp model constrains.</param> | ||
public static Expr Extract(this IEGraph eGraph, EClass root, Evaluator.IBaseFuncCostEvaluator? basefunc_cost_evaluator, EGraphExtractConstrains[] constrains) | ||
{ | ||
// 1. set enode expr with more accuracy type. | ||
foreach (var eclass in eGraph.Classes) | ||
{ | ||
foreach (var nodes in eclass.Nodes) | ||
{ | ||
if (eclass.CheckedType.CompareTo(nodes.Expr.CheckedType) > 0) | ||
{ | ||
nodes.Expr.CheckedType = eclass.CheckedType; | ||
} | ||
} | ||
} | ||
|
||
// 2. start the cost evaluator | ||
var costModel = new CostModel.EGraphCostEvaluator(root.Find(), basefunc_cost_evaluator, false).Evaluate(); | ||
|
||
return new EGraphExtractor(costModel).Extract(root.Find(), eGraph, constrains); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.