Skip to content

Clean up unused variables in get_kvcache_metadata_buffer#371

Open
gameofdimension wants to merge 1 commit intoNVIDIA:mainfrom
gameofdimension:patch-4
Open

Clean up unused variables in get_kvcache_metadata_buffer#371
gameofdimension wants to merge 1 commit intoNVIDIA:mainfrom
gameofdimension:patch-4

Conversation

@gameofdimension
Copy link
Copy Markdown
Contributor

Removed unused variable assignments for tensor data types and buffer sizes.

Description

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

Removed unused variable assignments for tensor data types and buffer sizes.
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 21, 2026

Greptile Summary

This PR removes two genuinely unused statements from get_kvcache_metadata_buffer in inference_config.py: a floating dtype ternary expression that was never assigned to a variable, and max_host_kv_buffer_size, a tuple that was computed but never referenced downstream. The cleanup is correct and has no functional impact.

Confidence Score: 5/5

Safe to merge — only dead code is removed with no behavioral change.

Both removed statements were provably unused: the dtype expression had no left-hand side assignment and was never referenced, and max_host_kv_buffer_size was assigned but never passed to KVCacheMetadata or used elsewhere. No logic paths are altered.

No files require special attention.

Important Files Changed

Filename Overview
examples/hstu/configs/inference_config.py Removed two dead-code statements in get_kvcache_metadata_buffer: a dtype ternary expression with no assignment, and an unused max_host_kv_buffer_size tuple variable. No functional change.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["get_kvcache_metadata_buffer(hstu_config, kvcache_config)"] --> B["Compute max_new_history_seqlen"]
    B --> C["Compute max_num_pages_per_seq"]
    C --> D["~~dtype ternary (removed)~~"]
    C --> E["~~max_host_kv_buffer_size (removed)~~"]
    C --> F["Allocate paged_indices_buffer"]
    F --> G["Allocate page_indptr_buffer"]
    G --> H["Allocate last_page_lens_buffer"]
    H --> I["Allocate batch_indices_buffer"]
    I --> J["Allocate position_buffer"]
    J --> K["Allocate total_history_offsets_buffer"]
    K --> L["Return KVCacheMetadata"]

    style D stroke-dasharray: 5 5,color:#999
    style E stroke-dasharray: 5 5,color:#999
Loading

Reviews (1): Last reviewed commit: "Clean up unused variables in get_kvcache..." | Re-trigger Greptile

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.

1 participant