Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
382 commits
Select commit Hold shift + click to select a range
ac81345
auto convert int, str, float
tqchen Mar 29, 2025
ab5bedd
[FFI] Add string traits via fallback
tqchen Mar 29, 2025
75b2ae6
fix wip
tqchen Mar 29, 2025
05ccf41
[FFI] lint
tqchen Mar 29, 2025
b606cf7
lint
tqchen Mar 29, 2025
e5af897
enable primexpr overload
tqchen Mar 29, 2025
f23caa8
[FFI] Add FallbackTypeTraits testcases
tqchen Mar 29, 2025
fa5d14d
[FFI] lint
tqchen Mar 29, 2025
5f1eff8
[FFI] more testcases on function value conversion
tqchen Mar 29, 2025
8929ea6
wip through arith tests
tqchen Mar 29, 2025
9a66803
[FFI] WIP through optional
tqchen Mar 30, 2025
f7c3187
Update optional
tqchen Mar 30, 2025
69dcdd6
[FFI] Fix traceback with empty filename
tqchen Mar 30, 2025
82bf364
[FFI] Formalize and adopt Optional throughout the codebase
tqchen Mar 30, 2025
9cc3d9c
[FFI] Cleanup Any
tqchen Mar 30, 2025
d0ec2a8
update wip
tqchen Mar 30, 2025
9b41c1e
[FFI] lint
tqchen Mar 30, 2025
b8a3b11
update wip
tqchen Mar 30, 2025
fa59ba6
[FFI] Remove Any traits for ObjectPtr so it can be kept internal
tqchen Mar 30, 2025
2200a89
wip cross check mem safety
tqchen Mar 30, 2025
bc4e3f4
[FFI] change back to let optional always generate fresh value for safety
tqchen Mar 30, 2025
6e53304
change back dataflow expr
tqchen Mar 30, 2025
718dcc6
[FFI] Keep Optional<T> only for data structure for now and use std::o…
tqchen Mar 30, 2025
a37e7f4
Fix primexpr conversion and legacy convert
tqchen Mar 30, 2025
92fc1e2
[FFI] Refactor to formalize container any storage policy
tqchen Mar 30, 2025
46bdecc
fix dtype type traits
tqchen Mar 30, 2025
ba2192b
WIP through arith
tqchen Mar 31, 2025
1890f02
[FFI] Introduce Tuple support
tqchen Apr 1, 2025
203d895
[FFI] Cleanup the functions in unsafe namespace
tqchen Apr 1, 2025
3b3991e
Update per latest update
tqchen Apr 1, 2025
bada4a6
[FFI] Introduce RValueRef for object type
tqchen Apr 2, 2025
6c44df1
work through base
tqchen Apr 2, 2025
939c274
lint
tqchen Apr 2, 2025
77cb618
wip tir-base
tqchen Apr 2, 2025
6a4fe89
error hanlding patch
tqchen Apr 2, 2025
ca595e9
[FFI] Make Traceback argument order consistent with appearance order
tqchen Apr 2, 2025
5a3b5f0
WIP error migration
tqchen Apr 2, 2025
6bade6c
wip target migration
tqchen Apr 2, 2025
70331d3
[FFI] Traceback consistent with python
tqchen Apr 3, 2025
598116c
wip through error
tqchen Apr 3, 2025
17b6d59
Remove backup files
tqchen Apr 3, 2025
1d09ef4
[FFI] Introduce GetGlobalRequired
tqchen Apr 3, 2025
f33342f
lint
tqchen Apr 3, 2025
f952def
fix logging compact
tqchen Apr 4, 2025
e4ba1f3
upgrade target
tqchen Apr 4, 2025
cd4ea68
upgrade target
tqchen Apr 4, 2025
b35eca4
fix target
tqchen Apr 4, 2025
c1b5bff
fix target and phase out box value
tqchen Apr 4, 2025
c49b882
fix through printer stmt
tqchen Apr 4, 2025
7b77d60
Update test
tqchen Apr 4, 2025
da0f6c9
[FFI] Add builtin types to dyn type table query
tqchen Apr 4, 2025
a283a9b
[FFI] Add static_field_type_index here
tqchen Apr 4, 2025
0d6638a
work on cpptests, need to visit one case
tqchen Apr 4, 2025
6a80177
[FFI] Improve to ensure array.map have uniqueness
tqchen Apr 4, 2025
342bbda
[FFI] Add reflection to runtime type index
tqchen Apr 5, 2025
417813b
upgrade target handling
tqchen Apr 5, 2025
29eab98
[FFI] minor object error report
tqchen Apr 5, 2025
09c1bdb
[FFI] Update cast to be any aware
tqchen Apr 5, 2025
1d19cef
Fix up target
tqchen Apr 5, 2025
d49a805
fix up serialization
tqchen Apr 5, 2025
d52ac57
push through script printer
tqchen Apr 5, 2025
dab840c
fix struct hash/equal
tqchen Apr 5, 2025
c1c0ba7
Move towards pod attribute in mod and func
tqchen Apr 5, 2025
7d68ed5
Fix trace
tqchen Apr 5, 2025
204f20e
Fix op registeration
tqchen Apr 5, 2025
530c3b2
Fix vk target
tqchen Apr 5, 2025
c20cb87
minor fix
tqchen Apr 5, 2025
932fde5
BUGfix reflection.cc
tqchen Apr 6, 2025
9a9caaf
Fix attribute values for tir-transform
tqchen Apr 6, 2025
e8e8f67
Fix compile, need also update from the ffi side
tqchen Apr 6, 2025
7d32741
Fix up attr setup
tqchen Apr 6, 2025
11e7567
Fix schedule setup attr
tqchen Apr 6, 2025
fbba142
Fix rvalue passing in passes via std::function
tqchen Apr 6, 2025
ff192f0
Fix for ir tests
tqchen Apr 6, 2025
819b4b1
wip through schedule
tqchen Apr 6, 2025
736d358
fix schedule bug introduced in refactor
tqchen Apr 6, 2025
2677349
[FFI] Support move from any
tqchen Apr 6, 2025
e98126a
Fix codegen
tqchen Apr 6, 2025
6122a3c
Fix save
tqchen Apr 7, 2025
1a9237a
Fix through runtime, rpc wip
tqchen Apr 7, 2025
214439c
Fix through rpc
tqchen Apr 7, 2025
fea731e
lint
tqchen Apr 7, 2025
305f311
Pass runtime
tqchen Apr 7, 2025
27d9f15
Backward compact ms
tqchen Apr 7, 2025
a17dd19
Fix MS Getvalue bug
tqchen Apr 8, 2025
725a1f5
fix ms replytrace
tqchen Apr 8, 2025
c15094a
WIP through MS, some last items
tqchen Apr 8, 2025
d1d3f57
Fix disco nccl and vm bultin
tqchen Apr 8, 2025
ec53c5d
Fix through MS
tqchen Apr 8, 2025
04fa035
Fix target
tqchen Apr 9, 2025
f0c198d
Fix tvmscript
tqchen Apr 9, 2025
e2d3f53
WIP through relax
tqchen Apr 9, 2025
f55c7e9
Fix relax wip
tqchen Apr 9, 2025
58e0dd2
Dlight minor wip
tqchen Apr 9, 2025
c20cd8e
[FFI] Dtype string conversion to empty string to be consistent
tqchen Apr 9, 2025
68d8c02
[FFI] Enable general contains check and upcast
tqchen Apr 10, 2025
b3d5d7e
MS to use any trace
tqchen Apr 9, 2025
b922030
Remove attr normalize and rework tir and script
tqchen Apr 11, 2025
9e9dbf3
bugfix relax compiled
tqchen Apr 11, 2025
6862125
fix vm
tqchen Apr 11, 2025
91f3286
Fix through relax
tqchen Apr 12, 2025
362d95e
work through shape lower
tqchen Apr 12, 2025
f74d969
Move Optional<Integer> to Optional<int64_t>
tqchen Apr 12, 2025
5fcaa1d
cpplint
tqchen Apr 12, 2025
f8599a6
Optional int migration finish
tqchen Apr 12, 2025
73bf87e
Fix dynamo
tqchen Apr 12, 2025
da2a7a5
Fix full
tqchen Apr 12, 2025
d8c7fe6
fix through fuse ops
tqchen Apr 12, 2025
2662a19
Fix fuse
tqchen Apr 12, 2025
9dce8d1
fix topi reduction
tqchen Apr 12, 2025
7fc1bc1
fix fuse tir
tqchen Apr 12, 2025
cabbb76
fix transform params
tqchen Apr 12, 2025
6fe320b
fix legalize ops
tqchen Apr 12, 2025
1722592
Fix reflection
tqchen Apr 12, 2025
85eebe2
fix memplan
tqchen Apr 12, 2025
4b565aa
fix tuning
tqchen Apr 12, 2025
ee256ea
fix parser
tqchen Apr 12, 2025
386cab3
Fix MS JSON parser
tqchen Apr 12, 2025
ceeca8b
fix alteroplayout
tqchen Apr 12, 2025
e9c3d2d
fix layout free buffers
tqchen Apr 12, 2025
8c938c0
support legacy export dll
tqchen Apr 12, 2025
29275d6
cpplint
tqchen Apr 12, 2025
24dfb91
fix onnx
tqchen Apr 12, 2025
6a94483
Fix vm codegen only
tqchen Apr 12, 2025
9d80e85
fix instrument
tqchen Apr 12, 2025
1b54e01
Fix adjust matmul order
tqchen Apr 12, 2025
92938dd
Fix vm setinput
tqchen Apr 12, 2025
0a7cfef
fix te
tqchen Apr 12, 2025
17bb84e
black
tqchen Apr 12, 2025
96c18c0
fix msc and cpptests
tqchen Apr 13, 2025
69f6c46
fix lint
tqchen Apr 13, 2025
28ed202
update contrib
tqchen Apr 13, 2025
902f825
[FFI] minor update
tqchen Apr 13, 2025
33d56ea
fix through web
tqchen Apr 13, 2025
30ca554
Always return str in ffi
tqchen Apr 13, 2025
6838aeb
Legacy always returns raw string to keep things simple
tqchen Apr 13, 2025
d159e93
[FFI] Move ByteArray to be consistent on 32bit for now
tqchen Apr 13, 2025
fd6276a
[FFI] 32bit robustness
tqchen Apr 13, 2025
714c787
fix web runtime
tqchen Apr 13, 2025
d43a141
Update
tqchen Apr 13, 2025
0a2c014
[FFI] 32bit compact
tqchen Apr 13, 2025
6023e29
minor runtime fix
tqchen Apr 13, 2025
cdb5298
lint
tqchen Apr 13, 2025
bd5a18c
fix contrib items
tqchen Apr 13, 2025
fcd199c
[FFI] clarify enabled into two categories
tqchen Apr 13, 2025
432208e
lint
tqchen Apr 13, 2025
03d6ebe
[FFI] Fix backtrace when symbol needs to be detected from env
tqchen Apr 14, 2025
27b9839
[FFI] Add up more object info
tqchen Apr 14, 2025
b2afe0c
fix load params
tqchen Apr 14, 2025
f515a2b
[FFI] consistent header size and alignment across platforms
tqchen Apr 14, 2025
0e249ff
Fixup MS to ensure concrete value
tqchen Apr 14, 2025
0ea4dea
[FFI] reverts DLtensor align assert
tqchen Apr 14, 2025
b1332f0
add handle add by byteoffset
tqchen Apr 14, 2025
2068108
[CODEGEN] TVMFFIAny support in struct get/set/alloca
tqchen Apr 14, 2025
732cf8b
[CODEGEN] handle_byte_offset
tqchen Apr 14, 2025
ba1be65
Fix MS trace
tqchen Apr 16, 2025
03ce496
pylint
tqchen Apr 16, 2025
1d45f17
skip msc plugin
tqchen Apr 16, 2025
b379974
[FFI] Fix flag
tqchen Apr 17, 2025
20039c7
Fix hexagon flags
tqchen Apr 17, 2025
cc25f77
Fix hexagon build
tqchen Apr 17, 2025
0744a36
fix lin and MS
tqchen Apr 18, 2025
5b4027d
[FFI] Enhance FFI error handling
tqchen Apr 20, 2025
1da2b51
Upragde codegen callee side PackedAPI to use the latest FFI ABI
tqchen Apr 20, 2025
ad8c16c
Upgrade the caller side of ABI to make use of the latest FII
tqchen Apr 20, 2025
6cbaa4d
Upgrade error reporting mechanism ABI to new FFI.
tqchen Apr 21, 2025
99f0f53
[FFI] upgrade dlpack to v1.1
tqchen Apr 21, 2025
bd6d002
[FFI] DType support for dlpack v1.1
tqchen Apr 21, 2025
066c914
Cleanup boxed primitive
tqchen Apr 21, 2025
94a8f17
Introduce a new ffi path for dev
tqchen Apr 21, 2025
ba824f7
Fix chost caller
tqchen Apr 21, 2025
4d2d590
Fix packed api testcases
tqchen Apr 21, 2025
0c869c4
[FFI] improve traceback
tqchen Apr 21, 2025
decf77b
Fix lower call packed
tqchen Apr 22, 2025
2809adc
[FFI] Introduce Shape
tqchen Apr 22, 2025
53a8b86
migrate shape to use ffi::Shape
tqchen Apr 22, 2025
c131c78
[FFI] Make the data/size fields of ByteObjBase inline
tqchen Apr 22, 2025
6d9ea4c
Update string to make use of the new ffi::String convention
tqchen Apr 22, 2025
76062b4
fix python shape obj reg
tqchen Apr 22, 2025
5fd8676
Upgrade FFI to accept ndarray as handle
tqchen Apr 22, 2025
f3fde8a
fix structural hash and relax tir codegen
tqchen Apr 22, 2025
97e8158
[FFI] Introduce NDArray with DLPack support
tqchen Apr 22, 2025
be65ed0
NDArray migrate to new mechanism
tqchen Apr 23, 2025
06d17ce
[FFI] bool compact
tqchen Apr 24, 2025
58a3329
Upgrade GetDataSize
tqchen Apr 24, 2025
e4b7a8b
[FFI] Rename ArrayNode to ArrayObj, MapNode to MapObj
tqchen Apr 24, 2025
f6c0e94
update code after array/map node to obj rename
tqchen Apr 24, 2025
5c5ec95
[FFI] Keep name FFIModule
tqchen Apr 24, 2025
36fc88f
Upragde to keep name FFI Module
tqchen Apr 24, 2025
ad63811
[FFI] Rename GetTypeKey2Index
tqchen Apr 24, 2025
620616b
run node reflection
tqchen Apr 24, 2025
726fb76
[FFI] Create DataType helper function
tqchen Apr 25, 2025
aa69762
upgrade to dtype changes
tqchen Apr 25, 2025
5ea9be2
Setup cython basic items for new FFI
tqchen Apr 24, 2025
2761172
[FFI] Add testing
tqchen Apr 26, 2025
8a3b870
[FFI] Clarify more on safe call
tqchen Apr 26, 2025
d914bca
[FFI] Introduce Formal ErrorInfo
tqchen Apr 26, 2025
91b0223
upgrade to latest erorr abi
tqchen Apr 26, 2025
c6307c9
Cython func call with error handling
tqchen Apr 26, 2025
6d48dcb
[FFI] Device support
tqchen Apr 26, 2025
ad2fcdc
Cython Device support
tqchen Apr 26, 2025
8bfdc9e
[FFI] Fix DLPack
tqchen Apr 27, 2025
bab9d39
Cython DLPack and NDArray support
tqchen Apr 27, 2025
aeafe09
[FFI] Add container registered funcs
tqchen Apr 28, 2025
0041570
Cython all container ready
tqchen Apr 28, 2025
5eaa64c
Cython some improvement of convention
tqchen Apr 28, 2025
2323440
[FFI] update error handling
tqchen Apr 28, 2025
455db7c
Cython migrate to new error handling
tqchen Apr 28, 2025
ca9f94d
[FFI] Add CheckSignal support for long running fn
tqchen Apr 28, 2025
df9bbfe
Add check signal support
tqchen Apr 28, 2025
afa3f66
[FFI] Enable set_body_method
tqchen Apr 28, 2025
400c74a
[FFI] Isolate reflection as submodule
tqchen Apr 28, 2025
fcf0908
Update code to reflect latest changes
tqchen Apr 28, 2025
ed6e168
[FFI] More global function access utils
tqchen Apr 28, 2025
e9aa755
Swap global registry to use ffi::Function
tqchen Apr 28, 2025
2f6e390
Cython FFI module cleanup
tqchen Apr 28, 2025
063fc3e
Update to fix gpu and ffi
tqchen Apr 29, 2025
4f27f54
[FFI] Enable Map to preserve insertion order
tqchen Apr 29, 2025
37c23af
[FFI] Fix the range based child slot checking
tqchen Apr 29, 2025
62e8587
[FFI] Cython update map to conforms to abc
tqchen Apr 30, 2025
8ecbf72
[CYTHON] better traceback with cython func
tqchen Apr 30, 2025
be1b40f
[MACOS] enable backtrace for macos
tqchen Apr 30, 2025
1a03842
[WIN] Initial stab to make win ffi compile
tqchen Apr 30, 2025
b925498
[FFI] Refactor to make Any require explicit cast to value
tqchen May 1, 2025
04ad6cd
Update to enable explicit Any cast
tqchen May 1, 2025
e02cdea
[WIN] Windows support
tqchen May 2, 2025
c2842ce
[FFI] Clarify and upgrade the function ffi
tqchen May 3, 2025
ff4c500
Fix up remaining items
tqchen May 3, 2025
78ea60a
[FFI] Use stl style get for Variant/Tuple
tqchen May 3, 2025
d9fcc33
Update to reflect latest variant api
tqchen May 3, 2025
9e12846
[FFI] Unify notable object cell naming
tqchen May 3, 2025
a37f5f0
Followup testcase fixes
tqchen May 3, 2025
bfb39f3
[FFI] Enable RValue passing
tqchen May 4, 2025
6239d24
[PYTHON] Initial migration into new FFI
tqchen Apr 28, 2025
9b9df2d
[CYTHON] Update str/bytes handle support
tqchen May 4, 2025
f5c4956
Passt through tests/ir
tqchen May 4, 2025
83b32a5
Phase out asnumpy() in favor of numpy()
tqchen May 4, 2025
09829d8
Fix target and repr
tqchen May 4, 2025
16858da
Pass through tir-transform
tqchen May 4, 2025
47f7432
Pass through runtime
tqchen May 4, 2025
2a2156f
Bring custom hook to ffi layer
tqchen May 4, 2025
72fd799
Fix through relax
tqchen May 4, 2025
dc35e89
[FFI] Simplify unpack traits
tqchen May 5, 2025
fd744dc
[CYTHON] Phase out legacy FFI
tqchen May 5, 2025
b12e112
[WIN] Cleanup for win
tqchen May 5, 2025
83b52ed
Fix C codegen caller convention
tqchen May 5, 2025
ddad26f
[WIN] Remove lock to avoid mutex dep at init time
tqchen May 5, 2025
4cf0157
[FFI] Update the API to use the ByteArray API
tqchen May 5, 2025
b446008
[FFI] Make Error to be ABI invariant
tqchen May 5, 2025
8004994
misc fixes
tqchen May 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
139 changes: 52 additions & 87 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,22 @@ jobs:
run: >-
conda build --output-folder=conda/pkg conda/recipe &&
conda install tvm -c ./conda/pkg
- name: Build iOS RPC
run: |
IOS_VERSION="14.0"
CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_SYSTEM_NAME=iOS \
-DCMAKE_SYSTEM_VERSION=${IOS_VERSION} \
-DCMAKE_OSX_SYSROOT=iphonesimulator \
-DCMAKE_OSX_ARCHITECTURES=x86_64 \
-DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
-DCMAKE_BUILD_WITH_INSTALL_NAME_DIR=ON \
-DUSE_IOS_RPC=ON"

mkdir build-ios-simulator
cd build-ios-simulator
cmake .. ${CMAKE_FLAGS}
cmake --build . --target ios_rpc
# - name: Build iOS RPC
# run: |
# IOS_VERSION="14.0"
# CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=Release \
# -DCMAKE_SYSTEM_NAME=iOS \
# -DCMAKE_SYSTEM_VERSION=${IOS_VERSION} \
# -DCMAKE_OSX_SYSROOT=iphonesimulator \
# -DCMAKE_OSX_ARCHITECTURES=x86_64 \
# -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
# -DCMAKE_BUILD_WITH_INSTALL_NAME_DIR=ON \
# -DUSE_IOS_RPC=ON"
#
# mkdir build-ios-simulator
# cd build-ios-simulator
# cmake .. ${CMAKE_FLAGS}
# cmake --build . --target ios_rpc
- name: Test
shell: bash -l {0}
run: >-
Expand Down Expand Up @@ -108,74 +108,39 @@ jobs:
run: >-
python -m pytest -v tests/python/all-platform-minimal-test

# Disabled due to https://github.com/apache/tvm/issues/13950
# Windows-Static-Runtime:
# if: ${{ github.repository == 'apache/tvm' }}
# runs-on: windows-2019
# steps:
# - uses: actions/checkout@v2
# with:
# submodules: 'recursive'
# - name: Set up environment
# uses: ./.github/actions/setup
# - name: Build static TVM runtime
# shell: bash -l {0}
# run: |
# tests/scripts/task_config_build_static.sh build
# cd build
# cmake .. -A x64 -DCMAKE_CONFIGURATION_TYPES="Release"
# cmake --build . --config Release --target runtime

