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

単一マイグレーションと異種マイグレーションのdiff #11

Draft
wants to merge 101 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
e478f84
Add opcode log functions
funera1 Oct 9, 2023
7d123f5
Fix typo
funera1 Oct 9, 2023
9daf11a
init dispatch_limit to -1
funera1 Oct 9, 2023
1a68332
WIP: Add dump functions for wamr
funera1 Oct 11, 2023
8ef781c
WIP: dump program counter for wamr
funera1 Oct 13, 2023
8a4f212
WasmEdgeのプログラムカウンタをWAMRのプログラムカウンタのオフセットに変換するための関数を実装
funera1 Oct 13, 2023
b0b5474
WAMR向けProgramCounter dump関数の実装
funera1 Oct 13, 2023
156b73f
WIP: Add dumpFrames
funera1 Oct 13, 2023
ccc4ae0
frameごとのlpとspの中身のdump
funera1 Oct 17, 2023
b7e3d49
ControlStackの生成
funera1 Oct 17, 2023
62bb17f
dump Frame for WAMR
funera1 Oct 17, 2023
8d6f5c9
dump frame for wamr微修正
funera1 Oct 17, 2023
9bd850c
dump frame for wamr. addr.imgも吐き出す
funera1 Oct 17, 2023
6c65f53
TypeStackに32bit or 64bitの情報以外が入るバグを修正
funera1 Oct 17, 2023
d7d3ea2
Add debug info
funera1 Oct 17, 2023
a0aece6
Add debug info
funera1 Oct 18, 2023
72bf532
frame.imgのfile formatを修正
funera1 Oct 18, 2023
8c6026b
Add addrs.img dump
funera1 Oct 18, 2023
4765469
localとstackの個数を修正
funera1 Oct 18, 2023
27347bc
Refactor: dumpFrameのファイル出力部分を関数にまとめた
funera1 Oct 19, 2023
09eb280
Refactor: 改行等を修正
funera1 Oct 19, 2023
3930ac3
wamrとwasmedge間でプログラムカウンタのオフセットを変換する機構を既存のInstr.Offsetを用いて実装
funera1 Oct 19, 2023
0799f74
WIP: cspのbegin_addr, target_addr修正
funera1 Oct 19, 2023
22965b7
WIP: frameでダンプする情報を修正中
funera1 Oct 19, 2023
0b5efa4
wasmedge2wamrでマイグレーションできた
funera1 Oct 19, 2023
04062ab
マイグレーションのバグを修正
funera1 Oct 19, 2023
afab038
WIP
funera1 Oct 20, 2023
e3fa87d
間違えてビルドしてできたファイルを削除
funera1 Oct 20, 2023
1445d49
WIP
funera1 Oct 20, 2023
3209c51
localは型が変わらないので、local.setとlocal.teeで型スタックの更新をするのをやめた
funera1 Oct 20, 2023
e410780
print debug必要なさそうなの一旦コメントアウト
funera1 Oct 20, 2023
9a4dd45
Select, SelectTの型スタック対応. loop.wasmのマイグレーションはできた
funera1 Oct 20, 2023
b9e6df1
sqlite.wasm動いた
funera1 Oct 20, 2023
a1eda25
Merge pull request #9 from oss-fun/migration_debug_2
funera1 Oct 20, 2023
15288eb
Merge pull request #6 from oss-fun/migration_wasmedge2wamr_debug
funera1 Oct 20, 2023
e0ebf62
First commit
funera1 Nov 5, 2023
1c49268
optionからsnapshotをするようにした
funera1 Nov 5, 2023
e10463f
Merge pull request #10 from oss-fun/no-dump
funera1 Nov 5, 2023
92a13ee
update
funera1 Nov 5, 2023
9d21f52
update
funera1 Nov 5, 2023
a836248
コメントアウト
funera1 Nov 6, 2023
52381ae
Add gperftools
funera1 Nov 18, 2023
040ed6f
local.get高速化
funera1 Nov 18, 2023
884ca0c
Speed up
funera1 Nov 22, 2023
cb3bc2e
Merge pull request #17 from oss-fun/migration_wasmedge2wamr_improveme…
funera1 Nov 22, 2023
04a5eff
WIP: dump and restore type stack
funera1 Nov 22, 2023
d4f7521
linear_mem_sizeの保存
funera1 Nov 22, 2023
842cda2
Fix restore
funera1 Nov 23, 2023
534e63b
Clean debug print
funera1 Nov 23, 2023
e3d790b
Clean debug print
funera1 Nov 23, 2023
7bf1251
Clean debug print
funera1 Nov 23, 2023
3ed3332
Merge pull request #18 from oss-fun/fix/restore
funera1 Nov 23, 2023
1334692
unique_ptr
funera1 Nov 25, 2023
0e17397
restoreDataPtrを生ポインタからスマートポインタに書き直した
funera1 Nov 25, 2023
634f868
Delete comment out
funera1 Nov 25, 2023
998033b
Merge pull request #19 from oss-fun/fix/restore_memory
funera1 Nov 25, 2023
5ff4a36
unique_ptrでrestore memoryをするとバグったのでvectorで実装
funera1 Nov 25, 2023
9221860
Delete comment out
funera1 Nov 25, 2023
4199b10
Delete comment out
funera1 Nov 25, 2023
21699f4
Merge pull request #20 from oss-fun/fix/restore_memory_by_vector
funera1 Nov 25, 2023
25a5cf9
memory.imgとmem_page_count.imgのdump/restoreを統一
funera1 Nov 25, 2023
adaf595
WIP
funera1 Nov 25, 2023
2dc5a02
Clean comment out
funera1 Nov 25, 2023
9184786
memory_instanceが複数あったときをsupport
funera1 Nov 25, 2023
59bf4e7
Fix merge conflict
funera1 Nov 25, 2023
1fe2d55
Merge pull request #26 from oss-fun/feature/unify_memory_image
funera1 Dec 11, 2023
476aa10
Fix fix merge conflict
funera1 Dec 11, 2023
cbce824
WIP: global instanceの状態表現統一化
funera1 Dec 11, 2023
50ca5ec
global.imgの保存を統一化
funera1 Dec 12, 2023
92a19c3
memory.img, mem_page_count.imgの名前を修正
funera1 Dec 12, 2023
ae297cc
Merge pull request #27 from oss-fun/feature/unify_global
funera1 Dec 12, 2023
faa074b
WIP: dump proguram counter
funera1 Dec 12, 2023
91faf0e
program counterをWAMR仕様で保存
funera1 Dec 13, 2023
02181d0
program counterをWAMR仕様で保存
funera1 Dec 13, 2023
40e55df
program counterの保存復元を実装(とりあえずWasmEdge仕様で統一することにした)
funera1 Dec 13, 2023
da8d9b1
WIP
funera1 Dec 13, 2023
4078e9f
program counterの復元関数を実装(WAMR仕様)
funera1 Dec 13, 2023
1332d78
program counterの復元関数を動かした
funera1 Dec 13, 2023
cbd7691
addrs.imgからframe_ipを削除
funera1 Dec 13, 2023
277c949
Merge pull request #28 from oss-fun/feature/unify_program_counter
funera1 Dec 13, 2023
1ca6080
WIP
funera1 Dec 18, 2023
9f258f2
WIP: frame stackの保存関数を実装
funera1 Dec 18, 2023
1119dc7
stackのdump関数
funera1 Dec 19, 2023
7e0ddf7
dump stack
funera1 Dec 19, 2023
ac82e67
FrameにFunctionInstanceを持つようにした
funera1 Dec 19, 2023
caa5b8a
StackMgr.Pushに対する型スタックへの操作をt/4に置換
funera1 Dec 19, 2023
b874c96
型スタックの中身を{1, 2, 4}にした
funera1 Dec 19, 2023
4c47245
Restore stack
funera1 Dec 19, 2023
13afcdc
WIP
funera1 Dec 19, 2023
cc7d4f8
WIP
funera1 Dec 19, 2023
23fad28
FIX: dumpStackでの型スタックのtopを計算する部分を間違えていたのを修正
funera1 Dec 20, 2023
9790ea7
DEBUG: dumpStackとrestoreStackのフレーム内の値をログとして出力
funera1 Dec 20, 2023
21e50c6
マイグレーションできるようになった。ただしstack2.imgのVPosだけ正しいものと異なるので要修正
funera1 Dec 20, 2023
8173769
DEBUG: restoreStackの最初の時点でValueStackのサイズがいくつかを確認
funera1 Dec 20, 2023
e29cfe3
動くようになった.
funera1 Dec 20, 2023
6e2524f
debugを整理
funera1 Dec 21, 2023
fb41057
Merge pull request #30 from oss-fun/feature/unify_value_stack
funera1 Dec 21, 2023
b381d03
WAMR用のdump/restore関数を削除
funera1 Dec 21, 2023
1d184ab
Merge pull request #31 from oss-fun/feature/refactor_unify_image
funera1 Dec 21, 2023
0acffb4
ctrl_tsp.imgをstack.imgにマージ
funera1 Dec 21, 2023
d661783
Merge pull request #32 from oss-fun/feature/unify_csp_tsp
funera1 Dec 21, 2023
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
36 changes: 36 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ option(WASMEDGE_BUILD_AOT_RUNTIME "Enable WasmEdge LLVM-based ahead of time comp
option(WASMEDGE_BUILD_SHARED_LIB "Generate the WasmEdge shared library." ON)
option(WASMEDGE_BUILD_STATIC_LIB "Generate the WasmEdge static library." OFF)
option(WASMEDGE_BUILD_TOOLS "Generate wasmedge and wasmedgec tools. Depend on and will build the WasmEdge shared library." ON)
option(WASMEDGE_PROFILING_GPERF "Link gperftools to binary" OFF)
option(WASMEDGE_PROFILING_GPROF "Link gperftools to binary" OFF)
option(WASMEDGE_BUILD_FUZZING "Generate fuzzing test tools. Couldn't build with wasmedge tools and unit tests." OFF)
option(WASMEDGE_BUILD_PLUGINS "Generate plugins." ON)
option(WASMEDGE_BUILD_EXAMPLE "Generate examples." OFF)
Expand All @@ -70,6 +72,40 @@ option(WASMEDGE_PLUGIN_IMAGE "Enable WasmEdge image plugin." OFF)
option(WASMEDGE_PLUGIN_TENSORFLOW "Enable WasmEdge TensorFlow plugin." OFF)
option(WASMEDGE_PLUGIN_TENSORFLOWLITE "Enable WasmEdge TensorFlow-Lite plugin." OFF)


if(WASMEDGE_PROFILING_GPERF)
# set(GPERF_PATH "/tmp/gperftools-2.13/cmake/")
if(GPERF_PATH)
link_directories(${GPERF_PATH})
else()
message(STATUS "Gperf path not given, running ${CMAKE_SOURCE_DIR}/utils/profiling.sh")
link_directories("/usr/local/lib")
endif()

# link_libraries("profiler")
# target_link_libraries(YourTargetName PRIVATE -Wl,-no-as-needed gperftools -Wl,--as-needed)
link_libraries(-Wl,-no-as-needed profiler -Wl,--as-needed)

add_custom_target(profile
COMMAND env CPUPROFILE=${CMAKE_BINARY_DIR}/wasmedge.prof
${CMAKE_BINARY_DIR}/tools/wasmedge/wasmedge n-body.wasm 1000
COMMENT "Profiling"
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
DEPENDS wasmedge
)
add_dependencies(profile wasmedge)
add_custom_target(prof-visualize-text
COMMAND pprof --text ${CMAKE_BINARY_DIR}/tools/wasmedge/wasmedge ${CMAKE_BINARY_DIR}/wasmedge.prof
COMMENT "Visualize in text"
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
add_custom_target(prof-visualize-gv
COMMAND pprof --gv ${CMAKE_BINARY_DIR}/tools/wasmedge/wasmedge ${CMAKE_BINARY_DIR}/wasmedge.prof
COMMENT "Visualize in gv"
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
endif()

if(WASMEDGE_BUILD_TOOLS AND WASMEDGE_BUILD_FUZZING)
message(FATAL_ERROR "wasmedge tool and fuzzing tool are exclusive options.")
endif()
Expand Down
12 changes: 11 additions & 1 deletion include/common/configure.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ class StatisticsConfigure {
: InstrCounting(RHS.InstrCounting.load(std::memory_order_relaxed)),
CostMeasuring(RHS.CostMeasuring.load(std::memory_order_relaxed)),
TimeMeasuring(RHS.TimeMeasuring.load(std::memory_order_relaxed)),
DumpFlag(RHS.DumpFlag.load(std::memory_order_relaxed)),
RestoreFlag(RHS.RestoreFlag.load(std::memory_order_relaxed)) {}

void setInstructionCounting(bool IsCount) noexcept {
Expand Down Expand Up @@ -176,14 +177,22 @@ class StatisticsConfigure {
return CostLimit.load(std::memory_order_relaxed);
}

void setDumpFlag(bool flag) noexcept {
DumpFlag.store(flag, std::memory_order_relaxed);
}

bool getDumpFlag() const noexcept {
return DumpFlag.load(std::memory_order_relaxed);
}

void setRestoreFlag(bool flag) noexcept {
RestoreFlag.store(flag, std::memory_order_relaxed);
}

bool getRestoreFlag() const noexcept {
return RestoreFlag.load(std::memory_order_relaxed);
}

void setDebugMode(bool flag) noexcept {
DebugMode.store(flag, std::memory_order_relaxed);
}
Expand All @@ -196,6 +205,7 @@ class StatisticsConfigure {
std::atomic<bool> InstrCounting = false;
std::atomic<bool> CostMeasuring = false;
std::atomic<bool> TimeMeasuring = false;
std::atomic<bool> DumpFlag = false;
std::atomic<bool> RestoreFlag = false;
std::atomic<bool> DebugMode = false;
std::atomic<uint64_t> CostLimit = UINT64_C(-1);
Expand Down
7 changes: 6 additions & 1 deletion include/common/statistics.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,17 @@ class Statistics {
spdlog::info("======================= End ======================");
}
}

// DumpFlag
void setDumpFlag(bool f) { DumpFlag = f; }
bool getDumpFlag() { return DumpFlag; }

// RestoreFlag
void setRestoreFlag(bool f) { RestoreFlag = f; }
bool getRestoreFlag() { return RestoreFlag; }

// DebugMode
void setDebugMode(bool f) {DebugMode = f; }
void setDebugMode(bool f) { DebugMode = f; }
bool getDebugMode() { return DebugMode; }

private:
Expand All @@ -196,6 +200,7 @@ class Statistics {
uint64_t CostLimit;
std::atomic_uint64_t CostSum;
Timer::Timer TimeRecorder;
bool DumpFlag;
bool RestoreFlag;
bool DebugMode;
};
Expand Down
5 changes: 4 additions & 1 deletion include/driver/tool.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ struct DriverToolOptions {
"Enable generating code for all statistics options include instruction counting, gas measuring, and execution time"sv)),
ConfForceInterpreter(
PO::Description("Forcibly run WASM in interpreter mode."sv)),
DumpFlag(PO::Description("Snapshot statement to img files."sv)),
RestoreFlag(PO::Description("Restore statement by img files."sv)),
TimeLim(
PO::Description(
Expand Down Expand Up @@ -108,6 +109,7 @@ struct DriverToolOptions {
PO::Option<PO::Toggle> ConfEnableTimeMeasuring;
PO::Option<PO::Toggle> ConfEnableAllStatistics;
PO::Option<PO::Toggle> ConfForceInterpreter;
PO::Option<PO::Toggle> DumpFlag;
PO::Option<PO::Toggle> RestoreFlag;
PO::Option<PO::Toggle> DebugMode;
PO::Option<uint64_t> TimeLim;
Expand Down Expand Up @@ -139,7 +141,8 @@ struct DriverToolOptions {
.add_option("enable-extended-const"sv, PropExtendConst)
.add_option("enable-threads"sv, PropThreads)
.add_option("enable-all"sv, PropAll)
.add_option("restore-flag"sv, RestoreFlag)
.add_option("snapshot"sv, DumpFlag)
.add_option("restore"sv, RestoreFlag)
.add_option("debug-mode"sv, DebugMode)
.add_option("time-limit"sv, TimeLim)
.add_option("gas-limit"sv, GasLim)
Expand Down
Loading
Loading