@@ -349,7 +349,7 @@ struct GraphNode : public hipGraphNodeDOTAttribute {
349
349
}
350
350
virtual hipError_t GetNumParallelStreams (size_t &num) { return hipSuccess; }
351
351
// / Enqueue commands part of the node
352
- virtual void EnqueueCommands (hipStream_t stream) {
352
+ virtual void EnqueueCommands (hip::Stream* stream) {
353
353
// If the node is disabled it becomes empty node. To maintain ordering just enqueue marker.
354
354
// Node can be enabled/disabled only for kernel, memcpy and memset nodes.
355
355
if (!isEnabled_ &&
@@ -359,8 +359,7 @@ struct GraphNode : public hipGraphNodeDOTAttribute {
359
359
if (!commands_.empty ()) {
360
360
waitList = commands_[0 ]->eventWaitList ();
361
361
}
362
- hip::Stream* hip_stream = hip::getStream (stream);
363
- amd::Command* command = new amd::Marker (*hip_stream, !kMarkerDisableFlush , waitList);
362
+ amd::Command* command = new amd::Marker (*stream, !kMarkerDisableFlush , waitList);
364
363
command->enqueue ();
365
364
command->release ();
366
365
return ;
@@ -811,10 +810,10 @@ struct ChildGraphNode : public GraphNode {
811
810
bool TopologicalOrder (std::vector<Node>& TopoOrder) override {
812
811
return childGraph_->TopologicalOrder (TopoOrder);
813
812
}
814
- void EnqueueCommands (hipStream_t stream) override {
813
+ void EnqueueCommands (hip::Stream* stream) override {
815
814
if (graphCaptureStatus_) {
816
815
hipError_t status =
817
- EnqueueGraphWithSingleList (childGraphNodeOrder_, reinterpret_cast <hip::Stream*>( stream) );
816
+ EnqueueGraphWithSingleList (childGraphNodeOrder_, stream);
818
817
} else {
819
818
// enqueue child graph start command
820
819
if (startCommand_ != nullptr ) {
@@ -869,16 +868,15 @@ class GraphKernelNode : public GraphNode {
869
868
870
869
public:
871
870
bool HasHiddenHeap () const { return hasHiddenHeap_; }
872
- void EnqueueCommands (hipStream_t stream) override {
871
+ void EnqueueCommands (hip::Stream* stream) override {
873
872
// If the node is disabled it becomes empty node. To maintain ordering just enqueue marker.
874
873
// Node can be enabled/disabled only for kernel, memcpy and memset nodes.
875
874
if (!isEnabled_) {
876
875
amd::Command::EventWaitList waitList;
877
876
if (!commands_.empty ()) {
878
877
waitList = commands_[0 ]->eventWaitList ();
879
878
}
880
- hip::Stream* hip_stream = hip::getStream (stream);
881
- amd::Command* command = new amd::Marker (*hip_stream, !kMarkerDisableFlush , waitList);
879
+ amd::Command* command = new amd::Marker (*stream, !kMarkerDisableFlush , waitList);
882
880
command->enqueue ();
883
881
command->release ();
884
882
return ;
@@ -892,6 +890,7 @@ class GraphKernelNode : public GraphNode {
892
890
command->release ();
893
891
}
894
892
}
893
+
895
894
void PrintAttributes (std::ostream& out, hipGraphDebugDotFlags flag) override {
896
895
out << " [" ;
897
896
out << " style" ;
@@ -1316,12 +1315,12 @@ class GraphMemcpyNode : public GraphNode {
1316
1315
return status;
1317
1316
}
1318
1317
1319
- virtual void EnqueueCommands (hipStream_t stream) override {
1318
+ virtual void EnqueueCommands (hip::Stream* stream) override {
1320
1319
if ( (copyParams_.kind == hipMemcpyHostToHost || copyParams_.kind == hipMemcpyDefault) &&
1321
1320
isEnabled_ && IsHtoHMemcpy (copyParams_.dstPtr .ptr , copyParams_.srcPtr .ptr )) {
1322
1321
ihipHtoHMemcpy (copyParams_.dstPtr .ptr , copyParams_.srcPtr .ptr ,
1323
1322
copyParams_.extent .width * copyParams_.extent .height *
1324
- copyParams_.extent .depth , *hip::getStream ( stream) );
1323
+ copyParams_.extent .depth , *stream);
1325
1324
return ;
1326
1325
}
1327
1326
GraphNode::EnqueueCommands (stream);
@@ -1470,7 +1469,7 @@ class GraphMemcpyNode1D : public GraphMemcpyNode {
1470
1469
return status;
1471
1470
}
1472
1471
1473
- virtual void EnqueueCommands (hipStream_t stream) override {
1472
+ virtual void EnqueueCommands (hip::Stream* stream) override {
1474
1473
bool isH2H = false ;
1475
1474
if ((kind_ == hipMemcpyHostToHost || kind_ == hipMemcpyDefault) && IsHtoHMemcpy (dst_, src_)) {
1476
1475
isH2H = true ;
@@ -1483,22 +1482,21 @@ class GraphMemcpyNode1D : public GraphMemcpyNode {
1483
1482
if (isEnabled_) {
1484
1483
// HtoH
1485
1484
if (isH2H) {
1486
- ihipHtoHMemcpy (dst_, src_, count_, *hip::getStream ( stream) );
1485
+ ihipHtoHMemcpy (dst_, src_, count_, *stream);
1487
1486
return ;
1488
1487
}
1489
1488
amd::Command* command = commands_[0 ];
1490
1489
amd::HostQueue* cmdQueue = command->queue ();
1491
- hip::Stream* hip_stream = hip::getStream (stream);
1492
1490
1493
- if (cmdQueue == hip_stream ) {
1491
+ if (cmdQueue == stream ) {
1494
1492
command->enqueue ();
1495
1493
command->release ();
1496
1494
return ;
1497
1495
}
1498
1496
1499
1497
amd::Command::EventWaitList waitList;
1500
1498
amd::Command* depdentMarker = nullptr ;
1501
- amd::Command* cmd = hip_stream ->getLastQueuedCommand (true );
1499
+ amd::Command* cmd = stream ->getLastQueuedCommand (true );
1502
1500
if (cmd != nullptr ) {
1503
1501
waitList.push_back (cmd);
1504
1502
amd::Command* depdentMarker = new amd::Marker (*cmdQueue, true , waitList);
@@ -1515,7 +1513,7 @@ class GraphMemcpyNode1D : public GraphMemcpyNode {
1515
1513
if (cmd != nullptr ) {
1516
1514
waitList.clear ();
1517
1515
waitList.push_back (cmd);
1518
- amd::Command* depdentMarker = new amd::Marker (*hip_stream , true , waitList);
1516
+ amd::Command* depdentMarker = new amd::Marker (*stream , true , waitList);
1519
1517
if (depdentMarker != nullptr ) {
1520
1518
depdentMarker->enqueue (); // Make sure future commands of queue synced with command
1521
1519
depdentMarker->release ();
@@ -1524,8 +1522,7 @@ class GraphMemcpyNode1D : public GraphMemcpyNode {
1524
1522
}
1525
1523
} else {
1526
1524
amd::Command::EventWaitList waitList;
1527
- hip::Stream* hip_stream = hip::getStream (stream);
1528
- amd::Command* command = new amd::Marker (*hip_stream, !kMarkerDisableFlush , waitList);
1525
+ amd::Command* command = new amd::Marker (*stream, !kMarkerDisableFlush , waitList);
1529
1526
command->enqueue ();
1530
1527
command->release ();
1531
1528
}
@@ -2005,11 +2002,12 @@ class GraphEventRecordNode : public GraphNode {
2005
2002
return status;
2006
2003
}
2007
2004
2008
- void EnqueueCommands (hipStream_t stream) override {
2005
+ void EnqueueCommands (hip::Stream* stream) override {
2009
2006
if (!commands_.empty ()) {
2010
2007
hip::Event* e = reinterpret_cast <hip::Event*>(event_);
2011
2008
// command release during enqueueRecordCommand
2012
- hipError_t status = e->enqueueRecordCommand (stream, commands_[0 ], true );
2009
+ hipError_t status = e->enqueueRecordCommand (
2010
+ reinterpret_cast <hipStream_t>(stream), commands_[0 ], true );
2013
2011
if (status != hipSuccess) {
2014
2012
ClPrint (amd::LOG_ERROR, amd::LOG_CODE,
2015
2013
" [hipGraph] Enqueue event record command failed for node %p - status %d" , this ,
@@ -2058,10 +2056,11 @@ class GraphEventWaitNode : public GraphNode {
2058
2056
return status;
2059
2057
}
2060
2058
2061
- void EnqueueCommands (hipStream_t stream) override {
2059
+ void EnqueueCommands (hip::Stream* stream) override {
2062
2060
if (!commands_.empty ()) {
2063
2061
hip::Event* e = reinterpret_cast <hip::Event*>(event_);
2064
- hipError_t status = e->enqueueStreamWaitCommand (stream, commands_[0 ]);
2062
+ hipError_t status =
2063
+ e->enqueueStreamWaitCommand (reinterpret_cast <hipStream_t>(stream), commands_[0 ]);
2065
2064
if (status != hipSuccess) {
2066
2065
ClPrint (amd::LOG_ERROR, amd::LOG_CODE,
2067
2066
" [hipGraph] Enqueue stream wait command failed for node %p - status %d" , this ,
@@ -2119,7 +2118,7 @@ class GraphHostNode : public GraphNode {
2119
2118
NodeParams->fn (NodeParams->userData );
2120
2119
}
2121
2120
2122
- void EnqueueCommands (hipStream_t stream) override {
2121
+ void EnqueueCommands (hip::Stream* stream) override {
2123
2122
if (!commands_.empty ()) {
2124
2123
if (!commands_[0 ]->setCallback (CL_COMPLETE, GraphHostNode::Callback, &NodeParams_)) {
2125
2124
ClPrint (amd::LOG_ERROR, amd::LOG_CODE, " [hipGraph] Failed during setCallback" );
@@ -2443,7 +2442,7 @@ class GraphDrvMemcpyNode : public GraphNode {
2443
2442
return status;
2444
2443
}
2445
2444
2446
- void EnqueueCommands (hipStream_t stream) override {
2445
+ void EnqueueCommands (hip::Stream* stream) override {
2447
2446
bool isHtoH = false ;
2448
2447
if (copyParams_.srcMemoryType == hipMemoryTypeHost &&
2449
2448
copyParams_.dstMemoryType == hipMemoryTypeHost &&
@@ -2453,7 +2452,7 @@ class GraphDrvMemcpyNode : public GraphNode {
2453
2452
if (isEnabled_ && isHtoH) {
2454
2453
ihipHtoHMemcpy (copyParams_.dstHost , copyParams_.srcHost ,
2455
2454
copyParams_.WidthInBytes * copyParams_.Height *
2456
- copyParams_.Depth , *hip::getStream ( stream) );
2455
+ copyParams_.Depth , *stream);
2457
2456
return ;
2458
2457
}
2459
2458
GraphNode::EnqueueCommands (stream);
0 commit comments