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

Lock-free Inference #4290

Closed
glarb opened this issue May 14, 2021 · 3 comments
Closed

Lock-free Inference #4290

glarb opened this issue May 14, 2021 · 3 comments

Comments

@glarb
Copy link

glarb commented May 14, 2021

Summary

Hi, I didn't see this enhancement request on the 2302 page. We need lock-free, single-row predict for fastest parallel inference with the same booster. Can't the FastConfig object be enhanced to hold all storage required for inference? Then we can pass-in thread-specific FastConfig objects for parallel inference, and no mutex would be required. Let us tell you whether FastConfig should use a mutex (e.g. default true for backward compatibility).

Motivation

FastConfig was a step in the right direction (thank you), but the required sharing of one FastConfig across threads still requires a mutex and has contention slowness. Please consider supporting lock-free inference if we pass-in thread-specific FastConfig handles, or some other API for lock-free single-row predict.

Description

(see above)

References

Similar capability in xgboost:
https://xgboost.readthedocs.io/en/latest/python/python_api.html#xgboost.Booster.inplace_predict

@StrikerRUS
Copy link
Collaborator

Linking #3675 and #3751.

I believe @JoanFM @AlbertoEAF comments will be valuable here

@AlbertoEAF
Copy link
Contributor

I'm all up for that, the thing is it will require some rewriting of the predictors as currently all the "shared" data is stored inside the predictor. Also, I believe the "non-fast" single-prediction methods should not be dropped from the API for they are simpler to use. The difficulty is that the non-fast versions assume all "shared" data is handled by the predictors, so this will require some work.

Anyway, if someone is willing to do the work I'd say it's definitely a nice improvement to the "fast" methods ;)

@StrikerRUS
Copy link
Collaborator

Closed in favor of being in #2302. We decided to keep all feature requests in one place.

Welcome to contribute this feature! Please re-open this issue (or post a comment if you are not a topic starter) if you are actively working on implementing this feature.

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

No branches or pull requests

4 participants