Skip to content

Commit

Permalink
添加 doc/vta
Browse files Browse the repository at this point in the history
  • Loading branch information
xinetzone committed Sep 25, 2023
1 parent 8c3371d commit ab6fd82
Show file tree
Hide file tree
Showing 25 changed files with 2,262 additions and 124 deletions.
179 changes: 86 additions & 93 deletions doc/deploy/build.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -62,7 +62,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -81,7 +81,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -98,7 +98,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -116,7 +116,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -136,7 +136,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -155,7 +155,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -171,7 +171,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -190,7 +190,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 11,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -947,114 +947,107 @@
"!20 = !{!\"ctx_ptr\", !21, i64 0}\n",
"!21 = !{!\"tvm-tbaa\"}\n",
"!22 = !{!23, !23, i64 0}\n",
"!23 = !{!\"0x4bcbc20.w4.b0\", !24, i64 0}\n",
"!24 = !{!\"0x4bcbc20.w8.b0\", !25, i64 0}\n",
"!25 = !{!\"0x4bcbc20.w16.b0\", !26, i64 0}\n",
"!26 = !{!\"0x4bcbc20.w32.b0\", !27, i64 0}\n",
"!27 = !{!\"0x4bcbc20.w64.b0\", !28, i64 0}\n",
"!28 = !{!\"0x4bcbc20.w128.b0\", !29, i64 0}\n",
"!29 = !{!\"0x4bcbc20.w256.b0\", !30, i64 0}\n",
"!30 = !{!\"0x4bcbc20.w512.b0\", !31, i64 0}\n",
"!31 = !{!\"0x4bcbc20.w1024.b0\", !32, i64 0}\n",
"!32 = !{!\"0x4bcbc20\", !21, i64 0}\n",
"!23 = !{!\"0x4b308b0.w4.b0\", !24, i64 0}\n",
"!24 = !{!\"0x4b308b0.w8.b0\", !25, i64 0}\n",
"!25 = !{!\"0x4b308b0.w16.b0\", !26, i64 0}\n",
"!26 = !{!\"0x4b308b0.w32.b0\", !27, i64 0}\n",
"!27 = !{!\"0x4b308b0.w64.b0\", !28, i64 0}\n",
"!28 = !{!\"0x4b308b0.w128.b0\", !29, i64 0}\n",
"!29 = !{!\"0x4b308b0.w256.b0\", !30, i64 0}\n",
"!30 = !{!\"0x4b308b0.w512.b0\", !31, i64 0}\n",
"!31 = !{!\"0x4b308b0.w1024.b0\", !32, i64 0}\n",
"!32 = !{!\"0x4b308b0\", !21, i64 0}\n",
"!33 = !{!34, !34, i64 0}\n",
"!34 = !{!\"0x4bcbc20.w4.b4\", !24, i64 0}\n",
"!34 = !{!\"0x4b308b0.w4.b4\", !24, i64 0}\n",
"!35 = !{!36, !36, i64 0}\n",
"!36 = !{!\"0x4bcbc20.w4.b8\", !37, i64 0}\n",
"!37 = !{!\"0x4bcbc20.w8.b8\", !25, i64 0}\n",
"!36 = !{!\"0x4b308b0.w4.b8\", !37, i64 0}\n",
"!37 = !{!\"0x4b308b0.w8.b8\", !25, i64 0}\n",
"!38 = !{!39, !39, i64 0}\n",
"!39 = !{!\"0x342c800.w8.b0\", !40, i64 0}\n",
"!40 = !{!\"0x342c800.w16.b0\", !41, i64 0}\n",
"!41 = !{!\"0x342c800.w32.b0\", !42, i64 0}\n",
"!42 = !{!\"0x342c800.w64.b0\", !43, i64 0}\n",
"!43 = !{!\"0x342c800.w128.b0\", !44, i64 0}\n",
"!44 = !{!\"0x342c800.w256.b0\", !45, i64 0}\n",
"!45 = !{!\"0x342c800.w512.b0\", !46, i64 0}\n",
"!46 = !{!\"0x342c800.w1024.b0\", !47, i64 0}\n",
"!47 = !{!\"0x342c800\", !21, i64 0}\n",
"!39 = !{!\"0x4c2e650.w8.b0\", !40, i64 0}\n",
"!40 = !{!\"0x4c2e650.w16.b0\", !41, i64 0}\n",
"!41 = !{!\"0x4c2e650.w32.b0\", !42, i64 0}\n",
"!42 = !{!\"0x4c2e650.w64.b0\", !43, i64 0}\n",
"!43 = !{!\"0x4c2e650.w128.b0\", !44, i64 0}\n",
"!44 = !{!\"0x4c2e650.w256.b0\", !45, i64 0}\n",
"!45 = !{!\"0x4c2e650.w512.b0\", !46, i64 0}\n",
"!46 = !{!\"0x4c2e650.w1024.b0\", !47, i64 0}\n",
"!47 = !{!\"0x4c2e650\", !21, i64 0}\n",
"!48 = !{!49, !49, i64 0}\n",
"!49 = !{!\"0x342c800.w8.b8\", !40, i64 0}\n",
"!49 = !{!\"0x4c2e650.w8.b8\", !40, i64 0}\n",
"!50 = !{!\"branch_weights\", i32 1, i32 1048576}\n",
"!51 = !{!52, !52, i64 0}\n",
"!52 = !{!\"0x4bce400.w8.b0\", !53, i64 0}\n",
"!53 = !{!\"0x4bce400.w16.b0\", !54, i64 0}\n",
"!54 = !{!\"0x4bce400.w32.b0\", !55, i64 0}\n",
"!55 = !{!\"0x4bce400.w64.b0\", !56, i64 0}\n",
"!56 = !{!\"0x4bce400.w128.b0\", !57, i64 0}\n",
"!57 = !{!\"0x4bce400.w256.b0\", !58, i64 0}\n",
"!58 = !{!\"0x4bce400.w512.b0\", !59, i64 0}\n",
"!59 = !{!\"0x4bce400.w1024.b0\", !60, i64 0}\n",
"!60 = !{!\"0x4bce400\", !21, i64 0}\n",
"!52 = !{!\"0x4c154b0.w8.b0\", !53, i64 0}\n",
"!53 = !{!\"0x4c154b0.w16.b0\", !54, i64 0}\n",
"!54 = !{!\"0x4c154b0.w32.b0\", !55, i64 0}\n",
"!55 = !{!\"0x4c154b0.w64.b0\", !56, i64 0}\n",
"!56 = !{!\"0x4c154b0.w128.b0\", !57, i64 0}\n",
"!57 = !{!\"0x4c154b0.w256.b0\", !58, i64 0}\n",
"!58 = !{!\"0x4c154b0.w512.b0\", !59, i64 0}\n",
"!59 = !{!\"0x4c154b0.w1024.b0\", !60, i64 0}\n",
"!60 = !{!\"0x4c154b0\", !21, i64 0}\n",
"!61 = !{!62, !62, i64 0}\n",
"!62 = !{!\"0x4bce400.w8.b8\", !53, i64 0}\n",
"!62 = !{!\"0x4c154b0.w8.b8\", !53, i64 0}\n",
"!63 = !{!64, !64, i64 0}\n",
"!64 = !{!\"0x4d29ca0.w8.b0\", !65, i64 0}\n",
"!65 = !{!\"0x4d29ca0.w16.b0\", !66, i64 0}\n",
"!66 = !{!\"0x4d29ca0.w32.b0\", !67, i64 0}\n",
"!67 = !{!\"0x4d29ca0.w64.b0\", !68, i64 0}\n",
"!68 = !{!\"0x4d29ca0.w128.b0\", !69, i64 0}\n",
"!69 = !{!\"0x4d29ca0.w256.b0\", !70, i64 0}\n",
"!70 = !{!\"0x4d29ca0.w512.b0\", !71, i64 0}\n",
"!71 = !{!\"0x4d29ca0.w1024.b0\", !72, i64 0}\n",
"!72 = !{!\"0x4d29ca0\", !21, i64 0}\n",
"!64 = !{!\"0x4ce8170.w8.b0\", !65, i64 0}\n",
"!65 = !{!\"0x4ce8170.w16.b0\", !66, i64 0}\n",
"!66 = !{!\"0x4ce8170.w32.b0\", !67, i64 0}\n",
"!67 = !{!\"0x4ce8170.w64.b0\", !68, i64 0}\n",
"!68 = !{!\"0x4ce8170.w128.b0\", !69, i64 0}\n",
"!69 = !{!\"0x4ce8170.w256.b0\", !70, i64 0}\n",
"!70 = !{!\"0x4ce8170.w512.b0\", !71, i64 0}\n",
"!71 = !{!\"0x4ce8170.w1024.b0\", !72, i64 0}\n",
"!72 = !{!\"0x4ce8170\", !21, i64 0}\n",
"!73 = !{!74, !74, i64 0}\n",
"!74 = !{!\"0x4d29ca0.w8.b8\", !65, i64 0}\n",
"!74 = !{!\"0x4ce8170.w8.b8\", !65, i64 0}\n",
"!75 = !{!76, !76, i64 0}\n",
"!76 = !{!\"0x4eabdc0.w8.b0\", !77, i64 0}\n",
"!77 = !{!\"0x4eabdc0.w16.b0\", !78, i64 0}\n",
"!78 = !{!\"0x4eabdc0.w32.b0\", !79, i64 0}\n",
"!79 = !{!\"0x4eabdc0.w64.b0\", !80, i64 0}\n",
"!80 = !{!\"0x4eabdc0.w128.b0\", !81, i64 0}\n",
"!81 = !{!\"0x4eabdc0.w256.b0\", !82, i64 0}\n",
"!82 = !{!\"0x4eabdc0.w512.b0\", !83, i64 0}\n",
"!83 = !{!\"0x4eabdc0.w1024.b0\", !84, i64 0}\n",
"!84 = !{!\"0x4eabdc0\", !21, i64 0}\n",
"!76 = !{!\"0x4c4bfb0.w8.b0\", !77, i64 0}\n",
"!77 = !{!\"0x4c4bfb0.w16.b0\", !78, i64 0}\n",
"!78 = !{!\"0x4c4bfb0.w32.b0\", !79, i64 0}\n",
"!79 = !{!\"0x4c4bfb0.w64.b0\", !80, i64 0}\n",
"!80 = !{!\"0x4c4bfb0.w128.b0\", !81, i64 0}\n",
"!81 = !{!\"0x4c4bfb0.w256.b0\", !82, i64 0}\n",
"!82 = !{!\"0x4c4bfb0.w512.b0\", !83, i64 0}\n",
"!83 = !{!\"0x4c4bfb0.w1024.b0\", !84, i64 0}\n",
"!84 = !{!\"0x4c4bfb0\", !21, i64 0}\n",
"!85 = !{!86, !86, i64 0}\n",
"!86 = !{!\"0x4eabdc0.w8.b8\", !77, i64 0}\n",
"!86 = !{!\"0x4c4bfb0.w8.b8\", !77, i64 0}\n",
"!87 = !{!88, !88, i64 0}\n",
"!88 = !{!\"0x5075980.w8.b0\", !89, i64 0}\n",
"!89 = !{!\"0x5075980.w16.b0\", !90, i64 0}\n",
"!90 = !{!\"0x5075980.w32.b0\", !91, i64 0}\n",
"!91 = !{!\"0x5075980.w64.b0\", !92, i64 0}\n",
"!92 = !{!\"0x5075980.w128.b0\", !93, i64 0}\n",
"!93 = !{!\"0x5075980.w256.b0\", !94, i64 0}\n",
"!94 = !{!\"0x5075980.w512.b0\", !95, i64 0}\n",
"!95 = !{!\"0x5075980.w1024.b0\", !96, i64 0}\n",
"!96 = !{!\"0x5075980\", !21, i64 0}\n",
"!88 = !{!\"0x4c63e90.w8.b0\", !89, i64 0}\n",
"!89 = !{!\"0x4c63e90.w16.b0\", !90, i64 0}\n",
"!90 = !{!\"0x4c63e90.w32.b0\", !91, i64 0}\n",
"!91 = !{!\"0x4c63e90.w64.b0\", !92, i64 0}\n",
"!92 = !{!\"0x4c63e90.w128.b0\", !93, i64 0}\n",
"!93 = !{!\"0x4c63e90.w256.b0\", !94, i64 0}\n",
"!94 = !{!\"0x4c63e90.w512.b0\", !95, i64 0}\n",
"!95 = !{!\"0x4c63e90.w1024.b0\", !96, i64 0}\n",
"!96 = !{!\"0x4c63e90\", !21, i64 0}\n",
"!97 = !{!98, !98, i64 0}\n",
"!98 = !{!\"0x5075980.w8.b8\", !89, i64 0}\n",
"!98 = !{!\"0x4c63e90.w8.b8\", !89, i64 0}\n",
"!99 = !{!100, !100, i64 0}\n",
"!100 = !{!\"0x4afbc10.w8.b0\", !101, i64 0}\n",
"!101 = !{!\"0x4afbc10.w16.b0\", !102, i64 0}\n",
"!102 = !{!\"0x4afbc10.w32.b0\", !103, i64 0}\n",
"!103 = !{!\"0x4afbc10.w64.b0\", !104, i64 0}\n",
"!104 = !{!\"0x4afbc10.w128.b0\", !105, i64 0}\n",
"!105 = !{!\"0x4afbc10.w256.b0\", !106, i64 0}\n",
"!106 = !{!\"0x4afbc10.w512.b0\", !107, i64 0}\n",
"!107 = !{!\"0x4afbc10.w1024.b0\", !108, i64 0}\n",
"!108 = !{!\"0x4afbc10\", !21, i64 0}\n",
"!100 = !{!\"0x4b45120.w8.b0\", !101, i64 0}\n",
"!101 = !{!\"0x4b45120.w16.b0\", !102, i64 0}\n",
"!102 = !{!\"0x4b45120.w32.b0\", !103, i64 0}\n",
"!103 = !{!\"0x4b45120.w64.b0\", !104, i64 0}\n",
"!104 = !{!\"0x4b45120.w128.b0\", !105, i64 0}\n",
"!105 = !{!\"0x4b45120.w256.b0\", !106, i64 0}\n",
"!106 = !{!\"0x4b45120.w512.b0\", !107, i64 0}\n",
"!107 = !{!\"0x4b45120.w1024.b0\", !108, i64 0}\n",
"!108 = !{!\"0x4b45120\", !21, i64 0}\n",
"!109 = !{!110, !110, i64 0}\n",
"!110 = !{!\"0x4afbc10.w8.b8\", !101, i64 0}\n",
"!110 = !{!\"0x4b45120.w8.b8\", !101, i64 0}\n",
"!111 = !{!112, !112, i64 0}\n",
"!112 = !{!\"0x49f16f0\", !21, i64 0}\n",
"!112 = !{!\"0x4ca5fd0\", !21, i64 0}\n",
"!113 = !{!114, !114, i64 0}\n",
"!114 = !{!\"0x4d7dbe0\", !21, i64 0}\n",
"!114 = !{!\"0x4b9ce30\", !21, i64 0}\n",
"!115 = !{!116, !116, i64 0}\n",
"!116 = !{!\"0x4aa1a30\", !21, i64 0}\n",
"!116 = !{!\"0x4c9f880\", !21, i64 0}\n",
"\n"
]
}
],
"source": [
"print(compiled_lib.lib.get_source())"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -1073,7 +1066,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.9"
"version": "3.10.12"
},
"orig_nbformat": 4,
"vscode": {
Expand Down
40 changes: 33 additions & 7 deletions doc/deploy/get_source.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,17 @@
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"/media/pc/data/lxw/ai/tvm\n"
]
}
],
"source": [
"import set_env\n",
"import numpy as np\n",
"import tvm\n",
"from tvm import relay"
Expand All @@ -22,12 +31,29 @@
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/html": [
"<div class=\"highlight\" style=\"background: \"><pre style=\"line-height: 125%;\"><span></span><span style=\"color: #008000; font-weight: bold\">def</span> <span style=\"color: #AA22FF\">@main</span>(<span style=\"color: #AA22FF; font-weight: bold\">%</span>x: Tensor[(<span style=\"color: #008000\">1</span>), float32], <span style=\"color: #AA22FF; font-weight: bold\">%</span>y: Tensor[(<span style=\"color: #008000\">1</span>), float32]) {\n",
" add(<span style=\"color: #AA22FF; font-weight: bold\">%</span>x, <span style=\"color: #AA22FF; font-weight: bold\">%</span>y)\n",
"}\n",
"</pre></div>\n"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"x = relay.var(\"x\", shape=(2,), dtype=\"float32\")\n",
"y = relay.var(\"y\", shape=(2,), dtype=\"float32\")\n",
"params = {\"y\": np.ones((2,), dtype=\"float32\")}\n",
"mod = tvm.IRModule.from_expr(relay.Function([x, y], x + y))"
"x = relay.var(\"x\", shape=(1,), dtype=\"float32\")\n",
"y = relay.var(\"y\", shape=(1,), dtype=\"float32\")\n",
"params = {\"y\": np.ones((1,), dtype=\"float32\")}\n",
"mod = tvm.IRModule.from_expr(relay.Function([x, y], x + y))\n",
"mod.show()"
]
},
{
Expand Down Expand Up @@ -79,7 +105,7 @@
" }\n",
" if (!(tvmgen_default_fused_add_T_add_strides == NULL)) {\n",
" }\n",
" *(float2*)(((float*)T_add_1) + 0) = (*(float2*)(((float*)p0_1) + 0) + *(float2*)(((float*)p1_1) + 0));\n",
" ((float*)T_add_1)[0] = (((float*)p0_1)[0] + ((float*)p1_1)[0]);\n",
" return 0;\n",
"}\n",
"\n",
Expand Down
17 changes: 0 additions & 17 deletions doc/tutorials/basic/tests/python/tvm_ext/__init__.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

"""TVM 扩展包示例"""
# 首先导入 TVM 以获取库 symbols
from . import set_env
4 changes: 2 additions & 2 deletions doc/tutorials/basic/tests/src/tvm_ext.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using namespace tvm::runtime;


// 参考:https://daobook.github.io/tvm/docs/arch/runtime.html
// 参考:https://xinetzone.github.io/tvm/docs/arch/runtime.html
void MyAdd(TVMArgs args, TVMRetValue* rv) {
// 自动将参数转换为所需的类型。
int a = args[0];
Expand All @@ -19,4 +19,4 @@ TVM_REGISTER_GLOBAL("callhello")
.set_body([](TVMArgs args, TVMRetValue* rv) {
PackedFunc f = args[0];
f("hello world");
});
});
2 changes: 1 addition & 1 deletion doc/tutorials/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ frontend/index
transform/index
../quantize/index
relay/index
vta/index
../vta/index
relax/index
tedd/index
datasets/index
Expand Down
2 changes: 0 additions & 2 deletions doc/tutorials/vta/ops/index.md

This file was deleted.

Loading

0 comments on commit ab6fd82

Please sign in to comment.