Skip to content

Feature/wasm m2#8

Merged
junjihashimoto merged 2 commits into
mainfrom
feature/wasm-m2
Jun 10, 2026
Merged

Feature/wasm m2#8
junjihashimoto merged 2 commits into
mainfrom
feature/wasm-m2

Conversation

@junjihashimoto

Copy link
Copy Markdown
Contributor

No description provided.

First step toward browser WebGPU via emdawnwebgpu, following the plan
in docs/research/wasm-webgpu-plan.md.

* native/CMakeLists.txt: Emscripten short-circuit branch that produces
  libhesper_wasm.a from bridge_wasm_stub.cpp + cuda_bridge_stub.cpp and
  returns before any Dawn / GLFW / CUDA-driver machinery.
* native/bridge.cpp: guard dawn_proc.h / DawnNative.h includes and the
  dawnProcSetProcs call behind #ifndef __EMSCRIPTEN__ so the existing
  native build is untouched.
* native/bridge_wasm_stub.cpp (new): every lean_hesper_* extern as a
  stub returning IO.Error("Wasm bridge not wired yet"). Lets xeus-lean
  link Hesper modules now; real wgpu* wiring lands in M2/M3.
* native/wasm/build-libhesper-wasm.sh (new): emcmake + emmake wrapper.
  Locally produces an 18 KB libhesper_wasm.a containing all expected
  lean_hesper_* symbols.
* native/.gitignore (new): build/, build-cmake/, build-wasm/, archives.

No native code paths change; this only adds a new EMSCRIPTEN branch.
…sm.a

Move the wasm build recipe from xeus-lean's hesper-wasm/ directory into
hesper itself so xeus-lean no longer has to know hesper internals.
xeus-lean follows up by calling this one script and linking the result.

* native/wasm/lakefile-wasm.lean (new): WGSL-only Lake override that
  drops LSpec, doc-gen4, nativeDeps, Tests / Examples / lean_exe.
  Lifted from xeus-lean/hesper-wasm/lakefile-wasm.lean verbatim, no
  upstream-version patch needed now that hesper main is on Lean 4.28.
* native/wasm/build-wasm.sh (new): single script with two phases —
  `lake build` against the override + emcc build of libhesper_wasm.a
  via the EMSCRIPTEN branch in native/CMakeLists.txt.  Stages outputs
  to `<out-dir>/Hesper{,/**}.{olean,olean.server,olean.private,ir,ilean}`
  and `<out-dir>/lib/libhesper_wasm.a`.  Env knobs: LEAN_TOOLCHAIN_OVERRIDE,
  SKIP_LIB, SKIP_OLEAN, BUILD_TYPE.  Restore-on-trap ensures the repo's
  lakefile.lean / lean-toolchain survive a failed `lake build`.
* native/wasm/build-libhesper-wasm.sh (removed): superseded by the
  unified script.
* docs/research/wasm-webgpu-plan.md: M2 section rewritten to match
  reality — hesper now owns the build recipe; the xeus-lean PR is just
  a `-DHESPER_WASM_DIR=...` consumer.

Verified locally with emsdk 4.0.12 + Lean 4.28.0:
  $ native/wasm/build-wasm.sh /tmp/out
  ...
  [hesper-wasm] staged 222 olean files
  [hesper-wasm] staged 18K libhesper_wasm.a

No native code paths change; this only adds a wasm-side staging recipe.
@junjihashimoto junjihashimoto merged commit 6648d83 into main Jun 10, 2026
4 checks passed
@junjihashimoto junjihashimoto deleted the feature/wasm-m2 branch June 10, 2026 02:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant