Skip to content

Testing(do-not-merge): Isolate GEMM to single chip to remove barrier-cores (v6e only) - #133

Draft
simrankaurb wants to merge 1 commit into
AI-Hypercomputer:chsfrom
simrankaurb:single-chip-isolation
Draft

Testing(do-not-merge): Isolate GEMM to single chip to remove barrier-cores (v6e only) #133
simrankaurb wants to merge 1 commit into
AI-Hypercomputer:chsfrom
simrankaurb:single-chip-isolation

Conversation

@simrankaurb

Copy link
Copy Markdown

No description provided.

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

Copy link
Copy Markdown

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 attempts to restrict the benchmarking execution to a subset of devices by hardcoding device_count = 1 in benchmark_gemm_throttling.py and slicing the devices list to [0:1] in benchmark_utils.py. The reviewer identified two critical issues with these changes: first, slicing to [0:1] selects only a single core, which will trigger an assertion error because a single TPU chip requires two cores (suggesting [0:2] instead); second, hardcoding device_count = 1 will underestimate the total FLOPs and throughput metrics by a factor of two for a single-chip configuration (suggesting device_count = 2 instead).

If False, uses all available devices.
"""
devices = jax.local_devices() if local_mesh else jax.devices()
devices = jax.local_devices()[0:1] if local_mesh else jax.devices()[0:1]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Slicing the devices to [0:1] selects only a single device (core). However, a single TPU chip consists of two cores (as indicated by the assertion num_devices % 2 == 0 and the comment on SHARDING_ON_SINGLE_CHIP_WITH_M). Using [0:1] will cause an AssertionError whenever a single-chip sharding strategy is used because num_devices will be 1, which is not divisible by 2. To isolate to a single chip (2 cores), you should slice [0:2] instead.

Suggested change
devices = jax.local_devices()[0:1] if local_mesh else jax.devices()[0:1]
devices = jax.local_devices()[0:2] if local_mesh else jax.devices()[0:2]

device_count = (
jax.local_device_count() if run_on_local_node else jax.device_count()
)
device_count = 1

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

If the GEMM is isolated to a single chip (which contains 2 devices/cores), the mesh created by create_mesh will contain 2 devices. Hardcoding device_count = 1 here will cause total_flops_all_devices to be underestimated by a factor of 2, leading to incorrect total throughput metrics. Consider setting device_count = 2 to match the single-chip configuration.

Suggested change
device_count = 1
device_count = 2

@simrankaurb
simrankaurb marked this pull request as draft August 20, 2026 14:08
@simrankaurb simrankaurb changed the title Testing: Isolate GEMM to single chip to remove barrier-cores Testing: Isolate GEMM to single chip to remove barrier-cores (v6e only) Aug 20, 2026
@simrankaurb simrankaurb changed the title Testing: Isolate GEMM to single chip to remove barrier-cores (v6e only) Testing(do-not-merge): Isolate GEMM to single chip to remove barrier-cores (v6e only) Aug 20, 2026
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