Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Chakra Converter Handling of NCCL All-to-All, Logging Consistency, and HTA Dependency Issues #160

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

JoongunPark
Copy link
Contributor

@JoongunPark JoongunPark commented Oct 14, 2024

Summary

This PR addresses multiple issues in the Chakra converter:

1. Improper Handling of NCCL All-to-All Communication

Chakra incorrectly distinguishes between point-to-point and collective communication. In NCCL, all-to-all is implemented as point-to-point communication, but Chakra's current logic treats these as distinct, leading to an incorrect type for PyTorchNode. More details on NCCL point-to-point can be found here.

2. Logging Inconsistency

There was a mismatch in logging levels: sync dependencies log via logging.info, while other dependencies use logging.debug. This PR resolves the inconsistency by standardizing the logging approach.

3. False Positive Dependencies from HTA

HTA returns false positives for sync dependencies, leading to invalid later op -> earlier op dependencies. This causes Chakra to fail in certain traces. The Chakra converter was found to encounter two critical failures:

  • Cycle dependencies
  • Stack overflows (due to call stacks exceeding 1000 levels)

4. Support for PyTorch >2.5.0 and Updated Chakra Schema

The nightly version of PyTorch >2.5.0 appears to require support for schema version 1.1.1-chakra.0.0.4.
Updated Chakra to include the most recent schema version in its supported list.

5. Update trace_linker to use external_id for finding GPU op's parent CPU op

There were many operations matched with wrong parent CPU during trace linking.
This PR solves this problem using external_id instead of ev_idx.

6. Handling HTA Errors in Chakra

The trace linker was terminating unexpectedly due to errors in HTA. Although this may stem from trace inconsistencies, the issue does not occur when HTA is excluded.
Updated Chakra to handle these errors by raising exceptions instead of terminating the trace linker.

7. Proper Encoding of pg_name in Collective Operations

Identified an issue where SendRecv, Reduce-Scatter and All-Gather operations do not correctly encode pg_name following updates on the PyTorch side.
Modified Chakra to ensure proper encoding of pg_name in these collective operations.

Test Plan

I tested the fixes using Mixtral 8x3B traces collected with the NeMo framework (NVIDIA).
traces_device_0.zip

#!/bin/bash
# Set the result path
PATH="~/scratch/results/mixtral_8x3b/results"

# Loop through trace ranks
for i in 0
do
    echo "Start linking trace: $i"
    chakra_trace_link \
        --chakra-host-trace $PATH/host_$i.json \
        --chakra-device-trace $PATH/device_$i.json  \
        --rank $i \
        --output-file $PATH/rank_$i.json

    echo "Start converting trace: $i"
    chakra_converter PyTorch \
        --input $PATH/rank_$i.json \
        --output $PATH/rank_$i.et
done

@JoongunPark JoongunPark requested a review from a team as a code owner October 14, 2024 18:39
Copy link

github-actions bot commented Oct 14, 2024

MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅

@JoongunPark JoongunPark force-pushed the main branch 2 times, most recently from d50a6c0 to 2833ef8 Compare October 14, 2024 18:57
@JoongunPark JoongunPark force-pushed the main branch 3 times, most recently from cf42d25 to 474b99f Compare November 16, 2024 04:33
@JoongunPark JoongunPark force-pushed the main branch 3 times, most recently from cbcce6a to aee556b Compare December 1, 2024 21:36
@JoongunPark JoongunPark force-pushed the main branch 2 times, most recently from d1a331b to 640de25 Compare December 2, 2024 06:00
@JoongunPark
Copy link
Contributor Author

Hi @srinivas212 and @tushar-krishna .
Who would be the best person to ask for a review?

@JoongunPark
Copy link
Contributor Author

JoongunPark commented Dec 16, 2024

Hi @srinivas212 and @tushar-krishna . Who would be the best person to ask for a review?

Hi, this PR should be refined with recently accpeted PR (#145) and I am working on it.

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