Skip to content

Issue with tile assignment involving composite types #941

@shi-eric

Description

@shi-eric

Potentially related:

import numpy as np
import warp as wp

vec256f = wp.types.vector(length=256, dtype=wp.float32)

@wp.kernel
def test(a: wp.array2d(dtype=wp.float32)):
    i = wp.tid()
    R = wp.tile_zeros(shape=(1,), dtype=vec256f)
    R[0][i] = wp.float32(i)
    a[i // 16, i % 16] = R[0][i]  # incorrect
    # a[i // 16, i % 16] = wp.float32(i)  # correct

TILE_SIZE = 256
device="cuda"
a = wp.zeros((16, 16), dtype=wp.float32, device=device)
wp.launch(kernel=test, dim=TILE_SIZE, outputs=[a], block_dim=TILE_SIZE, device=device)
wp.synchronize()
print(a.numpy())
kernel: test dim: 256 inputs: [] outputs: [array(shape=(16, 16), dtype=float32)] device: cuda:0
[[0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]]

I'll try to test this on v1.9.0 later.

Originally posted by @j3soon in #926

Metadata

Metadata

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions