NVIDIA / warp

A Python framework for high performance GPU simulation and graphics

Home Page:https://nvidia.github.io/warp/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Array of struct type to kernel giving CUDA build failed error

nithinsomu opened this issue · comments

I am trying to create a struct with one of its variable being an array of datatype of another struct. I am able to assign the struct variables without any error. But when I send it to the kernel I receive CUDA build failed error.

Error:
Warp NVRTC compilation error 6: NVRTC_ERROR_COMPILATION (/buildAgent/work/3db450722a274445/warp/native/warp.cu:1107)
default_program(63): error: identifier "MyStruct" is undefined

default_program(67): error: identifier "MyStruct" is undefined

default_program(79): error: identifier "MyStruct" is undefined

default_program(81): error: identifier "MyStruct" is undefined

default_program(214): error: identifier "MyStruct" is undefined

The code that I am trying to run is :

@WP.struct
class MyStruct:

param1: int
param2: float
param3 : wp.array(dtype=int)

@WP.struct
class struct2:

index : wp.array(dtype=MyStruct)
ptr : int

var = MyStruct()
var.param1=1
var.param2 = 2.0
var.param3 = wp.array([1,2,7], dtype=int)

var1 = MyStruct()
var1.param1=1
var1.param2 = 3.0
var1.param3 = wp.array([1,2,8,9], dtype=int)

teststruct = struct2()
teststruct.index = wp.array([var, var1], dtype=MyStruct)
teststruct.ptr=1

@wp.kernel
def struct2_reader(test : struct2):

k = wp.tid()
wp.printf('\n%d',test.index[k].param3[2])

wp.launch(struct2_reader, dim=2, inputs=[teststruct])

Please tell me if I am making some mistake or such operations arent supported yet in Warp. Any help is appreciated.
Thanks in advance.

Hi @nithinsomu,

Thanks a lot for the report - I could repro this bug. locally, the nested array struct was not being picked up for code-gen. I have a simple fix here:

0d2035d

This will make it into the next release.

Cheers,
Miles