Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Ironwood/src/benchmark_gemm_throttling.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def gemm_throttling(
dtype: jnp.dtype = jax.numpy.float8_e4m3fn,
gap_strategy: str = "data_gen_every_iter_block_every_iter",
trace_dir: str = None,
run_on_local_node: bool = False,
Comment thread
simrankaurb marked this conversation as resolved.
) -> Dict[str, Any]:
"""Benchmarks the OUT<M, N>:BF16 = IN0<M, K>:FP8 x IN1<N, K>:FP8.

Expand All @@ -59,7 +60,7 @@ def f(x, y):
)
return acc.astype(jnp.bfloat16)

mesh = create_mesh(SHARDING_STRATEGY)
mesh = create_mesh(SHARDING_STRATEGY, local_mesh=run_on_local_node)
lhs_sharding = get_lhs_named_shading(mesh, SHARDING_STRATEGY)
rhs_sharding = get_rhs_named_shading(mesh, SHARDING_STRATEGY)
out_sharding = get_out_sharding(SHARDING_STRATEGY)
Expand Down Expand Up @@ -120,12 +121,16 @@ def gemm_throttling_calculate_metrics(
gap_strategy: str,
dtype: jnp.dtype,
time_ms_list: list[float],
run_on_local_node: bool = False,
) -> Dict[str, Any]:
# pylint: disable=unused-argument
# Calculate FLOPs
total_flops = 2 * m * k * n # Total floating-point operations
device_count = (
jax.local_device_count() if run_on_local_node else jax.device_count()
)
total_flops, total_flops_all_devices = handle_based_on_sharding(
total_flops, SHARDING_STRATEGY
total_flops, SHARDING_STRATEGY, device_count=device_count
)
return unified_flops_metrics(
m,
Expand Down
Loading