René's URL Explorer Experiment


Title: Non-externed Cython type definitions cause redefinition errors with transitive header includes · Issue #1663 · NVIDIA/cuda-python · GitHub

Open Graph Title: Non-externed Cython type definitions cause redefinition errors with transitive header includes · Issue #1663 · NVIDIA/cuda-python

X Title: Non-externed Cython type definitions cause redefinition errors with transitive header includes · Issue #1663 · NVIDIA/cuda-python

Description: Summary Several cuda.bindings Cython interfaces (cynvvm, cynvml, cynvjitlink, cynvfatbin) define types using Cython's quoted C name syntax without cdef extern from blocks. This causes C compilation errors when a user cimports these types...

Open Graph Description: Summary Several cuda.bindings Cython interfaces (cynvvm, cynvml, cynvjitlink, cynvfatbin) define types using Cython's quoted C name syntax without cdef extern from blocks. This causes C compilation...

X Description: Summary Several cuda.bindings Cython interfaces (cynvvm, cynvml, cynvjitlink, cynvfatbin) define types using Cython's quoted C name syntax without cdef extern from blocks. This causes C compila...

Opengraph URL: https://github.com/NVIDIA/cuda-python/issues/1663

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Non-externed Cython type definitions cause redefinition errors with transitive header includes","articleBody":"## Summary\n\nSeveral `cuda.bindings` Cython interfaces (`cynvvm`, `cynvml`, `cynvjitlink`, `cynvfatbin`) define types using Cython's quoted C name syntax without `cdef extern from` blocks. This causes C compilation errors when a user `cimport`s these types in a module that also transitively includes the corresponding C header.\n\n## Problem\n\nThe externed interfaces (`cynvrtc`, `cydriver`, `cyruntime`) use `cdef extern from \"header.h\"` blocks, so Cython emits a `#include` directive and the header's include guards prevent duplicate definitions.\n\nThe non-externed interfaces instead define types inline:\n\n```cython\n# cynvvm.pxd (current)\nctypedef enum nvvmResult \"nvvmResult\":\n    NVVM_SUCCESS \"NVVM_SUCCESS\" = 0\n    NVVM_ERROR_OUT_OF_MEMORY \"NVVM_ERROR_OUT_OF_MEMORY\" = 1\n    ...\n```\n\nWhen Cython compiles a `.pyx` that `cimport`s these types, it generates its own enum/typedef definitions in the C output. If any `cdef extern from` block in the same module (directly or via its `.pxd`) includes a header that transitively includes `nvvm.h`, the C compiler sees duplicate enum constant definitions and fails.\n\n## Minimal Reproducer\n\n**`nvvm.h`** (or the real one from the CUDA Toolkit):\n```c\n#ifndef NVVM_H\n#define NVVM_H\n\ntypedef enum {\n    NVVM_SUCCESS = 0,\n    NVVM_ERROR_OUT_OF_MEMORY = 1,\n    NVVM_ERROR_PROGRAM_CREATION_FAILURE = 2,\n    NVVM_ERROR_INVALID_INPUT = 4,\n    NVVM_ERROR_INVALID_PROGRAM = 5,\n} nvvmResult;\n\ntypedef void *nvvmProgram;\n\n#endif\n```\n\n**`example.h`** — a user header that happens to transitively include `nvvm.h`:\n```c\n#ifndef EXAMPLE_H\n#define EXAMPLE_H\n\n#include \"nvvm.h\"\n\nint test_func(int a);\n\n#endif\n```\n\n**`example.pxd`** — declares the user's C function:\n```cython\ncdef extern from \"example.h\":\n    int test_func(int a)\n```\n\n**`example.pyx`** — cimports the nvvm types from cuda.bindings:\n```cython\nfrom cuda.bindings.cynvvm cimport nvvmResult\n\ndef call_test(int x):\n    return test_func(x)\n```\n\n### Build Output\n\n```\nexample.c:1541:3: error: redeclaration of enumerator 'NVVM_SUCCESS'\n 1541 |   NVVM_SUCCESS = 0,\n      |   ^~~~~~~~~~~~\nIn file included from example.h:4,\n                 from example.c:1138:\nnvvm.h:5:5: note: previous definition of 'NVVM_SUCCESS' with type 'enum \u003canonymous>'\n    5 |     NVVM_SUCCESS = 0,\n      |     ^~~~~~~~~~~~\nexample.c:1542:3: error: redeclaration of enumerator 'NVVM_ERROR_OUT_OF_MEMORY'\n...\nexample.c:1547:25: error: conflicting types for 'nvvmResult'; have 'enum nvvmResult'\n```\n\nThe generated C file first emits `#include \"example.h\"` (which transitively includes `nvvm.h`), then later emits Cython's own `enum nvvmResult { NVVM_SUCCESS = 0, ... }` from the `cimport`. The duplicate enum constants are a hard C compilation error.\n\n## Impact\n\nAny downstream Cython project that wants to:\n1. Use types from `cynvvm`, `cynvml`, `cynvjitlink`, or `cynvfatbin` via `cimport`, **and**\n2. Has any `cdef extern from` that transitively includes the corresponding C header\n\n...will fail to compile. The user doesn't need to redeclare any types themselves — the mere transitive include is sufficient.\n\nThis does **not** affect the externed interfaces (`cynvrtc`, `cydriver`, `cyruntime`) since they use `cdef extern from`, which emits `#include` directives that are deduplicated by include guards.\n\n## Affected Interfaces\n\n| Interface | Style | Affected |\n|-----------|-------|----------|\n| `cynvvm.pxd` | Non-externed (quoted names) | Yes |\n| `cynvml.pxd` | Non-externed (quoted names) | Yes |\n| `cynvjitlink.pxd` | Non-externed (quoted names) | Yes |\n| `cynvfatbin.pxd` | Non-externed (quoted names) | Yes |\n| `cynvrtc.pxd` | `cdef extern from \"nvrtc.h\"` | No |\n| `cydriver.pxd` | `cdef extern from \"cuda.h\"` | No |\n| `cyruntime.pxd` | `cdef extern from \"driver_types.h\"` | No |\n\n## Suggested Fix\n\nSwitch the non-externed interfaces to use `cdef extern from` blocks, consistent with `cynvrtc.pxd`, `cydriver.pxd`, and `cyruntime.pxd`. This causes Cython to emit `#include` directives instead of generating its own type definitions, allowing include guards to deduplicate.\n\n**Edit:** On further analysis, this is **not** believed to be an ABI break. The `.pxd` file is purely a compile-time artifact — it is not referenced at runtime by already-compiled extensions. Since the quoted C names already produce the exact same C type identifiers and enum constant values as the header, the generated machine code is identical regardless of declaration style. Already-compiled downstream extensions would continue to work without recompilation against an updated `cuda.bindings` that makes this change.\n","author":{"url":"https://github.com/kkraus14","@type":"Person","name":"kkraus14"},"datePublished":"2026-02-19T22:57:24Z","url":"https://github.com/NVIDIA/cuda-python/issues/1663"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:dca676d1-d918-b25b-121a-de3c22058a0a
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9178:39CFE8:6B153C:8C76AB:6AF83D22
html-safe-nonce1b22d9b39ba00b659af5234b082158872eb5a39979af8fb3cfccd3a194403343
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MTc4OjM5Q0ZFODo2QjE1M0M6OEM3NkFCOjZBRjgzRDIyIiwidmlzaXRvcl9pZCI6IjgzNjQ3OTIwNjg4MzU5MTcwOTAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac9ae3f2a91120c303adc1c8274127cc6118a8daa5993989c86e21aca47dc2d176
hovercard-subject-tagissue:3965570566
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/NVIDIA/cuda-python/1663/issue_layout
twitter:imagehttps://opengraph.githubassets.com/b70c08dc5087f8b7409df7da669538dd576af6a974eb65852511c7557cf1b136/NVIDIA/cuda-python/issues/1663
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/b70c08dc5087f8b7409df7da669538dd576af6a974eb65852511c7557cf1b136/NVIDIA/cuda-python/issues/1663
og:image:altSummary Several cuda.bindings Cython interfaces (cynvvm, cynvml, cynvjitlink, cynvfatbin) define types using Cython's quoted C name syntax without cdef extern from blocks. This causes C compilation...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamekkraus14
hostnamegithub.com
expected-hostnamegithub.com
None5713ecd83001b2f55c3509fb7a292bf7d66d0f167c7ae87a9f7eaec5a52bf8db
turbo-cache-controlno-preview
go-importgithub.com/NVIDIA/cuda-python git https://github.com/NVIDIA/cuda-python.git
octolytics-dimension-user_id1728152
octolytics-dimension-user_loginNVIDIA
octolytics-dimension-repository_id381173759
octolytics-dimension-repository_nwoNVIDIA/cuda-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id381173759
octolytics-dimension-repository_network_root_nwoNVIDIA/cuda-python
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release653be32ff5c755082a4db662491bfbbcfc9112c1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/NVIDIA/cuda-python/issues/1663#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNVIDIA%2Fcuda-python%2Fissues%2F1663
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNVIDIA%2Fcuda-python%2Fissues%2F1663
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=NVIDIA%2Fcuda-python
Reloadhttps://github.com/NVIDIA/cuda-python/issues/1663
Reloadhttps://github.com/NVIDIA/cuda-python/issues/1663
Reloadhttps://github.com/NVIDIA/cuda-python/issues/1663
NVIDIAhttps://github.com/NVIDIA
cuda-pythonhttps://github.com/NVIDIA/cuda-python
Codehttps://github.com/NVIDIA/cuda-python
Issues219 (219)https://github.com/NVIDIA/cuda-python/issues
Pull requests92 (92)https://github.com/NVIDIA/cuda-python/pulls
Discussionshttps://github.com/NVIDIA/cuda-python/discussions
Actionshttps://github.com/NVIDIA/cuda-python/actions
Projectshttps://github.com/NVIDIA/cuda-python/projects
Wikihttps://github.com/NVIDIA/cuda-python/wiki
Security and qualityhttps://github.com/NVIDIA/cuda-python/security
Insightshttps://github.com/NVIDIA/cuda-python/pulse
https://github.com/NVIDIA/cuda-python
New issuehttps://github.com/login?return_to=https://github.com/NVIDIA/cuda-python/issues/1663
New issuehttps://github.com/login?return_to=https://github.com/NVIDIA/cuda-python/issues/1663
Non-externed Cython type definitions cause redefinition errors with transitive header includeshttps://github.com/NVIDIA/cuda-python/issues/1663#top
https://github.com/mdboom
https://github.com/leofang
cuda.bindingsEverything related to the cuda.bindings modulehttps://github.com/NVIDIA/cuda-python/issues?q=state%3Aopen%20label%3A%22cuda.bindings%22
https://github.com/kkraus14
kkraus14https://github.com/kkraus14
on Feb 19, 2026https://github.com/NVIDIA/cuda-python/issues/1663#issue-3965570566
kkraus14https://github.com/kkraus14
bugSomething isn't workinghttps://github.com/NVIDIA/cuda-python/issues?q=state%3Aopen%20label%3A%22bug%22
cuda.bindingsEverything related to the cuda.bindings modulehttps://github.com/NVIDIA/cuda-python/issues?q=state%3Aopen%20label%3A%22cuda.bindings%22
on Feb 19, 2026https://github.com/NVIDIA/cuda-python/issues/1663#event-22931727222
leofanghttps://github.com/leofang
triageNeeds the team's attentionhttps://github.com/NVIDIA/cuda-python/issues?q=state%3Aopen%20label%3A%22triage%22
bugSomething isn't workinghttps://github.com/NVIDIA/cuda-python/issues?q=state%3Aopen%20label%3A%22bug%22
on Feb 19, 2026https://github.com/NVIDIA/cuda-python/issues/1663#event-22932020940
leofanghttps://github.com/leofang
on Feb 19, 2026https://github.com/NVIDIA/cuda-python/issues/1663#event-22932021528
leofanghttps://github.com/leofang
cuda.bindings backloghttps://github.com/NVIDIA/cuda-python/milestone/22
on Feb 19, 2026https://github.com/NVIDIA/cuda-python/issues/1663#event-22932023891
https://github.com/mdboom
mdboomhttps://github.com/mdboom
on Feb 20, 2026https://github.com/NVIDIA/cuda-python/issues/1663#issuecomment-3935568015
https://github.com/kkraus14
kkraus14https://github.com/kkraus14
on Feb 20, 2026https://github.com/NVIDIA/cuda-python/issues/1663#issuecomment-3936005376
https://github.com/mdboom
mdboomhttps://github.com/mdboom
on Feb 20, 2026https://github.com/NVIDIA/cuda-python/issues/1663#issuecomment-3936846051
https://github.com/leofang
leofanghttps://github.com/leofang
on Feb 20, 2026https://github.com/NVIDIA/cuda-python/issues/1663#issuecomment-3937236051
https://github.com/leofang
leofanghttps://github.com/leofang
on Feb 20, 2026https://github.com/NVIDIA/cuda-python/issues/1663#issuecomment-3937237861
rparolinhttps://github.com/rparolin
cuda.bindings backloghttps://github.com/NVIDIA/cuda-python/milestone/22
on Apr 2, 2026https://github.com/NVIDIA/cuda-python/issues/1663#event-24162194594
rparolinhttps://github.com/rparolin
bugSomething isn't workinghttps://github.com/NVIDIA/cuda-python/issues?q=state%3Aopen%20label%3A%22bug%22
on May 21, 2026https://github.com/NVIDIA/cuda-python/issues/1663#event-25787812717
https://github.com/mdboom
mdboomhttps://github.com/mdboom
on Jun 26, 2026https://github.com/NVIDIA/cuda-python/issues/1663#issuecomment-4813145171
@kkraus14https://github.com/kkraus14
leofanghttps://github.com/leofang
bugSomething isn't workinghttps://github.com/NVIDIA/cuda-python/issues?q=state%3Aopen%20label%3A%22bug%22
on Jun 26, 2026https://github.com/NVIDIA/cuda-python/issues/1663#event-27262999801
mdboomhttps://github.com/mdboom
on Jun 29, 2026https://github.com/NVIDIA/cuda-python/issues/1663#event-27343423874
rparolinhttps://github.com/rparolin
triageNeeds the team's attentionhttps://github.com/NVIDIA/cuda-python/issues?q=state%3Aopen%20label%3A%22triage%22
on Sep 24, 2026https://github.com/NVIDIA/cuda-python/issues/1663#event-31729422136
Sign up for freehttps://github.com/signup?return_to=https://github.com/NVIDIA/cuda-python/issues/1663
Sign in to commenthttps://github.com/login?return_to=https://github.com/NVIDIA/cuda-python/issues/1663
leofanghttps://github.com/leofang
mdboomhttps://github.com/mdboom
cuda.bindingsEverything related to the cuda.bindings modulehttps://github.com/NVIDIA/cuda-python/issues?q=state%3Aopen%20label%3A%22cuda.bindings%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.