Skip to content

gh-120507: Double WASI memory #120648

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

Merged
merged 1 commit into from
Jun 17, 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
5 changes: 2 additions & 3 deletions Tools/wasm/wasi.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,8 @@ def main():
default_host_runner = (f"{shutil.which('wasmtime')} run "
# Make sure the stack size will work for a pydebug
# build.
# The 8388608 value comes from `ulimit -s` under Linux
# which equates to 8291 KiB.
"--wasm max-wasm-stack=8388608 "
# Use 16 MiB stack.
"--wasm max-wasm-stack=16777216 "
# Use WASI 0.2 primitives.
"--wasi preview2 "
# Enable thread support; causes use of preview1.
Expand Down
2 changes: 1 addition & 1 deletion Tools/wasm/wasm_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ def _check_wasi() -> None:
# workaround for https://github.com/python/cpython/issues/95952
"HOSTRUNNER": (
"wasmtime run "
"--wasm max-wasm-stack=8388608 "
"--wasm max-wasm-stack=16777216 "
"--wasi preview2 "
"--dir {srcdir}::/ "
"--env PYTHONPATH=/{relbuilddir}/build/lib.wasi-wasm32-{version}:/Lib"
Expand Down
4 changes: 2 additions & 2 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1609,7 +1609,7 @@ then
dnl TODO: support other WASI runtimes
dnl wasmtime starts the proces with "/" as CWD. For OOT builds add the
dnl directory containing _sysconfigdata to PYTHONPATH.
[WASI/*], [HOSTRUNNER='wasmtime run --wasm max-wasm-stack=8388608 --wasi preview2 --env PYTHONPATH=/$(shell realpath --relative-to $(abs_srcdir) $(abs_builddir))/$(shell cat pybuilddir.txt):/Lib --dir $(srcdir)::/'],
[WASI/*], [HOSTRUNNER='wasmtime run --wasm max-wasm-stack=16777216 --wasi preview2 --env PYTHONPATH=/$(shell realpath --relative-to $(abs_srcdir) $(abs_builddir))/$(shell cat pybuilddir.txt):/Lib --dir $(srcdir)::/'],
[HOSTRUNNER='']
)
fi
Expand Down Expand Up @@ -2403,10 +2403,10 @@ AS_CASE([$ac_sys_system],
AS_VAR_APPEND([LDFLAGS_NODIST], [" -Wl,--max-memory=10485760"])
])

dnl gh-117645: Set the memory size to 20 MiB, the stack size to 8 MiB,
dnl gh-117645: Set the memory size to 40 MiB, the stack size to 16 MiB,
dnl and move the stack first.
dnl https://github.com/WebAssembly/wasi-libc/issues/233
AS_VAR_APPEND([LDFLAGS_NODIST], [" -z stack-size=8388608 -Wl,--stack-first -Wl,--initial-memory=20971520"])
AS_VAR_APPEND([LDFLAGS_NODIST], [" -z stack-size=16777216 -Wl,--stack-first -Wl,--initial-memory=41943040"])
]
)

Expand Down
Loading