-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
GH-36931: [C++] Add cumulative_mean function #36932
Conversation
|
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.
Thanks @js8544 !
// A kernel factory that forwards to CumulativeBinaryOp<Op, ...> for the given type. | ||
// Need to use a struct because template-using declarations cannot appear in | ||
// function scope. | ||
template <typename Op, typename OptionsType> | ||
struct MakeVectorCumulativeBinaryOpFunction { | ||
template <typename ArgType> | ||
using State = CumulativeBinaryOp<Op, ArgType>; | ||
|
||
static void Call(FunctionRegistry* registry, std::string func_name, FunctionDoc doc) { | ||
MakeVectorCumulativeStatefulFunction<State, OptionsType>( | ||
registry, std::move(func_name), std::move(doc)); | ||
} | ||
}; |
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.
@bkietz Can you think of a more straightforward way to do this?
+1 |
After merging your PR, Conbench analyzed the 6 benchmarking runs that have been run so far on merge-commit 6e6e6f0. There were no benchmark performance regressions. 🎉 The full Conbench report has more details. It also includes information about possible false positives for unstable benchmarks that are known to sometimes produce them. |
### Rationale for this change Add `cumulative_mean` function ### What changes are included in this PR? Implement `cumulative_mean` function. The current cumulative_* kernel generator can only be based on a simple binary arithmetic op and the state can only be a single value. I refactored it to using of a generic state such that it can handle complex operations such as `mean`, `median`, `var` etc. ### Are these changes tested? Yes ### Are there any user-facing changes? No * Closes: apache#36931 Lead-authored-by: Jin Shang <[email protected]> Co-authored-by: Antoine Pitrou <[email protected]> Signed-off-by: Antoine Pitrou <[email protected]>
Rationale for this change
Add
cumulative_mean
functionWhat changes are included in this PR?
Implement
cumulative_mean
function. The current cumulative_* kernel generator can only be based on a simple binary arithmetic op and the state can only be a single value. I refactored it to using of a generic state such that it can handle complex operations such asmean
,median
,var
etc.Are these changes tested?
Yes
Are there any user-facing changes?
No