gpu: handle compute me 2

This commit is contained in:
DH 2024-10-17 20:01:03 +03:00
parent 7e7a56f0e2
commit 5ce8d5147a
2 changed files with 22 additions and 4 deletions

View file

@ -172,10 +172,18 @@ void DeviceCtl::mapComputeQueue(int vmId, std::uint32_t meId,
orbis::uint64_t readPtrAddress,
orbis::uint64_t doorbell,
orbis::uint64_t ringSize) {
if (meId != 1) {
if (meId != 1 && meId != 2) {
rx::die("unexpected ME %d", meId);
}
if (meId == 2) {
pipeId += 4;
}
if (queueId >= ComputePipe::kQueueCount) {
rx::die("unexpected queueId %d", queueId);
}
auto &pipe = mDevice->computePipes[pipeId];
auto lock = pipe.lockQueue(queueId);
auto memory = RemoteMemory{vmId};
@ -201,10 +209,18 @@ void DeviceCtl::mapComputeQueue(int vmId, std::uint32_t meId,
void DeviceCtl::submitComputeQueue(std::uint32_t meId, std::uint32_t pipeId,
std::uint32_t queueId,
std::uint64_t offset) {
if (meId != 1) {
if (meId != 1 && meId != 2) {
rx::die("unexpected ME %d", meId);
}
if (queueId >= ComputePipe::kQueueCount) {
rx::die("unexpected queueId %d", queueId);
}
if (meId == 2) {
pipeId += 4;
}
auto &pipe = mDevice->computePipes[pipeId];
pipe.submit(queueId, offset);
}

View file

@ -35,15 +35,17 @@ struct Ring {
};
struct ComputePipe {
static constexpr auto kRingsPerQueue = 2;
static constexpr auto kQueueCount = 8;
Device *device;
Scheduler scheduler;
using CommandHandler = bool (ComputePipe::*)(Ring &);
CommandHandler commandHandlers[255];
orbis::shared_mutex queueMtx[8];
orbis::shared_mutex queueMtx[kQueueCount];
int index;
int currentQueueId;
Ring queues[2][8];
Ring queues[kRingsPerQueue][kQueueCount];
std::uint64_t drawIndexIndirPatchBase = 0;
ComputePipe(int index);