From 294e14b6f834c96c102328fe2debe6648a736331 Mon Sep 17 00:00:00 2001 From: kiefer Date: Tue, 16 Dec 2025 14:32:07 +0000 Subject: [PATCH] Limit the explicit cast added in threadwise_tensor_slice_transfer_v7r3 to only be used for f8, just in case it hurts performance. --- .../threadwise_tensor_slice_transfer_v7r3.hpp | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/include/ck/tensor_operation/gpu/thread/threadwise_tensor_slice_transfer_v7r3.hpp b/include/ck/tensor_operation/gpu/thread/threadwise_tensor_slice_transfer_v7r3.hpp index f8b08d6c6e..60734d3493 100644 --- a/include/ck/tensor_operation/gpu/thread/threadwise_tensor_slice_transfer_v7r3.hpp +++ b/include/ck/tensor_operation/gpu/thread/threadwise_tensor_slice_transfer_v7r3.hpp @@ -286,9 +286,25 @@ struct ThreadwiseTensorSliceTransfer_v7r3 static_for<0, nDst, 1>{}([&](auto i) { using elm_vector_t = typename remove_cvref_t::type; - elm_vectors(i).template AsType()(I0) = - oob_val ? elm_vector_t{elm_vectors(i).template AsType()[I0]} - : elm_vector_t{0}; + using scalar_t = std::remove_cvref_t< + decltype(elm_vectors(i).template AsType()[I0])>; + + // This is a bit ugly but necessary to be able to compile f8 instances for grouped + // convolution forward. For some reason for that specific type there is an ambiguity + // in the type resolution for the ternary expression. I added an explicit cast to + // disambiguate and only use it for f8 just in case it affects performance. + if constexpr(std::is_same_v) + { + elm_vectors(i).template AsType()(I0) = + oob_val ? elm_vector_t{elm_vectors(i).template AsType()[I0]} + : elm_vector_t{0}; + } + else + { + elm_vectors(i).template AsType()(I0) = + oob_val ? elm_vectors(i).template AsType()[I0] + : elm_vector_t{0}; + } }); elm_vectors_tuple_(thread_scratch_id)(iAccess) = elm_vectors;