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

Resume table syntax #10

Merged
merged 4 commits into from
Aug 23, 2024
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
2 changes: 1 addition & 1 deletion c10m/wasmfx_import.wast
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
(local $k (ref null $cawt))
(block $on_return (result i32)
(block $on_yield (result i32 (ref $cawt))
(resume $cawt (tag $yield $on_yield) (local.get $value) (table.get $conts (local.get $key)))
(resume $cawt (on $yield $on_yield) (local.get $value) (table.get $conts (local.get $key)))
(br $on_return)
) ;; on_yield [ i32 (ref $cawt) ]
(local.set $k)
Expand Down
12 changes: 6 additions & 6 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
]

MIMALLOC_REVISION = "v2.1.2"
# WebAssembly/binaryen#main as of April 8, 2024
BINARYEN_REVISION = "102c3633d2378457dae1f5e239fd63ad80eefb92"
# wasmfx/wasmfx#main as of April 9, 2024
WASMTIME_REVISION = "7f63b553c3d2c91d7fe3ef0902ed1543f2fd1821"
# wasmfx/specfx#main as of April 10, 2024
SPEC_REVISION = "0af205c2c6a5569046274173d8c0388a3272087f"
# WebAssembly/binaryen#main as of August 9, 2024
BINARYEN_REVISION = "3386e642c76028438fc783bf97089115ea9a900f"
# wasmfx/wasmfxtime#main as of August 7, 2024
WASMTIME_REVISION = "41c90734bf069d2487dc6d7121372f6295cf43f2"
# wasmfx/specfx#main as of August 7, 2024
SPEC_REVISION = "6d01dfc84d8d9bba6cfeedb0aa078918b082dd3c"

WASMTIME_CARGO_BUILD_ARGS = [
"--features=default,unsafe_disable_continuation_linearity_check"
Expand Down
8 changes: 7 additions & 1 deletion harness.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,13 @@ class Binaryen:

def build(self):
cpus = multiprocessing.cpu_count()
runCheck("cmake .", msg="cmake for binaryen failed", cwd=self.path)
# TODO(frank-emrich) Build with clang until the following is fixed:
# https://github.com/WebAssembly/binaryen/issues/6779
runCheck(
"cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ .",
msg="cmake for binaryen failed",
cwd=self.path,
)
runCheck(f"make -j {cpus}", msg="building binaryen failed", cwd=self.path)

def wasmMergeExecutablePath(self) -> Path:
Expand Down
3 changes: 2 additions & 1 deletion make.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Default stack size
ASYNCIFY_DEFAULT_STACK_SIZE?=2097152
DEFAULT_STACK_SIZE?=2097152
ASYNCIFY_DEFAULT_STACK_SIZE?=$(DEFAULT_STACK_SIZE)
WASMFX_CONT_TABLE_INITIAL_CAPACITY?=1024

# Mimalloc (drop-in replacement for malloc)
Expand Down
2 changes: 1 addition & 1 deletion make.generic.config
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ out/$(BENCHMARK)_wasmfx.wasm: $(BENCHMARK).c wasmfx_import.wast

out/wasmfx_fiber_imports.wat: ../vendor/fiber-c/src/wasmfx/imports.wat.pp
mkdir -p out
$(WASICC) -xc -DWASMFX_CONT_TABLE_INITIAL_CAPACITY=$(WASMFX_CONT_TABLE_INITIAL_CAPACITY) -E ../vendor/fiber-c/src/wasmfx/imports.wat.pp | tail -n+8 > out/wasmfx_fiber_imports.wat
$(WASICC) -xc -DWASMFX_CONT_TABLE_INITIAL_CAPACITY=$(WASMFX_CONT_TABLE_INITIAL_CAPACITY) -E ../vendor/fiber-c/src/wasmfx/imports.wat.pp | sed 's/.*#.*//g' > out/wasmfx_fiber_imports.wat

out/$(BENCHMARK)_wasmfx_fiber.wasm: out/wasmfx_fiber_imports.wat $(BENCHMARK).c
mkdir -p out
Expand Down
4 changes: 2 additions & 2 deletions micro/2resumes_same_function/bench.wat
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
(cont.new $ct (ref.func $suspend0))
(loop $loop (param (ref $ct))
(block $inner (param (ref $ct)) (result (ref $ct))
(resume $ct (tag $t $inner))
(resume $ct (on $t $inner))
(return)
)
(resume $ct (tag $t $loop))
(resume $ct (on $t $loop))
(return)
)
)
Expand Down
2 changes: 1 addition & 1 deletion micro/suspend_resume/bench.wat
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

(cont.new $cp0r0 (ref.func $suspend0))
(loop $loop (param (ref $cp0r0))
(resume $cp0r0 (tag $tr0s0 $loop))
(resume $cp0r0 (on $tr0s0 $loop))
(return)
)

Expand Down
4 changes: 2 additions & 2 deletions sieve/wasmfx_import.wast
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
(local $fiber (ref $cfilter))
(local.set $fiber (cont.new $cfilter (ref.func $filter)))
(block $on_init (result (ref $cfilter))
(resume $cfilter (tag $init $on_init)
(resume $cfilter (on $init $on_init)
(local.get $prime)
(local.get $fiber))
(unreachable)
Expand All @@ -64,7 +64,7 @@
(func $filter_send (export "filter_send") (param $fiber_idx i32) (param $candidate i32) (result i32)
(local $next_k (ref $cfilter))
(block $on_yield (result i32 (ref $cfilter))
(resume $cfilter (tag $yield $on_yield)
(resume $cfilter (on $yield $on_yield)
(local.get $candidate)
(table.get $conts (local.get $fiber_idx)))
(unreachable)
Expand Down
2 changes: 1 addition & 1 deletion skynet/wasmfx_import.wast
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
(param $num i64)
(result i64)
(block $on_yield (result i64 (ref $cyield))
(resume $ct (tag $yield $on_yield)
(resume $ct (on $yield $on_yield)
(local.get $level)
(local.get $num)
(cont.new $ct (ref.func $skynet)))
Expand Down
8 changes: 4 additions & 4 deletions state/wasmfx_import.wast
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
(block $on_done (result i32)
(block $on_put (result i32 (ref $cput))
(block $on_get (result (ref $cget))
(resume $kt (tag $get $on_get) (tag $put $on_put) (local.get $k))
(resume $kt (on $get $on_get) (on $put $on_put) (local.get $k))
(br $on_done)
) ;; on_get [ (ref $cget) ]
(local.set $kget)
Expand All @@ -53,7 +53,7 @@
(block $continue
(block $on_put1 (result i32 (ref $cput))
(block $on_get1 (result (ref $cget))
(resume $cinit (tag $get $on_get1) (tag $put $on_put1)
(resume $cinit (on $get $on_get1) (on $put $on_put1)
(local.get $limit)
(cont.new $cinit (ref.func $count)))
(br $on_done)
Expand All @@ -75,11 +75,11 @@
;; must have been `put`.
(br_on_null $handle_put (local.get $kget))
) ;; $handle_get
(resume $cget (tag $get $on_get) (tag $put $on_put)
(resume $cget (on $get $on_get) (on $put $on_put)
(local.get $state) (local.get $kget))
(br $on_done)
) ;; $handle_put
(resume $cput (tag $get $on_get) (tag $put $on_put)
(resume $cput (on $get $on_get) (on $put $on_put)
(local.get $kput))
(br $on_done)
) ;; $on_get [ (ref $cget) ]
Expand Down