Repository navigation
Conversation
valarLip
previously approved these changes
Nov 23, 2025
6 tasks
Zzz9990
marked this pull request as ready for review
December 4, 2025 01:05
valarLip
approved these changes
Dec 4, 2025
zhuyuhua-v
added a commit
that referenced
this pull request
Dec 17, 2025
* remote maxsize for mla lru cache * enable extenal num_kv_splits & num_kv_splits_ptr --------- Co-authored-by: Zhu Yuhua <[email protected]> Co-authored-by: Lingpeng Jin <[email protected]>
ZhangLirong-amd
pushed a commit
that referenced
this pull request
Dec 29, 2025
* remote maxsize for mla lru cache * enable extenal num_kv_splits & num_kv_splits_ptr --------- Co-authored-by: Zhu Yuhua <[email protected]> Co-authored-by: Lingpeng Jin <[email protected]>
valarLip
added a commit
that referenced
this pull request
Mar 18, 2026
* remote maxsize for mla lru cache * enable extenal num_kv_splits & num_kv_splits_ptr --------- Co-authored-by: Zhu Yuhua <[email protected]> Co-authored-by: Lingpeng Jin <[email protected]>
peizhang56
added a commit
to peizhang56/aiter
that referenced
this pull request
Sep 2, 2026
get_meta_param() was wholly @functools.lru_cache'd, so it returned a cached device tensor for num_kv_splits_indptr. A CUDA graph capturing a cache hit records only a pointer and no producing kernel, so once the LRU drops that entry (it was the tensor's only owner) the storage is recycled and replay reads garbage. Eviction is routine: total_kv is in the key and changes almost every decode step, while captured entries are never looked up again. This restores the cache to its original scope rather than removing an optimization. ROCm#322 added the decorator when the function returned two plain integers; ROCm#1233 added the torch.arange at the call site, outside the cache; ROCm#1390 folded it in and tightened the decorator to maxsize=1; ROCm#1445 widened that back to 128. Split the function. The split-count heuristic is pure and stays cached as _get_num_kv_splits(); get_meta_param() is now uncached and rebuilds the indptr with torch.arange, which is a fill kernel and so is recorded into the graph and re-runs on replay. This also drops a latent multi-device bug: the cached tensor was allocated on the then-current device with no device in the key. Costs nothing on the decode path, where the old cache took 0 hits in 2000 steps and was already rebuilding the arange every step (6.65 -> 6.69 us/call). It only paid on a repeating key, which is the graph-capture case, where the arange is recorded once and is free at replay. Adds op_tests/test_mla_split_indptr_cudagraph.py, which fails on the old code at bs=480 and passes with the fix. Co-Authored-By: Claude Opus 5 <[email protected]>
peizhang56
added a commit
to peizhang56/aiter
that referenced
this pull request
Sep 2, 2026
get_meta_param() was wholly @functools.lru_cache'd, so it returned a cached device tensor for num_kv_splits_indptr. A CUDA graph capturing a cache hit records only a pointer and no producing kernel, so once the LRU drops that entry (it was the tensor's only owner) the storage is recycled and replay reads garbage. Eviction is routine: total_kv is in the key and changes almost every decode step, while captured entries are never looked up again. This restores the cache to its original scope rather than removing an optimization. ROCm#322 added the decorator when the function returned two plain integers; ROCm#1233 added the torch.arange at the call site, outside the cache; ROCm#1390 folded it in and tightened the decorator to maxsize=1; ROCm#1445 widened that back to 128. Split the function. The split-count heuristic is pure and stays cached as _get_num_kv_splits(); get_meta_param() is now uncached and rebuilds the indptr with torch.arange, which is a fill kernel and so is recorded into the graph and re-runs on replay. This also drops a latent multi-device bug: the cached tensor was allocated on the then-current device with no device in the key. Costs nothing on the decode path, where the old cache took 0 hits in 2000 steps and was already rebuilding the arange every step (6.65 -> 6.69 us/call). It only paid on a repeating key, which is the graph-capture case, where the arange is recorded once and is free at replay. Adds op_tests/test_mla_split_indptr_cudagraph.py, runnable both as a plain script (as .github/scripts/aiter_test.sh invokes it) and under pytest. Fails on the old code at bs=480, passes with the fix. Co-Authored-By: Claude Opus 5 <[email protected]> Signed-off-by: pei.zhang <[email protected]>
1 task done
peizhang56
added a commit
to peizhang56/aiter
that referenced
this pull request
Oct 1, 2026
get_meta_param() was wholly @functools.lru_cache'd, so it returned a cached device tensor for num_kv_splits_indptr. A CUDA graph capturing a cache hit records only a pointer and no producing kernel, so once the LRU drops that entry (it was the tensor's only owner) the storage is recycled and replay reads garbage. Eviction is routine: total_kv is in the key and changes almost every decode step, while captured entries are never looked up again. This restores the cache to its original scope rather than removing an optimization. ROCm#322 added the decorator when the function returned two plain integers; ROCm#1233 added the torch.arange at the call site, outside the cache; ROCm#1390 folded it in and tightened the decorator to maxsize=1; ROCm#1445 widened that back to 128. Split the function. The split-count heuristic is pure and stays cached as _get_num_kv_splits(); get_meta_param() is now uncached and rebuilds the indptr with torch.arange, which is a fill kernel and so is recorded into the graph and re-runs on replay. This also drops a latent multi-device bug: the cached tensor was allocated on the then-current device with no device in the key. Costs nothing on the decode path, where the old cache took 0 hits in 2000 steps and was already rebuilding the arange every step (6.65 -> 6.69 us/call). It only paid on a repeating key, which is the graph-capture case, where the arange is recorded once and is free at replay. Adds op_tests/test_mla_split_indptr_cudagraph.py, runnable both as a plain script (as .github/scripts/aiter_test.sh invokes it) and under pytest. Fails on the old code at bs=480, passes with the fix. Co-Authored-By: Claude Opus 5 <[email protected]> Signed-off-by: pei.zhang <[email protected]>
peizhang56
added a commit
to peizhang56/aiter
that referenced
this pull request
Oct 2, 2026
get_meta_param() was wholly @functools.lru_cache'd, so it returned a cached device tensor for num_kv_splits_indptr. A CUDA graph capturing a cache hit records only a pointer and no producing kernel, so once the LRU drops that entry (it was the tensor's only owner) the storage is recycled and replay reads garbage. Eviction is routine: total_kv is in the key and changes almost every decode step, while captured entries are never looked up again. This restores the cache to its original scope rather than removing an optimization. ROCm#322 added the decorator when the function returned two plain integers; ROCm#1233 added the torch.arange at the call site, outside the cache; ROCm#1390 folded it in and tightened the decorator to maxsize=1; ROCm#1445 widened that back to 128. Split the function. The split-count heuristic is pure and stays cached as _get_num_kv_splits(); get_meta_param() is now uncached and rebuilds the indptr with torch.arange, which is a fill kernel and so is recorded into the graph and re-runs on replay. This also drops a latent multi-device bug: the cached tensor was allocated on the then-current device with no device in the key. Costs nothing on the decode path, where the old cache took 0 hits in 2000 steps and was already rebuilding the arange every step (6.65 -> 6.69 us/call). It only paid on a repeating key, which is the graph-capture case, where the arange is recorded once and is free at replay. Adds op_tests/test_mla_split_indptr_cudagraph.py, runnable both as a plain script (as .github/scripts/aiter_test.sh invokes it) and under pytest. Fails on the old code at bs=480, passes with the fix. Co-Authored-By: Claude Opus 5 <[email protected]> Signed-off-by: pei.zhang <[email protected]>
peizhang56
added a commit
to peizhang56/aiter
that referenced
this pull request
Oct 2, 2026
get_meta_param() was wholly @functools.lru_cache'd, so it returned a cached device tensor for num_kv_splits_indptr. A CUDA graph capturing a cache hit records only a pointer and no producing kernel, so once the LRU drops that entry (it was the tensor's only owner) the storage is recycled and replay reads garbage. Eviction is routine: total_kv is in the key and changes almost every decode step, while captured entries are never looked up again. This restores the cache to its original scope rather than removing an optimization. ROCm#322 added the decorator when the function returned two plain integers; ROCm#1233 added the torch.arange at the call site, outside the cache; ROCm#1390 folded it in and tightened the decorator to maxsize=1; ROCm#1445 widened that back to 128. Split the function. The split-count heuristic is pure and stays cached as _get_num_kv_splits(); get_meta_param() is now uncached and rebuilds the indptr with torch.arange, which is a fill kernel and so is recorded into the graph and re-runs on replay. This also drops a latent multi-device bug: the cached tensor was allocated on the then-current device with no device in the key. Costs nothing on the decode path, where the old cache took 0 hits in 2000 steps and was already rebuilding the arange every step (6.65 -> 6.69 us/call). It only paid on a repeating key, which is the graph-capture case, where the arange is recorded once and is free at replay. Adds op_tests/test_mla_split_indptr_cudagraph.py, runnable both as a plain script (as .github/scripts/aiter_test.sh invokes it) and under pytest. Fails on the old code at bs=480, passes with the fix. Co-Authored-By: Claude Opus 5 <[email protected]> Signed-off-by: pei.zhang <[email protected]>
peizhang56
added a commit
to peizhang56/aiter
that referenced
this pull request
Oct 3, 2026
get_meta_param() was wholly @functools.lru_cache'd, so it returned a cached device tensor for num_kv_splits_indptr. A CUDA graph capturing a cache hit records only a pointer and no producing kernel, so once the LRU drops that entry (it was the tensor's only owner) the storage is recycled and replay reads garbage. Eviction is routine: total_kv is in the key and changes almost every decode step, while captured entries are never looked up again. This restores the cache to its original scope rather than removing an optimization. ROCm#322 added the decorator when the function returned two plain integers; ROCm#1233 added the torch.arange at the call site, outside the cache; ROCm#1390 folded it in and tightened the decorator to maxsize=1; ROCm#1445 widened that back to 128. Split the function. The split-count heuristic is pure and stays cached as _get_num_kv_splits(); get_meta_param() is now uncached and rebuilds the indptr with torch.arange, which is a fill kernel and so is recorded into the graph and re-runs on replay. This also drops a latent multi-device bug: the cached tensor was allocated on the then-current device with no device in the key. Costs nothing on the decode path, where the old cache took 0 hits in 2000 steps and was already rebuilding the arange every step (6.65 -> 6.69 us/call). It only paid on a repeating key, which is the graph-capture case, where the arange is recorded once and is free at replay. Adds op_tests/test_mla_split_indptr_cudagraph.py, runnable both as a plain script (as .github/scripts/aiter_test.sh invokes it) and under pytest. Fails on the old code at bs=480, passes with the fix. Co-Authored-By: Claude Opus 5 <[email protected]> Signed-off-by: pei.zhang <[email protected]>
peizhang56
added a commit
to peizhang56/aiter
that referenced
this pull request
Oct 5, 2026
get_meta_param() was wholly @functools.lru_cache'd, so it returned a cached device tensor for num_kv_splits_indptr. A CUDA graph capturing a cache hit records only a pointer and no producing kernel, so once the LRU drops that entry (it was the tensor's only owner) the storage is recycled and replay reads garbage. Eviction is routine: total_kv is in the key and changes almost every decode step, while captured entries are never looked up again. This restores the cache to its original scope rather than removing an optimization. ROCm#322 added the decorator when the function returned two plain integers; ROCm#1233 added the torch.arange at the call site, outside the cache; ROCm#1390 folded it in and tightened the decorator to maxsize=1; ROCm#1445 widened that back to 128. Split the function. The split-count heuristic is pure and stays cached as _get_num_kv_splits(); get_meta_param() is now uncached and rebuilds the indptr with torch.arange, which is a fill kernel and so is recorded into the graph and re-runs on replay. This also drops a latent multi-device bug: the cached tensor was allocated on the then-current device with no device in the key. Costs nothing on the decode path, where the old cache took 0 hits in 2000 steps and was already rebuilding the arange every step (6.65 -> 6.69 us/call). It only paid on a repeating key, which is the graph-capture case, where the arange is recorded once and is free at replay. Adds op_tests/test_mla_split_indptr_cudagraph.py, runnable both as a plain script (as .github/scripts/aiter_test.sh invokes it) and under pytest. Fails on the old code at bs=480, passes with the fix. Co-Authored-By: Claude Opus 5 <[email protected]> Signed-off-by: pei.zhang <[email protected]>
peizhang56
added a commit
to peizhang56/aiter
that referenced
this pull request
Oct 6, 2026
get_meta_param() was wholly @functools.lru_cache'd, so it returned a cached device tensor for num_kv_splits_indptr. A CUDA graph capturing a cache hit records only a pointer and no producing kernel, so once the LRU drops that entry (it was the tensor's only owner) the storage is recycled and replay reads garbage. Eviction is routine: total_kv is in the key and changes almost every decode step, while captured entries are never looked up again. This restores the cache to its original scope rather than removing an optimization. ROCm#322 added the decorator when the function returned two plain integers; ROCm#1233 added the torch.arange at the call site, outside the cache; ROCm#1390 folded it in and tightened the decorator to maxsize=1; ROCm#1445 widened that back to 128. Split the function. The split-count heuristic is pure and stays cached as _get_num_kv_splits(); get_meta_param() is now uncached and rebuilds the indptr with torch.arange, which is a fill kernel and so is recorded into the graph and re-runs on replay. This also drops a latent multi-device bug: the cached tensor was allocated on the then-current device with no device in the key. Costs nothing on the decode path, where the old cache took 0 hits in 2000 steps and was already rebuilding the arange every step (6.65 -> 6.69 us/call). It only paid on a repeating key, which is the graph-capture case, where the arange is recorded once and is free at replay. Adds op_tests/test_mla_split_indptr_cudagraph.py, runnable both as a plain script (as .github/scripts/aiter_test.sh invokes it) and under pytest. Fails on the old code at bs=480, passes with the fix. Co-Authored-By: Claude Opus 5 <[email protected]> Signed-off-by: pei.zhang <[email protected]>
peizhang56
added a commit
to peizhang56/aiter
that referenced
this pull request
Nov 3, 2026
get_meta_param() was wholly @functools.lru_cache'd, so it returned a cached device tensor for num_kv_splits_indptr. A CUDA graph capturing a cache hit records only a pointer and no producing kernel, so once the LRU drops that entry (it was the tensor's only owner) the storage is recycled and replay reads garbage. Eviction is routine: total_kv is in the key and changes almost every decode step, while captured entries are never looked up again. This restores the cache to its original scope rather than removing an optimization. ROCm#322 added the decorator when the function returned two plain integers; ROCm#1233 added the torch.arange at the call site, outside the cache; ROCm#1390 folded it in and tightened the decorator to maxsize=1; ROCm#1445 widened that back to 128. Split the function. The split-count heuristic is pure and stays cached as _get_num_kv_splits(); get_meta_param() is now uncached and rebuilds the indptr with torch.arange, which is a fill kernel and so is recorded into the graph and re-runs on replay. This also drops a latent multi-device bug: the cached tensor was allocated on the then-current device with no device in the key. Costs nothing on the decode path, where the old cache took 0 hits in 2000 steps and was already rebuilding the arange every step (6.65 -> 6.69 us/call). It only paid on a repeating key, which is the graph-capture case, where the arange is recorded once and is free at replay. Verified locally with a throwaway capture/evict/replay harness (not added to the tree, per review): on the old code bs=480 replays a corrupted indptr (reads 3072, 3080, ... instead of 0, 8, 16, ...); with this fix bs=8 and bs=480 both replay the correct values. Co-Authored-By: Claude Opus 5 <[email protected]> Signed-off-by: pei.zhang <[email protected]>
jamestangg
pushed a commit
that referenced
this pull request
Nov 3, 2026
get_meta_param() was wholly @functools.lru_cache'd, so it returned a cached device tensor for num_kv_splits_indptr. A CUDA graph capturing a cache hit records only a pointer and no producing kernel, so once the LRU drops that entry (it was the tensor's only owner) the storage is recycled and replay reads garbage. Eviction is routine: total_kv is in the key and changes almost every decode step, while captured entries are never looked up again. This restores the cache to its original scope rather than removing an optimization. #322 added the decorator when the function returned two plain integers; #1233 added the torch.arange at the call site, outside the cache; #1390 folded it in and tightened the decorator to maxsize=1; #1445 widened that back to 128. Split the function. The split-count heuristic is pure and stays cached as _get_num_kv_splits(); get_meta_param() is now uncached and rebuilds the indptr with torch.arange, which is a fill kernel and so is recorded into the graph and re-runs on replay. This also drops a latent multi-device bug: the cached tensor was allocated on the then-current device with no device in the key. Costs nothing on the decode path, where the old cache took 0 hits in 2000 steps and was already rebuilding the arange every step (6.65 -> 6.69 us/call). It only paid on a repeating key, which is the graph-capture case, where the arange is recorded once and is free at replay. Verified locally with a throwaway capture/evict/replay harness (not added to the tree, per review): on the old code bs=480 replays a corrupted indptr (reads 3072, 3080, ... instead of 0, 8, 16, ...); with this fix bs=8 and bs=480 both replay the correct values. Signed-off-by: pei.zhang <[email protected]> Co-authored-by: Claude Opus 5 <[email protected]>
shantipriya-amd
pushed a commit
to shantipriya-amd/aiter
that referenced
this pull request
Nov 18, 2026
…#5194) get_meta_param() was wholly @functools.lru_cache'd, so it returned a cached device tensor for num_kv_splits_indptr. A CUDA graph capturing a cache hit records only a pointer and no producing kernel, so once the LRU drops that entry (it was the tensor's only owner) the storage is recycled and replay reads garbage. Eviction is routine: total_kv is in the key and changes almost every decode step, while captured entries are never looked up again. This restores the cache to its original scope rather than removing an optimization. ROCm#322 added the decorator when the function returned two plain integers; ROCm#1233 added the torch.arange at the call site, outside the cache; ROCm#1390 folded it in and tightened the decorator to maxsize=1; ROCm#1445 widened that back to 128. Split the function. The split-count heuristic is pure and stays cached as _get_num_kv_splits(); get_meta_param() is now uncached and rebuilds the indptr with torch.arange, which is a fill kernel and so is recorded into the graph and re-runs on replay. This also drops a latent multi-device bug: the cached tensor was allocated on the then-current device with no device in the key. Costs nothing on the decode path, where the old cache took 0 hits in 2000 steps and was already rebuilding the arange every step (6.65 -> 6.69 us/call). It only paid on a repeating key, which is the graph-capture case, where the arange is recorded once and is free at replay. Verified locally with a throwaway capture/evict/replay harness (not added to the tree, per review): on the old code bs=480 replays a corrupted indptr (reads 3072, 3080, ... instead of 0, 8, 16, ...); with this fix bs=8 and bs=480 both replay the correct values. Signed-off-by: pei.zhang <[email protected]> Co-authored-by: Claude Opus 5 <[email protected]>
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.
Motivation
Technical Details
Test Plan
Test Result
Submission Checklist