-
Notifications
You must be signed in to change notification settings - Fork 1k
qwen3_5_moe: add CUDA Engine/Session execution path #20288
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -100,7 +100,7 @@ It can be uploaded to HuggingFace Hub for easy sharing. | |
|
|
||
| ExecuTorch must be installed from source first (see | ||
| [Prerequisites](#prerequisites)). The `make` target handles building | ||
| core libraries and the runner binary. | ||
| core libraries, the runner binary, and the CUDA no-bleed test binary. | ||
|
|
||
| ```bash | ||
| make qwen3_5_moe-cuda | ||
|
|
@@ -109,6 +109,10 @@ make qwen3_5_moe-cuda | |
| This builds ExecuTorch with CUDA backend support, then the runner binary | ||
| at `cmake-out/examples/models/qwen3_5_moe/qwen3_5_moe_runner`. | ||
|
|
||
| The runner is a thin CLI over `Qwen35MoEEngine` and `Qwen35MoESession`. | ||
| On CUDA, the engine loads the model weights once and can create multiple | ||
| isolated sessions by rebinding the model's mutable buffers before execution. | ||
|
|
||
| ## Run | ||
|
|
||
| The runner requires: | ||
|
|
@@ -133,8 +137,28 @@ cmake-out/examples/models/qwen3_5_moe/qwen3_5_moe_runner \ | |
| | `--data_path` | (none) | Path to `.ptd` delegate data file (required for CUDA) | | ||
| | `--tokenizer_path` | (required) | Path to HuggingFace `tokenizer.json` | | ||
| | `--prompt` | `"Hello"` | Input prompt text | | ||
| | `--prompt_file` | (none) | Path to a prompt file (overrides `--prompt`) | | ||
| | `--temperature` | `0.8` | Sampling temperature (0 = greedy) | | ||
| | `--max_new_tokens` | `128` | Maximum tokens to generate | | ||
| | `--warmup` | `0` | Warmup iterations to discard before timing | | ||
| | `--num_iters` | `1` | Timed iterations to average after warmup | | ||
| | `--cuda_graph` | `false` | CUDA-only decode graph capture for single-session runner use | | ||
|
|
||
| `--cuda_graph` is intentionally single-session only. CUDA graph replay captures | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should find some way to support cuda graph in multiple session setting. One idea is promoting the cuda graph configs into llm sessions and whenever we change to a new session we should recaptured the graph.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will be a follow-up issue. Create an #20310 |
||
| device pointers, so it is not combined with per-session mutable-state rebinding. | ||
|
|
||
| ### CUDA no-bleed test | ||
|
|
||
| The CUDA build also produces `test_qwen35_moe_nobleed`, which validates that two | ||
| sessions can interleave prefill/decode on one loaded model without sharing | ||
| mutable state: | ||
|
|
||
| ```bash | ||
| QWEN_MODEL_PATH=qwen35_moe_exports/model.pte \ | ||
| QWEN_DATA_PATH=qwen35_moe_exports/aoti_cuda_blob.ptd \ | ||
| QWEN_TOKENIZER_PATH=~/models/Qwen3.5-35B-A3B/tokenizer.json \ | ||
| cmake-out/examples/models/qwen3_5_moe/test_qwen35_moe_nobleed | ||
| ``` | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.