-
Notifications
You must be signed in to change notification settings - Fork 138
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
[Refactor] Remove all ctx parameters in memory operators #5862
base: develop
Are you sure you want to change the base?
Conversation
It may be necessary to have a unified naming convention to distinguish whether this is a device or CPU resize_memory? |
In fact every type of operators have its own unique name defined by using keyword in memory_op.h, which clearly shows an operator's data type and device type. But no one uses that in fact. I used it in my new prs. These new functions are also available for this By using AbacusDevice_t you can clearly see which device this operator is operating, but this is merged yesterday so no one used it temporarily. |
Nice work! I'm currently struggling with including things like this in my code: Device* ctx = {};
base_device::DEVICE_CPU* cpu_ctx = {}; I was wondering what the hack exactly does this do? It seems that these pointers are no longer used after a total refactoring. |
No one uses the |
Exactly. I will soon add that suggested naming convention in the document later. But it seemed that this problem has no relationship with this pull request I think? Because the ctx parameter is completely useless as a parameter. Many codes even directly use a same "ctx" variable in every place where a ctx parameter is needed, no matter it is a gpu operator or cpu operator. I just removed it from parameter, not removing it from the template. |
After Abacus start using template to implement caculation on different devices, the ctx parameter in operators became fully useless. But it is never removed because of its heavy usage. This pull request removes the ctx parameters in all memory operators.
Hint: If this pr is accepted, other pull requests may need rerun to ensure they are correct.