clr: SWDEV-547890 - Maintain an MQD for the emulated AQL queue (#1669)

* clr: SWDEV-547890 - Maintain an MQD for the emulated AQL queue

To simplify the shader debugger implementation, maintain the relevant
parts of the emulated AQL queue's MQD (amd_queue_t): read_dispatch_id,
write_dispatch_id, compute_tmpring_size.

With this MQD, the shader debugger can handle the emulated AQL queue
the same way it does the real AQL queue, no specialization is required.

* clr: SWDEV-547890 - Conservatively update the MQD's read_dispatch_id

The read_dispatch_id cannot be smaller than the current aql_packet_id
- hsa_queue.size for the debugger to work correctly.

The read_dispatch_id really should be updated when the CmdBuf is marked
as complete. Left a FIXME to address it in a future commit.

---------

Co-authored-by: Laurent Morichetti <laurent.morichetti@amd.com>
Este commit está contenido en:
lancesix
2025-11-05 17:39:33 +00:00
cometido por GitHub
padre 8797bb0150
commit 280cda3196
Se han modificado 5 ficheros con 106 adiciones y 39 borrados
+6 -8
Ver fichero
@@ -172,12 +172,10 @@ const pal::Program& Kernel::prog() const {
return reinterpret_cast<const pal::Program&>(prog_);
}
hsa_kernel_dispatch_packet_t* Kernel::loadArguments(VirtualGPU& gpu, const amd::Kernel& kernel,
const amd::NDRangeContainer& sizes,
const_address params, size_t ldsAddress,
uint64_t vmDefQueue,
uint64_t* vmParentWrap,
uint32_t* aql_index) const {
std::pair<hsa_kernel_dispatch_packet_t* /* packet address */, uint64_t /* packet id */>
Kernel::loadArguments(VirtualGPU& gpu, const amd::Kernel& kernel,
const amd::NDRangeContainer& sizes, const_address params,
size_t ldsAddress, uint64_t vmDefQueue, uint64_t* vmParentWrap) const {
// Provide private and local heap addresses
static constexpr uint AddressShift = LP64_SWITCH(0, 32);
const_address parameters = params;
@@ -364,7 +362,7 @@ hsa_kernel_dispatch_packet_t* Kernel::loadArguments(VirtualGPU& gpu, const amd::
std::min(static_cast<uint32_t>(argsBufferSize()), signature.paramsSize()));
}
hsa_kernel_dispatch_packet_t* hsaDisp = gpu.GetAqlPacketSlot(aql_index);
auto&& [hsaDisp, aql_packet_id] = gpu.GetAqlPacketSlot();
constexpr uint16_t kDispatchPacketHeader =
(HSA_PACKET_TYPE_KERNEL_DISPATCH << HSA_PACKET_HEADER_TYPE) |
@@ -401,7 +399,7 @@ hsa_kernel_dispatch_packet_t* Kernel::loadArguments(VirtualGPU& gpu, const amd::
gpu.addVmMemory(gpu.hsaQueueMem());
}
return hsaDisp;
return {hsaDisp, aql_packet_id};
}
bool Kernel::setKernelDescriptor(amd::hsa::loader::Symbol* sym,