@@ -401,52 +401,17 @@ void dequantize_row_q1_0_g128(const block_q1_0_g128 * GGML_RESTRICT x, float * G
401401
402402 const int nb = k / qk ;
403403
404- #if defined(__ARM_NEON )
405- for (int i = 0 ; i < nb ; i ++ ) {
406- const float d = GGML_FP16_TO_FP32 (x [i ].d );
407- const float32x4_t vd = vdupq_n_f32 (d );
408- const float32x4_t vnd = vdupq_n_f32 (- d );
409-
410- float * GGML_RESTRICT yptr = y + i * qk ;
411-
412- // Process 16 bytes (128 bits) at a time
413- for (int b = 0 ; b < 16 ; b ++ ) {
414- const uint8_t byte = x [i ].qs [b ];
415-
416- // Expand each bit to a float: bit=1 -> +d, bit=0 -> -d
417- // Process 8 bits from this byte
418- for (int bit = 0 ; bit < 8 ; bit += 4 ) {
419- // Extract 4 bits and create mask
420- const uint32_t b0 = (byte >> (bit + 0 )) & 1 ;
421- const uint32_t b1 = (byte >> (bit + 1 )) & 1 ;
422- const uint32_t b2 = (byte >> (bit + 2 )) & 1 ;
423- const uint32_t b3 = (byte >> (bit + 3 )) & 1 ;
424-
425- // Use bit select: if bit=1 select d, else select -d
426- float32x4_t result ;
427- result = vsetq_lane_f32 (b0 ? d : - d , result , 0 );
428- result = vsetq_lane_f32 (b1 ? d : - d , result , 1 );
429- result = vsetq_lane_f32 (b2 ? d : - d , result , 2 );
430- result = vsetq_lane_f32 (b3 ? d : - d , result , 3 );
431-
432- vst1q_f32 (yptr + b * 8 + bit , result );
433- }
434- }
435- }
436- #else
437404 for (int i = 0 ; i < nb ; i ++ ) {
438405 const float d = GGML_FP16_TO_FP32 (x [i ].d );
439406 const float neg_d = - d ;
440407
441- // Simple bit unpacking
442408 for (int j = 0 ; j < qk ; ++ j ) {
443409 const int byte_index = j / 8 ;
444410 const int bit_offset = j % 8 ;
445411 const uint8_t bit = (x [i ].qs [byte_index ] >> bit_offset ) & 1 ;
446412 y [i * qk + j ] = bit ? d : neg_d ;
447413 }
448414 }
449- #endif
450415}
451416
452417
0 commit comments