Skip to content

Instantly share code, notes, and snippets.

@apivovarov
Created April 26, 2026 23:10
Show Gist options
  • Select an option

  • Save apivovarov/08e01df9eb0d32f4181245dd6ad33809 to your computer and use it in GitHub Desktop.

Select an option

Save apivovarov/08e01df9eb0d32f4181245dd6ad33809 to your computer and use it in GitHub Desktop.
ra2a_r8_2x4.hlo
HloModule module, input_output_alias={ {}: (1, {}) }, num_partitions=1, replica_count=8
// HloModule module, num_partitions=1, replica_count=8
ENTRY entry {
id = u32[] replica-id()
input = f32[16] parameter(0)
output = f32[16] parameter(1)
send_sizes = s32[8] constant({1,1,1,1,1,1,1,1})
recv_sizes = s32[8] constant({1,1,1,1,1,1,1,1})
input_offsets = s32[8] constant({0, 2, 4, 6, 8, 10, 12, 14})
step = u32[] constant(2)
oof = u32[] multiply(id, step)
oof2 = s32[] convert(oof)
output_offsets = s32[8] broadcast(oof2)
ra2a = f32[16] ragged-all-to-all(input, output, input_offsets,
send_sizes, output_offsets, recv_sizes), replica_groups={{0,1,2,3,4,5,6,7}}
ROOT res = cosine(ra2a)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment