SWDEV-337331 - graph feature on Windows

Fixes for hipGraphInstantiate OutofMemory issue and
soft hang of hipStreamSynchronize.
Change-Id: Ic2bb97582c5978ef2e4eb3a1b124483aa412838e


[ROCm/clr commit: c06bfa6bef]
Этот коммит содержится в:
Ajay
2022-05-19 23:13:23 +00:00
коммит произвёл Ajay GunaShekar
родитель 3f588bf604
Коммит 65d3357dbc
2 изменённых файлов: 17 добавлений и 14 удалений
+11 -9
Просмотреть файл
@@ -689,7 +689,8 @@ hipError_t hipGraphExec::CreateQueues(size_t numQueues) {
cl_command_queue_properties properties =
(callbacks_table.is_enabled() || HIP_FORCE_QUEUE_PROFILING) ? CL_QUEUE_PROFILING_ENABLE : 0;
queue = new amd::HostQueue(*hip::getCurrentDevice()->asContext(),
*hip::getCurrentDevice()->devices()[0], properties);
*hip::getCurrentDevice()->devices()[0], properties,
amd::CommandQueue::RealTimeDisabled, amd::CommandQueue::Priority::Normal);
bool result = (queue != nullptr) ? queue->create() : false;
// Create a host queue
@@ -716,7 +717,8 @@ hipError_t hipGraphExec::Init() {
hipError_t FillCommands(std::vector<std::vector<Node>>& parallelLists,
std::unordered_map<Node, std::vector<Node>>& nodeWaitLists,
std::vector<Node>& levelOrder, amd::Command*& rootCommand,
std::vector<Node>& levelOrder,
std::vector<amd::Command*>& rootCommands,
amd::Command*& endCommand, amd::HostQueue* queue) {
hipError_t status;
for (auto& node : levelOrder) {
@@ -739,13 +741,14 @@ hipError_t FillCommands(std::vector<std::vector<Node>>& parallelLists,
first = false;
continue;
}
rootCommand = new amd::Marker(*queue, false, {});
amd::Command* rootCommand = new amd::Marker(*queue, false, {});
amd::Command::EventWaitList waitList;
waitList.push_back(rootCommand);
if (!singleList.empty()) {
auto commands = singleList[0]->GetCommands();
if (!commands.empty()) {
commands[0]->updateEventWaitList(waitList);
rootCommands.push_back(rootCommand);
}
}
}
@@ -794,17 +797,16 @@ hipError_t hipGraphExec::Run(hipStream_t stream) {
return hipErrorInvalidResourceHandle;
}
UpdateQueue(parallelLists_, queue, this);
amd::Command* rootCommand = nullptr;
std::vector<amd::Command*> rootCommands;
amd::Command* endCommand = nullptr;
status =
FillCommands(parallelLists_, nodeWaitLists_, levelOrder_, rootCommand, endCommand, queue);
FillCommands(parallelLists_, nodeWaitLists_, levelOrder_, rootCommands, endCommand, queue);
if (status != hipSuccess) {
return status;
}
if (rootCommand != nullptr) {
rootCommand->enqueue();
rootCommand->release();
for (auto& cmd : rootCommands) {
cmd->enqueue();
cmd->release();
}
for (auto& node : levelOrder_) {
node->EnqueueCommands(stream);
+6 -5
Просмотреть файл
@@ -37,7 +37,8 @@ typedef hipGraphNode* Node;
hipError_t ihipValidateKernelParams(const hipKernelNodeParams* pNodeParams);
hipError_t FillCommands(std::vector<std::vector<Node>>& parallelLists,
std::unordered_map<Node, std::vector<Node>>& nodeWaitLists,
std::vector<Node>& levelOrder, amd::Command*& rootCommand,
std::vector<Node>& levelOrder,
std::vector<amd::Command*>& rootCommands,
amd::Command*& endCommand, amd::HostQueue* queue);
void UpdateQueue(std::vector<std::vector<Node>>& parallelLists, amd::HostQueue*& queue,
hipGraphExec* ptr);
@@ -394,12 +395,12 @@ struct hipChildGraphNode : public hipGraphNode {
return status;
}
commands_.reserve(2);
amd::Command* rootCommand = nullptr;
std::vector<amd::Command*> rootCommands;
amd::Command* endCommand = nullptr;
status = FillCommands(parallelLists_, nodeWaitLists_, childGraphlevelOrder_, rootCommand,
status = FillCommands(parallelLists_, nodeWaitLists_, childGraphlevelOrder_, rootCommands,
endCommand, queue);
if (rootCommand != nullptr) {
commands_.push_back(rootCommand);
for (auto& cmd : rootCommands) {
commands_.push_back(cmd);
}
if (endCommand != nullptr) {
commands_.push_back(endCommand);