Skip to content

Reassigning a tuple with the same element types fails #2166

Open

Description

@daedalus5

Bug Description

Rebinding a local tuple variable to a new tuple with the same element types fails during code generation. This is ordinary reassignment, not mutation of an immutable tuple.

Save the following as a Python file:

import warp as wp


@wp.kernel(enable_backward=False)
def evaluate(out: wp.array[float]):
    values = (2.0, 3.0)
    values = (4.0, 5.0)
    out[0] = values[0] * values[1]


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

Expected: [20.0].

Actual: WarpCodegenTypeError: Error, assigning to existing symbol values (<...tuple_t object...>) with different type (<...tuple_t object...>).

Both tuples have type tuple[float, float]. The internal tuple descriptors are compared by identity rather than by their element types when checking reassignment. Equal tuple shapes and element types should be accepted; incompatible types or lengths should remain errors.

Related: #2099, #2100, #2101. This reproducer uses flat tuples, no unpacking, and disables backward generation, so it is independent of those failures. Ordinary tuple composition is also useful for structured inputs to #1813.

System Information

  • Warp 1.20.0.dev0, main commit 0c1ed78f7.
  • Python 3.12.3, Linux x86_64, CPU device.
  • Reproduced before any of the tuple fixes were applied; failure occurs during code generation.

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