Skip to content

Conversation

@wujingyue
Copy link
Collaborator

Summary

  • add debug logging hooks for propagation paths
  • adjust related scheduler/propagation utilities

Testing

  • not run

@github-actions
Copy link

github-actions bot commented Jan 29, 2026

Review updated until commit 0ee7101

Description

  • Add debug logging for transform propagation in shardLoopLike function

  • Implement stream operator for PropagateDirection enum to enable proper logging

  • Remove unused include from propagate_shardings.cpp

  • Reorder SPECIALIZE_PRINTER macros alphabetically in base.h

Changes walkthrough

Relevant files
Enhancement
propagation.cpp
Add debug logging to shardLoopLike function                           

csrc/multidevice/propagation.cpp

  • Added debug logging in shardLoopLike function
  • Logs propagation details including ref, target, direction, and
    parallel types
  • Only logs when DebugDumpOption::TransformPropagator is enabled
  • +7/-0     
    utils.cpp
    Add stream operator for PropagateDirection                             

    csrc/scheduler/utils.cpp

  • Implemented operator<< for PropagateDirection enum
  • Returns "Forward" or "Backward" string representation
  • Enables proper logging of propagation direction
  • +16/-0   
    utils.h
    Declare stream operator for PropagateDirection                     

    csrc/scheduler/utils.h

  • Added declaration of operator<< for PropagateDirection
  • Enables proper logging of propagation direction
  • +2/-0     
    Cleanup
    propagate_shardings.cpp
    Remove unused include                                                                       

    csrc/preseg_passes/propagate_shardings.cpp

    • Removed unused include of "multidevice/utils.h"
    +0/-1     
    Formatting
    base.h
    Reorder SPECIALIZE_PRINTER macros                                               

    csrc/base.h

  • Reordered SPECIALIZE_PRINTER macros alphabetically
  • No functional changes, only formatting improvement
  • +13/-11 

    PR Reviewer Guide

    Here are some key observations to aid the review process:

    🧪 No relevant tests
    ⚡ Recommended focus areas for review
    Missing Testing

    The PR description explicitly states "not run" for testing. This is a debug logging change that should be tested to ensure the logging works correctly and doesn't introduce any runtime issues or performance regressions.

    if (isDebugDumpEnabled(DebugDumpOption::TransformPropagator)) {
      debug() << "Propagating shardings from " << ref->toString() << " to "
              << tv->toString() << " in " << direction << " for "
              << toDelimitedString(selected_parallel_types) << std::endl;
    }
    Removed Include

    The #include "multidevice/utils.h" was removed but there's no explanation of why this include is no longer needed. This could potentially break compilation if other code in this file depends on symbols from that header.

    #include "multidevice/propagation.h"
    Printer Reorganization

    The SPECIALIZE_PRINTER macros were significantly reorganized. While this appears to be just reordering for clarity, it should be verified that all necessary printers are still defined and that the change doesn't break any existing debug output functionality.

    SPECIALIZE_PRINTER(BinaryOpType);
    SPECIALIZE_PRINTER(CircularBufferLoopStage);
    SPECIALIZE_PRINTER(DataType);
    SPECIALIZE_PRINTER(LoadStoreOpType);
    SPECIALIZE_PRINTER(MemoryType);
    SPECIALIZE_PRINTER(MmaInputSmemSwizzle);
    SPECIALIZE_PRINTER(ParallelType);
    SPECIALIZE_PRINTER(Swizzle2DType);
    SPECIALIZE_PRINTER(SwizzleMode);
    SPECIALIZE_PRINTER(SwizzleType);
    SPECIALIZE_PRINTER(TernaryOpType);
    SPECIALIZE_PRINTER(UnaryOpType);
    SPECIALIZE_PRINTER(std::optional<bool>);
    SPECIALIZE_PRINTER(std::vector<int64_t>);
    SPECIALIZE_PRINTER(std::vector<int>);
    SPECIALIZE_PRINTER(std::vector<uint32_t>);
    SPECIALIZE_PRINTER(std::vector<uint64_t>);
    SPECIALIZE_PRINTER(tma::TensorMapFloatOOBFill);
    SPECIALIZE_PRINTER(tma::TensorMapInterleave);
    SPECIALIZE_PRINTER(tma::TensorMapL2Promotion);

    @greptile-apps
    Copy link
    Contributor

    greptile-apps bot commented Jan 29, 2026

    Greptile Overview

    Greptile Summary

    Added debug logging infrastructure to track sharding propagation paths through the transform propagator. The changes enable developers to trace how shardings propagate between tensors during compilation.

    Key changes:

    • Added operator<< for PropagateDirection enum to enable debug printing
    • Inserted debug logging hook in shardLoopLike that outputs source tensor, target tensor, direction, and parallel types when TransformPropagator debug option is enabled
    • Alphabetized SPECIALIZE_PRINTER macros in base.h for better organization
    • Removed unused multidevice/utils.h include from propagate_shardings.cpp

    Confidence Score: 5/5

    • This PR is safe to merge with minimal risk
    • All changes are non-functional debug logging additions and code organization improvements. The debug logging is properly guarded by runtime checks and only activates when explicitly enabled. The removed include is genuinely unused as the required function is available through transitive includes.
    • No files require special attention

    Important Files Changed

    Filename Overview
    csrc/scheduler/utils.h Added stream operator declaration for PropagateDirection enum
    csrc/scheduler/utils.cpp Implemented stream operator for PropagateDirection enum to enable debug printing
    csrc/multidevice/propagation.cpp Added debug logging for sharding propagation paths using TransformPropagator debug option

    Sequence Diagram

    sequenceDiagram
        participant User
        participant PropagateShardingsPass
        participant shardLoopLike
        participant DebugLogger
        participant TransformPropagator
    
        User->>PropagateShardingsPass: Enable TransformPropagator debug option
        PropagateShardingsPass->>shardLoopLike: shardLoopLike(ref, tv, parallel_types, direction)
        shardLoopLike->>DebugLogger: isDebugDumpEnabled(TransformPropagator)?
        alt Debug enabled
            DebugLogger-->>shardLoopLike: true
            shardLoopLike->>DebugLogger: debug() << ref << tv << direction << parallel_types
            Note over DebugLogger: Logs: "Propagating shardings from [ref] to [tv] in [Forward/Backward] for [ParallelTypes]"
        else Debug disabled
            DebugLogger-->>shardLoopLike: false
        end
        shardLoopLike->>TransformPropagator: Continue with propagation logic
        TransformPropagator-->>shardLoopLike: Propagation complete
    
    Loading

    Copy link
    Contributor

    @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.

    3 files reviewed, no comments

    Edit Code Review Agent Settings | Greptile

    @wujingyue
    Copy link
    Collaborator Author

    !test

    @wujingyue wujingyue requested a review from Priya2698 January 30, 2026 23:55
    Copy link
    Contributor

    @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.

    3 files reviewed, no comments

    Edit Code Review Agent Settings | Greptile

    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.

    2 participants