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

[refactor] [CUDA] Add traced_records_ for KernelProfilerBase, refactoring KernelProfilerCUDA::sync() #2909

Merged
merged 4 commits into from
Sep 11, 2021

Conversation

yolo2themoon
Copy link
Contributor

@yolo2themoon yolo2themoon commented Sep 10, 2021

Related issue = #2902

Concisely describe the proposed feature

Taichi counts profiling records and stores the results in KernelProfileRecord directly (StatisticalResult).
But didn't allocate space to store raw data (TracedRecord).

Code in KernelProfilerCUDA::sync() is somewhat complicated

Describe the solution you'd like

Add a new structure, KernelProfileTracedRecord to store traced records.
Rename the old structure from KernelProfileRecord to KernelProfileStatisticalResult

Decouple the code in KernelProfilerCUDA::sync() into 5 parts:

  • sync
  • get&store traced kernel_elapsed_time ( new feature )
  • statistics on traced_records_
  • code for Timelines
  • clear temporary records

@yolo2themoon
Copy link
Contributor Author

/format

@yolo2themoon
Copy link
Contributor Author

FYI, most of the changes are in KernelProfilerCUDA, the rest are mostly name replacements.

Copy link
Member

@k-ye k-ye left a comment

Choose a reason for hiding this comment

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

LGTM!

struct KernelProfileRecord {
struct KernelProfileTracedRecord {
std::string name;
float kernel_elapsed_time_in_ms{0.0};
Copy link
Member

Choose a reason for hiding this comment

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

TODO: In the future we can use a more accurate type to denote time and duration, e.g. std::chrono::duration

taichi/backends/cuda/cuda_profiler.cpp Outdated Show resolved Hide resolved
taichi/program/kernel_profiler.h Outdated Show resolved Hide resolved
@yolo2themoon
Copy link
Contributor Author

/format

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