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

WIP: Adding TransformerEngine support for Communication GeMM overlap for Tensor Parallelism #1194

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

abhinavgoel95
Copy link
Contributor

Description

This PR adds the API for a TransformerEngine API into MaxText. This feature enables communication-gemm overlap (AKA collective matmul).

  • This feature improves the performance of LLM training by ~10% when using Tensor Parallelism
  • More stable than XLA's pattern matcher and the custom call generates good schedules.

Tests

I have tested this change on Llama2 and Llama3 workloads so far.

python3 /opt/workspace/maxtext_fork/MaxText/train.py \
    /opt/workspace/maxtext_fork/MaxText/configs/base.yml \
    model_name=${MODEL} \
    per_device_batch_size=0.25 \
    steps=15 \
    scan_layers=true \
    monitor_goodput=false \
    enable_goodput_recording=false \
    remat_policy=minimal_flash \
    attention=cudnn_flash_te \
    max_target_length=4096 \
    use_iota_embed=true \
    logits_dot_in_fp32=false\
    enable_checkpointing=false \
    ici_data_parallelism=1 \
    ici_fsdp_parallelism=2 \
    ici_tensor_parallelism=1 \
    ici_tensor_sequence_parallelism=4 \
    base_output_directory=local_train \
    dataset_path=local \
    dataset_type=synthetic \
    hardware=gpu_mpi \
    comm_gemm_overlap=true

Checklist

Before submitting this PR, please make sure (put X in square brackets):

  • I have performed a self-review of my code.
  • I have necessary comments in my code, particularly in hard-to-understand areas.
  • I have run end-to-end tests tests and provided workload links above if applicable.
  • I have made or will make corresponding changes to the doc if needed.

"atomic_gemm": False, # more performant when not using CUDA Graphs
"use_ce": True, # ignored (always False) for "pipeline" method
},
"fc2_fprop": {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Avoid nested configs. Make it editable through the command line.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Apologies if you've already started to refactor - I think the nested config is fine if we expect the default settings are fixed, e.g. almost never any need to use something different than the default. If we expect we often want something different than the default then I would strongly prefer a easy way to override via CLI

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They would not need to be tweaked after the model is set up. Thanks for the input, I will not make that change for now.

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.

3 participants