Repository navigation
Conversation
Every launch through JITFunction.run binds and re-specializes all arguments in Python before the kernel is enqueued. On the device-initiated path that host time sits directly in front of the GEMM launch while the GPU idles, and it is longer for the 16-argument submit kernel: 18.2 us per launch vs 9.5 us for the 1-argument trigger kernel (8 GPUs, M=1024, GPU kept busy so launches only enqueue). _launch_prebound compiles on the first call and afterwards calls the CompiledKernel's launcher directly, cached on the workspace (FusedWorkspace.launch_cache, cleared in clear()). The cache key covers everything the specialization depends on that can change between calls on one workspace (A_sharded's dtype and 16-byte alignment, M, K_local and the strides); all other arguments are workspace buffers. The unused flag_iteration kernel argument is dropped (it changed every call); the op's public parameter stays. Host launch: submit kernel 18.2 -> 7.7 us, trigger kernel 9.5 -> 6.2 us. The op test now also checks that the second call on a workspace reused the first call's launcher. Co-Authored-By: Claude <noreply@anthropic.com>
dsidler
requested review from
BKP,
artulab,
drprajap,
efric,
mawad-amd,
neoblizz and
nirvedhmeshram
as code owners
November 25, 2026 18:00
This branch has not been deployed
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.
Stacked on #661 (base
dev/dasidler/ag-gemm-ce-prepost).Summary
Every launch through
JITFunction.runbinds and re-specializes all arguments in Python before the kernel is enqueued. That host time sits directly in front of the GEMM launch while the GPU idles. It is longest for the 16-argument submit kernel: 18.2 µs per launch, vs 9.5 µs for the 1-argument trigger kernel. Measured on 8× MI300X at M=1024, with the GPU kept busy so launches only enqueue._launch_preboundcompiles on the first call and afterwards calls theCompiledKernel's launcher directly. The launcher is cached on the workspace (FusedWorkspace.launch_cache, cleared inclear()).A_sharded's dtype and 16-byte alignment, M, K_local and the strides. All other arguments are workspace buffers.flag_iterationkernel argument is dropped, since it changed on every call. The op's public parameter stays.Host launch time:
End-to-end benchmark differences at M=1024 are within run-to-run drift.
Tests
tests/ops/test_all_gather_matmul_copy_engine.pyalso checks that the second call on a workspace reused the first call's launcher.🤖 Generated with Claude Code