Move repetitive code into a dedicated header
Based on https://github.com/ROCm/MIOpen/pull/2737#discussion_r1486010993 discussion. The project contains lots of copy-pasted functions like integer division with ceil rounding or various power of 2 checks, it would be nice to move that code into dedicated header and reuse it everywhere. Ideally it should be generalized and templated.
- [ ]
uint32_t Ceil(uint32_t val, uint32_t div) - [ ]
uint32_t RoundUpNearestPower2Positive(uint32_t v) - [ ]
uint32_t RoundUpToMultiple(uint32_t val, uint32_t factor) - [ ]
bool isPow2(uint32_t val)(questionable, it's not a widely used function) - [ ] anything else?
There might be a use case for uin64_t versions as well. Also it would be good if we can improve naming if it's possible.
It's probably a good place for all those functions. https://github.com/ROCm/MIOpen/blob/develop/src/include/miopen/mlo_internal.hpp
Closing since MIOpen is being migrated to ROCm/rocm-libraries. Please re-open there if you believe this is still an issue.