composable_kernel
composable_kernel copied to clipboard
[CK_BUILDER] Fwd instance test improvements
Proposed changes
Cleaned-up test code for the forward convolution instance creation tests for the CK Builder. Addressed some leftover comments from PR #3138. Main changes
- Refactored tests such that they reflect better the builder pattern (cf. comments https://github.com/ROCm/composable_kernel/pull/3138#discussion_r2482778243 and https://github.com/ROCm/composable_kernel/pull/3138#discussion_r2482786428). This also reduced the amount of duplicated code.
- Moved tests into anonymous namespace (cf. comment https://github.com/ROCm/composable_kernel/pull/3138#discussion_r2482780409).
- The convolution factory had lot of
if-elseconstructs when CK Builder types were converted into CK library types. I had initially trouble in usingstatic_assertin thedefaultbranch ofswitchas thestatic_assertwas evaluated at compile time even for valid types. However, if we change thestatic_asserttothrow "<error message>", it will result in a compile-time error only if thedefaultbranch is actually hit. This assumes that the function isconsteval. Hence, changed all conversions in the convolution factory to useswitch, which is more intuitive (cf. comment https://github.com/ROCm/composable_kernel/pull/3138#discussion_r2482782459). Added alsousingstatements to remove repeated namespace usages.