gpu-compute: Store accum_offset from code object in WF

The accumulation offset is needed for some instructions. In order to
access this value we need to place it somewhere instruction definitions
can access. The most logical place is in the wavefront.

This commit simply copies the value from the HSA task to the wavefront
object.

Change-Id: I44ef62ef32d2421953f096c431dd758e882245b4
This commit is contained in:
Matthew Poremba
2024-02-20 13:34:51 -06:00
parent 1990186170
commit 8722aef2e2
4 changed files with 18 additions and 1 deletions

View File

@@ -723,7 +723,6 @@ GPUCommandProcessor::sanityCheckAKC(AMDKernelCode *akc)
warn_if(akc->kernarg_preload_spec_length ||
akc->kernarg_preload_spec_offset,
"Kernarg preload not implemented\n");
warn_if(akc->accum_offset, "ACC offset not implemented\n");
warn_if(akc->tg_split, "TG split not implemented\n");
}

View File

@@ -122,6 +122,11 @@ class HSAQueueEntry
}
parseKernelCode(akc);
// Offset of a first AccVGPR in the unified register file.
// Granularity 4. Value 0-63. 0 - accum-offset = 4,
// 1 - accum-offset = 8, ..., 63 - accum-offset = 256.
_accumOffset = (akc->accum_offset + 1) * 4;
}
const GfxVersion&
@@ -394,6 +399,12 @@ class HSAQueueEntry
assert(_outstandingWbs >= 0);
}
unsigned
accumOffset() const
{
return _accumOffset;
}
private:
void
parseKernelCode(AMDKernelCode *akc)
@@ -489,6 +500,8 @@ class HSAQueueEntry
std::bitset<NumVectorInitFields> initialVgprState;
std::bitset<NumScalarInitFields> initialSgprState;
unsigned _accumOffset;
};
} // namespace gem5

View File

@@ -430,6 +430,9 @@ Wavefront::initRegState(HSAQueueEntry *task, int wgSizeInWorkItems)
}
}
// Save the offset to the first accumulation VGPR number from HSA task.
accumOffset = task->accumOffset();
regInitIdx = 0;
// VGPRs are initialized to the work item IDs for a given thread. There

View File

@@ -131,6 +131,8 @@ class Wavefront : public SimObject
uint32_t maxVgprs;
// number of SGPRs required by WF
uint32_t maxSgprs;
// first accumulation vgpr number
uint32_t accumOffset;
void freeResources();
GPUDynInstPtr nextInstr();
void setStatus(status_e newStatus);