SWDEV-240807 - Fix header file
Remove class useage from header file
Change-Id: Ibe1a59241f000cc162dd865484c313e56c4db95f
[ROCm/clr commit: 223c0364f8]
Этот коммит содержится в:
коммит произвёл
Christophe Paquot
родитель
d407cc46ee
Коммит
9488cd1194
@@ -302,7 +302,7 @@ hipError_t hipStreamBeginCapture(hipStream_t stream, hipStreamCaptureMode mode)
|
|||||||
if (stream == nullptr || s->GetCaptureStatus() == hipStreamCaptureStatusActive) {
|
if (stream == nullptr || s->GetCaptureStatus() == hipStreamCaptureStatusActive) {
|
||||||
HIP_RETURN(hipErrorInvalidValue);
|
HIP_RETURN(hipErrorInvalidValue);
|
||||||
}
|
}
|
||||||
s->SetCaptureGraph(new hipGraph());
|
s->SetCaptureGraph(new ihipGraph());
|
||||||
s->SetCaptureMode(mode);
|
s->SetCaptureMode(mode);
|
||||||
s->SetOriginStream();
|
s->SetOriginStream();
|
||||||
g_captureStreams.push_back(stream);
|
g_captureStreams.push_back(stream);
|
||||||
@@ -339,7 +339,7 @@ hipError_t hipStreamEndCapture(hipStream_t stream, hipGraph_t* pGraph) {
|
|||||||
|
|
||||||
hipError_t hipGraphCreate(hipGraph_t* pGraph, unsigned int flags) {
|
hipError_t hipGraphCreate(hipGraph_t* pGraph, unsigned int flags) {
|
||||||
HIP_INIT_API(hipGraphCreate, pGraph, flags);
|
HIP_INIT_API(hipGraphCreate, pGraph, flags);
|
||||||
*pGraph = new hipGraph();
|
*pGraph = new ihipGraph();
|
||||||
HIP_RETURN(hipSuccess);
|
HIP_RETURN(hipSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ const char* GetGraphNodeTypeString(uint32_t op) {
|
|||||||
return case_string;
|
return case_string;
|
||||||
};
|
};
|
||||||
|
|
||||||
hipError_t hipGraph::AddNode(const Node& node) {
|
hipError_t ihipGraph::AddNode(const Node& node) {
|
||||||
vertices_.emplace_back(node);
|
vertices_.emplace_back(node);
|
||||||
nodeOutDegree_[node] = 0;
|
nodeOutDegree_[node] = 0;
|
||||||
nodeInDegree_[node] = 0;
|
nodeInDegree_[node] = 0;
|
||||||
@@ -55,7 +55,7 @@ hipError_t hipGraph::AddNode(const Node& node) {
|
|||||||
return hipSuccess;
|
return hipSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
hipError_t hipGraph::AddEdge(const Node& parentNode, const Node& childNode) {
|
hipError_t ihipGraph::AddEdge(const Node& parentNode, const Node& childNode) {
|
||||||
// if vertice doesn't exist, add it to the graph
|
// if vertice doesn't exist, add it to the graph
|
||||||
if (std::find(vertices_.begin(), vertices_.end(), parentNode) == vertices_.end()) {
|
if (std::find(vertices_.begin(), vertices_.end(), parentNode) == vertices_.end()) {
|
||||||
AddNode(parentNode);
|
AddNode(parentNode);
|
||||||
@@ -84,7 +84,7 @@ hipError_t hipGraph::AddEdge(const Node& parentNode, const Node& childNode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// root nodes are all vertices with 0 in-degrees
|
// root nodes are all vertices with 0 in-degrees
|
||||||
std::vector<Node> hipGraph::GetRootNodes() const {
|
std::vector<Node> ihipGraph::GetRootNodes() const {
|
||||||
std::vector<Node> roots;
|
std::vector<Node> roots;
|
||||||
for (auto entry : vertices_) {
|
for (auto entry : vertices_) {
|
||||||
if (nodeInDegree_.at(entry) == 0) {
|
if (nodeInDegree_.at(entry) == 0) {
|
||||||
@@ -98,7 +98,7 @@ std::vector<Node> hipGraph::GetRootNodes() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// leaf nodes are all vertices with 0 out-degrees
|
// leaf nodes are all vertices with 0 out-degrees
|
||||||
std::vector<Node> hipGraph::GetLeafNodes() const {
|
std::vector<Node> ihipGraph::GetLeafNodes() const {
|
||||||
std::vector<Node> leafNodes;
|
std::vector<Node> leafNodes;
|
||||||
for (auto entry : vertices_) {
|
for (auto entry : vertices_) {
|
||||||
if (nodeOutDegree_.at(entry) == 0) {
|
if (nodeOutDegree_.at(entry) == 0) {
|
||||||
@@ -108,7 +108,7 @@ std::vector<Node> hipGraph::GetLeafNodes() const {
|
|||||||
return leafNodes;
|
return leafNodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t hipGraph::GetLeafNodeCount() const {
|
size_t ihipGraph::GetLeafNodeCount() const {
|
||||||
int numLeafNodes = 0;
|
int numLeafNodes = 0;
|
||||||
for (auto entry : vertices_) {
|
for (auto entry : vertices_) {
|
||||||
if (nodeOutDegree_.at(entry) == 0) {
|
if (nodeOutDegree_.at(entry) == 0) {
|
||||||
@@ -118,7 +118,7 @@ size_t hipGraph::GetLeafNodeCount() const {
|
|||||||
return numLeafNodes;
|
return numLeafNodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::pair<Node, Node>> hipGraph::GetEdges() const {
|
std::vector<std::pair<Node, Node>> ihipGraph::GetEdges() const {
|
||||||
std::vector<std::pair<Node, Node>> edges;
|
std::vector<std::pair<Node, Node>> edges;
|
||||||
for (const auto& i : edges_) {
|
for (const auto& i : edges_) {
|
||||||
for (const auto& j : i.second) {
|
for (const auto& j : i.second) {
|
||||||
@@ -128,7 +128,7 @@ std::vector<std::pair<Node, Node>> hipGraph::GetEdges() const {
|
|||||||
return edges;
|
return edges;
|
||||||
}
|
}
|
||||||
|
|
||||||
void hipGraph::GetRunListUtil(Node v, std::unordered_map<Node, bool>& visited,
|
void ihipGraph::GetRunListUtil(Node v, std::unordered_map<Node, bool>& visited,
|
||||||
std::vector<Node>& singleList,
|
std::vector<Node>& singleList,
|
||||||
std::vector<std::vector<Node>>& parallelLists,
|
std::vector<std::vector<Node>>& parallelLists,
|
||||||
std::unordered_map<Node, std::vector<Node>>& dependencies) {
|
std::unordered_map<Node, std::vector<Node>>& dependencies) {
|
||||||
@@ -174,7 +174,7 @@ void hipGraph::GetRunListUtil(Node v, std::unordered_map<Node, bool>& visited,
|
|||||||
}
|
}
|
||||||
// The function to do Topological Sort.
|
// The function to do Topological Sort.
|
||||||
// It uses recursive GetRunListUtil()
|
// It uses recursive GetRunListUtil()
|
||||||
void hipGraph::GetRunList(std::vector<std::vector<Node>>& parallelLists,
|
void ihipGraph::GetRunList(std::vector<std::vector<Node>>& parallelLists,
|
||||||
std::unordered_map<Node, std::vector<Node>>& dependencies) {
|
std::unordered_map<Node, std::vector<Node>>& dependencies) {
|
||||||
std::vector<Node> singleList;
|
std::vector<Node> singleList;
|
||||||
|
|
||||||
@@ -196,7 +196,7 @@ void hipGraph::GetRunList(std::vector<std::vector<Node>>& parallelLists,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hipError_t hipGraph::LevelOrder(std::vector<Node>& levelOrder) {
|
hipError_t ihipGraph::LevelOrder(std::vector<Node>& levelOrder) {
|
||||||
std::vector<Node> roots = GetRootNodes();
|
std::vector<Node> roots = GetRootNodes();
|
||||||
std::unordered_map<Node, bool> visited;
|
std::unordered_map<Node, bool> visited;
|
||||||
std::queue<Node> q;
|
std::queue<Node> q;
|
||||||
|
|||||||
@@ -58,15 +58,15 @@ class hipGraphNode {
|
|||||||
void SetLevel(uint32_t level) { level_ = level; }
|
void SetLevel(uint32_t level) { level_ = level; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class hipGraph {
|
class ihipGraph {
|
||||||
std::unordered_map<Node, size_t> nodeInDegree_; // count of in coming edges for every vertex
|
std::unordered_map<Node, size_t> nodeInDegree_; // count of in coming edges for every vertex
|
||||||
std::unordered_map<Node, size_t> nodeOutDegree_; // count of outgoing edges for every vertex
|
std::unordered_map<Node, size_t> nodeOutDegree_; // count of outgoing edges for every vertex
|
||||||
std::vector<Node> vertices_;
|
std::vector<Node> vertices_;
|
||||||
std::unordered_map<Node, std::vector<Node>> edges_;
|
std::unordered_map<Node, std::vector<Node>> edges_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
hipGraph() {}
|
ihipGraph() {}
|
||||||
~hipGraph(){};
|
~ihipGraph(){};
|
||||||
/// add node to the graph
|
/// add node to the graph
|
||||||
hipError_t AddNode(const Node& node);
|
hipError_t AddNode(const Node& node);
|
||||||
/// add edge to the graph
|
/// add edge to the graph
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user