Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support large kmodel #1079

Merged
merged 6 commits into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@
<PackageVersion Include="System.Linq.Async" Version="6.0.1" />
<PackageVersion Include="System.Reactive" Version="5.0.0" />
<PackageVersion Include="Tomlyn.Extensions.Configuration" Version="1.0.5" />
<PackageVersion Include="xunit" Version="2.4.1" />
<PackageVersion Include="xunit.analyzers" Version="1.1.0" />
<PackageVersion Include="xunit.assert" Version="2.4.1" />
<PackageVersion Include="xunit" Version="2.5.0" />
<PackageVersion Include="xunit.analyzers" Version="1.2.0" />
<PackageVersion Include="xunit.assert" Version="2.5.0" />
<PackageVersion Include="Xunit.Combinatorial">
<Version>1.5.25</Version>
</PackageVersion>
<PackageVersion Include="xunit.core" Version="2.4.2" />
<PackageVersion Include="xunit.core" Version="2.5.0" />
<PackageVersion Include="Xunit.DependencyInjection" Version="8.3.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.4.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.0" />
<PackageVersion Include="xunit.v3.assert" Version="0.1.1-pre.239" />
</ItemGroup>
<ItemGroup>
Expand Down
295 changes: 295 additions & 0 deletions modules/Nncase.Modules.CPU/packages.lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,295 @@
{
"version": 2,
"dependencies": {
"net7.0": {
"StyleCop.Analyzers": {
"type": "Direct",
"requested": "[1.2.0-beta.435, )",
"resolved": "1.2.0-beta.435",
"contentHash": "TADk7vdGXtfTnYCV7GyleaaRTQjfoSfZXprQrVMm7cSJtJbFc1QIbWPyLvrgrfGdfHbGmUPvaN4ODKNxg2jgPQ==",
"dependencies": {
"StyleCop.Analyzers.Unstable": "1.2.0.435"
}
},
"Google.OrTools.runtime.linux-arm64": {
"type": "Transitive",
"resolved": "9.4.1874",
"contentHash": "Z46ndZcZa2Lt5b76xU9kxVYbPLg/LfuMufhUVsu3Qo3L7Bibf7WXd9j7RRldjnuv8RIHWTqb0b+2FwwMxs0c5A=="
},
"Google.OrTools.runtime.linux-x64": {
"type": "Transitive",
"resolved": "9.4.1874",
"contentHash": "zGeDb8FuvP9HXjrsU7krVXtSDFpR+DUGNEsH51k94jL9tzf2vWYI8+WUBRHZ/cGe50dpLr+vIjfcNo3gFyOpkQ=="
},
"Google.OrTools.runtime.osx-arm64": {
"type": "Transitive",
"resolved": "9.4.1874",
"contentHash": "Wo0ZfDaH6DhiQw0jZm4HWJm/oPGPpWNwOLUz+EYaoH3MLtocSxItHGQj/Ta3HyhXnYNOv+TliAH8L+8RCXu/2w=="
},
"Google.OrTools.runtime.osx-x64": {
"type": "Transitive",
"resolved": "9.4.1874",
"contentHash": "IAfGgKR1og6vU87axK1d37Ak/4jy8B4NMoElovG/KZc/2UY+cJEAQDA709UMegtI4lBhuxTWFNUiHQYmRIB9yQ=="
},
"Google.OrTools.runtime.win-x64": {
"type": "Transitive",
"resolved": "9.4.1874",
"contentHash": "fUs5qDnZA6itygolcX6nPuachQkY9CVvQbakIzIiRAWKcaj8umQAbFdGwbkyzp3qp34BKW5mtPVsmMyfQBBjOQ=="
},
"libortki": {
"type": "Transitive",
"resolved": "0.0.2",
"contentHash": "svfuG5mxGY/QC/5DVheHOCELmdSP90RtxQ73j23KarPXZ9ZXW+7v1l5J77hGDyQbEh1BGrnGgKBlyn76RauGHg==",
"dependencies": {
"libortki-linux": "0.0.2",
"libortki-osx": "0.0.2",
"libortki-osx-arm64": "0.0.2",
"libortki-win": "0.0.2"
}
},
"libortki-linux": {
"type": "Transitive",
"resolved": "0.0.2",
"contentHash": "b04LWD4lgGy60tys3hPFhnUpgWDM6dN5r1PI7GOcPj8VupXCaI70LKNQ5/5twbDE6rkowOGanVTw0S2wBGBqBQ=="
},
"libortki-osx": {
"type": "Transitive",
"resolved": "0.0.2",
"contentHash": "O6Q9GLULkDkZEPAZJVKLPH0ROXGVOE7BxuddgOcHNK2oiTEM7wIRnzp2OIlYgLpaOLyxJMisbGOhtWgdzt2Wng=="
},
"libortki-osx-arm64": {
"type": "Transitive",
"resolved": "0.0.2",
"contentHash": "4Qn2dirJmRicnUG945oWpq7HVGwgqCKKxYPMISv/MRvmpZBbXrZ1cVvRaF8WwTu4XXgfKTa1sLv+i8zLifUMeQ=="
},
"libortki-win": {
"type": "Transitive",
"resolved": "0.0.2",
"contentHash": "HAoROgAKn8XBun11X43HZuspKlo5JGy8/OYw5IUPo7FVh5TCaPrLjGmyGYYZ2dqLlv31yv/b6s254PIRGn95cA=="
},
"Microsoft.Extensions.Configuration.Abstractions": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "qWzV9o+ZRWq+pGm+1dF+R7qTgTYoXvbyowRoBxQJGfqTpqDun2eteerjRQhq5PQ/14S+lqto3Ft4gYaRyl4rdQ==",
"dependencies": {
"Microsoft.Extensions.Primitives": "6.0.0"
}
},
"Microsoft.Extensions.DependencyInjection.Abstractions": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "xlzi2IYREJH3/m6+lUrQlujzX8wDitm4QGnUu6kUXTQAWPuZY8i+ticFJbzfqaetLA6KR/rO6Ew/HuYD+bxifg=="
},
"Microsoft.Extensions.FileProviders.Abstractions": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "0pd4/fho0gC12rQswaGQxbU34jOS1TPS8lZPpkFCH68ppQjHNHYle9iRuHeev1LhrJ94YPvzcRd8UmIuFk23Qw==",
"dependencies": {
"Microsoft.Extensions.Primitives": "6.0.0"
}
},
"Microsoft.Extensions.Primitives": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "9+PnzmQFfEFNR9J2aDTfJGGupShHjOuGw4VUv+JB044biSHrnmCIMD+mJHmb2H7YryrfBEXDurxQ47gJZdCKNQ==",
"dependencies": {
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
}
},
"NetFabric.Hyperlinq.Abstractions": {
"type": "Transitive",
"resolved": "1.3.0",
"contentHash": "WXnEcGwmXfa8gW9N2MlcaPNUzM3NLMwnAhacbtH554F8YcoXbIkTB+uGa1Aa+9gyb/9JZgYVHnmADgJUKP52nA=="
},
"StyleCop.Analyzers.Unstable": {
"type": "Transitive",
"resolved": "1.2.0.435",
"contentHash": "ouwPWZxbOV3SmCZxIRqHvljkSzkCyi1tDoMzQtDb/bRP8ctASV/iRJr+A2Gdj0QLaLmWnqTWDrH82/iP+X80Lg=="
},
"System.Buffers": {
"type": "Transitive",
"resolved": "4.5.1",
"contentHash": "Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg=="
},
"System.Runtime.CompilerServices.Unsafe": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg=="
},
"nncase.codegen": {
"type": "Project",
"dependencies": {
"Extension.Mathematics": "[1.2.12, )",
"Nncase.Core": "[1.0.0, )",
"Nncase.IO": "[1.0.0, )"
}
},
"nncase.core": {
"type": "Project",
"dependencies": {
"DryIoc.dll": "[5.3.1, )",
"GiGraph.Dot": "[2.0.0, )",
"Microsoft.Extensions.Hosting.Abstractions": "[6.0.0, )",
"Microsoft.Extensions.Logging.Abstractions": "[6.0.0, )",
"Microsoft.Extensions.Options": "[6.0.0, )",
"Microsoft.Toolkit.HighPerformance": "[7.1.1, )",
"NetFabric.Hyperlinq": "[3.0.0-beta48, )",
"System.Reactive": "[5.0.0, )"
}
},
"nncase.diagnostics": {
"type": "Project",
"dependencies": {
"Nncase.Core": "[1.0.0, )"
}
},
"nncase.egraph": {
"type": "Project",
"dependencies": {
"GiGraph.Dot": "[2.0.0, )",
"Google.OrTools": "[9.4.1874, )",
"NetFabric.Hyperlinq": "[3.0.0-beta48, )",
"Nncase.Core": "[1.0.0, )",
"Nncase.Evaluator": "[1.0.0, )",
"Singulink.Collections.Weak": "[1.0.2, )"
}
},
"nncase.evaluator": {
"type": "Project",
"dependencies": {
"Nncase.Core": "[1.0.0, )",
"OrtKISharp": "[0.0.2, )"
}
},
"nncase.graph": {
"type": "Project",
"dependencies": {
"Nncase.Core": "[1.0.0, )",
"Nncase.Evaluator": "[1.0.0, )"
}
},
"nncase.io": {
"type": "Project"
},
"nncase.modules.stackvm": {
"type": "Project",
"dependencies": {
"Nncase.CodeGen": "[1.0.0, )",
"Nncase.Passes": "[1.0.0, )"
}
},
"nncase.passes": {
"type": "Project",
"dependencies": {
"Nncase.Core": "[1.0.0, )",
"Nncase.EGraph": "[1.0.0, )",
"Nncase.Evaluator": "[1.0.0, )",
"Nncase.Graph": "[1.0.0, )"
}
},
"DryIoc.dll": {
"type": "CentralTransitive",
"requested": "[5.3.1, )",
"resolved": "5.3.1",
"contentHash": "E3zclUh2CIBks1t2uBD1k18pyGFJ1YSKCrbCDbB7qCdl2RAB+k68AyDpjeplhF1ot2XPV82AgyCWBXMf0ggL1g=="
},
"Extension.Mathematics": {
"type": "CentralTransitive",
"requested": "[1.2.12, )",
"resolved": "1.2.12",
"contentHash": "D4mn5Cab4ztPLJ0V8uMErDrO/Y61098nwrvyIOLZymVAYOQcwP1vomVWKbTagf1aPU3cX5Q7adZtQEQwOy6XEg=="
},
"GiGraph.Dot": {
"type": "CentralTransitive",
"requested": "[2.0.0, )",
"resolved": "2.0.0",
"contentHash": "ThvS2mQVveSkTMUm04tMbRYzu1XFPV8xBHISrUMp02APjhv9IRbLu3v3upTPCywORx2Ds/c6AqEUL1WU6kPfuQ=="
},
"Google.OrTools": {
"type": "CentralTransitive",
"requested": "[9.4.1874, )",
"resolved": "9.4.1874",
"contentHash": "jqRoI+pYlym+fhoU25u+13oti5h+772bllQ9zDitTVMclDXVTiG6pxzvmYO74wnADBMdpb2SQlgiNQxoNk5dlA==",
"dependencies": {
"Google.OrTools.runtime.linux-arm64": "9.4.1874",
"Google.OrTools.runtime.linux-x64": "9.4.1874",
"Google.OrTools.runtime.osx-arm64": "9.4.1874",
"Google.OrTools.runtime.osx-x64": "9.4.1874",
"Google.OrTools.runtime.win-x64": "9.4.1874",
"Google.Protobuf": "3.19.4"
}
},
"Google.Protobuf": {
"type": "CentralTransitive",
"requested": "[3.19.4, )",
"resolved": "3.19.4",
"contentHash": "fd07/ykL4O4FhqrZIELm5lmiyOHfdPg9+o+hWr6tcfRdS7tHXnImg/2wtogLzlW2eEmr0J7j6ZrZvaWOLiJbxQ=="
},
"Microsoft.Extensions.Hosting.Abstractions": {
"type": "CentralTransitive",
"requested": "[6.0.0, )",
"resolved": "6.0.0",
"contentHash": "GcT5l2CYXL6Sa27KCSh0TixsRfADUgth+ojQSD5EkzisZxmGFh7CwzkcYuGwvmXLjr27uWRNrJ2vuuEjMhU05Q==",
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "6.0.0",
"Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0",
"Microsoft.Extensions.FileProviders.Abstractions": "6.0.0"
}
},
"Microsoft.Extensions.Logging.Abstractions": {
"type": "CentralTransitive",
"requested": "[6.0.0, )",
"resolved": "6.0.0",
"contentHash": "/HggWBbTwy8TgebGSX5DBZ24ndhzi93sHUBDvP1IxbZD7FDokYzdAr6+vbWGjw2XAfR2EJ1sfKUotpjHnFWPxA=="
},
"Microsoft.Extensions.Options": {
"type": "CentralTransitive",
"requested": "[6.0.0, )",
"resolved": "6.0.0",
"contentHash": "dzXN0+V1AyjOe2xcJ86Qbo233KHuLEY0njf/P2Kw8SfJU+d45HNS2ctJdnEnrWbM9Ye2eFgaC5Mj9otRMU6IsQ==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0",
"Microsoft.Extensions.Primitives": "6.0.0"
}
},
"Microsoft.Toolkit.HighPerformance": {
"type": "CentralTransitive",
"requested": "[7.1.1, )",
"resolved": "7.1.1",
"contentHash": "TRnvDpZPXO30hTOtjfLw6Y9BtTKtTpzk9lefeh4RMCaUihWrVKQR454nYH4/mMJAh+LXqfAPyk0kfkJs0Amopw=="
},
"NetFabric.Hyperlinq": {
"type": "CentralTransitive",
"requested": "[3.0.0-beta48, )",
"resolved": "3.0.0-beta48",
"contentHash": "oYUhXvxNS8bBJWqNkvx5g8y0P/0LtyqS2pN0w4OWjVDNWEpLbdbvPy9w/9z1n2PrqIjX3jxUsEnoCmxxGnI3gw==",
"dependencies": {
"NetFabric.Hyperlinq.Abstractions": "1.3.0",
"System.Buffers": "4.5.1",
"System.Runtime.CompilerServices.Unsafe": "5.0.0"
}
},
"OrtKISharp": {
"type": "CentralTransitive",
"requested": "[0.0.2, )",
"resolved": "0.0.2",
"contentHash": "q8j0yR5836Zhv9WB9BFkQt1UaEFyibq8bqJcTiULlILF6/sz8z7Wy2N8sgYdDKsdW25zncIz7j6IDbKM5ynePg==",
"dependencies": {
"libortki": "0.0.2"
}
},
"Singulink.Collections.Weak": {
"type": "CentralTransitive",
"requested": "[1.0.2, )",
"resolved": "1.0.2",
"contentHash": "giLAHrjJe0Bh7yhNexR6pmcv02+Fi+lEPxQVdB8zvkuJCmy6rnqu8CZLIpxrUfLcWDuTCSiK0IfGmMhig3UDhA=="
},
"System.Reactive": {
"type": "CentralTransitive",
"requested": "[5.0.0, )",
"resolved": "5.0.0",
"contentHash": "erBZjkQHWL9jpasCE/0qKAryzVBJFxGHVBAvgRN1bzM0q2s1S4oYREEEL0Vb+1kA/6BKb5FjUZMp5VXmy+gzkQ=="
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public StackVMFunctionBuilder(uint id, SectionManager sectionManager)
_textEmitter = new StackVMEmitter(TextWriter);
}

