|
|
|
@@ -364,7 +364,9 @@ struct GraphNode : public hipGraphNodeDOTAttribute {
|
|
|
|
|
fout << "\"" << fromNodeName << "\" -> \"" << toNodeName << "\"" << std::endl;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
virtual std::string GetLabel(hipGraphDebugDotFlags flag) { return (std::to_string(id_) + "\n" + label_); }
|
|
|
|
|
virtual std::string GetLabel(hipGraphDebugDotFlags flag) override {
|
|
|
|
|
return (std::to_string(id_) + "\n" + label_);
|
|
|
|
|
}
|
|
|
|
|
unsigned int GetEnabled() const { return isEnabled_; }
|
|
|
|
|
void SetEnabled(unsigned int isEnabled) { isEnabled_ = isEnabled; }
|
|
|
|
|
};
|
|
|
|
@@ -669,13 +671,13 @@ struct ChildGraphNode : public GraphNode {
|
|
|
|
|
childGraph_ = rhs.childGraph_->clone();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GraphNode* clone() const {
|
|
|
|
|
GraphNode* clone() const override {
|
|
|
|
|
return new ChildGraphNode(static_cast<ChildGraphNode const&>(*this));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Graph* GetChildGraph() { return childGraph_; }
|
|
|
|
|
Graph* GetChildGraph() override { return childGraph_; }
|
|
|
|
|
|
|
|
|
|
hipError_t GetNumParallelStreams(size_t &num) {
|
|
|
|
|
hipError_t GetNumParallelStreams(size_t &num) override {
|
|
|
|
|
if (false == TopologicalOrder(childGraphNodeOrder_)) {
|
|
|
|
|
return hipErrorInvalidValue;
|
|
|
|
|
}
|
|
|
|
@@ -690,17 +692,19 @@ struct ChildGraphNode : public GraphNode {
|
|
|
|
|
return hipSuccess;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SetStream(hip::Stream* stream, GraphExec* ptr = nullptr) {
|
|
|
|
|
void SetStream(hip::Stream* stream, GraphExec* ptr = nullptr) override {
|
|
|
|
|
stream_ = stream;
|
|
|
|
|
UpdateStream(parallelLists_, stream, ptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// For nodes that are dependent on the child graph node waitlist is the last node of the first
|
|
|
|
|
// parallel list
|
|
|
|
|
std::vector<amd::Command*>& GetCommands() { return parallelLists_[0].back()->GetCommands(); }
|
|
|
|
|
std::vector<amd::Command*>& GetCommands() override {
|
|
|
|
|
return parallelLists_[0].back()->GetCommands();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Create child graph node commands and set waitlists
|
|
|
|
|
hipError_t CreateCommand(hip::Stream* stream) {
|
|
|
|
|
hipError_t CreateCommand(hip::Stream* stream) override {
|
|
|
|
|
hipError_t status = GraphNode::CreateCommand(stream);
|
|
|
|
|
if (status != hipSuccess) {
|
|
|
|
|
return status;
|
|
|
|
@@ -713,20 +717,20 @@ struct ChildGraphNode : public GraphNode {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
void UpdateEventWaitLists(amd::Command::EventWaitList waitList) {
|
|
|
|
|
void UpdateEventWaitLists(amd::Command::EventWaitList waitList) override {
|
|
|
|
|
if (startCommand_ != nullptr) {
|
|
|
|
|
startCommand_->updateEventWaitList(waitList);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GetRunList(std::vector<std::vector<Node>>& parallelList,
|
|
|
|
|
std::unordered_map<Node, std::vector<Node>>& dependencies) {
|
|
|
|
|
std::unordered_map<Node, std::vector<Node>>& dependencies) override {
|
|
|
|
|
childGraph_->GetRunList(parallelLists_, nodeWaitLists_);
|
|
|
|
|
}
|
|
|
|
|
bool TopologicalOrder(std::vector<Node>& TopoOrder) {
|
|
|
|
|
bool TopologicalOrder(std::vector<Node>& TopoOrder) override {
|
|
|
|
|
return childGraph_->TopologicalOrder(TopoOrder);
|
|
|
|
|
}
|
|
|
|
|
void EnqueueCommands(hipStream_t stream) {
|
|
|
|
|
void EnqueueCommands(hipStream_t stream) override {
|
|
|
|
|
// enqueue child graph start command
|
|
|
|
|
if (startCommand_ != nullptr) {
|
|
|
|
|
startCommand_->enqueue();
|
|
|
|
@@ -755,16 +759,16 @@ struct ChildGraphNode : public GraphNode {
|
|
|
|
|
return hipSuccess;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
hipError_t SetParams(GraphNode* node) {
|
|
|
|
|
hipError_t SetParams(GraphNode* node) override {
|
|
|
|
|
const ChildGraphNode* childGraphNode = static_cast<ChildGraphNode const*>(node);
|
|
|
|
|
return SetParams(childGraphNode->childGraph_);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string GetLabel(hipGraphDebugDotFlags flag) {
|
|
|
|
|
virtual std::string GetLabel(hipGraphDebugDotFlags flag) override {
|
|
|
|
|
return std::to_string(GetID()) + "\n" + "graph_" + std::to_string(childGraph_->GetID());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual void GenerateDOT(std::ostream& fout, hipGraphDebugDotFlags flag) {
|
|
|
|
|
virtual void GenerateDOT(std::ostream& fout, hipGraphDebugDotFlags flag) override {
|
|
|
|
|
childGraph_->GenerateDOT(fout, flag);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
@@ -783,7 +787,7 @@ class GraphKernelNode : public GraphNode {
|
|
|
|
|
size_t GetKerArgSize() const { return alignedKernArgSize_; }
|
|
|
|
|
size_t GetKernargSegmentByteSize() const { return kernargSegmentByteSize_; }
|
|
|
|
|
size_t GetKernargSegmentAlignment() const { return kernargSegmentAlignment_; }
|
|
|
|
|
void PrintAttributes(std::ostream& out, hipGraphDebugDotFlags flag) {
|
|
|
|
|
void PrintAttributes(std::ostream& out, hipGraphDebugDotFlags flag) override {
|
|
|
|
|
out << "[";
|
|
|
|
|
out << "style";
|
|
|
|
|
out << "=\"";
|
|
|
|
@@ -817,7 +821,7 @@ class GraphKernelNode : public GraphNode {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string GetLabel(hipGraphDebugDotFlags flag) {
|
|
|
|
|
virtual std::string GetLabel(hipGraphDebugDotFlags flag) override {
|
|
|
|
|
hipFunction_t func = getFunc(kernelParams_, ihipGetDevice());
|
|
|
|
|
hip::DeviceFunc* function = hip::DeviceFunc::asFunction(func);
|
|
|
|
|
std::string label;
|
|
|
|
@@ -865,7 +869,7 @@ class GraphKernelNode : public GraphNode {
|
|
|
|
|
return label;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string GetShape(hipGraphDebugDotFlags flag) {
|
|
|
|
|
std::string GetShape(hipGraphDebugDotFlags flag) override {
|
|
|
|
|
if (flag == hipGraphDebugDotFlagsKernelNodeParams || flag == hipGraphDebugDotFlagsVerbose) {
|
|
|
|
|
return "record";
|
|
|
|
|
} else {
|
|
|
|
@@ -1003,11 +1007,11 @@ class GraphKernelNode : public GraphNode {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GraphNode* clone() const {
|
|
|
|
|
GraphNode* clone() const override {
|
|
|
|
|
return new GraphKernelNode(static_cast<GraphKernelNode const&>(*this));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
hipError_t CreateCommand(hip::Stream* stream) {
|
|
|
|
|
hipError_t CreateCommand(hip::Stream* stream) override {
|
|
|
|
|
hipFunction_t func = nullptr;
|
|
|
|
|
hipError_t status = validateKernelParams(&kernelParams_, &func,
|
|
|
|
|
stream ? hip::getDeviceID(stream->context()) : -1);
|
|
|
|
@@ -1136,7 +1140,7 @@ class GraphKernelNode : public GraphNode {
|
|
|
|
|
return hipSuccess;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
hipError_t SetParams(GraphNode* node) {
|
|
|
|
|
hipError_t SetParams(GraphNode* node) override {
|
|
|
|
|
const GraphKernelNode* kernelNode = static_cast<GraphKernelNode const*>(node);
|
|
|
|
|
return SetParams(&kernelNode->kernelParams_);
|
|
|
|
|
}
|
|
|
|
@@ -1184,11 +1188,11 @@ class GraphMemcpyNode : public GraphNode {
|
|
|
|
|
copyParams_ = rhs.copyParams_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GraphNode* clone() const {
|
|
|
|
|
GraphNode* clone() const override {
|
|
|
|
|
return new GraphMemcpyNode(static_cast<GraphMemcpyNode const&>(*this));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual hipError_t CreateCommand(hip::Stream* stream) {
|
|
|
|
|
virtual hipError_t CreateCommand(hip::Stream* stream) override {
|
|
|
|
|
if ((copyParams_.kind == hipMemcpyHostToHost || copyParams_.kind == hipMemcpyDefault)
|
|
|
|
|
&& IsHtoHMemcpy(copyParams_.dstPtr.ptr, copyParams_.srcPtr.ptr)) {
|
|
|
|
|
return hipSuccess;
|
|
|
|
@@ -1230,14 +1234,14 @@ class GraphMemcpyNode : public GraphNode {
|
|
|
|
|
return hipSuccess;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual hipError_t SetParams(GraphNode* node) {
|
|
|
|
|
virtual hipError_t SetParams(GraphNode* node) override {
|
|
|
|
|
const GraphMemcpyNode* memcpyNode = static_cast<GraphMemcpyNode const*>(node);
|
|
|
|
|
return SetParams(&memcpyNode->copyParams_);
|
|
|
|
|
}
|
|
|
|
|
// ToDo: use this when commands are cloned and command params are to be updated
|
|
|
|
|
hipError_t ValidateParams(const hipMemcpy3DParms* pNodeParams);
|
|
|
|
|
|
|
|
|
|
std::string GetLabel(hipGraphDebugDotFlags flag) {
|
|
|
|
|
virtual std::string GetLabel(hipGraphDebugDotFlags flag) override {
|
|
|
|
|
size_t offset = 0;
|
|
|
|
|
const HIP_MEMCPY3D pCopy = hip::getDrvMemcpy3DDesc(copyParams_);
|
|
|
|
|
hipMemoryType srcMemoryType = pCopy.srcMemoryType;
|
|
|
|
@@ -1312,7 +1316,7 @@ class GraphMemcpyNode : public GraphNode {
|
|
|
|
|
}
|
|
|
|
|
return label;
|
|
|
|
|
}
|
|
|
|
|
std::string GetShape(hipGraphDebugDotFlags flag) {
|
|
|
|
|
std::string GetShape(hipGraphDebugDotFlags flag) override {
|
|
|
|
|
if (flag == hipGraphDebugDotFlagsMemcpyNodeParams || flag == hipGraphDebugDotFlagsVerbose) {
|
|
|
|
|
return "record";
|
|
|
|
|
} else {
|
|
|
|
@@ -1339,11 +1343,11 @@ class GraphMemcpyNode1D : public GraphMemcpyNode {
|
|
|
|
|
|
|
|
|
|
~GraphMemcpyNode1D() {}
|
|
|
|
|
|
|
|
|
|
GraphNode* clone() const {
|
|
|
|
|
GraphNode* clone() const override {
|
|
|
|
|
return new GraphMemcpyNode1D(static_cast<GraphMemcpyNode1D const&>(*this));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual hipError_t CreateCommand(hip::Stream* stream) {
|
|
|
|
|
virtual hipError_t CreateCommand(hip::Stream* stream) override {
|
|
|
|
|
if ((kind_ == hipMemcpyHostToHost || kind_ == hipMemcpyDefault) && IsHtoHMemcpy(dst_, src_)) {
|
|
|
|
|
return hipSuccess;
|
|
|
|
|
}
|
|
|
|
@@ -1358,7 +1362,7 @@ class GraphMemcpyNode1D : public GraphMemcpyNode {
|
|
|
|
|
return status;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual void EnqueueCommands(hipStream_t stream) {
|
|
|
|
|
virtual void EnqueueCommands(hipStream_t stream) override {
|
|
|
|
|
bool isH2H = false;
|
|
|
|
|
if ((kind_ == hipMemcpyHostToHost || kind_ == hipMemcpyDefault) && IsHtoHMemcpy(dst_, src_)) {
|
|
|
|
|
isH2H = true;
|
|
|
|
@@ -1419,7 +1423,7 @@ class GraphMemcpyNode1D : public GraphMemcpyNode {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
hipMemcpyKind GetMemcpyKind() const {
|
|
|
|
|
hipMemcpyKind GetMemcpyKind() const override {
|
|
|
|
|
return kind_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1435,13 +1439,13 @@ class GraphMemcpyNode1D : public GraphMemcpyNode {
|
|
|
|
|
return hipSuccess;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual hipError_t SetParams(GraphNode* node) {
|
|
|
|
|
virtual hipError_t SetParams(GraphNode* node) override {
|
|
|
|
|
const GraphMemcpyNode1D* memcpy1DNode = static_cast<GraphMemcpyNode1D const*>(node);
|
|
|
|
|
return SetParams(memcpy1DNode->dst_, memcpy1DNode->src_, memcpy1DNode->count_,
|
|
|
|
|
memcpy1DNode->kind_);
|
|
|
|
|
}
|
|
|
|
|
static hipError_t ValidateParams(void* dst, const void* src, size_t count, hipMemcpyKind kind);
|
|
|
|
|
std::string GetLabel(hipGraphDebugDotFlags flag) {
|
|
|
|
|
virtual std::string GetLabel(hipGraphDebugDotFlags flag) override {
|
|
|
|
|
size_t sOffsetOrig = 0;
|
|
|
|
|
amd::Memory* origSrcMemory = getMemoryObject(src_, sOffsetOrig);
|
|
|
|
|
size_t dOffsetOrig = 0;
|
|
|
|
@@ -1468,16 +1472,18 @@ class GraphMemcpyNode1D : public GraphMemcpyNode {
|
|
|
|
|
std::string label;
|
|
|
|
|
if (flag == hipGraphDebugDotFlagsMemcpyNodeParams || flag == hipGraphDebugDotFlagsVerbose) {
|
|
|
|
|
char buffer[500];
|
|
|
|
|
sprintf(buffer,
|
|
|
|
|
"{\n%s\n| {{ID | node handle} | {%u | %p}}\n| {kind | %s}\n| {{srcPtr | dstPtr} | "
|
|
|
|
|
"{pitch "
|
|
|
|
|
"| ptr | xsize | ysize | pitch | ptr | xsize | size} | {%zu | %p | %zu | %zu | %zu | %p "
|
|
|
|
|
"| %zu "
|
|
|
|
|
"| %zu}}\n| {{srcPos | {{x | %zu} | {y | %zu} | {z | %zu}}} | {dstPos | {{x | %zu} | {y "
|
|
|
|
|
"| "
|
|
|
|
|
"%zu} | {z | %zu}}} | {Extent | {{Width | %zu} | {Height | %zu} | {Depth | %zu}}}}\n}",
|
|
|
|
|
label_.c_str(), GetID(), this, memcpyDirection.c_str(), (size_t)0,
|
|
|
|
|
src_, (size_t)0, (size_t)0, (size_t)0, dst_, (size_t)0, (size_t)0, (size_t)0, (size_t)0, (size_t)0, (size_t)0, (size_t)0, (size_t)0, count_, (size_t)1, (size_t)1);
|
|
|
|
|
sprintf(
|
|
|
|
|
buffer,
|
|
|
|
|
"{\n%s\n| {{ID | node handle} | {%u | %p}}\n| {kind | %s}\n| {{srcPtr | dstPtr} | "
|
|
|
|
|
"{pitch "
|
|
|
|
|
"| ptr | xsize | ysize | pitch | ptr | xsize | size} | {%zu | %p | %zu | %zu | %zu | %p "
|
|
|
|
|
"| %zu "
|
|
|
|
|
"| %zu}}\n| {{srcPos | {{x | %zu} | {y | %zu} | {z | %zu}}} | {dstPos | {{x | %zu} | {y "
|
|
|
|
|
"| "
|
|
|
|
|
"%zu} | {z | %zu}}} | {Extent | {{Width | %zu} | {Height | %zu} | {Depth | %zu}}}}\n}",
|
|
|
|
|
label_.c_str(), GetID(), this, memcpyDirection.c_str(), (size_t)0, src_, (size_t)0,
|
|
|
|
|
(size_t)0, (size_t)0, dst_, (size_t)0, (size_t)0, (size_t)0, (size_t)0, (size_t)0,
|
|
|
|
|
(size_t)0, (size_t)0, (size_t)0, count_, (size_t)1, (size_t)1);
|
|
|
|
|
label = buffer;
|
|
|
|
|
} else {
|
|
|
|
|
label = std::to_string(GetID()) + "\n" + label_ + "\n(" + memcpyDirection + "," +
|
|
|
|
@@ -1485,7 +1491,7 @@ class GraphMemcpyNode1D : public GraphMemcpyNode {
|
|
|
|
|
}
|
|
|
|
|
return label;
|
|
|
|
|
}
|
|
|
|
|
std::string GetShape(hipGraphDebugDotFlags flag) {
|
|
|
|
|
std::string GetShape(hipGraphDebugDotFlags flag) override {
|
|
|
|
|
if (flag == hipGraphDebugDotFlagsMemcpyNodeParams || flag == hipGraphDebugDotFlagsVerbose) {
|
|
|
|
|
return "record";
|
|
|
|
|
} else {
|
|
|
|
@@ -1507,12 +1513,12 @@ class GraphMemcpyNodeFromSymbol : public GraphMemcpyNode1D {
|
|
|
|
|
|
|
|
|
|
~GraphMemcpyNodeFromSymbol() {}
|
|
|
|
|
|
|
|
|
|
GraphNode* clone() const {
|
|
|
|
|
GraphNode* clone() const override {
|
|
|
|
|
return new GraphMemcpyNodeFromSymbol(
|
|
|
|
|
static_cast<GraphMemcpyNodeFromSymbol const&>(*this));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual hipError_t CreateCommand(hip::Stream* stream) {
|
|
|
|
|
virtual hipError_t CreateCommand(hip::Stream* stream) override {
|
|
|
|
|
hipError_t status = GraphNode::CreateCommand(stream);
|
|
|
|
|
if (status != hipSuccess) {
|
|
|
|
|
return status;
|
|
|
|
@@ -1580,7 +1586,7 @@ class GraphMemcpyNodeFromSymbol : public GraphMemcpyNode1D {
|
|
|
|
|
return hipSuccess;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual hipError_t SetParams(GraphNode* node) {
|
|
|
|
|
virtual hipError_t SetParams(GraphNode* node) override {
|
|
|
|
|
const GraphMemcpyNodeFromSymbol* memcpyNode =
|
|
|
|
|
static_cast<GraphMemcpyNodeFromSymbol const*>(node);
|
|
|
|
|
return SetParams(memcpyNode->dst_, memcpyNode->symbol_, memcpyNode->count_, memcpyNode->offset_,
|
|
|
|
@@ -1600,11 +1606,11 @@ class GraphMemcpyNodeToSymbol : public GraphMemcpyNode1D {
|
|
|
|
|
|
|
|
|
|
~GraphMemcpyNodeToSymbol() {}
|
|
|
|
|
|
|
|
|
|
GraphNode* clone() const {
|
|
|
|
|
GraphNode* clone() const override {
|
|
|
|
|
return new GraphMemcpyNodeToSymbol(static_cast<GraphMemcpyNodeToSymbol const&>(*this));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual hipError_t CreateCommand(hip::Stream* stream) {
|
|
|
|
|
virtual hipError_t CreateCommand(hip::Stream* stream) override {
|
|
|
|
|
hipError_t status = GraphNode::CreateCommand(stream);
|
|
|
|
|
if (status != hipSuccess) {
|
|
|
|
|
return status;
|
|
|
|
@@ -1670,7 +1676,7 @@ class GraphMemcpyNodeToSymbol : public GraphMemcpyNode1D {
|
|
|
|
|
return hipSuccess;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual hipError_t SetParams(GraphNode* node) {
|
|
|
|
|
virtual hipError_t SetParams(GraphNode* node) override {
|
|
|
|
|
const GraphMemcpyNodeToSymbol* memcpyNode =
|
|
|
|
|
static_cast<GraphMemcpyNodeToSymbol const*>(node);
|
|
|
|
|
return SetParams(memcpyNode->src_, memcpyNode->symbol_, memcpyNode->count_, memcpyNode->offset_,
|
|
|
|
@@ -1698,11 +1704,11 @@ class GraphMemsetNode : public GraphNode {
|
|
|
|
|
memsetParams_ = memsetNode.memsetParams_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GraphNode* clone() const {
|
|
|
|
|
GraphNode* clone() const override {
|
|
|
|
|
return new GraphMemsetNode(static_cast<GraphMemsetNode const&>(*this));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string GetLabel(hipGraphDebugDotFlags flag) {
|
|
|
|
|
virtual std::string GetLabel(hipGraphDebugDotFlags flag) override {
|
|
|
|
|
std::string label;
|
|
|
|
|
if (flag == hipGraphDebugDotFlagsMemsetNodeParams || flag == hipGraphDebugDotFlagsVerbose) {
|
|
|
|
|
char buffer[500];
|
|
|
|
@@ -1726,7 +1732,7 @@ class GraphMemsetNode : public GraphNode {
|
|
|
|
|
return label;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string GetShape(hipGraphDebugDotFlags flag) {
|
|
|
|
|
std::string GetShape(hipGraphDebugDotFlags flag) override {
|
|
|
|
|
if (flag == hipGraphDebugDotFlagsMemsetNodeParams || flag == hipGraphDebugDotFlagsVerbose) {
|
|
|
|
|
return "record";
|
|
|
|
|
} else {
|
|
|
|
@@ -1734,7 +1740,7 @@ class GraphMemsetNode : public GraphNode {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
hipError_t CreateCommand(hip::Stream* stream) {
|
|
|
|
|
hipError_t CreateCommand(hip::Stream* stream) override {
|
|
|
|
|
hipError_t status = GraphNode::CreateCommand(stream);
|
|
|
|
|
if (status != hipSuccess) {
|
|
|
|
|
return status;
|
|
|
|
@@ -1748,7 +1754,9 @@ class GraphMemsetNode : public GraphNode {
|
|
|
|
|
commands_,
|
|
|
|
|
{memsetParams_.dst, memsetParams_.pitch, memsetParams_.width * memsetParams_.elementSize,
|
|
|
|
|
memsetParams_.height},
|
|
|
|
|
memsetParams_.value, {memsetParams_.width * memsetParams_.elementSize, memsetParams_.height, 1}, stream, memsetParams_.elementSize);
|
|
|
|
|
memsetParams_.value,
|
|
|
|
|
{memsetParams_.width * memsetParams_.elementSize, memsetParams_.height, 1}, stream,
|
|
|
|
|
memsetParams_.elementSize);
|
|
|
|
|
}
|
|
|
|
|
return status;
|
|
|
|
|
}
|
|
|
|
@@ -1818,9 +1826,9 @@ class GraphMemsetNode : public GraphNode {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
sizeBytes = params->width * params->elementSize * params->height * 1;
|
|
|
|
|
hip_error =
|
|
|
|
|
ihipMemset3D_validate({params->dst, params->pitch, params->width * params->elementSize, params->height},
|
|
|
|
|
params->value, {params->width * params->elementSize, params->height, 1}, sizeBytes);
|
|
|
|
|
hip_error = ihipMemset3D_validate(
|
|
|
|
|
{params->dst, params->pitch, params->width * params->elementSize, params->height},
|
|
|
|
|
params->value, {params->width * params->elementSize, params->height, 1}, sizeBytes);
|
|
|
|
|
}
|
|
|
|
|
if (hip_error != hipSuccess) {
|
|
|
|
|
return hip_error;
|
|
|
|
@@ -1841,7 +1849,7 @@ class GraphMemsetNode : public GraphNode {
|
|
|
|
|
pmemsetParams.width = params->width;
|
|
|
|
|
return SetParamsInternal(&pmemsetParams, isExec);
|
|
|
|
|
}
|
|
|
|
|
hipError_t SetParams(GraphNode* node) {
|
|
|
|
|
hipError_t SetParams(GraphNode* node) override {
|
|
|
|
|
const GraphMemsetNode* memsetNode = static_cast<GraphMemsetNode const*>(node);
|
|
|
|
|
return SetParams(&memsetNode->memsetParams_);
|
|
|
|
|
}
|
|
|
|
@@ -1856,11 +1864,11 @@ class GraphEventRecordNode : public GraphNode {
|
|
|
|
|
event_(event) {}
|
|
|
|
|
~GraphEventRecordNode() {}
|
|
|
|
|
|
|
|
|
|
GraphNode* clone() const {
|
|
|
|
|
GraphNode* clone() const override {
|
|
|
|
|
return new GraphEventRecordNode(static_cast<GraphEventRecordNode const&>(*this));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
hipError_t CreateCommand(hip::Stream* stream) {
|
|
|
|
|
hipError_t CreateCommand(hip::Stream* stream) override {
|
|
|
|
|
hipError_t status = GraphNode::CreateCommand(stream);
|
|
|
|
|
if (status != hipSuccess) {
|
|
|
|
|
return status;
|
|
|
|
@@ -1873,7 +1881,7 @@ class GraphEventRecordNode : public GraphNode {
|
|
|
|
|
return status;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void EnqueueCommands(hipStream_t stream) {
|
|
|
|
|
void EnqueueCommands(hipStream_t stream) override {
|
|
|
|
|
if (!commands_.empty()) {
|
|
|
|
|
hip::Event* e = reinterpret_cast<hip::Event*>(event_);
|
|
|
|
|
// command release during enqueueRecordCommand
|
|
|
|
@@ -1893,7 +1901,7 @@ class GraphEventRecordNode : public GraphNode {
|
|
|
|
|
return hipSuccess;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
hipError_t SetParams(GraphNode* node) {
|
|
|
|
|
hipError_t SetParams(GraphNode* node) override {
|
|
|
|
|
const GraphEventRecordNode* eventRecordNode =
|
|
|
|
|
static_cast<GraphEventRecordNode const*>(node);
|
|
|
|
|
return SetParams(eventRecordNode->event_);
|
|
|
|
@@ -1909,11 +1917,11 @@ class GraphEventWaitNode : public GraphNode {
|
|
|
|
|
event_(event) {}
|
|
|
|
|
~GraphEventWaitNode() {}
|
|
|
|
|
|
|
|
|
|
GraphNode* clone() const {
|
|
|
|
|
GraphNode* clone() const override {
|
|
|
|
|
return new GraphEventWaitNode(static_cast<GraphEventWaitNode const&>(*this));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
hipError_t CreateCommand(hip::Stream* stream) {
|
|
|
|
|
hipError_t CreateCommand(hip::Stream* stream) override {
|
|
|
|
|
hipError_t status = GraphNode::CreateCommand(stream);
|
|
|
|
|
if (status != hipSuccess) {
|
|
|
|
|
return status;
|
|
|
|
@@ -1926,7 +1934,7 @@ class GraphEventWaitNode : public GraphNode {
|
|
|
|
|
return status;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void EnqueueCommands(hipStream_t stream) {
|
|
|
|
|
void EnqueueCommands(hipStream_t stream) override {
|
|
|
|
|
if (!commands_.empty()) {
|
|
|
|
|
hip::Event* e = reinterpret_cast<hip::Event*>(event_);
|
|
|
|
|
hipError_t status = e->enqueueStreamWaitCommand(stream, commands_[0]);
|
|
|
|
@@ -1946,7 +1954,7 @@ class GraphEventWaitNode : public GraphNode {
|
|
|
|
|
return hipSuccess;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
hipError_t SetParams(GraphNode* node) {
|
|
|
|
|
hipError_t SetParams(GraphNode* node) override {
|
|
|
|
|
const GraphEventWaitNode* eventWaitNode = static_cast<GraphEventWaitNode const*>(node);
|
|
|
|
|
return SetParams(eventWaitNode->event_);
|
|
|
|
|
}
|
|
|
|
@@ -1966,11 +1974,11 @@ class GraphHostNode : public GraphNode {
|
|
|
|
|
NodeParams_ = hostNode.NodeParams_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GraphNode* clone() const {
|
|
|
|
|
GraphNode* clone() const override {
|
|
|
|
|
return new GraphHostNode(static_cast<GraphHostNode const&>(*this));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
hipError_t CreateCommand(hip::Stream* stream) {
|
|
|
|
|
hipError_t CreateCommand(hip::Stream* stream) override {
|
|
|
|
|
hipError_t status = GraphNode::CreateCommand(stream);
|
|
|
|
|
if (status != hipSuccess) {
|
|
|
|
|
return status;
|
|
|
|
@@ -1987,7 +1995,7 @@ class GraphHostNode : public GraphNode {
|
|
|
|
|
NodeParams->fn(NodeParams->userData);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void EnqueueCommands(hipStream_t stream) {
|
|
|
|
|
void EnqueueCommands(hipStream_t stream) override {
|
|
|
|
|
if (!commands_.empty()) {
|
|
|
|
|
if (!commands_[0]->setCallback(CL_COMPLETE, GraphHostNode::Callback, &NodeParams_)) {
|
|
|
|
|
ClPrint(amd::LOG_ERROR, amd::LOG_CODE, "[hipGraph] Failed during setCallback");
|
|
|
|
@@ -2015,7 +2023,7 @@ class GraphHostNode : public GraphNode {
|
|
|
|
|
return hipSuccess;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
hipError_t SetParams(GraphNode* node) {
|
|
|
|
|
hipError_t SetParams(GraphNode* node) override {
|
|
|
|
|
const GraphHostNode* hostNode = static_cast<GraphHostNode const*>(node);
|
|
|
|
|
return SetParams(&hostNode->NodeParams_);
|
|
|
|
|
}
|
|
|
|
@@ -2026,11 +2034,11 @@ class GraphEmptyNode : public GraphNode {
|
|
|
|
|
GraphEmptyNode() : GraphNode(hipGraphNodeTypeEmpty, "solid", "rectangle", "EMPTY") {}
|
|
|
|
|
~GraphEmptyNode() {}
|
|
|
|
|
|
|
|
|
|
GraphNode* clone() const {
|
|
|
|
|
GraphNode* clone() const override {
|
|
|
|
|
return new GraphEmptyNode(static_cast<GraphEmptyNode const&>(*this));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
hipError_t CreateCommand(hip::Stream* stream) {
|
|
|
|
|
hipError_t CreateCommand(hip::Stream* stream) override {
|
|
|
|
|
hipError_t status = GraphNode::CreateCommand(stream);
|
|
|
|
|
if (status != hipSuccess) {
|
|
|
|
|
return status;
|
|
|
|
@@ -2044,8 +2052,8 @@ class GraphEmptyNode : public GraphNode {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// ================================================================================================
|
|
|
|
|
class GraphMemAllocNode : public GraphNode {
|
|
|
|
|
hipMemAllocNodeParams node_params_; // Node parameters for memory allocation
|
|
|
|
|
class GraphMemAllocNode final : public GraphNode {
|
|
|
|
|
hipMemAllocNodeParams node_params_; // Node parameters for memory allocation
|
|
|
|
|
amd::Memory* va_ = nullptr; // Memory object, which holds a virtual address
|
|
|
|
|
|
|
|
|
|
// Derive the new class for VirtualMapCommand,
|
|
|
|
@@ -2289,11 +2297,11 @@ class GraphDrvMemcpyNode : public GraphNode {
|
|
|
|
|
copyParams_ = rhs.copyParams_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GraphNode* clone() const {
|
|
|
|
|
GraphNode* clone() const override {
|
|
|
|
|
return new GraphDrvMemcpyNode(static_cast<GraphDrvMemcpyNode const&>(*this));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
hipError_t CreateCommand(hip::Stream* stream) {
|
|
|
|
|
hipError_t CreateCommand(hip::Stream* stream) override {
|
|
|
|
|
if(copyParams_.srcMemoryType == hipMemoryTypeHost &&
|
|
|
|
|
copyParams_.dstMemoryType == hipMemoryTypeHost &&
|
|
|
|
|
IsHtoHMemcpy(copyParams_.dstHost, copyParams_.srcHost)) {
|
|
|
|
@@ -2337,7 +2345,7 @@ class GraphDrvMemcpyNode : public GraphNode {
|
|
|
|
|
std::memcpy(©Params_, params, sizeof(HIP_MEMCPY3D));
|
|
|
|
|
return hipSuccess;
|
|
|
|
|
}
|
|
|
|
|
hipError_t SetParams(GraphNode* node) {
|
|
|
|
|
hipError_t SetParams(GraphNode* node) override {
|
|
|
|
|
const GraphDrvMemcpyNode* memcpyNode = static_cast<GraphDrvMemcpyNode const*>(node);
|
|
|
|
|
return SetParams(&memcpyNode->copyParams_);
|
|
|
|
|
}
|
|
|
|
|