SWDEV-403382 - Add missing graph APIs

- add external semaphor signal and wait node

Signed-off-by: sdashmiz <shadi.dashmiz@amd.com>
Change-Id: If205d48bc4fb60ce2966ca6ed0419e7700755bdd
이 커밋은 다음에 포함됨:
sdashmiz
2023-06-01 11:10:34 -04:00
커밋한 사람 Shadi Dashmiz
부모 bf7d45050d
커밋 087767d9ac
5개의 변경된 파일274개의 추가작업 그리고 0개의 파일을 삭제
+119
파일 보기
@@ -2329,5 +2329,124 @@ class GraphDrvMemcpyNode : public GraphNode {
}
return hipSuccess;
}
};
class hipGraphExternalSemSignalNode : public GraphNode {
hipExternalSemaphoreSignalNodeParams externalSemaphorNodeParam_;
public:
hipGraphExternalSemSignalNode(const hipExternalSemaphoreSignalNodeParams* pNodeParams)
: GraphNode(hipGraphNodeTypeExtSemaphoreSignal, "solid", "rectangle",
"EXTERNAL_SEMAPHORE_SIGNAL") {
externalSemaphorNodeParam_ = *pNodeParams;
}
hipGraphExternalSemSignalNode(const hipGraphExternalSemSignalNode& rhs)
: GraphNode(rhs) {
externalSemaphorNodeParam_ = rhs.externalSemaphorNodeParam_;
}
~hipGraphExternalSemSignalNode() {}
GraphNode* clone() const {
return new hipGraphExternalSemSignalNode(
static_cast<hipGraphExternalSemSignalNode const&>(*this));
}
hipError_t CreateCommand(hip::Stream* stream) {
hipError_t status = GraphNode::CreateCommand(stream);
if (status != hipSuccess) {
return status;
}
unsigned int numExtSems = externalSemaphorNodeParam_.numExtSems;
commands_.reserve(numExtSems);
for (unsigned int i = 0; i < numExtSems; i++) {
if (externalSemaphorNodeParam_.extSemArray[i] != nullptr) {
amd::ExternalSemaphoreCmd* command = new amd::ExternalSemaphoreCmd(*stream,
externalSemaphorNodeParam_.extSemArray[i],
externalSemaphorNodeParam_.paramsArray[i].params.fence.value,
amd::ExternalSemaphoreCmd::COMMAND_SIGNAL_EXTSEMAPHORE);
if (command == nullptr) {
return hipErrorOutOfMemory;
}
commands_.emplace_back(command);
} else {
return hipErrorInvalidValue;
}
}
return hipSuccess;
}
void GetParams(hipExternalSemaphoreSignalNodeParams* pNodeParams) const {
std::memcpy(pNodeParams, &externalSemaphorNodeParam_,
sizeof(hipExternalSemaphoreSignalNodeParams));
}
hipError_t SetParams(const hipExternalSemaphoreSignalNodeParams* pNodeParams) {
std::memcpy(&externalSemaphorNodeParam_, pNodeParams,
sizeof(hipExternalSemaphoreSignalNodeParams));
return hipSuccess;
}
};
class hipGraphExternalSemWaitNode : public GraphNode {
hipExternalSemaphoreWaitNodeParams externalSemaphorNodeParam_;
public:
hipGraphExternalSemWaitNode(const hipExternalSemaphoreWaitNodeParams* pNodeParams)
: GraphNode(hipGraphNodeTypeExtSemaphoreWait, "solid",
"rectangle", "EXTERNAL_SEMAPHORE_WAIT") {
externalSemaphorNodeParam_ = *pNodeParams;
}
hipGraphExternalSemWaitNode(const hipGraphExternalSemWaitNode& rhs) : GraphNode(rhs) {
externalSemaphorNodeParam_ = rhs.externalSemaphorNodeParam_;
}
~hipGraphExternalSemWaitNode() {}
GraphNode* clone() const {
return new hipGraphExternalSemWaitNode(static_cast<hipGraphExternalSemWaitNode const&>(*this));
}
hipError_t CreateCommand(hip::Stream* stream) {
hipError_t status = GraphNode::CreateCommand(stream);
if (status != hipSuccess) {
return status;
}
unsigned int numExtSems = externalSemaphorNodeParam_.numExtSems;
commands_.reserve(numExtSems);
for (unsigned int i = 0; i < numExtSems; i++) {
if (externalSemaphorNodeParam_.extSemArray[i] != nullptr) {
amd::ExternalSemaphoreCmd* command = new amd::ExternalSemaphoreCmd(*stream,
externalSemaphorNodeParam_.extSemArray[i],
externalSemaphorNodeParam_.paramsArray[i].params.fence.value,
amd::ExternalSemaphoreCmd::COMMAND_WAIT_EXTSEMAPHORE);
if (command == nullptr) {
return hipErrorOutOfMemory;
}
commands_.emplace_back(command);
} else {
return hipErrorInvalidValue;
}
}
return hipSuccess;
}
void GetParams(hipExternalSemaphoreWaitNodeParams* pNodeParams) const {
std::memcpy(pNodeParams, &externalSemaphorNodeParam_,
sizeof(hipExternalSemaphoreWaitNodeParams));
}
hipError_t SetParams(const hipExternalSemaphoreWaitNodeParams* pNodeParams) {
std::memcpy(&externalSemaphorNodeParam_, pNodeParams,
sizeof(hipExternalSemaphoreWaitNodeParams));
return hipSuccess;
}
};
} // namespace hip