Skip to content

Empty tuple construction raises KeyError #2168

Open

Description

@daedalus5

Bug Description

Constructing an empty tuple inside a Warp kernel raises KeyError: 'args'. A zero-element tuple should be a valid statically shaped value with length zero.

import warp as wp


@wp.kernel(enable_backward=False)
def evaluate(out: wp.array[int]):
    values = ()
    out[0] = len(values)


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

Expected: [0].

Actual: KeyError: 'args', from tuple_value_func() in warp/_src/builtins.py:

return tuple_t(arg_types["args"], arg_values["args"])

The variadic argument mappings omit args for a zero-argument call. Tuple construction should handle that case and support the resulting value consistently in length queries and function calls.

Related: #2099, #2100, #2101, #2166, #2167. This reproducer disables backward generation and does not use nesting, reassignment, or unpacking.

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 during code generation.

Activity

  1. self-assigned this
    on Oct 27, 2026
  2. added this to the 1.20.0 milestone on Oct 27, 2026
  3. added theissue type 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