-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev/3.0' into feature/ntt_benchmark_roofline_3
- Loading branch information
Showing
76 changed files
with
1,134 additions
and
192 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
15 changes: 15 additions & 0 deletions
15
modules/Nncase.Modules.CPU/CodeGen/CPU/Templates/Kernels/Compare.cshtml
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,15 @@ | ||
@model Nncase.CodeGen.CPU.CompareKernelTemplateModel | ||
@{ | ||
string CompareToCFunction(CompareOp op) => | ||
op switch | ||
{ | ||
CompareOp.Equal => "ops::equal", | ||
CompareOp.NotEqual => "ops::not_equal", | ||
CompareOp.LowerThan => "ops::less", | ||
CompareOp.LowerOrEqual => "ops::less_or_equal", | ||
CompareOp.GreaterThan => "ops::greater", | ||
CompareOp.GreaterOrEqual => "ops::greater_or_equal", | ||
_ => throw new NotSupportedException($"Unsupported Compare: {op}."), | ||
}; | ||
} | ||
compare<@CompareToCFunction(Model.CompareOp)>(@Html.Raw(Model.Arguments[0].Symbol.Name), @Html.Raw(Model.Arguments[1].Symbol.Name), @Html.Raw(Model.Arguments[2].Symbol.Name)); |
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,30 @@ | ||
// Copyright (c) Canaan Inc. All rights reserved. | ||
// Licensed under the Apache license. See LICENSE file in the project root for full license information. | ||
|
||
using Nncase.IR; | ||
using Nncase.IR.Affine; | ||
using Nncase.Schedule; | ||
using Nncase.TIR.CPU; | ||
|
||
namespace Nncase.Evaluator.TIR.CPU; | ||
|
||
public sealed class CompareEvaluator : ITypeInferencer<Compare>, IKernelInfoEvaluator<Compare> | ||
{ | ||
public IRType Visit(ITypeInferenceContext context, Compare target) | ||
{ | ||
return TupleType.Void; | ||
} | ||
|
||
public MicroKernelInfo Visit(Compare op, MicroKernelContext context) | ||
{ | ||
var domain = context.AccessMaps[0].Domains; | ||
var primitives = Enumerable.Repeat(1, domain.Length).ToArray(); | ||
var multipliers = Enumerable.Repeat(new ValueRange<int>(1, int.MaxValue), domain.Length).ToArray(); | ||
var bufferInfos = new MicroKernelBufferInfo[context.BufferShapes.Length]; | ||
var opt = (ICpuTargetOptions)context.TargetOptions; | ||
bufferInfos[0] = new(opt.MemoryBandWidths[1], opt.MemoryBandWidths[1], MicroKernelBufferInfo.BufferState.Read); | ||
bufferInfos[1] = new(opt.MemoryBandWidths[1], opt.MemoryBandWidths[1], MicroKernelBufferInfo.BufferState.Read); | ||
bufferInfos[2] = new(opt.MemoryBandWidths[1], opt.MemoryBandWidths[1], MicroKernelBufferInfo.BufferState.Write); | ||
return new MicroKernelInfo(primitives, multipliers, bufferInfos); | ||
} | ||
} |
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,17 @@ | ||
// Copyright (c) Canaan Inc. All rights reserved. | ||
// Licensed under the Apache license. See LICENSE file in the project root for full license information. | ||
|
||
using Nncase.IR; | ||
using Nncase.IR.Affine; | ||
using Nncase.Schedule; | ||
using Nncase.TIR.CPU; | ||
|
||
namespace Nncase.Evaluator.TIR.CPU; | ||
|
||
public sealed class ScatterNDEvaluator : ITypeInferencer<ScatterND> | ||
{ | ||
public IRType Visit(ITypeInferenceContext context, ScatterND target) | ||
{ | ||
return TupleType.Void; | ||
} | ||
} |
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
Oops, something went wrong.