SWDEV-301667 - Create TS for each node recorded in graph

- Create a vector to allow multiple TS to be stored in Command.
- This would mean we dont wait for entire batch in Accumulate command
to finish when we exhaust signals.
- Reduce the number of signals created at init to 64. This min value
may still need to be tuned but the KFD allows max of 4094 interrupt
signals per device.
- Store kernel names whenever they are available and not just when
profiling. If we dynamically enable profiling like for Torch, a crash
can happen if hipGraphInstantiate wasnt included in Torch profile scope
beacuse we previously entered kernel names only when profiler is
attached.

Change-Id: I34e7881a25bbc763f82fdeb3408a8ea58e1ec006


[ROCm/clr commit: c157bfb202]
This commit is contained in:
Saleel Kudchadker
2024-03-21 18:26:01 +00:00
والد 150144a05f
کامیت f3aedfbec0
8فایلهای تغییر یافته به همراه63 افزوده شده و 71 حذف شده
@@ -258,7 +258,7 @@ class Command : public Event {
Command* next_; //!< Next GPU command in the queue list
Command* batch_head_ = nullptr; //!< The head of the batch commands
cl_command_type type_; //!< This command's OpenCL type.
void* data_;
std::vector<void*> data_;
const Event* waitingEvent_; //!< Waiting event associated with the marker
protected:
@@ -282,7 +282,6 @@ class Command : public Event {
queue_(nullptr),
next_(nullptr),
type_(type),
data_(nullptr),
waitingEvent_(nullptr),
eventWaitList_(nullWaitList),
commandWaitBits_(0) {}
@@ -322,11 +321,9 @@ class Command : public Event {
//! Return this command's OpenCL type.
cl_command_type type() const { return type_; }
//! Return the opaque, device specific data for this command.
void* data() const { return data_; }
//! Return the opaque, device specific data vector for this command.
std::vector<void*>& data() { return data_; }
//! Set the opaque, device specific data for this command.
void setData(void* data) { data_ = data; }
/*! \brief The execution engine for this command.
*
@@ -1273,17 +1270,13 @@ class AccumulateCommand : public Command {
//! Add kernel name to the list if available
void addKernelName(const std::string& kernelName) {
if (activity_prof::IsEnabled(OP_ID_DISPATCH)) {
// "^" is to indicate kernel is captured at instantiate
kernelNames_.push_back("^ " + kernelName);
}
// "^" is to indicate kernel is captured at instantiate
kernelNames_.push_back("^ " + kernelName);
}
//! Add kernel timestamp to the list if available
void addTimestamps(uint64_t startTs, uint64_t endTs) {
if (activity_prof::IsEnabled(OP_ID_DISPATCH)) {
tsList_.push_back(std::make_pair(startTs, endTs));
}
tsList_.push_back(std::make_pair(startTs, endTs));
}
//! Return the kernel names