Skip to content

[RFC] library function with 64+ arguments #162870

@tlsdmstn56

Description

@tlsdmstn56

Custom op support with 64+ arguments

Is there any plan to support 64+ argument? I have a custom kernel that takes 64+ arguments.

import torch
from torch.library import Library, impl, register_fake

num_args = 65

# Create a new custom namespace
my_lib = Library("my_ops", "LIB")

# Define a custom operator with a list of tensors as input
args = ", ".join([f"Tensor t{i}" for i in range(num_args)])
my_lib.define(f"a_func({args}) -> Tensor")
Traceback (most recent call last):
  File "/test/torch_test.py", line 18, in <module>
    my_lib.define(f"a_func({args}) -> Tensor")
  File "/miniconda3/envs/test-venv/lib/python3.11/site-packages/torch/library.py", line 172, in define
    result = self.m.define(schema, alias_analysis, tuple(tags))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: The function schema has 65 arguments but this PyTorch build only supports 64

Alternatives

No response

Additional context

No response

cc @anjali411 @chauhang @penguinwu @zou3519 @bdhirsh

Metadata

Metadata

Assignees

No one assigned

    Labels

    module: custom-operatorscustom operators, custom ops, custom-operators, custom-opsmodule: libraryRelated to torch.library (for registering ops from Python)triagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions