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

Add a new NVTX range for task GPU ownership #11596

Open
wants to merge 3 commits into
base: branch-24.12
Choose a base branch
from

Conversation

jihoonson
Copy link
Collaborator

If you have ever been curious about the semaphore-based GPU concurrency control mechanism, you may have wondered at some point exactly what tasks are holding the semaphore at a given point of time during query processing. This PR can help you in that case. This PR adds a new NVTX range that shows what task owns GPU in the nsys profile result. This feature is off by default (since I don't think it's always useful), and can be enabled by setting spark.rapids.sql.traceTaskGpuOwnership = true. The screenshot below shows an example nsys result with the new semaphore ranges. The orange boxes with Sem-${taskAttemptId} represent the ranges in which each spark task was holding the semaphore.

Screenshot 2024-10-11 at 4 09 11 PM

@jihoonson jihoonson changed the title Add a new nvtx range for task GPU ownership Add a new NVTX range for task GPU ownership Oct 11, 2024
@@ -258,6 +262,10 @@ private final class SemaphoreTaskInfo(val taskAttemptId: Long) extends Logging {
// We now own the semaphore so we need to wake up all of the other tasks that are
// waiting.
hasSemaphore = true
if (trackSemaphore) {
nvtxRange =
Some(new NvtxUniqueRange(s"Sem-${taskAttemptId}", NvtxColor.ORANGE))
Copy link
Collaborator

Choose a reason for hiding this comment

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

NvtxColor is a hex number in argb (alpha, red, green, blue). I think it would make this a lot more useable if task X hashed to a specific color, consistently. That way you can tell them apart while the task is alive. Bonus points to make it color match with the current Task ranges? That might make this even more useful.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This seems a really good idea. I will try as you suggested. Thanks!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually changed my mind, and want to try it later. It is a nice idea and I definitely want to try, but don't want to keep this PR open for unnecessarily long. Created #11645.

mythrocks
mythrocks previously approved these changes Oct 17, 2024
Copy link
Collaborator

@mythrocks mythrocks left a comment

Choose a reason for hiding this comment

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

This looks good to my eyes.

@sameerz sameerz added the task Work required that improves the product but is not user facing label Oct 22, 2024
@jihoonson
Copy link
Collaborator Author

build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
task Work required that improves the product but is not user facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants