Skip to content

Expose cuda.core.Kernel.attributes.num_arguments #568

Open
@leofang

Description

@leofang

This is a handy approach as suggested by @galv since the driver does not expose any queryable APIs for this purpose:

Hello pipul, there is not a direct API, but you can do this https://github.com/pytorch/pytorch/pull/137318/files#diff-d7302d133bb5e0890fc94de9aeea4d9d442555a3b40772c9db10edb5cf36a35cR424-R429

In other words:

for(size_t i = 0; cudaFuncGetParamInfo(func, i, &param_offset, &param_size) != CUDA_ERROR_INVALID_VALUE; i++) {}
// i now contains the total number of arguments to your kernel.

I'm sure you can translate that to python.

Originally posted by @galv in #543 (reply in thread)

Metadata

Metadata

Labels

P1Medium priority - Should docuda.coreEverything related to the cuda.core moduleenhancementAny code-related improvements

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions