NVIDIA / NVIDIA/cutlass

[QST] if(runtime_value) (cute::copy or cute::gemm) Generates NaNs

Open
#2,163 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

? - Needs Triage inactive-30d inactive-90d question
Dominant language
C++
Stars
10.5k
Forks
2.1k
Avg merge
3d 11h
Merged PRs (30d)
7

Description

What is your question?

Hello! I encountered this weird case when debugging my kernel.
I have some cute::copy and cute::gemm which work perfectly like a charm.

Now that I've determined to introduce some conditional statements for these operations. I could have defined a template<bool Enable> my_kernel to make this Enable static.

However, I tried simply doing:

if(enable) { cute::copy(xx);  cute::gemm(xx);}

For which enable is a runtime variable that's passed into the kernel as a parameter.

All of a sudden my kernel started to generate nan values (even if I did pass enable as a true value).
When changing this to:

if(true) { cute::copy(xx); cute::gemm(xx);}

my kernel works again.

I'm generally wondering if you could help me understand what happens if I wrote something like this, and in general if this is not recommended.

Thank you so much!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The report names cute::copy, cute::gemm, and a kernel parameter named enable, but no source file or test. Start with a minimal kernel comparing if(enable) with if(true), run both with enable=true, and document the conditions that produce NaNs. Done means the runtime-conditional behavior has a reproducible explanation and expected outcome.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.