GPUOpen-LibrariesAndSDKs / RadeonRays_SDK

Radeon Rays is ray intersection acceleration library for hardware and software multiplatforms using CPU and GPU
MIT License
1.06k stars 190 forks source link

AttachShape performance issues #191

Open sudsy opened 5 years ago

sudsy commented 5 years ago

Hi There,

I am working on a scientific modelling project that involves modelling a surface with 5e8 pyramid structures at various heights and positions along a surface.

I am running some proof of concept tests on my macbook with a Radeon Pro 560 in it. I have found that the performance of adding triangles degrades significantly as the number of triangles increases. Perhaps this is something I am doing wrong, if so, your help would be appreciated.

Here are the stats I generated for my triangle test.

Triangles Time (sec) Triangles / sec
1000 0.144 6944.44444444445
2000 0.17097 11697.9587062058
4000 0.2734 14630.5779078274
8000 0.549968 14546.3008756873
16000 1.70 9411.76470588235
32000 5.35 5981.30841121495
64000 20.66 3097.77347531462
128000 77.76 1646.09053497942

And here is the code I used to perform the tests:

Shape* mesh = api->CreateMesh(g_vertices, 3, 3 * sizeof(float), g_indices, 0, g_numfaceverts, 1);
    assert(mesh != nullptr);

    // api->AttachShape(mesh);
    int shapeCount = 128000;

    Shape* shapes[shapeCount];

    for(int i= 0; i < shapeCount; i++){
        // matrix m = translation(float3(0, i, 0));
        // matrix minv = inverse(m);
        shapes[i] = api->CreateInstance(mesh);
        // shapes[i]->SetTransform(m, minv);
        api->AttachShape(shapes[i]);   
    }

    //commit scene changes
    api->Commit();