Skip to content

Instantly share code, notes, and snippets.

@tugot17
tugot17 / README.md
Last active March 27, 2026 21:45
MI325X vs H100: P2P & All-Reduce Interconnect Benchmarks (Infinity Fabric vs NVLink)

MI325X vs H100: P2P & Collectives Benchmarks

P2P Bandwidth

P2P Bandwidth

H100: ~395 GB/s per pair (dedicated NVLink). MI325X: ~49 GB/s per pair (448 GB/s shared across 7 links).

All-Reduce (8 GPUs, RCCL/NCCL)

@tugot17
tugot17 / var_sequence_plus_causal_mask.py
Created February 8, 2024 09:35
Generate a causal mask for batches of varying length; can by consumed by torch.nn.functional.scaled_dot_product_attention
import torch
from torch import Tensor
#padding plus causal mask
def create_combined_mask(seq_lengths: torch.Tensor, t: int) -> Tensor:
# Create the Base Causal Mask (mask future tokens)
base_causal_mask = torch.triu(torch.ones((t, t), dtype=torch.bool), diagonal=1)
# Adjust for Padding (mask padding tokens on the left)
padding_mask = torch.arange(t).expand(len(seq_lengths), t) < (t - seq_lengths.unsqueeze(1))