Commit a93ea03
cuda.core: import graph submodule after extension modules to avoid circular load
Importing cuda.core.graph from the top of cuda/core/__init__.py triggers a
load of cuda.core.graph._graph_builder, which cimports cuda.core._stream and
other extensions. While cuda.core itself is still initializing, those
circular loads leave the graph submodules partially initialized when
`from ._graph_builder import *` runs in cuda/core/graph/__init__.py, and
Graph, GraphBuilder, GraphCompleteOptions, and GraphDebugPrintOptions
silently fail to surface on cuda.core.graph.
Defer `import cuda.core.graph` until after every cuda.core._* extension has
been loaded so the inner `from ._graph_builder import *` finds a fully
initialized module. The standalone `import` form (rather than
`from cuda.core import graph`) keeps it from being collapsed back into the
checkpoint/system/utils block by ruff's import sorter; an `# isort: split`
marker pins the placement.
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent cebc75b commit a93ea03
1 file changed
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
0 commit comments