Skip to content

Conversation

@sunxxuns
Copy link
Collaborator

Motivation

Modifications

Accuracy Tests

Benchmarking and Profiling

Checklist

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @sunxxuns, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on optimizing memory consumption within the system, particularly for continuous integration (CI) environments that may have limited resources or lack virtual DRAM. The changes involve refining memory assertion messages for better debugging, improving the detection of AMD CI machines, and crucially, adjusting hierarchical cache memory parameters to reduce GPU and CPU memory footprint during tests on HIP-enabled systems. This ensures more stable and efficient test execution in resource-constrained CI setups.

Highlights

  • Memory Assertion Clarity: The host memory assertion message has been enhanced to display the actual host and device memory sizes in GB, making debugging memory-related issues more straightforward.
  • AMD CI Detection Improvement: The is_in_amd_ci utility function now includes a check for is_hip(), providing a more robust detection mechanism for AMD CI environments.
  • Hierarchical Cache Memory Optimization for HIP: The hierarchical cache test configuration has been updated to significantly reduce memory usage for HIP (AMD) environments. Specifically, mem-fraction-static is lowered from 0.7 to 0.2, and hicache-size is reduced from 200 to 40, addressing memory constraints on CI machines without virtual DRAM.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request aims to reduce GPU and CPU memory consumption for CI environments, particularly for machines without virtual DRAM. The changes primarily involve adjusting memory-related parameters for tests running on AMD GPUs. Specifically, mem-fraction-static and hicache-size are lowered in test/srt/hicache/test_hicache.py. Additionally, the utility function is_in_amd_ci is updated to be more robust by checking for a HIP environment directly. My review focuses on the correctness of these changes. While the adjustments for CI seem appropriate, I've identified an issue in the updated assertion message in python/sglang/srt/mem_cache/memory_pool_host.py. The calculation for memory size in GB is incorrect, and I've provided a suggestion to fix it. The other changes look good.

Comment on lines 73 to 75
assert (
self.size > device_pool.size
), "The host memory should be larger than the device memory with the current protocol"
), f"The host memory {self.size / 1024**3} GB should be larger than the device memory {device_pool.size/ 1024**3} GB with the current protocol"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The calculation for memory size in the assertion message is incorrect. self.size and device_pool.size represent the number of tokens, not the size in bytes. To correctly calculate the size in GB, you should multiply the token count by self.size_per_token before dividing by 1024**3. I've also added formatting to improve readability.

Suggested change
assert (
self.size > device_pool.size
), "The host memory should be larger than the device memory with the current protocol"
), f"The host memory {self.size / 1024**3} GB should be larger than the device memory {device_pool.size/ 1024**3} GB with the current protocol"
assert (
self.size > device_pool.size
), f"The host memory {(self.size * self.size_per_token) / 1024**3:.2f} GB should be larger than the device memory {(device_pool.size * self.size_per_token) / 1024**3:.2f} GB with the current protocol"

@sunxxuns sunxxuns changed the title reduced gpu and cpu memory to for ci machine without virtual dram [test] adjust timeout and dram host mem for amd ci Sep 29, 2025
@sunxxuns sunxxuns force-pushed the fixing_amd_ci_1 branch 4 times, most recently from 92d1f69 to ba3f2ba Compare September 30, 2025 08:59
@sunxxuns sunxxuns closed this Oct 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant