Skip to content

Remove legacy bindings#5917

Open
rdspring1 wants to merge 3 commits intomainfrom
remove_legacy_bindings
Open

Remove legacy bindings#5917
rdspring1 wants to merge 3 commits intomainfrom
remove_legacy_bindings

Conversation

@rdspring1
Copy link
Collaborator

This PR removes the nvfuser python module, corresponding pybind11 CPP bindings, and any references from csrc. Version is bumped to 0.2.36.

@rdspring1 rdspring1 added the Direct Bindings Python extension with direct mapping to NvFuser CPP objects. label Feb 3, 2026
@rdspring1
Copy link
Collaborator Author

!test

@github-actions
Copy link

github-actions bot commented Feb 3, 2026

Review updated until commit aa333da

Description

  • Remove legacy nvfuser Python module and bindings from build system

  • Update build scripts to only use nvfuser_direct module

  • Add TODO comments in documentation for migration to nvfuser_direct

  • Bump version from 0.2.35 to 0.2.36

Changes walkthrough

Relevant files
Enhancement
6 files
CMakeLists.txt
Remove legacy nvfuser Python library build section             
+3/-141 
utils.py
Remove nvfuser._C references, keep only nvfuser_direct._C_DIRECT
+2/-7     
check_symbol_visibility.sh
Remove nvfuser extension checks, keep only nvfuser_direct
+1/-16   
version.txt
Bump version from 0.2.35 to 0.2.36                                             
+1/-1     
type.h
Add NVF_API visibility to operator<< functions                     
+2/-2     
utils.h
Add NVF_API visibility to getShardedLogicalAxis function 
+2/-1     
Documentation
5 files
autotune_inner_reduction.py
Add TODO comment to migrate to nvfuser_direct module         
+2/-0     
autotune_pointwise.py
Add TODO comment to migrate to nvfuser_direct module         
+2/-0     
autotune_matmul.py
Add TODO comment to migrate to nvfuser_direct module         
+2/-0     
profile_matmul.py
Add TODO comment to migrate to nvfuser_direct module         
+1/-0     
Serde.md
Update documentation about serialization being disabled   
+3/-1     
Miscellaneous
1 files
fusion_segmenter.cpp
Update GitHub link reference in comment                                   
+1/-1     
Additional files
36 files
options.cpp +0/-2     
options.h +0/-2     
fusion_kernel_runtime.cpp +0/-12   
fusion_record.cpp +0/-952 
fusion_record.h +0/-124 
README.md +0/-210 
__init__.py +0/-649 
__init__.pyi +0/-4     
benchmark_utils.py +0/-160 
__init__.py +0/-9     
__init__.py +0/-13   
normalization.py +0/-725 
nvfuser_version.py +0/-69   
pytorch_utils.py +0/-190 
fusion_cache.cpp +0/-953 
fusion_cache.h +0/-320 
fusion_definition.cpp +0/-769 
fusion_definition.h +0/-389 
fusion_record.h +0/-3675
fusion_state.cpp +0/-297 
fusion_state.h +0/-143 
multidevice_bindings.cpp +0/-103 
python_bindings.cpp +0/-4196
python_bindings.h +0/-27   
python_bindings_extension.cpp +0/-18   
schedule_bindings.cpp +0/-517 
segmentation.cpp +0/-369 
segmentation.h +0/-246 
translation.cpp +0/-1484
translation.h +0/-20   
translation_utils.cpp +0/-80   
translation_utils.h +0/-300 
test_import.py +0/-17   
__init__.py +0/-6     
utils.py +0/-358 
env_options.yaml +0/-12   

PR Reviewer Guide

Here are some key observations to aid the review process:

🧪 PR contains tests
⚡ Recommended focus areas for review
Build System Logic Issue

The build_extension method has incorrect indentation causing a syntax error. The conditional logic for nvfuser_direct._C_DIRECT is improperly nested inside the copy_library method instead of being a separate conditional branch.

def build_extension(self, ext):
    if ext.name == "nvfuser_direct._C_DIRECT":
        self.copy_library(ext, "libnvfuser_direct")
        self.copy_shared_library("libnvfuser_codegen.so")
    else:
        super().build_extension(ext)

Documentation References
Multiple documentation files have TODO comments about updating to use nvfuser_direct module, but no actual updates are made. This leaves documentation in an inconsistent state that could confuse users.

Script Logic Error

The script logic has been modified to only check nvfuser_direct but the final results section still references NVFUSER_OK variable which is no longer set, potentially causing shell script errors.

if [ $NVFUSER_DIRECT_OK -eq 0 ]; then

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 3, 2026

Greptile Overview

Greptile Summary

This PR removes the legacy nvfuser Python module and associated pybind11 bindings. The removal includes 17,590 lines deleted across 48 files, covering the entire python/nvfuser package, python/python_frontend C++ bindings, and serialization code in csrc/serde/fusion_record.cpp.

Major Changes:

  • Deleted entire python/nvfuser module (649 lines in __init__.py plus supporting files)
  • Removed python/python_frontend pybind11 bindings (4,196 lines in python_bindings.cpp plus other files)
  • Removed csrc/serde/fusion_record.cpp serialization code (952 lines)
  • Updated CMakeLists.txt to remove nvfuser build targets and move common sources to nvfuser_direct
  • Removed Python frontend debug options from csrc/options.h/cpp
  • Updated tools/check_symbol_visibility.sh to only check nvfuser_direct
  • Bumped version to 0.2.36

Critical Issues Found:

  • Four documentation scripts in doc/dev/python_scheduling/ have TODO comments added but still import from the removed nvfuser module. These scripts will fail at runtime with ModuleNotFoundError.

Confidence Score: 2/5

  • This PR has critical runtime failures in documentation scripts that prevent it from being safely merged
  • The core removal is clean, but four documentation scripts will fail at runtime due to imports from the removed nvfuser module. While TODOs were added, the imports were not updated, making these scripts completely non-functional
  • doc/dev/python_scheduling/autotune_inner_reduction.py, doc/dev/python_scheduling/autotune_matmul.py, doc/dev/python_scheduling/autotune_pointwise.py, doc/dev/python_scheduling/profile_matmul.py - all have broken imports

Important Files Changed

Filename Overview
CMakeLists.txt Removes nvfuser Python bindings build configuration, moves common sources to nvfuser_direct, removes symbolic link creation
doc/dev/python_scheduling/autotune_inner_reduction.py TODO added but still imports from removed nvfuser module - script will fail at runtime
doc/dev/python_scheduling/autotune_matmul.py TODO added but still imports from removed nvfuser module - script will fail at runtime
doc/dev/python_scheduling/autotune_pointwise.py TODO added but still imports from removed nvfuser module - script will fail at runtime
doc/dev/python_scheduling/profile_matmul.py TODO added but still imports from removed nvfuser module - script will fail at runtime
python/utils.py Removes nvfuser._C extension from build configuration, updates comments
tools/check_symbol_visibility.sh Removes nvfuser extension checks, only validates nvfuser_direct symbols

Sequence Diagram

sequenceDiagram
    participant Dev as Developer
    participant PR as PR (Remove Legacy Bindings)
    participant Build as Build System
    participant Python as Python Environment
    participant Scripts as Doc Scripts

    Dev->>PR: Remove nvfuser module files
    Dev->>PR: Remove python_frontend bindings
    Dev->>PR: Remove csrc/serde/fusion_record
    
    PR->>Build: Update CMakeLists.txt
    Build-->>Build: Remove nvfuser._C extension
    Build-->>Build: Move common sources to nvfuser_direct
    Build-->>Build: Remove nvfuser symlink
    
    PR->>Python: Update python/utils.py
    Python-->>Python: Remove nvfuser._C from setup
    
    PR->>Scripts: Add TODO comments
    Note over Scripts: Scripts still import nvfuser module!
    Scripts--xPython: import nvfuser (FAILS)
    
    PR->>Build: Update tools/check_symbol_visibility.sh
    Build-->>Build: Remove nvfuser extension checks
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.

7 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 3, 2026

Additional Comments (2)

python/utils.py
stale reference to removed python_frontend directory


tools/env-config/env_options.yaml
stale entries for removed debug options python_definition_segments and python_frontend_debug should be removed

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.

8 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 3, 2026

Additional Comments (1)

python/utils.py
outdated comment references nvfuser._C which was removed in this PR

    # "nvfuser_codegen" into "./nvfuser_direct/lib", and the former will be "nvfuser_direct._C_DIRECT".

@rdspring1 rdspring1 force-pushed the remove_legacy_bindings branch from 7d0a9ba to 904ab90 Compare February 4, 2026 05:13
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.

8 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

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.

5 files reviewed, 7 comments

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 4, 2026

Additional Comments (7)

tests/python/utils/utils.py
The nvfuser module has been removed in this PR. Update to import from nvfuser_direct instead:

from nvfuser_direct import FusionCache, FusionDefinition, DataType, clone, Tensor

doc/dev/python_scheduling/autotune_utils.py
The nvfuser module has been removed. Update to import from nvfuser_direct:

from nvfuser_direct import FusionCache, FusionDefinition

doc/dev/python_scheduling/autotune_pointwise.py
Update to use nvfuser_direct instead of removed nvfuser module:

from nvfuser_direct import FusionDefinition, SchedulerType, DataType

doc/dev/python_scheduling/autotune_inner_reduction.py
Update to use nvfuser_direct:

from nvfuser_direct import FusionDefinition, SchedulerType, DataType, ParallelType

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!


doc/dev/python_scheduling/autotune_persistent.py
Update imports to use nvfuser_direct:

from nvfuser_direct import FusionCache, FusionDefinition, SchedulerType, DataType
from nvfuser_direct.pytorch_utils import torch_dtype_to_nvfuser_dtype

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!


doc/dev/python_scheduling/autotune_matmul.py
Update to use nvfuser_direct:

from nvfuser_direct import FusionDefinition, SchedulerType

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!


doc/dev/python_scheduling/profile_matmul.py
Update imports to use nvfuser_direct instead of removed nvfuser module

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.

8 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@rdspring1 rdspring1 force-pushed the remove_legacy_bindings branch from 21cb6bd to 5107f26 Compare February 4, 2026 19:24
@rdspring1
Copy link
Collaborator Author

!test --dev

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.

7 files reviewed, 6 comments

Edit Code Review Agent Settings | Greptile

Comment on lines +8 to +9

# TODO Update script to use nvfuser_direct module
Copy link
Contributor

Choose a reason for hiding this comment

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

TODO added but imports still reference removed nvfuser module - script will fail

Suggested change
# TODO Update script to use nvfuser_direct module
# TODO Update script to use nvfuser_direct module
from nvfuser_direct import FusionDefinition, SchedulerType, DataType, ParallelType

Comment on lines +8 to +9

# TODO Update script to use nvfuser_direct module
Copy link
Contributor

Choose a reason for hiding this comment

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

TODO added but imports still reference removed nvfuser module - script will fail

Suggested change
# TODO Update script to use nvfuser_direct module
# TODO Update script to use nvfuser_direct module
from nvfuser_direct import FusionDefinition, SchedulerType

Comment on lines 8 to +9
import math

Copy link
Contributor

Choose a reason for hiding this comment

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

TODO added but imports still reference removed nvfuser module - script will fail

Suggested change
import math
# TODO Update script to use nvfuser_direct module
from nvfuser_direct import FusionDefinition, SchedulerType, DataType

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 4, 2026

Additional Comments (3)

doc/dev/python_scheduling/autotune_utils.py
imports from removed nvfuser module will fail at runtime

from nvfuser_direct import FusionCache, FusionDefinition

doc/dev/python_scheduling/autotune_persistent.py
imports from removed nvfuser module will fail at runtime

from nvfuser_direct import FusionCache, FusionDefinition, SchedulerType, DataType
from nvfuser_direct.pytorch_utils import torch_dtype_to_nvfuser_dtype

doc/dev/python_scheduling/profile_matmul.py
TODO added but imports still reference removed nvfuser module - script will fail. All imports need updating to nvfuser_direct

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.

7 files reviewed, 4 comments

Edit Code Review Agent Settings | Greptile

import itertools

# TODO Update script to use nvfuser_direct module
from nvfuser import FusionDefinition, SchedulerType, DataType, ParallelType
Copy link
Contributor

Choose a reason for hiding this comment

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

Script imports from removed nvfuser module and will fail at runtime

Suggested change
from nvfuser import FusionDefinition, SchedulerType, DataType, ParallelType
from nvfuser_direct import FusionDefinition, SchedulerType, DataType, ParallelType

@@ -6,6 +6,8 @@
import torch
import itertools
import math
Copy link
Contributor

Choose a reason for hiding this comment

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

Script imports from removed nvfuser module and will fail at runtime

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 4, 2026

Additional Comments (2)

doc/dev/python_scheduling/autotune_matmul.py
Script imports from removed nvfuser module and will fail at runtime

from nvfuser_direct import (
    FusionDefinition,
    SchedulerType,
    ClusterDims,
    MatMulTileOptions,
    GemmTile,
    MmaMacroEncode,
    MmaMacroArch,
    MatmulTileRasterizationOrder,

doc/dev/python_scheduling/profile_matmul.py
Script imports from removed nvfuser module and will fail at runtime

from nvfuser_direct import (
    FusionDefinition,
    SchedulerType,
    ClusterDims,
    MatMulTileOptions,
    GemmTile,
    MmaMacroEncode,
    MmaMacroArch,
    MatmulTileRasterizationOrder,
    MatmulCircularBufferingStrategy,
)

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

Labels

Direct Bindings Python extension with direct mapping to NvFuser CPP objects.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant