Skip to content

Conversation

@yaeliyac
Copy link
Contributor

@yaeliyac yaeliyac commented Nov 9, 2025

Add Matrix generator option to pt generator for A2AV matrices.
This PR adds matrix creation based on this repo
4 kinds of matrices -
0. Basic A2AV (uniform traffic)

  1. Biased A2AV (higher intensity for selected ranks)
  2. Random target group sizes (topK)
  3. Random token sizes

run with --gen matrix:kind={0-3}@token_size_KB_mean=N@num_tokens=M@tgt_group_size_mean=K
token_size_KB_mean, num_tokens, tgt_group_size_mean will get default values if not set.

@yaeliyac yaeliyac force-pushed the pt_generator_add_matrix_generator_a2av branch 2 times, most recently from 395e944 to 81d74f2 Compare November 16, 2025 15:03
@yaeliyac yaeliyac marked this pull request as ready for review November 16, 2025 15:07
@greptile-apps
Copy link

greptile-apps bot commented Nov 16, 2025

Greptile Overview

Greptile Summary

Adds matrix-based traffic pattern generator for A2AV collective operations with four pattern types: uniform, biased, random target groups, and random message sizes.

Key Changes:

  • New ucc_pt_generator_traffic_matrix class generates configurable A2AV traffic patterns
  • Command-line interface extended with --gen matrix: and --seed options
  • Global random generator seeding support for reproducible patterns

Critical Issue:

  • Line 86 in traffic_matrix.cc: integer accumulator (0 instead of 0.0) truncates probability sum to 0, causing division by zero when normalizing biased probabilities

Confidence Score: 2/5

  • This PR has a critical division-by-zero bug that will crash when using biased matrix generation (kind=1)
  • The integer accumulator bug on line 86 causes division by zero, making biased traffic patterns (kind=1) unusable. This is a runtime crash bug that needs immediate fixing before merge.
  • tools/perf/generator/ucc_pt_generator_traffic_matrix.cc requires immediate attention for the division-by-zero bug

Important Files Changed

File Analysis

Filename Score Overview
tools/perf/generator/ucc_pt_generator_traffic_matrix.cc 2/5 New traffic matrix generator with critical division-by-zero bug in bias probability calculation (line 86)
tools/perf/ucc_pt_config.cc 4/5 Adds command-line parsing for matrix generator and seed parameter with proper error handling
tools/perf/ucc_pt_benchmark.cc 5/5 Integrates matrix generator with proper type checking for ALLTOALLV operations

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

6 files reviewed, 9 comments

Edit Code Review Agent Settings | Greptile

@yaeliyac yaeliyac force-pushed the pt_generator_add_matrix_generator_a2av branch from 3ad787f to 08bac56 Compare November 17, 2025 15:33
@yaeliyac yaeliyac force-pushed the pt_generator_add_matrix_generator_a2av branch 4 times, most recently from 849964b to 746b197 Compare November 25, 2025 11:04
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

6 files reviewed, 5 comments

Edit Code Review Agent Settings | Greptile


size_t ucc_pt_generator_traffic_matrix::get_count_max()
{
auto matrix = pattern_counts[current_pattern];
Copy link

Choose a reason for hiding this comment

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

style: copying entire vector instead of using const reference, causes unnecessary memory allocation

Copy link
Collaborator

@ikryukov ikryukov left a comment

Choose a reason for hiding this comment

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

Please, use clang format file from repo to format code

#include <numeric>
#include <stdexcept>

std::default_random_engine generator;
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we avoid global variables?

@yaeliyac yaeliyac force-pushed the pt_generator_add_matrix_generator_a2av branch from 746b197 to 867fb69 Compare November 27, 2025 14:11
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

6 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

probabilities[bias_index] *= bias_factor;
}
}
int sum = std::accumulate(probabilities.begin(), probabilities.end(), 0);
Copy link

Choose a reason for hiding this comment

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

logic: integer accumulator truncates doubles to 0, causing division by zero on line 88

Suggested change
int sum = std::accumulate(probabilities.begin(), probabilities.end(), 0);
double sum = std::accumulate(probabilities.begin(), probabilities.end(), 0.0);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants