Skip to content

Tuple literals passed to generic functions fail during module hashing #2167

Open

Description

@daedalus5

Bug Description

Passing a tuple literal directly to a generic @wp.func fails while hashing the kernel module. Assigning the same tuple to a local variable before the call works.

import warp as wp


@wp.func
def product(values: tuple[int, ...]):
    return values[0] * values[1]


@wp.kernel(enable_backward=False, module="unique")
def evaluate(out: wp.array[int]):
    out[0] = product((2, 3))


out = wp.zeros(1, dtype=int, device="cpu")
wp.launch(evaluate, dim=1, inputs=[out], device="cpu")
print(out.numpy())

Expected: [6].

Actual:

RuntimeError: Failed to determine type code for argument 'values' of function product:
Unrecognized type '(<class 'int'>, <class 'int'>)'

The traceback goes through Adjoint.get_references(), iter_call_callable_arg_targets(), Function.get_overload(), and get_type_code(). The literal's inferred argument type is a raw tuple of types, which the signature encoder does not recognize.

The equivalent kernel body succeeds:

values = (2, 3)
out[0] = product(values)

Generic calls should accept either spelling consistently, including during dependency discovery and module hashing.

Related: #2099, #2100, #2101, #2166. The reproducer uses flat integer tuples, indexed access, and disables backward generation, so it does not depend on nested tuples, argument unpacking, or autodiff. This also affects the natural grouped-input spelling proposed for #1813.

System Information

  • Warp 1.20.0.dev0, main commit 0c1ed78f7.
  • Python 3.12.3, Linux x86_64, CPU device.
  • Reproduced before applying tuple fixes; failure occurs before native kernel execution.

Activity

  1. self-assigned this
    on Oct 27, 2026
  2. added theissue type on Oct 27, 2026
  3. added this to the 1.20.0 milestone on Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions