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.

rt: fixed incorrect indexing

+11 -11
+11 -11
kestrel/rt/api.cpp
··· 50 50 }; 51 51 52 52 struct QueueHandle { 53 - KesDevice drv_handle; 53 + DeviceHandle *dev; 54 54 KesQueue queue; 55 55 }; 56 56 57 57 struct CommandListHandle { 58 - KesDevice drv_handle; 58 + DeviceHandle *dev; 59 59 KesCommandList cmdlist; 60 60 }; 61 61 ··· 132 132 auto queue = dev->fns.fn_create_queue(dev->drv_handle, type); 133 133 134 134 auto *qhandle = new QueueHandle{}; 135 - qhandle->drv_handle = dev->drv_handle; 135 + qhandle->dev = dev; 136 136 qhandle->queue = queue; 137 137 return qhandle; 138 138 } ··· 140 140 API_EXPORT void kes_destroy_queue(KesQueue pq) { 141 141 auto *qhandle = reinterpret_cast<QueueHandle *>(pq); 142 142 if (qhandle) { 143 - auto *dev = reinterpret_cast<DeviceHandle *>(qhandle->drv_handle); 143 + auto *dev = qhandle->dev; 144 144 dev->fns.fn_destroy_queue(qhandle->queue); 145 145 delete qhandle; 146 146 } ··· 148 148 149 149 API_EXPORT KesCommandList kes_start_recording(KesQueue pq) { 150 150 auto *qhandle = reinterpret_cast<QueueHandle *>(pq); 151 - auto *dev = reinterpret_cast<DeviceHandle *>(qhandle->drv_handle); 151 + auto *dev = qhandle->dev; 152 152 auto *clhandle = new CommandListHandle{}; 153 - clhandle->drv_handle = qhandle->drv_handle; 153 + clhandle->dev = qhandle->dev; 154 154 clhandle->cmdlist = dev->fns.fn_start_recording(qhandle->queue); 155 155 156 156 return clhandle; ··· 159 159 API_EXPORT void kes_submit(KesQueue pq, KesCommandList pcl) { 160 160 auto *qhandle = reinterpret_cast<QueueHandle *>(pq); 161 161 auto *clhandle = reinterpret_cast<CommandListHandle *>(pcl); 162 - auto *dev = reinterpret_cast<DeviceHandle *>(qhandle->drv_handle); 162 + auto *dev = qhandle->dev; 163 163 164 164 dev->fns.fn_submit(qhandle->queue, clhandle->cmdlist); 165 165 ··· 168 168 169 169 API_EXPORT void kes_cmd_memset(KesCommandList pcl, kes_gpuptr_t addr, size_t size, uint32_t value) { 170 170 auto *clhandle = reinterpret_cast<CommandListHandle *>(pcl); 171 - auto *dev = reinterpret_cast<DeviceHandle *>(clhandle->drv_handle); 171 + auto *dev = clhandle->dev; 172 172 173 173 dev->fns.fn_cmd_memset(clhandle->cmdlist, addr, size, value); 174 174 } 175 175 API_EXPORT void kes_cmd_write_timestamp(KesCommandList pcl, kes_gpuptr_t addr) { 176 176 auto *clhandle = reinterpret_cast<CommandListHandle *>(pcl); 177 - auto *dev = reinterpret_cast<DeviceHandle *>(clhandle->drv_handle); 177 + auto *dev = clhandle->dev; 178 178 179 179 dev->fns.fn_cmd_write_timestamp(clhandle->cmdlist, addr); 180 180 } 181 181 182 182 API_EXPORT void kes_cmd_signal_after(KesCommandList pcl, KesStage before, kes_gpuptr_t addr, uint64_t value, KesSignal signal) { 183 183 auto *clhandle = reinterpret_cast<CommandListHandle *>(pcl); 184 - auto *dev = reinterpret_cast<DeviceHandle *>(clhandle->drv_handle); 184 + auto *dev = clhandle->dev; 185 185 186 186 dev->fns.fn_cmd_signal_after(clhandle->cmdlist, before, addr, value, signal); 187 187 } 188 188 189 189 API_EXPORT void kes_cmd_wait_before(KesCommandList pcl, KesStage after, kes_gpuptr_t addr, uint64_t value, KesOp op, KesHazardFlags hazard, uint64_t mask) { 190 190 auto *clhandle = reinterpret_cast<CommandListHandle *>(pcl); 191 - auto *dev = reinterpret_cast<DeviceHandle *>(clhandle->drv_handle); 191 + auto *dev = clhandle->dev; 192 192 193 193 dev->fns.fn_cmd_wait_before(clhandle->cmdlist, after, addr, value, op, hazard, mask); 194 194 }