-
Notifications
You must be signed in to change notification settings - Fork 533
Add trace points in xrt classes #9734
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3948,6 +3948,7 @@ get_run_update(xrtRunHandle rhdl) | |
| static std::unique_ptr<xrt::run_impl> | ||
| alloc_run(const std::shared_ptr<xrt::kernel_impl>& khdl) | ||
| { | ||
| XRT_TRACE_POINT_SCOPE(xrt_run_alloc); | ||
| return khdl->has_mailbox() | ||
| ? std::make_unique<xrt::mailbox_impl>(khdl) | ||
| : std::make_unique<xrt::run_impl>(khdl); | ||
|
|
@@ -3959,6 +3960,7 @@ alloc_kernel(const std::shared_ptr<device_type>& dev, | |
| const std::string& name, | ||
| xrt::kernel::cu_access_mode mode) | ||
| { | ||
| XRT_TRACE_POINT_SCOPE(xrt_kernel_alloc); | ||
| auto amode = hwctx_access_mode(mode); // legacy access mode to hwctx qos | ||
| return std::make_shared<xrt::kernel_impl>(dev, xrt::hw_context{dev->get_xrt_device(), xclbin_id, amode}, xrt::module{}, name); | ||
| } | ||
|
|
@@ -3968,6 +3970,7 @@ alloc_kernel_from_ctx(const std::shared_ptr<device_type>& dev, | |
| const xrt::hw_context& hwctx, | ||
| const std::string& name) | ||
| { | ||
| XRT_TRACE_POINT_SCOPE(xrt_kernel_alloc_from_ctx); | ||
| // Delegating constructor with no module | ||
| return std::make_shared<xrt::kernel_impl>(dev, hwctx, xrt::module{}, name); | ||
| } | ||
|
|
@@ -3978,6 +3981,7 @@ alloc_kernel_from_module(const std::shared_ptr<device_type>& dev, | |
| const xrt::module& module, | ||
| const std::string& name) | ||
| { | ||
| XRT_TRACE_POINT_SCOPE(xrt_kernel_alloc_from_module); | ||
| return std::make_shared<xrt::kernel_impl>(dev, hwctx, module, name); | ||
| } | ||
|
|
||
|
|
@@ -3986,6 +3990,7 @@ alloc_kernel_from_name(const std::shared_ptr<device_type>& dev, | |
| const xrt::hw_context& hwctx, | ||
| const std::string& name) | ||
| { | ||
| XRT_TRACE_POINT_SCOPE(xrt_kernel_alloc_from_name); | ||
| return std::make_shared<xrt::kernel_impl>(dev, hwctx, name); | ||
| } | ||
|
|
||
|
|
@@ -4238,6 +4243,7 @@ void | |
| run:: | ||
| set_dtrace_control_file(const std::string& path) | ||
| { | ||
| XRT_TRACE_POINT_SCOPE(xrt_run_set_dtrace_control_file); | ||
| handle->set_dtrace_control_file(path); | ||
| } | ||
|
|
||
|
|
@@ -4324,20 +4330,23 @@ void | |
| run:: | ||
| set_arg_at_index(int index, const void* value, size_t bytes) | ||
| { | ||
| XRT_TRACE_POINT_SCOPE(xrt_run_set_arg_value); | ||
| handle->set_arg_at_index(index, value, bytes); | ||
| } | ||
|
|
||
| void | ||
| run:: | ||
| set_arg_at_index(int index, const xrt::bo& glb) | ||
| { | ||
| XRT_TRACE_POINT_SCOPE(xrt_run_set_arg_bo); | ||
| handle->set_arg_at_index(index, glb); | ||
| } | ||
|
|
||
| void | ||
| run:: | ||
| update_arg_at_index(int index, const void* value, size_t bytes) | ||
| { | ||
| XRT_TRACE_POINT_SCOPE(xrt_run_update_arg_value); | ||
| auto upd = get_run_update(handle.get()); | ||
| upd->update_arg_at_index(index, value, bytes); | ||
| } | ||
|
|
@@ -4346,6 +4355,7 @@ void | |
| run:: | ||
| update_arg_at_index(int index, const xrt::bo& glb) | ||
| { | ||
| XRT_TRACE_POINT_SCOPE(xrt_run_update_arg_bo); | ||
| auto upd = get_run_update(handle.get()); | ||
| upd->update_arg_at_index(index, glb); | ||
| } | ||
|
|
@@ -4512,9 +4522,16 @@ set_read_range(const xrt::kernel& kernel, uint32_t start, uint32_t size) | |
| ip->m_readrange = {start, size}; | ||
| } | ||
|
|
||
| static std::shared_ptr<runlist_impl> | ||
| alloc_runlist(xrt::hw_context hwctx) | ||
| { | ||
| XRT_TRACE_POINT_SCOPE(xrt_runlist_alloc); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What are we measuring? The constructor is trivial with 0 overhead. I understand why alloc_runlist was created, it was to ensure that you can measure the time it takes to create runlist_impl, which does all initialization in its initializer list. This makes sense if we truly want to measure the construction time, but do we? The function is kind of like an observer of hwctx, where the sink is really runlist_impl ctor. Shouldn't alloc_runlist take hwctx by const ref and leave the copying to the runlist_impl ctor? |
||
| return std::make_shared<runlist_impl>(std::move(hwctx)); | ||
| } | ||
|
|
||
| runlist:: | ||
| runlist(const xrt::hw_context& hwctx) | ||
| : detail::pimpl<runlist_impl>(std::make_shared<runlist_impl>(hwctx)) | ||
| : detail::pimpl<runlist_impl>(alloc_runlist(hwctx)) | ||
| {} | ||
|
|
||
| runlist:: | ||
|
|
@@ -4527,6 +4544,7 @@ void | |
| runlist:: | ||
| add(const xrt::run& run) | ||
| { | ||
| XRT_TRACE_POINT_SCOPE(xrt_runlist_add); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we measuring here and not in |
||
| if (!handle) | ||
| throw xrt_core::error("cannot add run object to uninitialized runlist"); | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it the dump() function you want to trace?