Skip to content

Set a 256 KB stack for the wasm binding - #288

Merged
bab2min merged 1 commit into
bab2min:mainfrom
ollipa:fix-wasm-stack-size
Oct 19, 2026
Merged

bab2min merged 1 commit into
bab2min:mainfrom
ollipa:fix-wasm-stack-size

Conversation

@ollipa

@ollipa ollipa commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #287.

Emscripten's default stack is 64 KB (since 3.1.27), and cong-global overflows it on some sentences (memory access out of bounds). This adds -s STACK_SIZE=256KB to the wasm link flags and a test to catch the issue. I verified that the test failed with the old code and passes with the change in this PR.

Summary by CodeRabbit

  • Improvements

    • Increased the available stack space for the WebAssembly build, providing more room for operations that require deeper processing.
  • Tests

    • Added coverage confirming that Korean sentence tokenization returns the expected words when using the cong-global model.

Default stack is 64 KB and cong-global overflows it
on some sentences.
@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 928758d5-008c-4f1e-94c0-8ea45a9cc3b9
📥 Commits

Reviewing files that changed from the base of the PR and between 28e8415 and 66e6af7.

📒 Files selected for processing: 2
  • bindings/wasm/CMakeLists.txt
  • bindings/wasm/package/test/kiwi.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

📝 Walkthrough

The WASM linker flags now set the stack size to 256KB. A WASM test builds a cong-global model and checks that tokenization includes 생각 and 기도.

Changes: WASM cong-global stack handling

Layer / File(s) Summary
Stack setting and tokenization test
bindings/wasm/CMakeLists.txt, bindings/wasm/package/test/kiwi.test.ts
The linker flags set STACK_SIZE to 256KB. A test builds a cong-global model and checks that tokenization includes 생각 and 기도.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: sebjacobs, piousangel

Merge Risk: ⚪ Minimal · up to 66e6a

The regression test exercises the same tokenization path as the reported reproducer for this sentence. No actionable merge risk remains in the supplied review context.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the primary change: setting a 256 KB stack size for the WebAssembly binding.
Linked Issues check Passed Issue #287 requires -s STACK_SIZE=256KB in bindings/wasm/CMakeLists.txt and a regression test for the failing cong-global sentence. The diff adds the linker flag and adds a WASM test that builds…
Out of Scope Changes check Passed The changes are limited to the WASM linker configuration and a regression test for the stack-overflow input from issue #287. Both changes directly support the linked issue.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Full details: Linked Issues check

Explanation

Issue #287 requires -s STACK_SIZE=256KB in bindings/wasm/CMakeLists.txt and a regression test for the failing cong-global sentence. The diff adds the linker flag and adds a WASM test that builds cong-global, analyzes 우리는 모든 일이 생각대로 될 것이라며 기도를 드렸다., and checks expected tokens including 생각 and 기도.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@bab2min

bab2min commented Oct 19, 2026

Copy link
Copy Markdown
Owner

@ollipa Thank you for your contribution. It looks good to me. I'll merge it.

@bab2min
bab2min merged commit 0f11859 into bab2min:main Oct 19, 2026
10 checks passed
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.

WASM: cong-global 사용 시 스택 부족으로 크래시

2 participants