@@ -55,29 +55,25 @@ Status ApplyMatMulIntel(ComputeContext& context,
5555
5656 TensorShape output_shape = helper.OutputShape ();
5757
58- const auto & arch = context.AdapterInfo ().architecture ;
59- const bool is_xe_lpg = arch == std::string_view (" xe-lpg" );
60- const bool is_xe_3lpg = arch == std::string_view (" xe-3lpg" );
6158 // When B is a matrix (batch is 1), we fold batchA into the M dimension for better
6259 // performance (e.g., [2,3,5] → [1,6,5]).
63- // This is especially beneficial when M is small:
64- // workgroups containing invalid (out-of-bounds) threads make up a large proportion of all
65- // dispatched workgroups when M is small, so folding reduces that waste significantly.
66- // When M is large, the proportion of such wasteful workgroups is already small, so
67- // folding yields negligible gains and is skipped.
68- // Don't fold to workaround for Xe-LPG/Xe-3LPG when M is small and the proportion is relatively small .
60+ // Don't fold to workaround for Xe-LPG/Xe-3LPG when M is small and the proportion of workgroups
61+ // containing invalid (out-of-bounds) threads is relatively small .
6962 const int64_t M = output_shape[output_shape.NumDimensions () - 2 ];
7063 const int64_t m_mod_32 = M % 32 ;
71- if (batchA != 1 && batchB == 1 && M < 128 && (!(is_xe_lpg || is_xe_3lpg) || (m_mod_32 > 0 && m_mod_32 <= 24 ))) {
64+ if (batchA != 1 && batchB == 1 &&
65+ (!(context.AdapterInfo ().architecture == std::string_view (" xe-lpg" ) ||
66+ context.AdapterInfo ().architecture == std::string_view (" xe-3lpg" )) ||
67+ (m_mod_32 > 0 && m_mod_32 <= 24 ))) {
7268 // dimensions of A: [1,`batchA`, M, K]
7369 int64_t batchAndM = a_shape.SizeToDimension (a_shape.NumDimensions () - 1 );
74- TensorShapeVector dims_a = {1 , batchAndM, helper.K ()};
70+ TensorShapeVector dims_a = {batchAndM, helper.K ()};
7571 // dimensions of B: [1,K,N]
76- TensorShapeVector dims_b = {1 , helper.K (), helper.N ()};
72+ TensorShapeVector dims_b = {helper.K (), helper.N ()};
7773
7874 a_shape = TensorShape (dims_a);
7975 b_shape = TensorShape (dims_b);
80- output_shape = {1 , batchAndM, helper.N ()};
76+ output_shape = {batchAndM, helper.N ()};
8177 }
8278
8379 // helpful dimension variables
0 commit comments