Linux-Static-Runtime:
if: ${{ github.repository == 'apache/tvm' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Set up environment
uses: ./.github/actions/setup
- name: Build static TVM runtime
shell: bash -l {0}
run: |
tests/scripts/task_config_build_static.sh build
cd build
cmake ..
cmake --build . --config Release --target runtime

Android:
if: ${{ github.repository == 'apache/tvm' }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Set up environment
uses: ./.github/actions/setup
- name: Set up java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
- name: Build TVM
shell: bash -l {0}
run: |
mkdir build
cd build
../tests/scripts/task_config_build_jvm.sh .
cmake ..
make
- name: Build TVM4J
run: |
make jvmpkg
- name: Build android_rpc
working-directory: apps/android_rpc
run: |
set -eux
export PATH="${ANDROID_NDK_LATEST_HOME}:$PATH"
gradle clean build
- name: Upload android_rpc APK
uses: actions/upload-artifact@v4
with:
name: android_rpc-debug.apk
path: ./apps/android_rpc/app/build/outputs/apk/debug/app-debug.apk
# Android:
# if: ${{ github.repository == 'apache/tvm' }}
# runs-on: ubuntu-22.04
# steps:
# - uses: actions/checkout@v2
# with:
# submodules: 'recursive'
# - name: Set up environment
# uses: ./.github/actions/setup
# - name: Set up java
# uses: actions/setup-java@v3
# with:
# distribution: 'zulu'
# java-version: '11'
# - name: Build TVM
# shell: bash -l {0}
# run: |
# mkdir build
# cd build
# ../tests/scripts/task_config_build_jvm.sh .
# cmake ..
# make
# - name: Build TVM4J
# run: |
# make jvmpkg
# - name: Build android_rpc
# working-directory: apps/android_rpc
# run: |
# set -eux
# export PATH="${ANDROID_NDK_LATEST_HOME}:$PATH"
# gradle clean build
# - name: Upload android_rpc APK
# uses: actions/upload-artifact@v4
# with:
# name: android_rpc-debug.apk
# path: ./apps/android_rpc/app/build/outputs/apk/debug/app-debug.apk
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@
[submodule "3rdparty/zlib"]
path = 3rdparty/zlib
url = https://github.com/madler/zlib.git
[submodule "ffi/3rdparty/dlpack"]
path = ffi/3rdparty/dlpack
url = https://github.com/dmlc/dlpack.git
2 changes: 1 addition & 1 deletion 3rdparty/cutlass_fpA_intB_gemm
43 changes: 22 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ if(MSVC)
add_definitions(-D_SCL_SECURE_NO_WARNINGS)
add_definitions(-D_ENABLE_EXTENDED_ALIGNED_STORAGE)
add_definitions(-DNOMINMAX)

# regeneration does not work well with msbuild custom rules.
set(CMAKE_SUPPRESS_REGENERATION ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
Expand Down Expand Up @@ -496,6 +495,9 @@ list(REMOVE_ITEM COMPILER_SRCS ${LIBINFO_FILE})
add_library(tvm_objs OBJECT ${COMPILER_SRCS})
add_library(tvm_runtime_objs OBJECT ${RUNTIME_SRCS})
add_library(tvm_libinfo_objs OBJECT ${LIBINFO_FILE})
target_link_libraries(tvm_objs PUBLIC tvm_ffi_header)
target_link_libraries(tvm_runtime_objs PUBLIC tvm_ffi_header)
target_link_libraries(tvm_libinfo_objs PUBLIC tvm_ffi_header)

include(GNUInstallDirs)
if(NOT BUILD_DUMMY_LIBTVM)
Expand Down Expand Up @@ -567,6 +569,9 @@ if(USE_IOS_RPC)
add_subdirectory("apps/ios_rpc")
endif()

add_subdirectory(ffi)


if(TVM_DEBUG_WITH_ABI_CHANGE)
message(STATUS "Building with debug code that may cause ABI changes...")
target_compile_definitions(tvm_objs PRIVATE "TVM_DEBUG_WITH_ABI_CHANGE")
Expand Down Expand Up @@ -602,6 +607,10 @@ endif()
target_link_libraries(tvm PRIVATE ${TVM_RUNTIME_LINKER_LIBS})
target_link_libraries(tvm_runtime PRIVATE ${TVM_RUNTIME_LINKER_LIBS})

target_link_libraries(tvm PUBLIC tvm_ffi_objs)
target_link_libraries(tvm_runtime PUBLIC tvm_ffi_objs)


if(BUILD_FOR_HEXAGON AND DEFINED USE_HEXAGON_GTEST AND EXISTS ${USE_HEXAGON_GTEST})
include(FetchContent)
FetchContent_Declare(googletest SOURCE_DIR "${USE_HEXAGON_GTEST}")
Expand Down Expand Up @@ -639,6 +648,7 @@ if (HIDE_PRIVATE_SYMBOLS AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
target_link_libraries(tvm_runtime PRIVATE ${HIDE_SYMBOLS_LINKER_FLAGS})
target_compile_definitions(tvm_allvisible PUBLIC $<TARGET_PROPERTY:tvm,INTERFACE_COMPILE_DEFINITONS>)
target_compile_definitions(tvm_allvisible PRIVATE $<TARGET_PROPERTY:tvm,COMPILE_DEFINITONS>)
target_link_libraries(tvm_allvisible PUBLIC tvm_ffi_objs)
endif()

# Create the `cpptest` target if we can find GTest. If not, we create dummy
Expand Down Expand Up @@ -696,10 +706,10 @@ if(NOT DEFINED ENV{CONDA_BUILD})
endif()

# Installation rules
install(TARGETS tvm EXPORT ${PROJECT_NAME}Targets DESTINATION lib${LIB_SUFFIX})
install(TARGETS tvm_runtime EXPORT ${PROJECT_NAME}Targets DESTINATION lib${LIB_SUFFIX})
install(TARGETS tvm DESTINATION lib${LIB_SUFFIX})
install(TARGETS tvm_runtime DESTINATION lib${LIB_SUFFIX})
if(BUILD_FOR_HEXAGON AND DEFINED USE_HEXAGON_GTEST AND EXISTS ${USE_HEXAGON_GTEST})
install(TARGETS gtest EXPORT ${PROJECT_NAME}Targets DESTINATION lib${LIB_SUFFIX})
install(TARGETS gtest DESTINATION lib${LIB_SUFFIX})
endif()

if (INSTALL_DEV)
Expand Down Expand Up @@ -734,9 +744,9 @@ string(APPEND PROJECT_CONFIG_CONTENT
"include(\"\${CMAKE_CURRENT_LIST_DIR}/${PROJECT_NAME}Targets.cmake\")")
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/temp_config_file.cmake" ${PROJECT_CONFIG_CONTENT})

install(EXPORT ${PROJECT_NAME}Targets
NAMESPACE ${PROJECT_NAME}::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
# install(EXPORT ${PROJECT_NAME}Targets
# NAMESPACE ${PROJECT_NAME}::
# DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})

# Create config for find_package()
configure_package_config_file(
Expand All @@ -750,9 +760,9 @@ install(

# More target definitions
if(MSVC)
target_compile_definitions(tvm_objs PRIVATE -DTVM_EXPORTS)
target_compile_definitions(tvm_libinfo_objs PRIVATE -DTVM_EXPORTS)
target_compile_definitions(tvm_runtime_objs PRIVATE -DTVM_EXPORTS)
target_compile_definitions(tvm_objs PRIVATE -DTVM_EXPORTS -DTVM_FFI_EXPORTS)
target_compile_definitions(tvm_libinfo_objs PRIVATE -DTVM_EXPORTS -DTVM_FFI_EXPORTS)
target_compile_definitions(tvm_runtime_objs PRIVATE -DTVM_EXPORTS -DTVM_FFI_EXPORTS)
endif()

set(TVM_IS_DEBUG_BUILD OFF)
Expand All @@ -774,17 +784,8 @@ if(TVM_IS_DEBUG_BUILD)
endif()
endif()

# Run dsymutil to generate debugging symbols for backtraces
if(APPLE AND TVM_IS_DEBUG_BUILD)
find_program(DSYMUTIL dsymutil)
mark_as_advanced(DSYMUTIL)
add_custom_command(TARGET tvm
POST_BUILD
COMMAND ${DSYMUTIL} ARGS $<TARGET_FILE:tvm>
COMMENT "Running dsymutil"
VERBATIM
)
endif()
add_dsymutil(tvm)
add_dsymutil(tvm_runtime)

if(BUILD_FOR_HEXAGON)
# Wrap pthread_create to allow setting custom stack size.
Expand Down
3 changes: 2 additions & 1 deletion apps/android_rpc/app/src/main/jni/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ LOCAL_SRC_FILES := org_apache_tvm_native_c_api.cc
LOCAL_LDFLAGS := -L$(SYSROOT)/usr/lib/ -llog

LOCAL_C_INCLUDES := $(ROOT_PATH)/include \
$(ROOT_PATH)/3rdparty/dlpack/include \
$(ROOT_PATH)/ffi/include \
$(ROOT_PATH)/ffi/3rdparty/dlpack/include \
$(ROOT_PATH)/3rdparty/dmlc-core/include \
$(ROOT_PATH)/3rdparty/OpenCL-Headers

Expand Down
9 changes: 9 additions & 0 deletions apps/android_rpc/app/src/main/jni/tvm_runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,16 @@
* Android logcat.
*/
#define TVM_LOG_CUSTOMIZE 1
#define TVM_FFI_USE_LIBBACKTRACE 0

#include "../ffi/src/ffi/container.cc"
#include "../ffi/src/ffi/dtype.cc"
#include "../ffi/src/ffi/error.cc"
#include "../ffi/src/ffi/function.cc"
#include "../ffi/src/ffi/ndarray.cc"
#include "../ffi/src/ffi/object.cc"
#include "../ffi/src/ffi/testing.cc"
#include "../ffi/src/ffi/traceback.cc"
#include "../src/runtime/c_runtime_api.cc"
#include "../src/runtime/container.cc"
#include "../src/runtime/cpu_device_api.cc"
Expand Down
70 changes: 34 additions & 36 deletions apps/cpp_rpc/rpc_env.cc
Original file line number Diff line number Diff line change
Expand Up @@ -126,46 +126,44 @@ RPCEnv::RPCEnv(const std::string& wd) {
mkdir(base_.c_str(), 0777);
}

TVM_REGISTER_GLOBAL("tvm.rpc.server.workpath").set_body([this](TVMArgs args, TVMRetValue* rv) {
*rv = this->GetPath(args[0]);
});
ffi::Function::SetGlobal(
"tvm.rpc.server.workpath",
ffi::Function::FromUnpacked([this](const std::string& path) { return this->GetPath(path); }));

TVM_REGISTER_GLOBAL("tvm.rpc.server.listdir").set_body([this](TVMArgs args, TVMRetValue* rv) {
std::string dir = this->GetPath(args[0]);
std::ostringstream os;
for (auto d : ListDir(dir)) {
os << d << ",";
}
*rv = os.str();
});

TVM_REGISTER_GLOBAL("tvm.rpc.server.load_module").set_body([this](TVMArgs args, TVMRetValue* rv) {
std::string file_name = this->GetPath(args[0]);
file_name = BuildSharedLibrary(file_name);
*rv = Module::LoadFromFile(file_name, "");
LOG(INFO) << "Load module from " << file_name << " ...";
});
ffi::Function::SetGlobal("tvm.rpc.server.listdir",
ffi::Function::FromUnpacked([this](const std::string& path) {
std::string dir = this->GetPath(path);
std::ostringstream os;
for (auto d : ListDir(dir)) {
os << d << ",";
}
return os.str();
}));

TVM_REGISTER_GLOBAL("tvm.rpc.server.download_linked_module")
.set_body([this](TVMArgs args, TVMRetValue* rv) {
std::string file_name = this->GetPath(args[0]);
file_name = BuildSharedLibrary(file_name);
std::string bin;
ffi::Function::SetGlobal("tvm.rpc.server.load_module",
ffi::Function::FromUnpacked([this](const std::string& path) {
std::string file_name = this->GetPath(path);
file_name = BuildSharedLibrary(file_name);
LOG(INFO) << "Load module from " << file_name << " ...";
return Module::LoadFromFile(file_name, "");
}));

std::ifstream fs(file_name, std::ios::in | std::ios::binary);
ICHECK(!fs.fail()) << "Cannot open " << file_name;
fs.seekg(0, std::ios::end);
size_t size = static_cast<size_t>(fs.tellg());
fs.seekg(0, std::ios::beg);
bin.resize(size);
fs.read(dmlc::BeginPtr(bin), size);
ffi::Function::SetGlobal("tvm.rpc.server.download_linked_module",
ffi::Function::FromUnpacked([this](const std::string& path) {
std::string file_name = this->GetPath(path);
file_name = BuildSharedLibrary(file_name);
std::string bin;

TVMByteArray binarr;
binarr.data = bin.data();
binarr.size = bin.length();
*rv = binarr;
LOG(INFO) << "Send linked module " << file_name << " to client";
});
std::ifstream fs(file_name, std::ios::in | std::ios::binary);
ICHECK(!fs.fail()) << "Cannot open " << file_name;
fs.seekg(0, std::ios::end);
size_t size = static_cast<size_t>(fs.tellg());
fs.seekg(0, std::ios::beg);
bin.resize(size);
fs.read(dmlc::BeginPtr(bin), size);
LOG(INFO) << "Send linked module " << file_name << " to client";
return ffi::Bytes(bin);
}));
}
/*!
* \brief GetPath To get the work path from packed function
Expand Down
4 changes: 1 addition & 3 deletions apps/cpp_rpc/rpc_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,6 @@ void RPCServerCreate(std::string host, int port, int port_end, std::string track
rpc.Start();
}

TVM_REGISTER_GLOBAL("rpc.ServerCreate").set_body([](TVMArgs args, TVMRetValue* rv) {
RPCServerCreate(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
});
TVM_REGISTER_GLOBAL("rpc.ServerCreate").set_body_typed(RPCServerCreate);
} // namespace runtime
} // namespace tvm
Loading