已合并
feat: add stream allocation logs #4715
feat: add stream allocation logs #4715
已合并
sunsummercqc创建于 9月3日
共 3 个文件变更+14-0
@@ -13,6 +13,7 @@
13#include "common/checker.h"13#include "common/checker.h"
14#include "framework/common/debug/ge_log.h"14#include "framework/common/debug/ge_log.h"
15#include "framework/common/ge_inner_error_codes.h"15#include "framework/common/ge_inner_error_codes.h"
16+#include "acl/acl_rt.h"
16 17 
17namespace gert {18namespace gert {
18StreamAllocator::StreamAllocator(int32_t priority, uint32_t flags)19StreamAllocator::StreamAllocator(int32_t priority, uint32_t flags)
@@ -43,6 +44,10 @@ TypedContinuousVector<rtStream_t> *StreamAllocator::AcquireStreams(const size_t
43 GE_ASSERT_RT_OK(rtStreamCreateWithFlags(&stream, default_priority_, default_flags_));44 GE_ASSERT_RT_OK(rtStreamCreateWithFlags(&stream, default_priority_, default_flags_));
44 streams->MutableData()[i] = stream;45 streams->MutableData()[i] = stream;
45 GE_ASSERT_SUCCESS(streams->SetSize(i + 1U));46 GE_ASSERT_SUCCESS(streams->SetSize(i + 1U));
47+ 
48+ int32_t rt_stream_id = -1;
49+ (void)aclrtStreamGetId(stream, &rt_stream_id);
50+ GELOGI("Collect rt2 stream, get rts stream %p from logical stream %zu, rts_stream_id: %d", stream, i, rt_stream_id);
46 }51 }
47 return streams;52 return streams;
48}53}
@@ -154,6 +154,8 @@ std::unique_ptr<ModelV2Executor> ModelV2ExecutorBuilder::Build(const ExecutorOpt
154 154 
155 ge::ComputeGraphPtr root_graph = root_model_->GetRootGraph();155 ge::ComputeGraphPtr root_graph = root_model_->GetRootGraph();
156 GE_ASSERT_NOTNULL(root_graph);156 GE_ASSERT_NOTNULL(root_graph);
157+ GELOGI("Build RT2 executor for root compute graph[%s], model[%s].", root_graph->GetName().c_str(),
158+ root_model_->GetModelName().c_str());
157 (void)ge::AttrUtils::GetInt(root_graph, ge::DETERMINISTIC, executor->deterministic_);159 (void)ge::AttrUtils::GetInt(root_graph, ge::DETERMINISTIC, executor->deterministic_);
158 (void)ge::AttrUtils::GetInt(root_graph, ge::DETERMINISTIC_LEVEL, executor->deterministic_level_);160 (void)ge::AttrUtils::GetInt(root_graph, ge::DETERMINISTIC_LEVEL, executor->deterministic_level_);
159 executor->need_set_deterministic_config_ =161 executor->need_set_deterministic_config_ =
@@ -147,8 +147,15 @@ ge::graphStatus ModelV2Executor::OccupyStreamResource(const ModelExecuteArg &arg
147 GE_ASSERT_NOTNULL(streams, "Failed to prepare reusable streams, num %zu. Maybe streams not enough on device",147 GE_ASSERT_NOTNULL(streams, "Failed to prepare reusable streams, num %zu. Maybe streams not enough on device",
148 stream_num);148 stream_num);
149 GE_ASSERT_TRUE(streams->GetSize() > 0u);149 GE_ASSERT_TRUE(streams->GetSize() > 0u);
150+ const auto previous_stream = streams->GetData()[0U];
150 streams->MutableData()[0] = arg.stream;151 streams->MutableData()[0] = arg.stream;
151 152 
153+ if ((arg.stream != nullptr) && (previous_stream != arg.stream)) {
154+ int32_t rt_stream_id = -1;
155+ (void)aclrtStreamGetId(arg.stream, &rt_stream_id);
156+ GELOGI("Collect rt2 stream, get rts stream %p from logical stream 0, rts_stream_id: %d", arg.stream, rt_stream_id);
157+ }
158+ 
152 events = event_allocator->AcquireEvents(model_desc_->GetReusableEventNum());159 events = event_allocator->AcquireEvents(model_desc_->GetReusableEventNum());
153 GE_ASSERT_NOTNULL(events, "Failed to prepare reusable events, num %zu. Maybe events not enough on device",160 GE_ASSERT_NOTNULL(events, "Failed to prepare reusable events, num %zu. Maybe events not enough on device",
154 model_desc_->GetReusableEventNum());161 model_desc_->GetReusableEventNum());