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

How to find the "Kernel Launch" time in trace view #900

Open
zxdclyz opened this issue Aug 19, 2024 · 0 comments
Open

How to find the "Kernel Launch" time in trace view #900

zxdclyz opened this issue Aug 19, 2024 · 0 comments

Comments

@zxdclyz
Copy link

zxdclyz commented Aug 19, 2024

I am trying to optimize my GPU training performance. In the overview page, I got "42.1% of the total step time sampled is spent on 'Kernel Launch'". I tried the methods mentioned in the #8 , but they did not improve my situation.

Now I want to further analyze this issue. How can I locate the kernel launch time in the trace view, or how is the kernel launch time calculated here?

I found the following part in TensorFlow's source code, and I think this is the kernel launch time, but I am not sure how to find them in the trace view

EventType ClassifyCpuEvent(absl::string_view event_name, bool has_device,
                           bool has_correlation_id) {
  tsl::profiler::TfOp tf_op = tsl::profiler::ParseTfOpFullname(event_name);
  if (tsl::profiler::IsInfeedEnqueueOp(tf_op) ||
      tsl::profiler::IsMemcpyHToDOp(tf_op)) {
    return HOST_TO_DEVICE;
  } else if (tsl::profiler::IsMemcpyHToHOp(tf_op)) {
    return HOST_TO_HOST;
  } else if (has_device && (has_correlation_id ||
                            absl::StartsWithIgnoreCase(
                                event_name, "ExecutorState::Process"))) {
    // TODO(b/150420972): Separate runtime overhead from actual compute for
    // CPU-only.
    return HOST_PREPARE; // !!!kernel launch!!!
  } else if (absl::StartsWithIgnoreCase(event_name, "IteratorGetNext")) {
    return HOST_WAIT_INPUT;
  } else {
    return HOST_COMPUTE;
  }
}
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

No branches or pull requests

1 participant