Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple pointer types and automatic generation of function overloads #740

Open
HGuillemet opened this issue Jan 28, 2024 · 1 comment
Open
Labels

Comments

@HGuillemet
Copy link
Contributor

If we have in C++:

void f(T t);

and:

new Info("T").pointerTypes("T1", "T2");

we generate:

void f(T1 t);
void f(T2 t);

If the function takes 2 arguments:

void f(T t, U u);

with:

new Info("T").pointerTypes("T1", "T2");
new Info("U").pointerTypes("U1", "U2");

we now generate:

void f(T1 t, U1 u);
void f(T2 t, U2 u);

Is this intentional ?
Shouldn't we generate all combinations ?

void f(T1 t, U1 u);
void f(T2 t, U1 u);
void f(T1 t, U2 u);
void f(T2 t, U2 u);

For instance in Pytorch, we have function einsum that takes as std::string and a ArrayRef.
We used to have 2 java methods, one taking BytePointer and ArrayRef and another String and ArrayRef.
But since I added Vector to pointer types for c10::ArrayRef, we now have a java method taking BytePointer and ArrayRef and another taking String and Vector. The overload taking String and ArrayRef is lost, which could break some user code.


@saudet
Copy link
Member

saudet commented Jan 29, 2024

If you want to generate more combinations, do something like this:

new Info("T").pointerTypes("T1", "T2", "T1", "T2");
new Info("U").pointerTypes("U1", "U2", "U2", "U1");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants