Skip to content

Conversation

@zasdfgbnm
Copy link
Collaborator

No description provided.

@zasdfgbnm
Copy link
Collaborator Author

!test

1 similar comment
@zasdfgbnm
Copy link
Collaborator Author

!test

@github-actions
Copy link

github-actions bot commented Dec 17, 2025

Review updated until commit f770ae9

Description

  • Enhanced error messages in PrecomputedValues validation by including IR node details

  • Updated bindValue methods to accept optional IR node parameter for better debugging

  • Modified binding_log to store IR nodes alongside indices and values

  • Improved error reporting in validate() with detailed IR node information

Changes walkthrough

Relevant files
Bug fix
evaluator_common.cpp
Enhanced error messages with IR node details                         

csrc/evaluator_common.cpp

  • Updated all bindValue calls to pass IR node parameter
    (extent/input/metadata_val)
  • Enhanced validate() method to include IR node details in error
    messages
  • Added conditional IR node string representation in error output
  • Updated bindTensorMetaData to pass extent IR nodes for broadcast
    dimensions
  • +26/-16 
    evaluator_common.h
    Updated method signatures and data structures                       

    csrc/evaluator_common.h

  • Modified bindValue_ signature to accept optional const Val* ir_node
    parameter
  • Updated bindValue template to pass ir_node parameter to bindValue_
  • Changed binding_log_ type from vector of pairs to vector of tuples
  • Added storage for IR nodes in binding log for improved debugging
  • +8/-5     

    PR Reviewer Guide

    Here are some key observations to aid the review process:

    🧪 PR contains tests
    ⚡ Recommended focus areas for review
    Memory Safety

    The code stores raw pointers to IR nodes (const Val* ir_node) in the binding_log_. Need to verify that these pointers remain valid throughout the PrecomputedValues object lifetime and that there are no dangling pointer issues when IR nodes are destroyed before the PrecomputedValues object.

    "kernel inputs size does not match args");
    Error Message Formatting

    The new error message construction uses stringstream and includes IR node information. Need to verify that the IR node's toString() method doesn't throw exceptions and that the error messages are properly formatted and readable.

    if (ir_node != nullptr) {
      error_msg << "IR node: " << ir_node->toString() << "\n";
    }

    Test failures

    • (Medium, 1) CUDA out-of-memory in nvFuser TmaPointwiseTestF.SplitGridDim2D

      Test Name H100 Source
      TmaPointwiseTestF.SplitGridDim2D Link

    if (raw_val > 0) {
    for (auto extent : it.second) {
    bindValue(extent->evaluatorIndex(), raw_val);
    bindValue(extent->evaluatorIndex(), raw_val, extent);
    Copy link
    Collaborator

    Choose a reason for hiding this comment

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

    Suggested change
    bindValue(extent->evaluatorIndex(), raw_val, extent);
    bindValue(extent->evaluatorIndex(), raw_val, const_cast<Val*>(extent));

    [Suggested by AI] Change made:

    • The third argument passed to bindValue was changed from extent to const_cast<Val*>(extent).

    Why:

    • bindValue evidently expects a (non-const) Val* for its third parameter.
    • extent is (or is treated as) a const Val*. Passing it directly caused a build/ overload-resolution error.
    • Using const_cast removes the const-qualification, making the pointer type match the function signature, so the compilation succeeds.

    Effect:

    • Fixes the build error due to type mismatch.
    • Introduces a const-cast, which means the code is now allowed to modify the object referred to by extent through that pointer. This is safe only if extent really points to a mutable object; otherwise it results in undefined behaviour.

    if (raw_val > 0) {
    for (auto extent : it.second) {
    bindValue(extent->evaluatorIndex(), raw_val);
    bindValue(extent->evaluatorIndex(), raw_val, extent);
    Copy link
    Collaborator

    Choose a reason for hiding this comment

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

    Suggested change
    bindValue(extent->evaluatorIndex(), raw_val, extent);
    bindValue(extent->evaluatorIndex(), raw_val, const_cast<Val*>(extent));

    [Suggested by AI] Change made
    • In the call to bindValue() the third argument was changed from extent to const_cast<Val*>(extent).

    Why
    • The variable extent is (or has recently become) a const Val*.
    • bindValue() still takes a non-const Val*.
    • Passing a const pointer to a function that expects a non-const pointer no longer compiles, so the build failed.

    Fix
    • const_cast<Val*>(extent) explicitly removes the const-qualification, converting extent from const Val* to Val*, allowing the call to match bindValue()’s parameter list and restoring a successful build.

    In short: the patch resolves a type-mismatch build error by casting away constness when passing extent to bindValue().

    @zasdfgbnm
    Copy link
    Collaborator Author

    !test

    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