Repository navigation
Conversation
- Add cuModuleEnumerateFunctions and cuFuncGetName bindings (CUDA 11.6+) - Implement C++ demangling using __cxa_demangle in function.pyx - Add _enumerate_and_build_mapping to Module class - Update compiler.py to use enumeration on cache hit for both CUDA and HIP - HIP/ROCm: Raise NotImplementedError if enumeration not supported Co-authored-by: leofang <[email protected]>
- Test cache hit with name_expressions - Test C++ demangling and name matching with whitespace variations - Verify mapping is built from cached CUBIN via enumeration APIs - Skip on HIP/ROCm as it doesn't support function enumeration yet Co-authored-by: leofang <[email protected]>
…evert HIP changes - Replace __cxa_demangle with __cu_demangle from nv_decode.h and link libcufilt - Change name_expressions parameter from list to tuple throughout - Revert HIP enumeration changes, add TODO comment instead - Functions are available in cuda.bindings (CUDA 11.6+ standard APIs) Co-authored-by: leofang <[email protected]>
- Include name_expressions in cache hash key (sorted, comma-separated) - Explicitly unload module if enumeration fails to prevent CUBIN leak - Move libcufilt from libraries to static_libraries (it's a static lib) - Clarify comment: return mangled name on demangle failure for exact matching Co-authored-by: leofang <[email protected]>
- Change moduleEnumerateFunctions to cdef returning std::vector<Function> - Change funcGetName to cdef returning char* - Remove match_name_expression, normalize_name, and demangle_cxx_name functions - Simplify _enumerate_and_build_mapping to use identity mapping - Remove unused imports (re, libc.stdlib.free) Co-authored-by: leofang <[email protected]>
- Restore demangling code and name matching logic in function.pyx - Swap HIP check before mapping check in _enumerate_and_build_mapping - Change except * to except +* in moduleEnumerateFunctions - Add back re import and libc.stdlib.free import Co-authored-by: leofang <[email protected]>
- Add cdef declarations for moduleEnumerateFunctions and funcGetName in driver.pxd - Simplify _enumerate_and_build_mapping to build demangled->mangled mapping directly - Remove match_name_expression and normalize_name functions (no longer needed) - Remove re import (no longer used) Co-authored-by: leofang <[email protected]>
- Wrap nv_decode.h extern declaration with IF CUPY_HIP_VERSION == 0 - Guard demangle_cxx_name function body for CUDA vs HIP - On HIP, return mangled name as-is since libcufilt is not available Co-authored-by: leofang <[email protected]>
- Change demangle_cxx_name to take const char* instead of str - Avoid encode→decode round-trip by passing char* directly - Decode only once when building mapping - Remove TestNameExpressionsCaching test class (tests unreliable due to multiple caching levels) Co-authored-by: leofang <[email protected]>
- Change IF CUPY_HIP_VERSION == 0 to IF CUPY_CUDA_VERSION > 0 - Move cdef declarations outside try block to fix Cython compilation error - "cdef statement not allowed here" error resolved Co-authored-by: leofang <[email protected]>
- Change except +* to except + in moduleEnumerateFunctions (Cython syntax) - Add _enumerate_and_build_mapping declaration to function.pxd - Fixes compiler crash and missing method declaration errors Co-authored-by: leofang <[email protected]>
…ibcufilt API Co-authored-by: leofang <[email protected]>
…ibcufilt API Co-authored-by: leofang <[email protected]>
…location Co-authored-by: leofang <[email protected]>
… reuse decoded string Co-authored-by: leofang <[email protected]>
|
/test mini |
|
/test mini |
|
/test mini,linux |
- Use r""" raw string for the cufilt C code block (reduces backslash escaping) - Use Py_ssize_t for loop/count variables in _build_mangled_name_mapping - Refactor moduleEnumerateFunctions to take vector as output parameter (avoids except+ on vector return; uses except?-1 per project convention) - Drop except+ from moduleGetFunctionCount (default except* suffices) - Update .pxd declarations to match Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
/test mini |
|
This PR is ready for review. The Windows failure is already fixed in #9902. |
seberg
left a comment
There was a problem hiding this comment.
Generally, looks good, I am still a bit wondering if integrating it into the file isn't better.
However, this doesn't block us from doing that in the future if we get into problems and it should be a pretty big improvement!
I'll be curious if we see speed improvements in CI here on re-runs now (that would be awesome and also a decent test that it works).
Claude found some nitpicks that I agree with, though (to me, I wonder if the try/except should be on the callers around self._enumerate_and_build_mapping() but either way seems fine).
- Thread safety: use std::call_once for Windows cufilt DLL init (eliminates TOCTOU race on _cupy_cufilt_loaded flag) - Wide-char APIs: switch Windows path handling from ANSI to Wide (GetModuleFileNameW, LoadLibraryW, etc.) to handle paths beyond MAX_PATH; also check return value for truncation - Incomplete mapping guard: only accept the demangled mapping when all name_expressions were matched (len check); if incomplete, fall through to recompilation which produces proper errors Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
Close/re-open again, let's see if readthedocs recovers... |
|
/test mini |
seberg
left a comment
There was a problem hiding this comment.
Thanks, nice to use an output parameter for the function return there. Let's give this a shot (I am curious if it affects CI).
|
Test failure is irrelevant. /test force-skip |
|
The following tests were force-skipped:
|
Let's monitor the main branch. The per-PR CI runs don't seem to get faster much. |
…els-mangled-names Support caching CUBINs generated with `name_expressions`
Close #9667. Close #6159.
This helps reduce test time greatly. For example with
test_mdspan.py: