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
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

This PR has been labeled inactive-30d due to no recent activity in the past 30 days. Please close this PR if it is no longer required. Otherwise, please respond with a comment indicating any updates. This PR will be labeled inactive-90d if there is no activity in the next 60 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant