Repository navigation
Benchmarking DeepGEMM main vs migrate_pybind_to_torch_library_dev branch - #9
Open
cleonard530 wants to merge 13 commits into
Open
cleonard530 wants to merge 13 commits into
cleonard530 wants to merge 13 commits into
Conversation
cleonard530
force-pushed
the
migrate_pybind_to_torch_library_dev
branch
from
September 24, 2026 12:56
b201a73 to
dec2595
Compare
cleonard530
pushed a commit
that referenced
this pull request
Sep 24, 2026
* fix(sm120): correct ported GEMM and MQA execution paths
Signed-off-by: Zihua Wu <13583761+lucifer1004@users.noreply.github.com>
* test(sm120): name checks by behavior and split omnibus tests
Signed-off-by: Zihua Wu <13583761+lucifer1004@users.noreply.github.com>
* test(sm120): move SM120 regressions into dedicated test files
Move all SM120-specific regression tests out of upstream-owned test
files into tests/test_sm120_{bf16,fp8_fp4,einsum,hyperconnection,skip_head}.py
so the fork's tests/ directory stays byte-identical to dev on upstream
files (one documented exception: the cross-case tensor lifetime fix in
test_paged_mqa_logits). This removes every sync-conflict surface from
upstream's per-release rewrites of the shared test files.
All moved tests switch to upstream's call-time test_filter gating, so
non-SM120 machines see zero behavior change at collection, under
pytest, in test_sanitizer.py's direct-call discovery, and via __main__.
Each new file is a self-contained script with its own __main__ runner.
Signed-off-by: Zihua Wu <13583761+lucifer1004@users.noreply.github.com>
---------
Signed-off-by: Zihua Wu <13583761+lucifer1004@users.noreply.github.com>
… branch. Will need to figure out how to handle DeepJIT. Signed-off-by: Chris Leonard <chleonar@redhat.com>
…nd for GIL release. We will need to come back and address this later Signed-off-by: Chris Leonard <chleonar@redhat.com>
…eplacing _C with _C_extension Signed-off-by: Chris Leonard <chleonar@redhat.com>
…hon_api.cpp like it was before, added some checks to mega_moe.hpp to keep the new registration inline with the pybind registration. Signed-off-by: Chris Leonard <chleonar@redhat.com>
Signed-off-by: Chris Leonard <chleonar@redhat.com>
Signed-off-by: Chris Leonard <chleonar@redhat.com>
…hpp to disable to gil.hpp in DeepJIT, this is just temporary and will need to be changed upstream Signed-off-by: Chris Leonard <chleonar@redhat.com>
…of doing it itslef (requires changes to DeepJIT) Signed-off-by: Chris Leonard <chleonar@redhat.com>
cleonard530
force-pushed
the
migrate_pybind_to_torch_library_dev
branch
from
September 24, 2026 12:59
dec2595 to
66d8928
Compare
cleonard530
force-pushed
the
benchmark_branch
branch
from
September 24, 2026 15:39
b0f573c to
87736fb
Compare
… to verify where it is being dispatched form (pybind or torch_library)
cleonard530
force-pushed
the
migrate_pybind_to_torch_library_dev
branch
2 times, most recently
from
September 30, 2026 12:27
9560d13 to
45d9a65
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This has 3 python scripts used for benchmarking the performance between DeepGEMM on
mainvsmigrate_pybind_to_torch_library_devwhere I migrated DeepGEMM kernel registration offpybind11and ontoTORCH_LIBRARY. In the runs on main, DeepJIT uses the current version of DeepJIT onmain, while themigrate_pybind_to_torch_library_devbranch uses the updated DeepJIT on deepseek-ai/DeepJIT#11, removing the dependency of pybind11 for the GIL release (sincetorch.opsrelease the GIL already) and allowing us to build with the CPython Stable ABI (abi3). This branch of DeepJIT also moved the unstable Torch calls to Stable ABI torch calls, which isn't necessary for this first update but is our ultimate goal (see vllm-project/vllm#26946). The only call this changes, is using a stable version of theat::cuda::getCurrentCUDAStream().stream().The 3 scripts are:
Results
scripts/benchmark_kernels.pyThe kernel run times where basically identical on
mainand onmigrate_pybind_to_torch_library_dev. You can checkout kernel_benchmark_comparison.txt to see the comparison between average run times for 1000 runs each. The results show ~ +/- 1% difference between runs on each branch.scripts/benchmark_sm90_deepjit.pyThe results of this run are in deepjit_main.txt and deepjit_torch_library.txt where each kernel is ran 5 times. Again, the results between
mainandmigrate_pybind_to_torch_library_devare nearly identical, for cold first call, disk-cache first call, and the warm calls.scripts/benchmark_gil_production.pyThis script considers the thread management. It basically calls
The script tests
no worker, anI/O-likeworker, ascheduler-likeworker, and acontinuously CPU-boundworker. It also measures how much progress the worker makes relative to running alone. Calls throughtorch.opsrelease the GIL around operator dispatch, allowing other Python threads to make progress. Under normal I/O-like and scheduler-like activity, this produced little or no foreground latency penalty in these measurements.The continuously CPU-bound case exposed a tradeoff. Once that thread acquires the GIL, the main thread can be delayed before it can issue its next Python-level operator call. DeepJIT on
mainalso releases the GIL around CUDA dispatch, but only around the kernel call. That shorter release window provides less opportunity for repeated GIL handoffs than releasing it around the completetorch.opsdispatch. Consequently,TORCH_LIBRARYimproves the opportunity for competing Python threads to run, but it can increase foreground latency when many short, separate operators compete with a non-yielding CPU-bound Python thread. CUDA graph capture mitigates this case because a captured sequence can be replayed through fewer Python operator calls.This benchmark intentionally creates an adverse GIL-contention scenario: short kernels, many separate uncaptured calls, and a continuously CPU-bound Python thread in the same process. The behavior is not specific to DeepGEMM; it is a general consideration when replacing a pybind11 binding with a
torch.opsbinding.The results can be found gil_production_results_torch_deepjit_main.json and gil_production_results_torch_deepjit_torch_gil.json with a significant difference in
median_foreground_us_per_callfor thecpu_boundtests.