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.

amdgpu: improve error reporting when creating too many queues

+17 -1
+1
drivers/amdgpu/impl.h
··· 14 14 int fd; 15 15 amdgpu_device_handle amd_handle; 16 16 17 + uint32_t num_queues[AMDGPU_HW_IP_NUM]; 17 18 GpuInfo info; 18 19 }; 19 20
+4
drivers/amdgpu/init.cpp
··· 29 29 auto dev = new DeviceImpl; 30 30 dev->fd = drm_fd; 31 31 32 + for (auto i = 0; i < AMDGPU_HW_IP_NUM; ++i) { 33 + dev->num_queues[i] = 0; 34 + } 35 + 32 36 uint32_t minor, major; 33 37 if (amdgpu_device_initialize(dev->fd, &major, &minor, &dev->amd_handle) != 0) { 34 38 delete dev;
+12 -1
drivers/amdgpu/queue.cpp
··· 17 17 KesQueue amdgpu_create_queue(KesDevice pd, KesQueueType qt) { 18 18 auto *dev = reinterpret_cast<DeviceImpl *>(pd); 19 19 20 + auto hw_ip_type = hw_ip_type_from_queue_type(qt); 21 + 22 + assert(dev->num_queues[hw_ip_type] < dev->info.ip[hw_ip_type].num_queues, 23 + "amdgpu_create_queue: too many queues created for type: {} (created: {}, max: {})", 24 + qt, dev->num_queues[hw_ip_type], dev->info.ip[hw_ip_type].num_queues); 25 + 20 26 auto queue = new QueueImpl; 21 27 queue->dev = dev; 22 28 queue->type = qt; 23 - queue->hw_ip_type = hw_ip_type_from_queue_type(qt); 29 + queue->hw_ip_type = hw_ip_type; 24 30 25 31 // @todo: consider creating ctx at device initialization? 26 32 int r = amdgpu_cs_ctx_create(dev->amd_handle, &queue->ctx_handle); ··· 28 34 delete queue; 29 35 return nullptr; 30 36 } 37 + 38 + dev->num_queues[hw_ip_type]++; 31 39 32 40 // @todo: cleanup: remove this fkn pointer; shit stuff we don't need! 33 41 auto conf = CommandRing::Config{}; ··· 39 47 void amdgpu_destroy_queue(KesQueue pq) { 40 48 auto *queue = reinterpret_cast<QueueImpl *>(pq); 41 49 // @todo: actually delete queue. 50 + 51 + auto hw_ip_type = hw_ip_type_from_queue_type(queue->type); 52 + queue->dev->num_queues[hw_ip_type]--; 42 53 } 43 54 44 55 KesCommandList amdgpu_start_recording(KesQueue pq) {