Skip to content

[BUG] tile_arange() has issues with negative numbers #403

@shi-eric

Description

@shi-eric

Bug Description

Example:

import warp as wp


@wp.kernel
def compute():
    a = wp.tile_arange(-10, 10, dtype=int)

    print(a)


wp.launch_tiled(compute, dim=[1], inputs=[], block_dim=16)

This code results in the following issue:

  File "/home/eshi/code-projects/warp/warp/builtins.py", line 1856, in tile_arange_value_func
    raise RuntimeError("wp.tile_arange() arguments must be compile time constants")
RuntimeError: Error while parsing function "compute" at /home/eshi/code-projects/warp/ershi-tests/test_tile_min_docstring.py:6:
    a = wp.tile_arange(-10, 10, dtype=int)
;wp.tile_arange() arguments must be compile time constants

(Note also that the RuntimeError raised in tile_arange_value_func() is not very helpful here).

Similarly, using a negative step doesn't work:

import warp as wp


@wp.kernel
def compute():
    a = wp.tile_arange(10, 0, -1, dtype=int)

    print(a)


wp.launch_tiled(compute, dim=[1], inputs=[], block_dim=16)

Output:

  File "/home/eshi/code-projects/warp/warp/builtins.py", line 1856, in tile_arange_value_func
    raise RuntimeError("wp.tile_arange() arguments must be compile time constants")
RuntimeError: Error while parsing function "compute" at /home/eshi/code-projects/warp/ershi-tests/test_tile_min_docstring.py:6:
    a = wp.tile_arange(10, 0, -1, dtype=int)
;wp.tile_arange() arguments must be compile time constants

System Information

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions