-
Notifications
You must be signed in to change notification settings - Fork 546
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
Unify template parameter dispatch for FIL inference and shared memory footprint estimation #4013
Conversation
…e_type>(predict_params, ...)
build fails with
|
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.
waiting for #4012 to rerun the CI
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.
Overall, this pull request is in a good shape, so nice work! The comments are mostly technical.
Specific points I'd like to highlight:
- What happens if
n_items
orleaf_algo
are negative? - Would it be possible to pass
predict_params
by value?
cpp/src/fil/common.cuh
Outdated
template <class KernelParams, class Func> | ||
void dispatch_on_n_items(Func func, predict_params& params) | ||
{ | ||
if (params.n_items == KernelParams::n_items) { |
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.
What happens if params.n_items == -1
?
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.
the assert gets triggered
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.
This is fine then.
cpp/src/fil/common.cuh
Outdated
template <class KernelParams, class Func> | ||
void dispatch_on_leaf_algo(Func func, predict_params& params) | ||
{ | ||
if (params.leaf_algo == KernelParams::leaf_algo) { |
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.
What happens if params.leaf_algo == -1
?
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.
the assert gets triggered
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.
This is fine then.
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.
Approved, provided that the comments are addressed.
cpp/src/fil/common.cuh
Outdated
} | ||
return func.run(params); // appeasing the compiler |
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.
Is there a better way of appeasing the compiler?
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 could remove else
s, since the branches return, and flip the if constexpr
condition. But I thought you prefer else
after return
?
Alternatively, return dispatch_on_n_items<KernelParams>(func, params)
might work.
Last, perhaps template <class KernelParams, class Func, class T = decltype(declval<Func>().run(params))>
might resolve both this and the signature decltype
question?
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.
Do we need T
to be in the template parameters? I guess yes if we want to use it in the return type, and no if we only need it in the function body.
In any case, even with T
in the template parameters, it looks better if return T()
or return T{}
works. Perhaps you could add a documentation comment as to why you're doing this.
Codecov Report
@@ Coverage Diff @@
## branch-21.12 #4013 +/- ##
===============================================
Coverage ? 86.06%
===============================================
Files ? 231
Lines ? 18691
Branches ? 0
===============================================
Hits ? 16087
Misses ? 2604
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
@gpucibot merge |
… footprint estimation (rapidsai#4013) Authors: - Levs Dolgovs (https://github.com/levsnv) Approvers: - Andy Adinets (https://github.com/canonizer) - Dante Gama Dessavre (https://github.com/dantegd) URL: rapidsai#4013
No description provided.