Skip to content

Conversation

@szalpal
Copy link
Member

@szalpal szalpal commented Dec 16, 2025

Category:

Refactoring (Redesign of existing code that doesn't affect functionality)

Description:

This PR takes out of experimental the following operators:
experimental.audio_resample
experimental.debayer
experimental.equalize
experimental.filter
experimental.tensor_resize
nvidia.dali.plugin.numba.fn.experimental.numba_function

The experimental flavours of the operators is kept to maintain backwards compatibility.

Tests are configured to test both: experimental and regular flavours of the operators. Since the backwards compatibility is maintained, both of these operators need to be tested.

TODO:

  • Adjust documentation (hide experimental flavours)
  • Unexperimentalize decoders.video

Additional information:

Affected modules and functionalities:

Key points relevant for the review:

Tests:

  • Existing tests apply
  • New tests added
    • Python tests
    • GTests
    • Benchmark
    • Other
  • N/A

Checklist

Documentation

  • Existing documentation applies
  • Documentation updated
    • Docstring
    • Doxygen
    • RST
    • Jupyter
    • Other
  • N/A

DALI team only

Requirements

  • Implements new requirements
  • Affects existing requirements
  • N/A

REQ IDs: N/A

JIRA TASK: DALI-4504


def check_numba_compatibility_gpu(if_skip=True):
import nvidia.dali.plugin.numba.experimental as ex
def check_numba_compatibility_gpu(if_skip=True, use_experimental: bool = False):

Check notice

Code scanning / CodeQL

Explicit returns mixed with implicit (fall through) returns Note test

Mixing implicit and explicit returns may indicate an error, as implicit returns always return None.
@szalpal
Copy link
Member Author

szalpal commented Dec 16, 2025

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [40306038]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [40306038]: BUILD FAILED

@szalpal szalpal force-pushed the unexperimentalize branch 3 times, most recently from e630529 to 51e599d Compare December 17, 2025 07:12
# try importing cuda.core as it can be used later to check the compatibility
# it is okay to fail as it may not be installed, the check later can handle this
import cuda.core
except ImportError:

Check notice

Code scanning / CodeQL

Empty except Note

'except' clause does nothing but pass and there is no explanatory comment.
@szalpal
Copy link
Member Author

szalpal commented Dec 17, 2025

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [40349534]: BUILD STARTED

@szalpal szalpal force-pushed the unexperimentalize branch 2 times, most recently from a3c3ac6 to a424878 Compare December 17, 2025 07:41
@szalpal
Copy link
Member Author

szalpal commented Dec 17, 2025

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [40350589]: BUILD STARTED

@szalpal szalpal marked this pull request as ready for review December 17, 2025 11:06
@greptile-apps
Copy link

greptile-apps bot commented Dec 17, 2025

Greptile Summary

This PR promotes several operators from the experimental namespace to the main DALI namespace while maintaining backwards compatibility through deprecated aliases.

Operators moved out of experimental:

  • fn.audio_resample
  • fn.debayer
  • fn.equalize
  • fn.filter
  • fn.tensor_resize
  • fn.decoders.video
  • nvidia.dali.plugin.numba.fn.numba_function

Key changes:

  • C++ operator schemas renamed from experimental__* to main names, with deprecated aliases added
  • Both experimental and non-experimental operator registrations kept for backwards compatibility
  • NumbaFunction class moved from numba.experimental to numba module
  • Tests updated to cover both experimental and non-experimental operator variants
  • Type stub files (.pyi) added for the numba plugin

Note: The type annotations for setup_fn parameter in the new .pyi files have an invalid Callable signature that was already present in the experimental version. This is a pre-existing issue that was copied over.

Confidence Score: 4/5

  • This PR is a safe refactoring that moves operators out of experimental namespace while preserving backwards compatibility.
  • Score of 4 reflects that this is a straightforward namespace migration with proper deprecation aliases. The type annotation issues in .pyi files are minor and don't affect runtime behavior. No logic changes to operator implementations.
  • The numba plugin type stub files have invalid Callable signatures for setup_fn, but this is a pre-existing issue from the experimental version.

Important Files Changed

Filename Overview
dali/operators/image/color/debayer.cc Moves Debayer schema from experimental to main namespace with deprecated alias for backwards compatibility.
dali/operators/image/color/equalize.cc Moves Equalize schema from experimental to main namespace with deprecated alias for backwards compatibility.
dali/operators/image/convolution/filter.cc Moves Filter schema from experimental to main namespace with deprecated alias for backwards compatibility.
dali/operators/video/decoder/video_decoder_cpu.cc Moves video decoder schema from experimental to main namespace with deprecated alias.
dali/python/nvidia/dali/plugin/numba/init.py Moves NumbaFunction class from experimental to main module. Contains pre-existing bug at line 187 where num_outs is used instead of num_ins for input shapes in setup function.
dali/python/nvidia/dali/plugin/numba/init.pyi New type stub file for NumbaFunction. Has invalid Callable type annotation for setup_fn parameter.
dali/python/nvidia/dali/plugin/numba/fn/init.pyi New type stub file for numba_function. Has invalid Callable type annotation for setup_fn parameter.
dali/test/python/test_dali_variable_batch_size.py Adds tests for non-experimental operators alongside experimental versions, updates tested_methods list.

Sequence Diagram

sequenceDiagram
    participant User
    participant MainAPI as fn.* / numba.fn.*
    participant ExpAPI as fn.experimental.* / numba.fn.experimental.*
    participant Operator as C++ Operator Implementation

    Note over MainAPI,ExpAPI: Before PR: Only experimental namespace
    
    rect rgb(200, 230, 200)
        Note over MainAPI,ExpAPI: After PR: Both namespaces available
        User->>MainAPI: fn.debayer() / fn.filter() / etc.
        MainAPI->>Operator: Calls main schema (Debayer, Filter, etc.)
        Operator-->>User: Returns result
        
        User->>ExpAPI: fn.experimental.debayer() (deprecated)
        ExpAPI->>Operator: Calls deprecated alias (experimental__Debayer)
        Operator-->>User: Returns result (identical behavior)
    end
    
    Note over MainAPI,ExpAPI: Backwards compatibility preserved
Loading

Copy link

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

Additional Comments (6)

  1. dali/operators/image/color/equalize.cc, line 37 (link)

    style: The docstring reference should use :meth:nvidia.dali.fn.equalize`` for consistency with DALI's documentation standards

    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!

  2. dali/python/nvidia/dali/plugin/numba/__init__.pyi, line 35 (link)

    logic: Return type annotation may be incorrect - setup_fn appears to return None but the signature suggests it takes parameters and returns None

    Should the setup_fn callable return type be None or should it return something else based on the actual implementation?

  3. dali/python/nvidia/dali/plugin/numba/fn/__init__.pyi, line 36 (link)

    syntax: The setup_fn parameter type annotation appears malformed - it has None as a return type in the callable signature but should likely return something or be Optional[Callable[...]] without the trailing None

  4. dali/operators/generic/resize/tensor_resize_cpu.cc, line 49-62 (link)

    style: The deprecated schema definition duplicates parent metadata (NumInput, NumOutput, SupportVolumetric, AllowSequences) that is already inherited from "TensorResize". Since AddParent("TensorResize") inherits all properties, these redundant specifications are unnecessary.

    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!

  5. dali/test/python/checkpointing/test_dali_stateless_operators.py, line 643-646 (link)

    logic: inconsistent with other tests - this test only uses fn.audio_resample but the decorator includes both experimental and non-experimental versions

  6. dali/python/nvidia/dali/plugin/numba/__init__.py, line 187 (link)

    logic: Incorrect variable used: should be num_ins instead of num_outs for the input shapes calculation

25 files reviewed, 6 comments

Edit Code Review Agent Settings | Greptile

@szalpal szalpal marked this pull request as draft December 17, 2025 13:13
@szalpal
Copy link
Member Author

szalpal commented Dec 17, 2025

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [40376844]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [40376844]: BUILD FAILED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [40349534]: BUILD FAILED

@szalpal
Copy link
Member Author

szalpal commented Dec 17, 2025

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [40397505]: BUILD STARTED

Signed-off-by: Michał Szołucha <[email protected]>
Signed-off-by: Michał Szołucha <[email protected]>
Signed-off-by: Michał Szołucha <[email protected]>
@szalpal
Copy link
Member Author

szalpal commented Jan 14, 2026

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [41719186]: BUILD STARTED

Copy link

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

Additional Comments (1)

  1. dali/operators/image/color/debayer.cc, line 51 (link)

    style: Example in documentation still uses experimental namespace and should be updated to use fn.debayer

    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!

29 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

in_types: List[DALIDataType],
outs_ndim: List[int],
ins_ndim: List[int],
setup_fn: Optional[Callable[[Sequence[Sequence[Any]], Sequence[Sequence[Any]], None]]] = None,
Copy link

Choose a reason for hiding this comment

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

logic: The setup_fn type annotation has an invalid callable signature with None as the third parameter type. Callable type parameters should only specify input argument types, not return types. Should be Optional[Callable[[Sequence[Sequence[Any]], Sequence[Sequence[Any]]], None]] if it returns None, or just Optional[Callable[[Sequence[Sequence[Any]], Sequence[Sequence[Any]]], Any]].

Suggested change
setup_fn: Optional[Callable[[Sequence[Sequence[Any]], Sequence[Sequence[Any]], None]]] = None,
setup_fn: Optional[Callable[[Sequence[Sequence[Any]], Sequence[Sequence[Any]]], None]] = None,

Comment on lines +187 to +188
in_shapes_np = _get_shape_view(in_shapes_ptr, in_ndims_ptr, num_outs, num_samples)
setup_fn(out_shapes_np, in_shapes_np)
Copy link

Choose a reason for hiding this comment

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

logic: Bug in parameter usage: should be num_ins instead of num_outs for input shapes.

Suggested change
in_shapes_np = _get_shape_view(in_shapes_ptr, in_ndims_ptr, num_outs, num_samples)
setup_fn(out_shapes_np, in_shapes_np)
in_shapes_np = _get_shape_view(in_shapes_ptr, in_ndims_ptr, num_ins, num_samples)
setup_fn(out_shapes_np, in_shapes_np)

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [41717403]: BUILD FAILED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [41719186]: BUILD FAILED

@greptile-apps
Copy link

greptile-apps bot commented Jan 15, 2026

Greptile's behavior is changing!

From now on, if a review finishes with no comments, we will not post an additional "statistics" comment to confirm that our review found nothing to comment on. However, you can confirm that we reviewed your changes in the status check section.

This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR".

@szalpal
Copy link
Member Author

szalpal commented Jan 16, 2026

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [41881093]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [41881093]: BUILD FAILED

Signed-off-by: Michał Szołucha <[email protected]>
@szalpal
Copy link
Member Author

szalpal commented Jan 19, 2026

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [42048338]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [42048338]: BUILD FAILED

@szalpal
Copy link
Member Author

szalpal commented Jan 19, 2026

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [42071458]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [42071458]: BUILD FAILED

Signed-off-by: Michał Szołucha <[email protected]>
@szalpal
Copy link
Member Author

szalpal commented Jan 20, 2026

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [42103524]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [42103524]: BUILD PASSED

@szalpal szalpal merged commit 08d2da1 into NVIDIA:main Jan 21, 2026
8 checks passed
@szalpal szalpal deleted the unexperimentalize branch January 21, 2026 11:43
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.

6 participants