|
|
|
@@ -3353,6 +3353,9 @@ static inline void helper_mv_reduce_and_write(
|
|
|
|
|
|
|
|
|
|
constant short FC_mul_mv_nsg [[function_constant(FC_MUL_MV + 0)]];
|
|
|
|
|
constant short FC_mul_mv_nxpsg [[function_constant(FC_MUL_MV + 1)]];
|
|
|
|
|
constant short FC_mul_mv_ne12 [[function_constant(FC_MUL_MV + 2)]];
|
|
|
|
|
constant short FC_mul_mv_r2 [[function_constant(FC_MUL_MV + 3)]];
|
|
|
|
|
constant short FC_mul_mv_r3 [[function_constant(FC_MUL_MV + 4)]];
|
|
|
|
|
|
|
|
|
|
template<typename block_q_type, short NR0, typename args_t>
|
|
|
|
|
void mul_vec_q_n_f32_impl(
|
|
|
|
@@ -3376,10 +3379,10 @@ void mul_vec_q_n_f32_impl(
|
|
|
|
|
const int r1 = tgpig.y;
|
|
|
|
|
const int im = tgpig.z;
|
|
|
|
|
|
|
|
|
|
const uint i12 = im%args.ne12;
|
|
|
|
|
const uint i13 = im/args.ne12;
|
|
|
|
|
const uint i12 = im%FC_mul_mv_ne12;
|
|
|
|
|
const uint i13 = im/FC_mul_mv_ne12;
|
|
|
|
|
|
|
|
|
|
//const uint64_t offset0 = r0*args.nb01 + (i12/args.r2)*args.nb02 + (i13/args.r3)*args.nb03;
|
|
|
|
|
//const uint64_t offset0 = r0*args.nb01 + (i12/FC_mul_mv_r2)*args.nb02 + (i13/FC_mul_mv_r3)*args.nb03;
|
|
|
|
|
const uint64_t offset1 = r1*args.nb11 + (i12 )*args.nb12 + (i13 )*args.nb13;
|
|
|
|
|
|
|
|
|
|
//device const block_q_type * x = (device const block_q_type *) (src0 + offset0);
|
|
|
|
@@ -3388,7 +3391,7 @@ void mul_vec_q_n_f32_impl(
|
|
|
|
|
// pointers to src0 rows
|
|
|
|
|
device const block_q_type * ax[NR0];
|
|
|
|
|
FOR_UNROLL (int row = 0; row < NR0; ++row) {
|
|
|
|
|
const uint64_t offset0 = (r0 + row)*args.nb01 + (i12/args.r2)*args.nb02 + (i13/args.r3)*args.nb03;
|
|
|
|
|
const uint64_t offset0 = (r0 + row)*args.nb01 + (i12/FC_mul_mv_r2)*args.nb02 + (i13/FC_mul_mv_r3)*args.nb03;
|
|
|
|
|
|
|
|
|
|
ax[row] = (device const block_q_type *) ((device char *) src0 + offset0);
|
|
|
|
|
}
|
|
|
|
@@ -3462,8 +3465,8 @@ void kernel_mul_mv_q1_0_f32_impl(
|
|
|
|
|
|
|
|
|
|
const int first_row = (r0 * NSG + sgitg) * nr0;
|
|
|
|
|
|
|
|
|
|
const uint i12 = im%args.ne12;
|
|
|
|
|
const uint i13 = im/args.ne12;
|
|
|
|
|
const uint i12 = im%FC_mul_mv_ne12;
|
|
|
|
|
const uint i13 = im/FC_mul_mv_ne12;
|
|
|
|
|
|
|
|
|
|
const uint64_t offset1 = r1*args.nb11 + (i12)*args.nb12 + (i13)*args.nb13;
|
|
|
|
|
|
|
|
|
@@ -3471,7 +3474,7 @@ void kernel_mul_mv_q1_0_f32_impl(
|
|
|
|
|
|
|
|
|
|
device const block_q1_0 * ax[nr0];
|
|
|
|
|
for (int row = 0; row < nr0; ++row) {
|
|
|
|
|
const uint64_t offset0 = (first_row + row)*args.nb01 + (i12/args.r2)*args.nb02 + (i13/args.r3)*args.nb03;
|
|
|
|
|
const uint64_t offset0 = (first_row + row)*args.nb01 + (i12/FC_mul_mv_r2)*args.nb02 + (i13/FC_mul_mv_r3)*args.nb03;
|
|
|
|
|
ax[row] = (device const block_q1_0 *) ((device char *) src0 + offset0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -3590,10 +3593,10 @@ void kernel_mul_mv_q8_0_f32_impl(
|
|
|
|
|
const int r1 = tgpig.y;
|
|
|
|
|
const int im = tgpig.z;
|
|
|
|
|
|
|
|
|
|
const uint i12 = im%args.ne12;
|
|
|
|
|
const uint i13 = im/args.ne12;
|
|
|
|
|
const uint i12 = im%FC_mul_mv_ne12;
|
|
|
|
|
const uint i13 = im/FC_mul_mv_ne12;
|
|
|
|
|
|
|
|
|
|
//const uint64_t offset0 = r0*args.nb01 + (i12/args.r2)*args.nb02 + (i13/args.r3)*args.nb03;
|
|
|
|
|
//const uint64_t offset0 = r0*args.nb01 + (i12/FC_mul_mv_r2)*args.nb02 + (i13/FC_mul_mv_r3)*args.nb03;
|
|
|
|
|
const uint64_t offset1 = r1*args.nb11 + (i12 )*args.nb12 + (i13 )*args.nb13;
|
|
|
|
|
|
|
|
|
|
//device const block_q8_0 * x = (device const block_q8_0 *) (src0 + offset0);
|
|
|
|
@@ -3602,7 +3605,7 @@ void kernel_mul_mv_q8_0_f32_impl(
|
|
|
|
|
// pointers to src0 rows
|
|
|
|
|
device const block_q8_0 * ax[NR0];
|
|
|
|
|
FOR_UNROLL (short row = 0; row < NR0; ++row) {
|
|
|
|
|
const uint64_t offset0 = (r0 + row)*args.nb01 + (i12/args.r2)*args.nb02 + (i13/args.r3)*args.nb03;
|
|
|
|
|
const uint64_t offset0 = (r0 + row)*args.nb01 + (i12/FC_mul_mv_r2)*args.nb02 + (i13/FC_mul_mv_r3)*args.nb03;
|
|
|
|
|
|
|
|
|
|
ax[row] = (device const block_q8_0 *) ((device char *) src0 + offset0);
|
|
|
|
|
}
|
|
|
|
@@ -3682,10 +3685,10 @@ void kernel_mul_mv_ext_q4_f32_impl(
|
|
|
|
|
const int i11 = tgpig.y*r1ptg;
|
|
|
|
|
const int i1m = tgpig.z;
|
|
|
|
|
|
|
|
|
|
const int i12 = i1m%args.ne12;
|
|
|
|
|
const int i13 = i1m/args.ne12;
|
|
|
|
|
const int i12 = i1m%FC_mul_mv_ne12;
|
|
|
|
|
const int i13 = i1m/FC_mul_mv_ne12;
|
|
|
|
|
|
|
|
|
|
const uint64_t offset0 = i01*args.nb01 + (i12/args.r2)*args.nb02 + (i13/args.r3)*args.nb03;
|
|
|
|
|
const uint64_t offset0 = i01*args.nb01 + (i12/FC_mul_mv_r2)*args.nb02 + (i13/FC_mul_mv_r3)*args.nb03;
|
|
|
|
|
const uint64_t offset1 = i11*args.nb11 + (i12 )*args.nb12 + (i13 )*args.nb13;
|
|
|
|
|
|
|
|
|
|
device const q_t * xq = (i01 < args.ne01) ? (device const q_t *) (src0 + offset0) + tx/chpb : (device const q_t *) src0;
|
|
|
|
@@ -3785,10 +3788,10 @@ void kernel_mul_mv_ext_q4x4_f32_impl(
|
|
|
|
|
const int i11 = tgpig.y*r1ptg;
|
|
|
|
|
const int i1m = tgpig.z;
|
|
|
|
|
|
|
|
|
|
const int i12 = i1m%args.ne12;
|
|
|
|
|
const int i13 = i1m/args.ne12;
|
|
|
|
|
const int i12 = i1m%FC_mul_mv_ne12;
|
|
|
|
|
const int i13 = i1m/FC_mul_mv_ne12;
|
|
|
|
|
|
|
|
|
|
const uint64_t offset0 = i01*args.nb01 + (i12/args.r2)*args.nb02 + (i13/args.r3)*args.nb03;
|
|
|
|
|
const uint64_t offset0 = i01*args.nb01 + (i12/FC_mul_mv_r2)*args.nb02 + (i13/FC_mul_mv_r3)*args.nb03;
|
|
|
|
|
const uint64_t offset1 = i11*args.nb11 + (i12 )*args.nb12 + (i13 )*args.nb13;
|
|
|
|
|
|
|
|
|
|
device const q_t * xq = (i01 < args.ne01) ? (device const q_t *) (src0 + offset0) + tx/chpb : (device const q_t *) src0;
|
|
|
|
@@ -4000,10 +4003,10 @@ void kernel_mul_mv_t_t_impl(
|
|
|
|
|
const int r1 = tgpig.y;
|
|
|
|
|
const int im = tgpig.z;
|
|
|
|
|
|
|
|
|
|
const uint i12 = im%args.ne12;
|
|
|
|
|
const uint i13 = im/args.ne12;
|
|
|
|
|
const uint i12 = im%FC_mul_mv_ne12;
|
|
|
|
|
const uint i13 = im/FC_mul_mv_ne12;
|
|
|
|
|
|
|
|
|
|
//const uint64_t offset0 = r0*args.nb01 + (i12/args.r2)*args.nb02 + (i13/args.r3)*args.nb03;
|
|
|
|
|
//const uint64_t offset0 = r0*args.nb01 + (i12/FC_mul_mv_r2)*args.nb02 + (i13/FC_mul_mv_r3)*args.nb03;
|
|
|
|
|
const uint64_t offset1 = r1*args.nb11 + (i12 )*args.nb12 + (i13 )*args.nb13;
|
|
|
|
|
|
|
|
|
|
//device const T0 * x = (device const T0 *) (src0 + offset0);
|
|
|
|
@@ -4012,7 +4015,7 @@ void kernel_mul_mv_t_t_impl(
|
|
|
|
|
// pointers to src0 rows
|
|
|
|
|
device const T0 * ax [NR0];
|
|
|
|
|
FOR_UNROLL (short row = 0; row < NR0; ++row) {
|
|
|
|
|
const uint64_t offset0 = (r0 + row)*args.nb01 + (i12/args.r2)*args.nb02 + (i13/args.r3)*args.nb03;
|
|
|
|
|
const uint64_t offset0 = (r0 + row)*args.nb01 + (i12/FC_mul_mv_r2)*args.nb02 + (i13/FC_mul_mv_r3)*args.nb03;
|
|
|
|
|
|
|
|
|
|
ax[row] = (device const T0 *) ((device char *) src0 + offset0);
|
|
|
|
|
}
|
|
|
|
@@ -4122,10 +4125,10 @@ void kernel_mul_mv_t_t_4_impl(
|
|
|
|
|
const int r1 = tgpig.y;
|
|
|
|
|
const int im = tgpig.z;
|
|
|
|
|
|
|
|
|
|
const uint i12 = im%args.ne12;
|
|
|
|
|
const uint i13 = im/args.ne12;
|
|
|
|
|
const uint i12 = im%FC_mul_mv_ne12;
|
|
|
|
|
const uint i13 = im/FC_mul_mv_ne12;
|
|
|
|
|
|
|
|
|
|
//const uint64_t offset0 = r0*args.nb01 + (i12/args.r2)*args.nb02 + (i13/args.r3)*args.nb03;
|
|
|
|
|
//const uint64_t offset0 = r0*args.nb01 + (i12/FC_mul_mv_r2)*args.nb02 + (i13/FC_mul_mv_r3)*args.nb03;
|
|
|
|
|
const uint64_t offset1 = r1*args.nb11 + (i12 )*args.nb12 + (i13 )*args.nb13;
|
|
|
|
|
|
|
|
|
|
device const T1 * y = (device const T1 *) (src1 + offset1);
|
|
|
|
@@ -4135,7 +4138,7 @@ void kernel_mul_mv_t_t_4_impl(
|
|
|
|
|
device const T0 * ax [NR0];
|
|
|
|
|
device const T04 * ax4[NR0];
|
|
|
|
|
FOR_UNROLL (short row = 0; row < NR0; ++row) {
|
|
|
|
|
const uint64_t offset0 = (r0 + row)*args.nb01 + (i12/args.r2)*args.nb02 + (i13/args.r3)*args.nb03;
|
|
|
|
|
const uint64_t offset0 = (r0 + row)*args.nb01 + (i12/FC_mul_mv_r2)*args.nb02 + (i13/FC_mul_mv_r3)*args.nb03;
|
|
|
|
|
|
|
|
|
|
ax [row] = (device const T0 *) ((device char *) src0 + offset0);
|
|
|
|
|
ax4[row] = (device const T04 *) ((device char *) src0 + offset0);
|
|
|
|
@@ -4239,10 +4242,10 @@ void kernel_mul_mv_t_t_short_impl(
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const uint i12 = im%args.ne12;
|
|
|
|
|
const uint i13 = im/args.ne12;
|
|
|
|
|
const uint i12 = im%FC_mul_mv_ne12;
|
|
|
|
|
const uint i13 = im/FC_mul_mv_ne12;
|
|
|
|
|
|
|
|
|
|
const uint64_t offset0 = r0*args.nb01 + (i12/args.r2)*args.nb02 + (i13/args.r3)*args.nb03;
|
|
|
|
|
const uint64_t offset0 = r0*args.nb01 + (i12/FC_mul_mv_r2)*args.nb02 + (i13/FC_mul_mv_r3)*args.nb03;
|
|
|
|
|
|
|
|
|
|
device const T0 * x = (device const T0 *) (src0 + offset0);
|
|
|
|
|
|
|
|
|
@@ -7462,10 +7465,10 @@ void kernel_mul_mv_q2_K_f32_impl(
|
|
|
|
|
|
|
|
|
|
const int first_row = (r0 * NSG + sgitg) * nr0;
|
|
|
|
|
|
|
|
|
|
const uint i12 = im%args.ne12;
|
|
|
|
|
const uint i13 = im/args.ne12;
|
|
|
|
|
const uint i12 = im%FC_mul_mv_ne12;
|
|
|
|
|
const uint i13 = im/FC_mul_mv_ne12;
|
|
|
|
|
|
|
|
|
|
const uint64_t offset0 = first_row*args.nb01 + (i12/args.r2)*args.nb02 + (i13/args.r3)*args.nb03;
|
|
|
|
|
const uint64_t offset0 = first_row*args.nb01 + (i12/FC_mul_mv_r2)*args.nb02 + (i13/FC_mul_mv_r3)*args.nb03;
|
|
|
|
|
const uint64_t offset1 = r1*args.nb11 + (i12 )*args.nb12 + (i13 )*args.nb13;
|
|
|
|
|
|
|
|
|
|
device const block_q2_K * x = (device const block_q2_K *) (src0 + offset0);
|
|
|
|
@@ -7567,10 +7570,10 @@ void kernel_mul_mv_q3_K_f32_impl(
|
|
|
|
|
|
|
|
|
|
const int first_row = (r0 * NSG + sgitg) * nr0;
|
|
|
|
|
|
|
|
|
|
const uint i12 = im%args.ne12;
|
|
|
|
|
const uint i13 = im/args.ne12;
|
|
|
|
|
const uint i12 = im%FC_mul_mv_ne12;
|
|
|
|
|
const uint i13 = im/FC_mul_mv_ne12;
|
|
|
|
|
|
|
|
|
|
const uint64_t offset0 = first_row*args.nb01 + (i12/args.r2)*args.nb02 + (i13/args.r3)*args.nb03;
|
|
|
|
|
const uint64_t offset0 = first_row*args.nb01 + (i12/FC_mul_mv_r2)*args.nb02 + (i13/FC_mul_mv_r3)*args.nb03;
|
|
|
|
|
const uint64_t offset1 = r1*args.nb11 + (i12 )*args.nb12 + (i13 )*args.nb13;
|
|
|
|
|
|
|
|
|
|
device const block_q3_K * x = (device const block_q3_K *) (src0 + offset0);
|
|
|
|
@@ -7741,10 +7744,10 @@ void kernel_mul_mv_q4_K_f32_impl(
|
|
|
|
|
|
|
|
|
|
const int first_row = (r0 * NSG + sgitg) * nr0;
|
|
|
|
|
|
|
|
|
|
const uint i12 = im%args.ne12;
|
|
|
|
|
const uint i13 = im/args.ne12;
|
|
|
|
|
const uint i12 = im%FC_mul_mv_ne12;
|
|
|
|
|
const uint i13 = im/FC_mul_mv_ne12;
|
|
|
|
|
|
|
|
|
|
const uint64_t offset0 = first_row*args.nb01 + (i12/args.r2)*args.nb02 + (i13/args.r3)*args.nb03;
|
|
|
|
|
const uint64_t offset0 = first_row*args.nb01 + (i12/FC_mul_mv_r2)*args.nb02 + (i13/FC_mul_mv_r3)*args.nb03;
|
|
|
|
|
const uint64_t offset1 = r1*args.nb11 + (i12 )*args.nb12 + (i13 )*args.nb13;
|
|
|
|
|
|
|
|
|
|
device const block_q4_K * x = (device const block_q4_K *) (src0 + offset0);
|
|
|
|
@@ -7853,10 +7856,10 @@ void kernel_mul_mv_q5_K_f32_impl(
|
|
|
|
|
|
|
|
|
|
const int first_row = (r0 * NSG + sgitg) * nr0;
|
|
|
|
|
|
|
|
|
|
const uint i12 = im%args.ne12;
|
|
|
|
|
const uint i13 = im/args.ne12;
|
|
|
|
|
const uint i12 = im%FC_mul_mv_ne12;
|
|
|
|
|
const uint i13 = im/FC_mul_mv_ne12;
|
|
|
|
|
|
|
|
|
|
const uint64_t offset0 = first_row*args.nb01 + (i12/args.r2)*args.nb02 + (i13/args.r3)*args.nb03;
|
|
|
|
|
const uint64_t offset0 = first_row*args.nb01 + (i12/FC_mul_mv_r2)*args.nb02 + (i13/FC_mul_mv_r3)*args.nb03;
|
|
|
|
|
const uint64_t offset1 = r1*args.nb11 + (i12 )*args.nb12 + (i13 )*args.nb13;
|
|
|
|
|
|
|
|
|
|
device const block_q5_K * x = (device const block_q5_K *) (src0 + offset0);
|
|
|
|
@@ -7989,10 +7992,10 @@ void kernel_mul_mv_q6_K_f32_impl(
|
|
|
|
|
|
|
|
|
|
const int first_row = (r0 * NSG + sgitg) * nr0;
|
|
|
|
|
|
|
|
|
|
const uint i12 = im%args.ne12;
|
|
|
|
|
const uint i13 = im/args.ne12;
|
|
|
|
|
const uint i12 = im%FC_mul_mv_ne12;
|
|
|
|
|
const uint i13 = im/FC_mul_mv_ne12;
|
|
|
|
|
|
|
|
|
|
const uint64_t offset0 = first_row*args.nb01 + (i12/args.r2)*args.nb02 + (i13/args.r3)*args.nb03;
|
|
|
|
|
const uint64_t offset0 = first_row*args.nb01 + (i12/FC_mul_mv_r2)*args.nb02 + (i13/FC_mul_mv_r3)*args.nb03;
|
|
|
|
|
const uint64_t offset1 = r1*args.nb11 + (i12 )*args.nb12 + (i13 )*args.nb13;
|
|
|
|
|
|
|
|
|
|
device const block_q6_K * x = (device const block_q6_K *) (src0 + offset0);
|
|
|
|
@@ -8094,10 +8097,10 @@ void kernel_mul_mv_iq2_xxs_f32_impl(
|
|
|
|
|
|
|
|
|
|
const int first_row = (r0 * NSG + sgitg) * nr0;
|
|
|
|
|
|
|
|
|
|
const uint i12 = im%args.ne12;
|
|
|
|
|
const uint i13 = im/args.ne12;
|
|
|
|
|
const uint i12 = im%FC_mul_mv_ne12;
|
|
|
|
|
const uint i13 = im/FC_mul_mv_ne12;
|
|
|
|
|
|
|
|
|
|
const uint64_t offset0 = first_row*args.nb01 + (i12/args.r2)*args.nb02 + (i13/args.r3)*args.nb03;
|
|
|
|
|
const uint64_t offset0 = first_row*args.nb01 + (i12/FC_mul_mv_r2)*args.nb02 + (i13/FC_mul_mv_r3)*args.nb03;
|
|
|
|
|
const uint64_t offset1 = r1*args.nb11 + (i12 )*args.nb12 + (i13 )*args.nb13;
|
|
|
|
|
|
|
|
|
|
device const block_iq2_xxs * x = (device const block_iq2_xxs *) (src0 + offset0);
|
|
|
|
@@ -8202,10 +8205,10 @@ void kernel_mul_mv_iq2_xs_f32_impl(
|
|
|
|
|
|
|
|
|
|
const int first_row = (r0 * NSG + sgitg) * nr0;
|
|
|
|
|
|
|
|
|
|
const uint i12 = im%args.ne12;
|
|
|
|
|
const uint i13 = im/args.ne12;
|
|
|
|
|
const uint i12 = im%FC_mul_mv_ne12;
|
|
|
|
|
const uint i13 = im/FC_mul_mv_ne12;
|
|
|
|
|
|
|
|
|
|
const uint64_t offset0 = first_row*args.nb01 + (i12/args.r2)*args.nb02 + (i13/args.r3)*args.nb03;
|
|
|
|
|
const uint64_t offset0 = first_row*args.nb01 + (i12/FC_mul_mv_r2)*args.nb02 + (i13/FC_mul_mv_r3)*args.nb03;
|
|
|
|
|
const uint64_t offset1 = r1*args.nb11 + (i12 )*args.nb12 + (i13 )*args.nb13;
|
|
|
|
|
|
|
|
|
|
device const block_iq2_xs * x = (device const block_iq2_xs *) (src0 + offset0);
|
|
|
|
@@ -8321,10 +8324,10 @@ void kernel_mul_mv_iq3_xxs_f32_impl(
|
|
|
|
|
|
|
|
|
|
const int first_row = (r0 * NSG + sgitg) * nr0;
|
|
|
|
|
|
|
|
|
|
const uint i12 = im%args.ne12;
|
|
|
|
|
const uint i13 = im/args.ne12;
|
|
|
|
|
const uint i12 = im%FC_mul_mv_ne12;
|
|
|
|
|
const uint i13 = im/FC_mul_mv_ne12;
|
|
|
|
|
|
|
|
|
|
const uint64_t offset0 = first_row*args.nb01 + (i12/args.r2)*args.nb02 + (i13/args.r3)*args.nb03;
|
|
|
|
|
const uint64_t offset0 = first_row*args.nb01 + (i12/FC_mul_mv_r2)*args.nb02 + (i13/FC_mul_mv_r3)*args.nb03;
|
|
|
|
|
const uint64_t offset1 = r1*args.nb11 + (i12 )*args.nb12 + (i13 )*args.nb13;
|
|
|
|
|
|
|
|
|
|
device const block_iq3_xxs * x = (device const block_iq3_xxs *) (src0 + offset0);
|
|
|
|
@@ -8433,10 +8436,10 @@ void kernel_mul_mv_iq3_s_f32_impl(
|
|
|
|
|
|
|
|
|
|
const int first_row = (r0 * NSG + sgitg) * nr0;
|
|
|
|
|
|
|
|
|
|
const uint i12 = im%args.ne12;
|
|
|
|
|
const uint i13 = im/args.ne12;
|
|
|
|
|
const uint i12 = im%FC_mul_mv_ne12;
|
|
|
|
|
const uint i13 = im/FC_mul_mv_ne12;
|
|
|
|
|
|
|
|
|
|
const uint64_t offset0 = first_row*args.nb01 + (i12/args.r2)*args.nb02 + (i13/args.r3)*args.nb03;
|
|
|
|
|
const uint64_t offset0 = first_row*args.nb01 + (i12/FC_mul_mv_r2)*args.nb02 + (i13/FC_mul_mv_r3)*args.nb03;
|
|
|
|
|
const uint64_t offset1 = r1*args.nb11 + (i12 )*args.nb12 + (i13 )*args.nb13;
|
|
|
|
|
|
|
|
|
|
device const block_iq3_s * x = (device const block_iq3_s *) (src0 + offset0);
|
|
|
|
@@ -8545,10 +8548,10 @@ void kernel_mul_mv_iq2_s_f32_impl(
|
|
|
|
|
|
|
|
|
|
const int first_row = (r0 * NSG + sgitg) * nr0;
|
|
|
|
|
|
|
|
|
|
const uint i12 = im%args.ne12;
|
|
|
|
|
const uint i13 = im/args.ne12;
|
|
|
|
|
const uint i12 = im%FC_mul_mv_ne12;
|
|
|
|
|
const uint i13 = im/FC_mul_mv_ne12;
|
|
|
|
|
|
|
|
|
|
const uint64_t offset0 = first_row*args.nb01 + (i12/args.r2)*args.nb02 + (i13/args.r3)*args.nb03;
|
|
|
|
|
const uint64_t offset0 = first_row*args.nb01 + (i12/FC_mul_mv_r2)*args.nb02 + (i13/FC_mul_mv_r3)*args.nb03;
|
|
|
|
|
const uint64_t offset1 = r1*args.nb11 + (i12 )*args.nb12 + (i13 )*args.nb13;
|
|
|
|
|
|
|
|
|
|
device const block_iq2_s * x = (device const block_iq2_s *) (src0 + offset0);
|
|
|
|
@@ -8658,10 +8661,10 @@ void kernel_mul_mv_iq1_s_f32_impl(
|
|
|
|
|
|
|
|
|
|
const int first_row = (r0 * NSG + sgitg) * nr0;
|
|
|
|
|
|
|
|
|
|
const uint i12 = im%args.ne12;
|
|
|
|
|
const uint i13 = im/args.ne12;
|
|
|
|
|
const uint i12 = im%FC_mul_mv_ne12;
|
|
|
|
|
const uint i13 = im/FC_mul_mv_ne12;
|
|
|
|
|
|
|
|
|
|
const uint64_t offset0 = first_row*args.nb01 + (i12/args.r2)*args.nb02 + (i13/args.r3)*args.nb03;
|
|
|
|
|
const uint64_t offset0 = first_row*args.nb01 + (i12/FC_mul_mv_r2)*args.nb02 + (i13/FC_mul_mv_r3)*args.nb03;
|
|
|
|
|
const uint64_t offset1 = r1*args.nb11 + (i12 )*args.nb12 + (i13 )*args.nb13;
|
|
|
|
|
|
|
|
|
|
device const block_iq1_s * x = (device const block_iq1_s *) (src0 + offset0);
|
|
|
|
@@ -8757,10 +8760,10 @@ void kernel_mul_mv_iq1_m_f32_impl(
|
|
|
|
|
|
|
|
|
|
const int first_row = (r0 * NSG + sgitg) * nr0;
|
|
|
|
|
|
|
|
|
|
const uint i12 = im%args.ne12;
|
|
|
|
|
const uint i13 = im/args.ne12;
|
|
|
|
|
const uint i12 = im%FC_mul_mv_ne12;
|
|
|
|
|
const uint i13 = im/FC_mul_mv_ne12;
|
|
|
|
|
|
|
|
|
|
const uint64_t offset0 = first_row*args.nb01 + (i12/args.r2)*args.nb02 + (i13/args.r3)*args.nb03;
|
|
|
|
|
const uint64_t offset0 = first_row*args.nb01 + (i12/FC_mul_mv_r2)*args.nb02 + (i13/FC_mul_mv_r3)*args.nb03;
|
|
|
|
|
const uint64_t offset1 = r1*args.nb11 + (i12 )*args.nb12 + (i13 )*args.nb13;
|
|
|
|
|
|
|
|
|
|
device const block_iq1_m * x = (device const block_iq1_m *) (src0 + offset0);
|
|
|
|
@@ -8866,10 +8869,10 @@ void kernel_mul_mv_iq4_nl_f32_impl(
|
|
|
|
|
|
|
|
|
|
const int first_row = (r0 * NSG + sgitg) * NR0;
|
|
|
|
|
|
|
|
|
|
const uint i12 = im%args.ne12;
|
|
|
|
|
const uint i13 = im/args.ne12;
|
|
|
|
|
const uint i12 = im%FC_mul_mv_ne12;
|
|
|
|
|
const uint i13 = im/FC_mul_mv_ne12;
|
|
|
|
|
|
|
|
|
|
const uint64_t offset0 = first_row*args.nb01 + (i12/args.r2)*args.nb02 + (i13/args.r3)*args.nb03;
|
|
|
|
|
const uint64_t offset0 = first_row*args.nb01 + (i12/FC_mul_mv_r2)*args.nb02 + (i13/FC_mul_mv_r3)*args.nb03;
|
|
|
|
|
const uint64_t offset1 = r1*args.nb11 + (i12 )*args.nb12 + (i13 )*args.nb13;
|
|
|
|
|
|
|
|
|
|
device const block_iq4_nl * x = (device const block_iq4_nl *) (src0 + offset0);
|
|
|
|
@@ -8975,10 +8978,10 @@ void kernel_mul_mv_iq4_xs_f32_impl(
|
|
|
|
|
const int im = tgpig.z;
|
|
|
|
|
const int first_row = (r0 * NSG + sgitg) * NR0;
|
|
|
|
|
|
|
|
|
|
const uint i12 = im%args.ne12;
|
|
|
|
|
const uint i13 = im/args.ne12;
|
|
|
|
|
const uint i12 = im%FC_mul_mv_ne12;
|
|
|
|
|
const uint i13 = im/FC_mul_mv_ne12;
|
|
|
|
|
|
|
|
|
|
const uint64_t offset0 = first_row*args.nb01 + (i12/args.r2)*args.nb02 + (i13/args.r3)*args.nb03;
|
|
|
|
|
const uint64_t offset0 = first_row*args.nb01 + (i12/FC_mul_mv_r2)*args.nb02 + (i13/FC_mul_mv_r3)*args.nb03;
|
|
|
|
|
const uint64_t offset1 = r1*args.nb11 + (i12 )*args.nb12 + (i13 )*args.nb13;
|
|
|
|
|
|
|
|
|
|
device const block_iq4_xs * x = (device const block_iq4_xs *) (src0 + offset0);
|
|
|
|
@@ -9086,10 +9089,10 @@ void kernel_mul_mv_mxfp4_f32_impl(
|
|
|
|
|
|
|
|
|
|
const int first_row = (r0 * NSG + sgitg) * NR0;
|
|
|
|
|
|
|
|
|
|
const uint i12 = im%args.ne12;
|
|
|
|
|
const uint i13 = im/args.ne12;
|
|
|
|
|
const uint i12 = im%FC_mul_mv_ne12;
|
|
|
|
|
const uint i13 = im/FC_mul_mv_ne12;
|
|
|
|
|
|
|
|
|
|
const uint64_t offset0 = first_row*args.nb01 + (i12/args.r2)*args.nb02 + (i13/args.r3)*args.nb03;
|
|
|
|
|
const uint64_t offset0 = first_row*args.nb01 + (i12/FC_mul_mv_r2)*args.nb02 + (i13/FC_mul_mv_r3)*args.nb03;
|
|
|
|
|
const uint64_t offset1 = r1*args.nb11 + (i12 )*args.nb12 + (i13 )*args.nb13;
|
|
|
|
|
|
|
|
|
|
device const block_mxfp4 * x = (device const block_mxfp4 *) (src0 + offset0);
|
|
|
|
@@ -9304,6 +9307,10 @@ kernel void kernel_diag_f32(
|
|
|
|
|
|
|
|
|
|
constant bool FC_mul_mm_bc_inp [[function_constant(FC_MUL_MM + 0)]];
|
|
|
|
|
constant bool FC_mul_mm_bc_out [[function_constant(FC_MUL_MM + 1)]];
|
|
|
|
|
constant short FC_mul_mm_ne12 [[function_constant(FC_MUL_MM + 2)]];
|
|
|
|
|
constant short FC_mul_mm_ne13 [[function_constant(FC_MUL_MM + 3)]];
|
|
|
|
|
constant short FC_mul_mm_r2 [[function_constant(FC_MUL_MM + 4)]];
|
|
|
|
|
constant short FC_mul_mm_r3 [[function_constant(FC_MUL_MM + 5)]];
|
|
|
|
|
|
|
|
|
|
// each block_q contains 16*nl weights
|
|
|
|
|
#ifdef GGML_METAL_HAS_TENSOR
|
|
|
|
@@ -9330,11 +9337,11 @@ kernel void kernel_mul_mm(
|
|
|
|
|
|
|
|
|
|
// Batch dimension handling
|
|
|
|
|
const int im = tgpig.z;
|
|
|
|
|
const int i12 = im % args.ne12;
|
|
|
|
|
const int i13 = im / args.ne12;
|
|
|
|
|
const int i12 = im % FC_mul_mm_ne12;
|
|
|
|
|
const int i13 = im / FC_mul_mm_ne12;
|
|
|
|
|
|
|
|
|
|
// Batch offsets for srcA and srcB
|
|
|
|
|
const uint64_t offset0 = (i12/args.r2)*args.nb02 + (i13/args.r3)*args.nb03;
|
|
|
|
|
const uint64_t offset0 = (i12/FC_mul_mm_r2)*args.nb02 + (i13/FC_mul_mm_r3)*args.nb03;
|
|
|
|
|
|
|
|
|
|
// Tile dimensions
|
|
|
|
|
constexpr int NRB = SZ_SIMDGROUP * N_MM_BLOCK_X * N_MM_SIMD_GROUP_X;
|
|
|
|
@@ -9473,10 +9480,10 @@ kernel void kernel_mul_mm(
|
|
|
|
|
|
|
|
|
|
short il = il0;
|
|
|
|
|
|
|
|
|
|
const int i12 = im%args.ne12;
|
|
|
|
|
const int i13 = im/args.ne12;
|
|
|
|
|
const int i12 = im % FC_mul_mm_ne12;
|
|
|
|
|
const int i13 = im / FC_mul_mm_ne12;
|
|
|
|
|
|
|
|
|
|
const uint64_t offset0 = (i12/args.r2)*args.nb02 + (i13/args.r3)*args.nb03;
|
|
|
|
|
const uint64_t offset0 = (i12/FC_mul_mm_r2)*args.nb02 + (i13/FC_mul_mm_r3)*args.nb03;
|
|
|
|
|
const short offset1 = il0/nl;
|
|
|
|
|
|
|
|
|
|
device const block_q * x = (device const block_q *)(src0 + args.nb01*(r0 + lr0) + offset0) + offset1;
|
|
|
|
|