mirror of
https://github.com/deepseek-ai/DeepGEMM.git
synced 2026-11-05 00:47:26 +00:00
[PR #361] fix: index CUDA sources/headers when generating .pyi stubs #391
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
deepseek-ai/DeepGEMM#391
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/deepseek-ai/DeepGEMM/pull/361
Author: @Osamaali313
Created: 6/14/2026
Status: 🔄 Open
Base:
main← Head:fix/pyi-index-cuda-sources📝 Commits (1)
108820bfix: index CUDA sources/headers when generating .pyi stubs📊 Changes
1 file changed (+6 additions, -2 deletions)
View changed files
📝
scripts/generate_pyi.py(+6 -2)📄 Description
Problem
scripts/generate_pyi.pybuilds the type stubs (stubs/_C.pyi) consumed at build time bysetup.py(generate_pyi_file(name='_C', root='./csrc', ...)). It locates each bound function's C++ signature by scanning source files, but the extension allowlists omit CUDA sources/headers:So any
m.def-bound function whose C++ definition/declaration lives in a.cuor.cuhis not found, and its stub falls back to a genericdef name(*args, **kwargs) -> Any: ...(the code even logsWarning: C++ function "<name>" not found in any .cpp file).This is also internally inconsistent:
build_cpp_function_indexalready classifies.cuhas a header in itsis_headercheck —— but never reads
.cuhfiles, so that branch is unreachable.Fix
Add
.cuand.cuhto both allowlists.Validation
Ran the generator's parser over
./csrcbefore and after:.cufile,csrc/indexing/main.cu, registers no bindings, so output is byte-identical today..hppwhose C++ function is declared in a sibling.cuh:my_kernelnot indexed →Warning: ... not found in any .cpp file→ generic*argsstubtorch::Tensor my_kernel(torch::Tensor x)(typed stub).cu-defined binding →int cu_fn(int a, int b)The change is forward-looking: as more kernels/bindings move into
.cu/.cuh, their public stubs stay typed instead of silently degrading toAny.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.