-
Notifications
You must be signed in to change notification settings - Fork 54
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
avoid mixed usage of Array<T, N> and T[N] when passing to template function #1475
Conversation
!build --diff --diff-bench |
2d1225f
to
3adc823
Compare
!build --diff --diff-bench |
d4183d6
to
6fc67f9
Compare
2a8fabd
to
7905dde
Compare
!build --diff --diff-bench |
codediff in matmul cases are caused by |
csrc/codegen.cpp
Outdated
// array. This avoid the type mismatch in template functions when one of the | ||
// arguments is an aligned array (Array<T,N>) while the other is a regular | ||
// array T[N]. | ||
std::string genVarForTemplateFunction(Val* v) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be named something like maybeConvertAlignedArrayToRawArray
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I rename to genVariableNameConvertAlignedArray
to reflect its two functions: (1) call genVariableName
and (2) ConvertAlignedArrayToRawArray
Issue: #1470
In the generated code of the case posted in the issue page:
nvfuser_index_t T5[4]
is aliased asArray<float, 4> T9.
float T4[4]
is aliased asauto& T10 = T4
.Then T9 and T10 are used to call
welfordGroupOuter
and causes a compilation error due to type mismatch: T9 is a custom array type, while T10 is a native float array.Fix: always pass the regular array of registers to template function.