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

rename nvprof-connector to nvtx-connector, add 3 more hooks #139

Merged
merged 21 commits into from
Aug 24, 2023

Conversation

cwpearson
Copy link
Contributor

@cwpearson cwpearson commented Apr 18, 2022

Changes / enhancements to nvprof-connector

  1. rename nvprof-connector to nvtx-connector. nvprof is on its way out, and really this connector is to NVTX anyway.
  2. Add hooks for kokkosp_begin_fence, kokkosp_end_fence, and kokkosp_profile_event

@crtrott
Copy link
Member

crtrott commented May 9, 2022

Can you add the code to disable auto fencing by the tool. I think we don't actually want it here. Furthermore, the fence profiling hooks are actually also getting called for the auto-fences, so any tool which profiles fencing needs to deal with that or get tons of false stuff.

@cwpearson
Copy link
Contributor Author

@vlkale
Copy link
Contributor

vlkale commented Mar 8, 2023

@crtrott is this the way to disable fencing?

https://github.com/cwpearson/kokkos-tools/blob/ad8848843e6fed0c0c3d76a8689b648eba44f3aa/profiling/nvtx-connector/kp_nvtx_connector.cpp#L60-L62

If so, I think we're good :D

@cwpearson yes, I believe that is right from looking at this a few months ago.

@vlkale vlkale requested a review from fnrizzi March 8, 2023 04:57
Copy link
Contributor

@vlkale vlkale left a comment

Choose a reason for hiding this comment

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

I would suggest using 'anonymous' rather than the 'anon.' Abbreviation.

Copy link
Contributor

@vlkale vlkale left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for these changes. Sorry it was somehow not reviewed until now.

The fix to #147 (now in develop) may relate to or overlap with the discussion on the tools fence callback above.

I will need one other review before we can merge, and I have requested a reviewer.

@vlkale vlkale requested review from dalg24 and removed request for fnrizzi March 8, 2023 05:07
@vlkale vlkale requested review from crtrott and dalg24 and removed request for dalg24 and crtrott March 9, 2023 22:41
Copy link
Member

@dalg24 dalg24 left a comment

Choose a reason for hiding this comment

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

No PR against master. You must target the develop branch.

@vlkale
Copy link
Contributor

vlkale commented Mar 16, 2023

@dalg24 Thanks. I will work with @cwpearson to fix.

@cwpearson cwpearson changed the base branch from master to develop March 21, 2023 15:26
@cwpearson
Copy link
Contributor Author

@dalg24 I have retargeted to develop

@vlkale
Copy link
Contributor

vlkale commented Mar 21, 2023

@dalg24 I have retargeted to develop

@cwpearson Thanks!

@cwpearson
Copy link
Contributor Author

cwpearson commented Mar 21, 2023

Interesting, my local clang-format-8 is happy with profiling/nvtx-connector/kp_nvtx_connector.cpp I'm not sure how to resolve the format-check failure.

@cwpearson cwpearson changed the title rename nvproof-connector to nvtx-connector, add 3 more hooks rename nvprof-connector to nvtx-connector, add 3 more hooks Mar 21, 2023
@vlkale
Copy link
Contributor

vlkale commented Mar 21, 2023

Interesting, my local clang-format-8 is happy with profiling/nvtx-connector/kp_nvtx_connector.cpp I'm not sure how to resolve the format-check failure.

Strange. So, the clang-format-8 was added in the last few months, and it should work through the CI in the same way that clang-format-8 works from the LLVM distribution containing clang-format-8. Can you provide the exact version info of clang-format-8? (The Kokkos team has discussed changing the clang-format version in the Kokkos Tools CI from 8 to a higher one like 11, but that's a separate/orthogonal issue).

@dalg24 @crtrott Do you know if there is an easy resolution to the failing format check here given results of CI?

@cwpearson
Copy link
Contributor Author

cwpearson commented Mar 21, 2023

$ git log -s | head -n5
commit b3579f18cec82fe7b5dafcfff754823952e61457
Author: Carl Pearson <[email protected]>
Date:   Mon Apr 18 09:49:13 2022 -0700

    rename nvprof-connector to nvtx-connector, add hooks for kokkosp_begin_fence, kokkosp_end_fence, and kokkosp_profile_event
$ git status
On branch nvtx
Your branch is up to date with 'origin/nvtx'.

nothing to commit, working tree clean
$ clang-format-8 --version
clang-format version 8.0.1 (tags/RELEASE_801/final)
$ clang-format-8 -i profiling/nvtx-connector/kp_nvtx_connector.cpp
$ git status
On branch nvtx
Your branch is up to date with 'origin/nvtx'.

nothing to commit, working tree clean

@cwpearson
Copy link
Contributor Author

It would be great if the format check printed what it thought the diff should be! core and kernels do this

@vlkale
Copy link
Contributor

vlkale commented Mar 21, 2023 via email

dalg24
dalg24 previously requested changes Mar 21, 2023
Copy link
Member

@dalg24 dalg24 left a comment

Choose a reason for hiding this comment

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

When profiling fences, we probably don't want kokkos to fence each time time it calls a callbacks.

extern "C" void kokkosp_request_tool_settings(
const uint32_t, Kokkos_Tools_ToolSettings* settings) {
settings->requires_global_fencing = false;
}

We probably need a lever to toggle whether or not to enable fence profiling because this changes the behavior of the tool, either marking the full kernel execution or just the launch latency.

Comment on lines 131 to 149
if (nullptr == name) {
name = "anonymous. Kokkos fence";
}
Copy link
Member

Choose a reason for hiding this comment

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

As far as I know this will never occur.

@crtrott
Copy link
Member

crtrott commented Aug 10, 2023

@cwpearson can you review this


void kokkosp_request_tool_settings(const uint32_t,
Kokkos_Tools_ToolSettings* settings) {
settings->requires_global_fencing = false;
settings->requires_global_fencing = true;
Copy link
Member

Choose a reason for hiding this comment

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

without this kernel renaming doesn't work, and the regions all only measure kernel launch


#include "kp_core.hpp"

static int tool_globfences; // use an integer
Copy link
Member

Choose a reason for hiding this comment

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

Why is it an int and not a bool?

profiling/nvtx-connector/kp_nvtx_connector_domain.h Outdated Show resolved Hide resolved
@romintomasetti
Copy link
Contributor

Hi @dalg24 @crtrott !

Reading this PR, it urges us to add proper testing for Cuda, don't you think? 😉 (I mean, the nvtx-connector is compiled, but there is no guarantee that it actually works as intended 🦀)

static int tool_globfences; // use an integer

static int tool_globfences; // use an integer for other options
using namespace std;
Copy link
Member

Choose a reason for hiding this comment

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

Why? That's generally a bad idea.

@crtrott crtrott merged commit bfdfdae into kokkos:develop Aug 24, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants