Skip to content

cuda - fix grad3d flat templates for gen#1992

Merged
jeremylt merged 2 commits into
mainfrom
jeremy/fix-flattened
Jul 17, 2026
Merged

cuda - fix grad3d flat templates for gen#1992
jeremylt merged 2 commits into
mainfrom
jeremy/fix-flattened

Conversation

@jeremylt

Copy link
Copy Markdown
Member

Purpose:

Fix my oops. That was totally copypasta

Closes: #1991

LLM/GenAI Disclosure:

None, pure human stupidity here

By submitting this PR, the author certifies to its contents as described by the Developer's Certificate of Origin.
Please follow the Contributing Guidelines for all PRs.

@jeremylt
jeremylt force-pushed the jeremy/fix-flattened branch from 81967d1 to 8bba9fb Compare July 17, 2026 08:03
Comment thread .github/workflows/release-notes.yml
@zatkins-dev

Copy link
Copy Markdown
Collaborator

Does HIP also need this fix?

@jeremylt

Copy link
Copy Markdown
Member Author

oddly no, I did that one correctly

@zatkins-dev

Copy link
Copy Markdown
Collaborator

huh, fair enough. Did you make sure it isn't still falling back? or should I check

@jeremylt

Copy link
Copy Markdown
Member Author

I didn't double check

@zatkins-dev

Copy link
Copy Markdown
Collaborator

Seems to compile okay now. I'm now getting:

CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES: max_threads_per_block 256 on block size (27,1,18), shared_size 8352, num_regs 250

@jeremylt

jeremylt commented Jul 17, 2026

Copy link
Copy Markdown
Member Author

Yea, I'm not surprised. Flattening should only work for really low order

@zatkins-dev

Copy link
Copy Markdown
Collaborator

Sounds good. Also, is there a reason we fall back straight to ref? In this case, fallback to shared would be faster

@jeremylt

Copy link
Copy Markdown
Member Author

Honestly, probably an oversight

@jeremylt

Copy link
Copy Markdown
Member Author

Oh, you know what I bet it is? Actually, should be using shared bases, just ref operator evaluation

@zatkins-dev

Copy link
Copy Markdown
Collaborator

Isn't that what the shared operator application does anyhow?

@jeremylt

Copy link
Copy Markdown
Member Author

Yea. There is no 'shared operator' so I directly fell back to the compatible backend that implements the target functionality so it was clear (to me) where that operator application/assembly logic actually came from

@zatkins-dev

Copy link
Copy Markdown
Collaborator

Gotcha. We should switch the fallback to shared then?

@jeremylt

Copy link
Copy Markdown
Member Author

I personally wouldn't because it is the operator implementation that is falling back and ref is what provides that fallback operator implementation, but I don't feel strongly

@zatkins-dev

Copy link
Copy Markdown
Collaborator

Hmm, will it still use the shared bases with the ref operator fallback?

@zatkins-dev

Copy link
Copy Markdown
Collaborator

yes it will

@zatkins-dev zatkins-dev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Okay, I think this is good! I'm going to have a follow up fixing block sizes for the non tensor gen, we can make it work for more cases

@jeremylt
jeremylt merged commit 454341a into main Jul 17, 2026
31 checks passed
@jeremylt
jeremylt deleted the jeremy/fix-flattened branch July 17, 2026 15:52
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.

NVRTC Compile error in GradTransposeTensor3dFlattened

2 participants