Separate task locations for different task types in Compute Unit tracing
Problem
Previously, different types of tasks (wavefronts, instruction fetch operations, and memory transactions) were all recorded at the same trace location - the Compute Unit (CU) level. This made it difficult to distinguish between different operation types when analyzing simulation traces, as all these heterogeneous tasks appeared mixed together at GPU[X].CU[Y].
Solution
This PR ensures each task type is recorded at its own specific location within the CU hierarchy by using StartTaskWithSpecificLocation instead of StartTask for task tracing. Each functional unit now has its own distinct trace location:
Changes by Task Type
-
Sampled Wavefronts (
computeunit.go)- Location changed from
CU→CU.WFPool - Now consistent with regular wavefront tracing
- Location changed from
-
Instruction Fetch Tasks (
scheduler.go)- Location changed from
CU→CU.InstFetch - Clearly separates fetch operations from other CU activities
- Location changed from
-
Vector Memory Transactions (
vectormemoryunit.go)- Location changed from
CU→CU.VectorMemUnit - Replaced
TraceReqInitiatewithStartTaskWithSpecificLocation(no location-aware variant exists) - Maintains identical behavior with added location support
- Location changed from
-
Scalar Memory Transactions (
scalarunit.go)- Location changed from
CU→CU.ScalarUnit - Same approach as vector memory transactions
- Location changed from
Example
Before:
GPU[1].CU[0]
├─ Wavefront task
├─ Fetch task
├─ Vector memory transaction
└─ Scalar memory transaction
After:
GPU[1].CU[0]
├─ .WFPool
│ └─ Wavefront task
├─ .InstFetch
│ └─ Fetch task
├─ .VectorMemUnit
│ └─ Vector memory transaction
└─ .ScalarUnit
└─ Scalar memory transaction
Impact
- No functional changes - simulation behavior remains identical
- Improved trace organization - task types are now clearly separated in the trace hierarchy
- Better analysis - trace analysis tools can filter by specific functional units
- Backward compatible - existing tools continue to work with more granular location data
Testing
- ✅ Full build successful
- ✅ Linter passed with no new issues
- ✅ Acceptance tests passed (FIR, AES, stencil2d benchmarks)
- ✅ CodeQL security scan passed
- ✅ Manual validation with timing and emulation modes
Fixes #[issue_number]
Original prompt
This section details on the original issue you should resolve
<issue_title>One type of task in one trace location</issue_title> <issue_description>Currently, we mix many different levels of tasks at the same location when tracing tasks. For example, workgroups, wavefronts, and memory transactions are all recorded at the CU level. This needs to be changed so that each level have their own locations, even if they happen in the same component.</issue_description>
Comments on the Issue (you are @copilot in this section)
Fixes sarchlab/mgpusim#221
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.