protected override ILinkableFunction CreateLinkableFunction(uint id, BaseFunction callable, IReadOnlyList<FunctionRef> functionRefs, byte[] text)
protected override ILinkableFunction CreateLinkableFunction(uint id, BaseFunction callable, IReadOnlyList<FunctionRef> functionRefs, Stream text)
{
return new StackVMLinkableFunction(id, callable, functionRefs, _localsAllocator.MaxCount, text, _context.CustomCallModules);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Nncase.CodeGen.StackVM;

internal class StackVMLinkableFunction : ILinkableFunction
{
public StackVMLinkableFunction(uint id, BaseFunction sourceFunction, IEnumerable<FunctionRef> functionRefs, ushort maxLocals, byte[] text, IReadOnlySet<ModuleType> custom_call_modules)
public StackVMLinkableFunction(uint id, BaseFunction sourceFunction, IEnumerable<FunctionRef> functionRefs, ushort maxLocals, Stream text, IReadOnlySet<ModuleType> custom_call_modules)
{
Id = id;
SourceFunction = sourceFunction;
Expand All @@ -30,7 +30,7 @@ public StackVMLinkableFunction(uint id, BaseFunction sourceFunction, IEnumerable

public ushort MaxLocals { get; }

public byte[] Text { get; }
public Stream Text { get; }

public IReadOnlyList<ILinkedSection> Sections => Array.Empty<ILinkedSection>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public StackVMLinkableModule(IReadOnlyList<ILinkableFunction> functions, Section
}
}

protected override ILinkedModule CreateLinkedModule(IReadOnlyList<LinkedFunction> linkedFunctions, byte[] text)
protected override ILinkedModule CreateLinkedModule(IReadOnlyList<LinkedFunction> linkedFunctions, Stream text)
{
return new StackVMLinkedModule(
linkedFunctions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Nncase.CodeGen.StackVM;

internal class StackVMLinkedModule : ILinkedModule
{
public StackVMLinkedModule(IReadOnlyList<LinkedFunction> functions, byte[] text, byte[]? rdata, byte[]? custom_calls)
public StackVMLinkedModule(IReadOnlyList<LinkedFunction> functions, Stream text, Stream? rdata, Stream? custom_calls)
{
Functions = functions;
Sections = new[]
Expand Down
Loading