add type-conversion to AccDataType and then to CDataType to exactly mimic GPU's behavior

This commit is contained in:
Kevin Abraham
2025-09-12 15:35:24 +00:00
committed by Kevin Abraham
parent 7ed033a1b2
commit 81953c81d6

View File

@@ -105,12 +105,15 @@ struct ReferenceBatchedGemm : public device::BaseOperator
{
for(int batchIdx = 0;batchIdx < arg.k_batch_;batchIdx++)
{
v_c = ck::type_convert<CDataType>(ck::type_convert<AccDataType>(v_c) + ck::type_convert<AccDataType>(partialSums[batchIdx]));
// mimic the way fp operations would be done on GPU for k-batching
v_c = ck::type_convert<AccDataType>(ck::type_convert<CDataType>(
ck::type_convert<AccDataType>(v_c) +
ck::type_convert<AccDataType>(partialSums[batchIdx])));
}
}
else
{
v_c = partialSums[0];
v_c = ck::type_convert<AccDataType>(partialSums[0]);
}
arg.c_g_m_n_(g, m, n) = ck::type_convert<CDataType>(v_c);