Skip to content

[BUG] Crash when allocating arrays with transposed strides #404

@nvlukasz

Description

@nvlukasz

Bug Description

The following snippet causes memory corruption because the allocated array capacity is too small:

import warp as wp

@wp.kernel
def foo(arr:wp.array(dtype=wp.int32, ndim=2)):
    i, j = wp.tid()
    arr[i, j] = i * j

with wp.ScopedDevice("cpu"):
    arr = wp.zeros(shape=(3, 3), strides=(4, 12), dtype=wp.int32)
    wp.launch(foo, dim=arr.shape, inputs=(arr,))
    print(arr)

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