Skip to content
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

[PROFILING] Add ability to profile a single function_profiling #9553

Merged
merged 3 commits into from
Jan 9, 2022

Conversation

tkonolige
Copy link
Contributor

Add a new function tvm.runtime.profiling.profile_function which collects performance metrics for a single function in an IRModule. For example, collecting performance counters using PAPIMetricCollector. This is helpful for optimizing kernels and schedules for a single operator.

Add a new function `tvm.runtime.profiling.profile_function` which
collects performance metrics for a single function in an IRModule. For
example, collecting performance counters using `PAPIMetricCollector`.
This is helpful for optimizing kernels and schedules for a single
operator.
Copy link
Contributor

@areusch areusch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

couple questions @tkonolige

Device dev{static_cast<DLDeviceType>(device_type), device_id};

// warmup
for (size_t i = 0; i < 10; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like this one should be configurable?

std::unordered_map<String, ObjectRef> results;
for (size_t i = 0; i < collectors.size(); i++) {
auto r = collectors[i]->Stop(collector_data[i]);
// We might want to do this in a separate loop to avoid unnecessary time
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we just do that now? seems better...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@tkonolige
Copy link
Contributor Author

@areusch Could you re-review?

@tkonolige
Copy link
Contributor Author

@areusch gentle ping

@masahi masahi merged commit 8c2360e into apache:main Jan 9, 2022
Raghav-Chakravarthy pushed a commit to Raghav-Chakravarthy/tvm that referenced this pull request Jan 28, 2022
…e#9553)

* [PROFILING] Add ability to profile a single function_profiling

Add a new function `tvm.runtime.profiling.profile_function` which
collects performance metrics for a single function in an IRModule. For
example, collecting performance counters using `PAPIMetricCollector`.
This is helpful for optimizing kernels and schedules for a single
operator.

* fix docs

* configurable number of warmup iterations. avoid allocating when stopping collectors
ylc pushed a commit to ylc/tvm that referenced this pull request Feb 16, 2022
…e#9553)

* [PROFILING] Add ability to profile a single function_profiling

Add a new function `tvm.runtime.profiling.profile_function` which
collects performance metrics for a single function in an IRModule. For
example, collecting performance counters using `PAPIMetricCollector`.
This is helpful for optimizing kernels and schedules for a single
operator.

* fix docs

* configurable number of warmup iterations. avoid allocating when stopping collectors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants