Skip to content

Fix Python ctypes signatures#3305

Open
fallintoplace wants to merge 1 commit into
NVIDIA:mainfrom
fallintoplace:fix-python-ctypes-argtypes
Open

Fix Python ctypes signatures#3305
fallintoplace wants to merge 1 commit into
NVIDIA:mainfrom
fallintoplace:fix-python-ctypes-argtypes

Conversation

@fallintoplace

Copy link
Copy Markdown

Summary

This fixes Python ctypes signatures for generated host functions in the CUTLASS Python interface.

The fresh compile path was assigning func.argtype, which is just a normal Python attribute and does not configure ctypes argument marshaling. The cache load path also restored _get_params functions without setting argument types. This change installs argtypes in both paths.

For grouped GEMM host precompute, the third generated C++ argument is size_t workspace_bytes, so the Python signature now uses ctypes.c_size_t instead of ctypes.c_longlong.

Validation

  • PYTHONPATH=python python -m unittest test/python/cutlass/backend/test_ctypes_signature.py
  • PYTHONPATH=python python -m py_compile python/cutlass_cppgen/backend/compiler.py python/cutlass_cppgen/backend/gemm_operation.py test/python/cutlass/backend/test_ctypes_signature.py

@fallintoplace fallintoplace marked this pull request as ready for review June 6, 2026 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant