A Modern GPGPU API & wip linux RDNA2+ Driver
rdna driver linux gpu
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

api: added compute shader dispatch

+62
+19
docs/drivers/amd/index.rst
··· 23 23 - *IB*: Indirect Buffer: Allocated on BO, can be submitted to a HW_IP. 24 24 - *CS*: Command Stream 25 25 26 + 27 + AMD (& afaik NV) support predication in multiple ways. In AMD, we can both skip over commands in the CP, but also 28 + many packets can read from the predication register. Skipping commands is done for arbitrary va atomic ops (i believe), 29 + and the register is for stuff like DRAW_VISIBLE. I believe it would be awesome to support an api like:: 30 + 31 + auto x = kes_malloc(dev, size, 4, KesMemoryDefault); 32 + auto pred = kes_malloc(dev, 1, 4, KesMemoryDefault); 33 + 34 + auto l1 = kes_start_recording(compute); 35 + 36 + kes_cmd_conditional_begin(l1, pred, KesCondOpEqual); 37 + kes_cmd_memset(l1, x.gpu, size, 2); 38 + kes_cmd_memcpy(l1, y.gpu, x.gpu, size); 39 + kes_cmd_conditional_end(l1); 40 + 41 + kes_submit(compute, l1); 42 + 43 + This would be awesome, as it would actually expose this stuff without weird extensions like VK_conditional_rendering. 44 + 26 45 .. toctree:: 27 46 bugs 28 47
+2
kestrel/include/kestrel/interface.h
··· 29 29 void (*fn_cmd_write_timestamp)(KesCommandList, kes_gpuptr_t addr); 30 30 void (*fn_cmd_signal_after)(KesCommandList, enum KesStage before, kes_gpuptr_t addr, uint64_t value, enum KesSignal); 31 31 void (*fn_cmd_wait_before)(KesCommandList, enum KesStage after, kes_gpuptr_t addr, uint64_t value, enum KesOp, enum KesHazardFlags, uint64_t mask); 32 + void (*fn_cmd_dispatch)(KesCommandList command_list, uint32_t x, uint32_t y, uint32_t z); 33 + void (*fn_cmd_dispatch_indirect)(KesCommandList command_list, kes_gpuptr_t command_addr); 32 34 }; 33 35 34 36 /**
+27
kestrel/include/kestrel/kestrel.h
··· 280 280 */ 281 281 void kes_cmd_wait_before(KesCommandList command_list, enum KesStage after, kes_gpuptr_t addr, uint64_t value, enum KesOp op, enum KesHazardFlags hazard_flags, uint64_t mask); 282 282 283 + /** 284 + * Contains arguments for a compute shader dispatch. 285 + */ 286 + struct KesDispatchIndirectCommand { 287 + uint32_t x; 288 + uint32_t y; 289 + uint32_t z; 290 + }; 291 + 292 + /** 293 + * Record a compute shader dispatch in the command list. 294 + * @param command_list 295 + * @param x 296 + * @param y 297 + * @param z 298 + */ 299 + void kes_cmd_dispatch(KesCommandList command_list, uint32_t x, uint32_t y, uint32_t z); 300 + 301 + /** 302 + * Record an indirect compute shader dispatch in the command list. 303 + * @param command_list The command list to record the command in. 304 + * @param command_addr A GPU pointer to a KesDispatchIndirectCommand 305 + * @sa KesDispatchIndirectCommand 306 + */ 307 + void kes_cmd_dispatch_indirect(KesCommandList command_list, kes_gpuptr_t command_addr); 308 + 309 + 283 310 #ifdef __cplusplus 284 311 } 285 312 #endif
+14
kestrel/rt/api.cpp
··· 200 200 201 201 dev->fns.fn_cmd_wait_before(clhandle->cmdlist, after, addr, value, op, hazard, mask); 202 202 } 203 + 204 + API_EXPORT void kes_cmd_dispatch(KesCommandList pcl, uint32_t x, uint32_t y, uint32_t z) { 205 + auto *clhandle = reinterpret_cast<CommandListHandle *>(pcl); 206 + auto *dev = clhandle->dev; 207 + 208 + dev->fns.fn_cmd_dispatch(clhandle->cmdlist, x, y, z); 209 + } 210 + 211 + API_EXPORT void kes_cmd_dispatch_indirect(KesCommandList pcl, kes_gpuptr_t command_addr) { 212 + auto *clhandle = reinterpret_cast<CommandListHandle *>(pcl); 213 + auto *dev = clhandle->dev; 214 + 215 + dev->fns.fn_cmd_dispatch_indirect(clhandle->cmdlist, command_addr); 216 + }