okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
86bed1c92
main
1// src/kernels/cuda/quantize_act.cu - P2.S2: quantize an activation the way ggml converts src1. 2// 3// WHY THIS EXISTS AT ALL. `ggml_mul_mat` converts the ACTIVATION (src1) to the weight's `vec_dot_type` 4// before the dot product - the rule established over rounds 119-136 and written into `ref/quant.py` as 5// `apply_src1`. The CPU expert path already honours it (`bench/micro/cpu_s2.cpp` quantizes to int8 and uses 6// `vpdpbusd`), and its P0.T2 parity passes at 1.461e-06. The GPU kernels added in rounds 166-177 take FP16 7// activations instead. **Left that way, the two paths would compute different numbers for different experts 8// of the SAME token** - not a tolerance question, an inconsistency inside one forward pass. 9// 10// Q2_0 IS THE CASE THAT MATTERS: the routed experts are all Q2_0, `Q2_0 -> Q8_0`, and that is 31.64 GiB of the 11// 38 GiB pack. Q8_K (for the K-quants and IQ4_XS) is the other half of the table and is not here yet. 12// 13// THE THREE SUBTLETIES, each of which was paid for once already and is transcribed rather than recalled: 14// 15// 1. `d32 = amax / 127.0f` is computed in FP32, and the QUANTIZED INTEGERS divide by **d32**, not by the 16// fp16-rounded value that gets stored. Conflating the two shifts every quant near a rounding boundary - 17// measured against ggml's own bytes, 18 of 80 blocks differed, and because Q2_0 experts convert to Q8_0 18// the error landed in all 48 MoE blocks and made the end-to-end KL WORSE. 19// 2. The reference divides in FLOAT64 (`blk.astype(np.float64) / float(np.float32(d32))`) and rounds with 20// `rint` - half to even. This kernel therefore divides in double too: an FP32 division followed by 21// `rintf` differs from the reference wherever the f32 quotient rounds across a .5 boundary. 22// 3. The DEQUANTIZED value is `q * d16`, the fp16 scale, not `q * d32`. The block stores fp16 and that is 23// what a reader multiplies by. 24#define DPCT_PROFILING_ENABLED 25#include <sycl/sycl.hpp> 26#include "strata/kprof.hpp" 27#include <dpct/dpct.hpp> 28#include "strata/sycl_queue.hpp" 29#include "strata/kernels/quantize_act.hpp" 30#include "strata/kernels/f16_bits.hpp" 31 32#include <cmath> 33#include <cstdio> 34#include <cstdlib> 35 36namespace strata::kernels { 37namespace { 38 39constexpr int QK8_0 = 32 ; 40 41// THE fp16 CONVERSION LIVES IN `strata/kernels/f16_bits.hpp`, and this file used to carry its own copy. 42// 43// Round 198 found the private copy wrong in a way no fixture here could see: it tested `if (exp >= 31)` to 44// detect an out-of-range exponent, which conflates an f32 INF/NAN (raw exponent 255) with a FINITE value too 45// large for fp16. Every finite overflow - 1e30, 65536, 1e45 - came back as a NaN instead of saturating to 46// inf, and this file's fixture is O(1) throughout, so it passed. A numpy-generated oracle caught it on its 47// first run. Three copies of a converter whose failure mode is silent wrong bits was two copies too many. 48 49__dpct_inline__ void quantize_q8_0_kernel (const float * __restrict__x , 50uint8_t * __restrict__blocks , 51long long n_blocks ) { 52auto item_ct1 = sycl::ext::oneapi::this_work_item::get_nd_item < 3 > (); 53const long long b = 54 (long long )item_ct1 .get_group (2 )* item_ct1 .get_local_range (2 )+ 55item_ct1 .get_local_id (2 ); 56if (b >=n_blocks )return ; 57const float * xb = x + b * QK8_0 ; 58uint8_t * out = blocks + b * 34 ;// { fp16 d ; int8 qs[32] } 59 60float amax = 0.0f ; 61#pragma unroll 62for (int i = 0 ;i < QK8_0 ;++ i )amax = sycl::fmax (amax , sycl::fabs (xb [i ])); 63if (amax == 0.0f ) { 64// ggml leaves the block zeroed: d = 0 and every q = 0. Writing the fp16 zero explicitly rather than 65// skipping keeps the block layout deterministic for the byte comparison. 66const uint16_t zb = f16_from_f32 (0.0f ); 67out [0 ]= (uint8_t ) (zb & 0xFF ); 68out [1 ]= (uint8_t ) (zb >>8 ); 69#pragma unroll 70for (int i = 0 ;i < QK8_0 ;++ i )out [2 + i ]= 0 ; 71return ; 72 } 73const float d32 = amax /127.0f ; 74const uint16_t d16bits = f16_from_f32 (d32 ); 75out [0 ]= (uint8_t ) (d16bits & 0xFF ); 76out [1 ]= (uint8_t ) (d16bits >>8 ); 77 78// double division, matching the reference exactly (subtlety 2) 79for (int i = 0 ;i < QK8_0 ;++ i ) { 80double q = sycl::rint ((double )xb [i ] / (double )d32 ); 81if (q > 127.0 )q = 127.0 ; 82if (q < -128.0 )q = -128.0 ; 83out [2 + i ]= (uint8_t ) (int8_t )q ; 84 } 85} 86 87/// **THE HIT PATH'S QUANTIZER, AND IT EXISTS TO REPRODUCE `act_quant_q8_1` EXACTLY (R4.2h, round 331).** 88/// 89/// The engine computes every routed expert twice. MISSES go through `cpu/expert.cpp:138 act_quant_q8_1` 90/// into the VNNI kernel; HITS went through `quantize_q8_0` above. **Those are not the same quantization**, 91/// and round 330 measured the difference with both real implementations linked 92/// (`bench/micro/act_quant_parity.cu`): 93/// 94/// int8 activations differing : 0 of 2560 <- this rule's ties are measure-zero 95/// chunks whose SCALE differs : 80 of 80, max rel 4.761e-04 <- 2^-11: fp32 vs the block's fp16 96/// 97/// The scale is the difference that matters: `ActQ::scale` is `float` and the CPU kernel multiplies by it 98/// (`expert.cpp:92`), while `row_dot_s2_q8` read `f16_at(xb)` out of the `block_q8_0`. So this variant 99/// writes the SAME 34-byte blocks (the kernel's indexing is unchanged) **and** a parallel fp32 scale array 100/// carrying `d32` unrounded. 101/// 102/// It also adopts the CPU's ROUNDING RULE - multiply by the reciprocal, round half AWAY FROM ZERO - rather 103/// than this file's `rint`. That is deliberate and it is the opposite of the direction the comment above 104/// argues for. `quantize_q8_0` was tuned to match **ggml's Q8_0 bytes**, which is right for the pack and for 105/// `moe_hit_parity`. This function's job is different: it must match **this engine's own CPU reference**, 106/// because a hit and a miss for the same expert on the same layer have to produce the same number. The CPU 107/// path is the reference - C1 passes on it - so the hit path is brought to it, not the reverse. 108#if defined(__HIPCC__ )// AMD keeps the thread-a-block kernel 109__global__ void quantize_q8_0_scaled_kernel (const float * __restrict__x ,uint8_t * __restrict__blocks , 110float * __restrict__scales ,long long n_blocks ) { 111const long long b = (long long )blockIdx .x * blockDim .x + threadIdx .x ; 112if (b >=n_blocks )return ; 113const float * xb = x + b * QK8_0 ; 114uint8_t * out = blocks + b * 34 ; 115 116float amax = 0.0f ; 117for (int i = 0 ;i < QK8_0 ;++ i )amax = fmaxf (amax ,fabsf (xb [i ])); 118// VERBATIM from `cpu/expert.cpp:144-145`, including the `amax > 0` guard, so the fp32 value written here 119// is bit-identical to the `s` the CPU path used. 120const float s = amax > 0.f ?amax /127.f :0.f ; 121const float inv = s > 0.f ?1.f /s :0.f ; 122scales [b ]= s ; 123 124const uint16_t d16bits = f16_from_f32 (s ); 125out [0 ]= (uint8_t ) (d16bits & 0xFF ); 126out [1 ]= (uint8_t ) (d16bits >>8 ); 127for (int i = 0 ;i < QK8_0 ;++ i ) { 128// VERBATIM from `cpu/expert.cpp:159-162`: reciprocal multiply, then `t + copysign(0.5, t)` truncated 129// toward zero, which is `lround`'s rule - round half away from zero. 130const float t = xb [i ]* inv ; 131const float r = t + (t >=0.f ?0.5f :-0.5f ); 132int v = (int )r ; 133v = v < -127 ?-127 : (v > 127 ?127 :v ); 134out [2 + i ]= (uint8_t ) (int8_t )v ; 135 } 136} 137 138#else 139// A warp a block, lane i on value i: the block's |max| is a max over the same values (0 for none above it, as the 140// serial scan from 0 through fmaxf), so every byte is the per-thread loop's. 141__dpct_inline__ void quantize_q8_0_scaled_kernel (const float * __restrict__x , 142uint8_t * __restrict__blocks , 143float * __restrict__scales , 144long long n_blocks ) { 145auto item_ct1 = sycl::ext::oneapi::this_work_item::get_nd_item < 3 > (); 146const long long b = 147 ((long long )item_ct1 .get_group (2 )* item_ct1 .get_local_range (2 )+ 148item_ct1 .get_local_id (2 )) >> 1495 ; 150const int i = (int )(item_ct1 .get_local_id (2 )& 31 ); 151if (b >=n_blocks )return ; 152const float xi = x [b * QK8_0 + i ]; 153uint8_t * out = blocks + b * 34 ; 154 155float amax = sycl::fmax (0.0f , sycl::fabs (xi )); 156/* 157DPCT1108: '__shfl_xor_sync' was migrated with the experimental feature 158masked sub_group function which may not be supported by all compilers or 159runtimes. You may need to adjust the code. 160*/ 161#pragma unroll 162for (int o = 16 ;o > 0 ;o >>=1 )amax = sycl::fmax ( 163amax , dpct::experimental::permute_sub_group_by_xor ( 1640xffffffffu , 165 sycl::ext::oneapi::this_work_item::get_sub_group (),amax ,o )); 166// VERBATIM from `cpu/expert.cpp:144-145`, including the `amax > 0` guard, so the fp32 value written here 167// is bit-identical to the `s` the CPU path used. 168const float s = amax > 0.f ?amax /127.f :0.f ; 169const float inv = s > 0.f ?1.f /s :0.f ; 170if (i == 0 ) { 171scales [b ]= s ; 172const uint16_t d16bits = f16_from_f32 (s ); 173out [0 ]= (uint8_t ) (d16bits & 0xFF ); 174out [1 ]= (uint8_t ) (d16bits >>8 ); 175 } 176// VERBATIM from `cpu/expert.cpp:159-162`: reciprocal multiply, then `t + copysign(0.5, t)` truncated 177// toward zero, which is `lround`'s rule - round half away from zero. 178const float t = xi * inv ; 179const float r = t + (t >=0.f ?0.5f :-0.5f ); 180int v = (int )r ; 181v = v < -127 ?-127 : (v > 127 ?127 :v ); 182out [2 + i ]= (uint8_t ) (int8_t )v ; 183} 184 185#endif 186 187__dpct_inline__ void dequant_q8_0_kernel (const uint8_t * __restrict__blocks , 188float * __restrict__x , 189long long n_blocks ) { 190auto item_ct1 = sycl::ext::oneapi::this_work_item::get_nd_item < 3 > (); 191const long long b = 192 (long long )item_ct1 .get_group (2 )* item_ct1 .get_local_range (2 )+ 193item_ct1 .get_local_id (2 ); 194if (b >=n_blocks )return ; 195const uint8_t * blk = blocks + b * 34 ; 196const uint16_t dbits = (uint16_t ) (blk [0 ] | (blk [1 ] <<8 )); 197const float d = f32_from_f16 (dbits ); 198float * out = x + b * QK8_0 ; 199#pragma unroll 200for (int i = 0 ;i < QK8_0 ;++ i )out [i ]= (float )(int8_t )blk [2 + i ]* d ; 201} 202 203// ===================== Q8_K ===================== 204// 205// `block_q8_K` = { float d ; int8_t qs[256] ; int16_t bsums[16] } = 292 bytes, no padding 206// (`static_assert` in ggml-common.h). QK_K = 256. 207 208constexpr int QK_K = 256 ; 209constexpr int Q8K_BYTES = 292 ; 210 211/// ggml's `nearest_int` (ggml-quants.c L621), transcribed rather than replaced. 212/// 213/// The magic number is 1.5 * 2^23: adding it forces the mantissa's integer part into the low bits, and the 214/// mask/subtract recover it. The reason it is transcribed and not written as `rintf` is that the two differ 215/// on exact ties - and that is the whole point of the constant, so a "cleaner" rewrite would silently change 216/// which way ties go. 217__dpct_inline__ int nearest_int_dev (float fval ) { 218const float val = fval + 12582912.0f ; 219int i ; 220memcpy (& i ,& val ,4 ); 221return (i & 0x007fffff )- 0x00400000 ; 222} 223 224__dpct_inline__ void quantize_q8_K_kernel (const float * __restrict__x , 225uint8_t * __restrict__blocks , 226long long n_blocks ) { 227auto item_ct1 = sycl::ext::oneapi::this_work_item::get_nd_item < 3 > (); 228const long long b = 229 (long long )item_ct1 .get_group (2 )* item_ct1 .get_local_range (2 )+ 230item_ct1 .get_local_id (2 ); 231if (b >=n_blocks )return ; 232const float * xb = x + b * QK_K ; 233uint8_t * out = blocks + b * Q8K_BYTES ; 234float * d = (float * )out ; 235int8_t * qs = (int8_t * ) (out + 4 ); 236int16_t * bsums = (int16_t * ) (out + 4 + QK_K ); 237 238// `max` is the SIGNED value at the largest magnitude position, and the comparison is STRICTLY greater, 239// so a tie keeps the FIRST maximum - which is what `np.argmax` does in the reference transcription too. 240float max = 0.0f ,amax = 0.0f ; 241for (int j = 0 ;j < QK_K ;++ j ) { 242const float ax = sycl::fabs (xb [j ]); 243if (ax > amax ) { 244amax = ax ; 245max = xb [j ]; 246 } 247 } 248if (amax == 0.0f ) { 249// ggml writes d = 0 and zeroes qs, then `continue`s - which LEAVES bsums UNWRITTEN. A zeroed block 250// and an untouched one are indistinguishable to the dot product, but not to a byte comparison, so 251// this zeroes bsums as well and the parity test's reference does the same. Recorded because it is a 252// deliberate divergence from the letter of the source. 253* d = 0.0f ; 254#pragma unroll 255for (int j = 0 ;j < QK_K ;++ j )qs [j ]= 0 ; 256#pragma unroll 257for (int j = 0 ;j < QK_K /16 ;++ j )bsums [j ]= 0 ; 258return ; 259 } 260const float iscale = -127.0f /max ;// -127, NOT -128; see the header 261for (int j = 0 ;j < QK_K ;++ j ) { 262// `__fmul_rn`, NOT `iscale * xb[j]`. ggml computes the product, ROUNDS IT TO F32, and then adds 263// 12582912.0f inside `nearest_int`. Written as a plain expression, nvcc CONTRACTS the multiply into 264// the add as an FMA - which is a more accurate product but not the same one, and it flips the result 265// wherever the true product sits just off a .5 boundary. The first version of this kernel differed 266// from the reference in 1 element of 524,288 for exactly this reason, and `__fmul_rn` pins the 267// rounding step the source actually performs. 268/* 269DPCT1013: The rounding mode could not be specified and the generated 270code may have different accuracy than the original code. Verify the 271correctness. SYCL math built-in function rounding mode is aligned with 272OpenCL C 1.2 standard. 273*/ 274const int v = nearest_int_dev (iscale * xb [j ]); 275qs [j ]= (int8_t )sycl::min ( 276127 ,v );// MIN only - the source has no lower clamp 277 } 278for (int j = 0 ;j < QK_K /16 ;++ j ) { 279int sum = 0 ; 280#pragma unroll 281for (int ii = 0 ;ii < 16 ;++ ii )sum += qs [j * 16 + ii ]; 282bsums [j ]= (int16_t )sum ; 283 } 284* d = 1.0f /iscale ; 285} 286 287__dpct_inline__ void dequant_q8_K_kernel (const uint8_t * __restrict__blocks , 288float * __restrict__x , 289long long n_blocks ) { 290auto item_ct1 = sycl::ext::oneapi::this_work_item::get_nd_item < 3 > (); 291const long long b = 292 (long long )item_ct1 .get_group (2 )* item_ct1 .get_local_range (2 )+ 293item_ct1 .get_local_id (2 ); 294if (b >=n_blocks )return ; 295const uint8_t * blk = blocks + b * Q8K_BYTES ; 296float d ; 297memcpy (& d ,blk ,4 ); 298const int8_t * qs = (const int8_t * ) (blk + 4 ); 299float * out = x + b * QK_K ; 300#pragma unroll 301for (int i = 0 ;i < QK_K ;++ i )out [i ]= (float )qs [i ]* d ; 302} 303 304}// namespace 305 306void quantize_q8_0 (const float * x ,uint8_t * blocks ,int64_t n ,void * stream ) { 307if (n <=0 )return ; 308if (n %QK8_0 != 0 ) { 309 std::fprintf (stderr ,"quantize_q8_0: n %lld is not a multiple of %d\n" , (long long )n ,QK8_0 ); 310 std::exit (1 ); 311 } 312const long long nb = n /QK8_0 ; 313const int threads = 128 ; 314const unsigned grid = (unsigned ) ((nb + threads - 1 ) /threads ); 315 { 316auto exp_props = sycl::ext::oneapi::experimental::properties { 317 sycl::ext::oneapi::experimental::use_root_sync }; 318 dpct::has_capability_or_fail ( 319 strata::q_of (stream )-> get_device (), 320 {sycl::aspect::fp64 }); 321 322 strata::kprof::kp (strata::q_of (stream ),__FILE__ ,__func__ ,__LINE__ ) 323-> template parallel_for < dpct_kernel_name < class quantize_q8_0_kernel_5451b9 >> ( 324 sycl::nd_range < 3 > (sycl::range (1 ,1 ,grid )* 325 sycl::range (1 ,1 ,threads ), 326 sycl::range (1 ,1 ,threads )), 327exp_props , [= ](sycl::nd_item < 3 > item_ct1 ) { 328quantize_q8_0_kernel (x ,blocks ,nb ); 329 }); 330 } 331/* 332DPCT1010: SYCL uses exceptions to report errors and does not use the 333error codes. The cudaGetLastError function call was replaced with 0. You 334need to rewrite this code. 335*/ 336const dpct::err0 e = 0 ; 337 338if (stream == nullptr ) dpct::get_current_device ().queues_wait_and_throw (); 339} 340 341/// See `quantize_q8_0_scaled_kernel`. Writes the same 34-byte `block_q8_0` layout as `quantize_q8_0`, plus 342/// `scales[n/32]` carrying the fp32 `s` the CPU path used - so a hit can be computed with the CPU's 343/// multiplier instead of the block's fp16 `d`. `scales` must not be null. 344void quantize_q8_0_scaled (const float * x ,uint8_t * blocks ,float * scales ,int64_t n ,void * stream ) { 345if (n <=0 )return ; 346if (n %QK8_0 != 0 ) { 347 std::fprintf (stderr ,"quantize_q8_0_scaled: n %lld is not a multiple of %d\n" , (long long )n ,QK8_0 ); 348 std::exit (1 ); 349 } 350if (scales == nullptr ) { 351 std::fprintf (stderr ,"quantize_q8_0_scaled: scales is null\n" ); 352 std::exit (1 ); 353 } 354const long long nb = n /QK8_0 ; 355const int threads = 128 ; 356#if defined(__HIPCC__ ) 357const unsigned grid = (unsigned ) ((nb + threads - 1 ) /threads ); 358#else 359const unsigned grid = (unsigned ) ((nb + threads /32 - 1 ) / (threads /32 ));// a warp a block 360#endif 361 { 362auto exp_props = sycl::ext::oneapi::experimental::properties { 363 sycl::ext::oneapi::experimental::use_root_sync }; 364 365 strata::kprof::kp (strata::q_of (stream ),__FILE__ ,__func__ ,__LINE__ ) 366-> template parallel_for < 367dpct_kernel_name < class quantize_q8_0_scaled_kernel_caf6f4 >> ( 368 sycl::nd_range < 3 > (sycl::range (1 ,1 ,grid )* 369 sycl::range (1 ,1 ,threads ), 370 sycl::range (1 ,1 ,threads )), 371exp_props , 372 [= ](sycl::nd_item < 3 > item_ct1 ) 373 [[sycl ::reqd_sub_group_size (32 )]] { 374quantize_q8_0_scaled_kernel (x ,blocks ,scales ,nb ); 375 }); 376 } 377/* 378DPCT1010: SYCL uses exceptions to report errors and does not use the 379error codes. The cudaGetLastError function call was replaced with 0. You 380need to rewrite this code. 381*/ 382const dpct::err0 e = 0 ; 383 384if (stream == nullptr ) dpct::get_current_device ().queues_wait_and_throw (); 385} 386 387void dequant_q8_0 (const uint8_t * blocks ,float * x ,int64_t n ,void * stream ) { 388if (n <=0 )return ; 389const long long nb = n /QK8_0 ; 390const int threads = 128 ; 391const unsigned grid = (unsigned ) ((nb + threads - 1 ) /threads ); 392 { 393auto exp_props = sycl::ext::oneapi::experimental::properties { 394 sycl::ext::oneapi::experimental::use_root_sync }; 395 396 strata::kprof::kp (strata::q_of (stream ),__FILE__ ,__func__ ,__LINE__ ) 397-> template parallel_for < dpct_kernel_name < class dequant_q8_0_kernel_154e61 >> ( 398 sycl::nd_range < 3 > (sycl::range (1 ,1 ,grid )* 399 sycl::range (1 ,1 ,threads ), 400 sycl::range (1 ,1 ,threads )), 401exp_props , [= ](sycl::nd_item < 3 > item_ct1 ) { 402dequant_q8_0_kernel (blocks ,x ,nb ); 403 }); 404 } 405/* 406DPCT1010: SYCL uses exceptions to report errors and does not use the 407error codes. The cudaGetLastError function call was replaced with 0. You 408need to rewrite this code. 409*/ 410const dpct::err0 e = 0 ; 411 412if (stream == nullptr ) dpct::get_current_device ().queues_wait_and_throw (); 413} 414 415void quantize_q8_K (const float * x ,uint8_t * blocks ,int64_t n ,void * stream ) { 416if (n <=0 )return ; 417if (n %QK_K != 0 ) { 418 std::fprintf (stderr ,"quantize_q8_K: n %lld is not a multiple of %d\n" , (long long )n ,QK_K ); 419 std::exit (1 ); 420 } 421const long long nb = n /QK_K ; 422const int threads = 64 ;// one block per thread, and a block is 256 elements 423const unsigned grid = (unsigned ) ((nb + threads - 1 ) /threads ); 424 { 425auto exp_props = sycl::ext::oneapi::experimental::properties { 426 sycl::ext::oneapi::experimental::use_root_sync }; 427 428 strata::kprof::kp (strata::q_of (stream ),__FILE__ ,__func__ ,__LINE__ ) 429-> template parallel_for < dpct_kernel_name < class quantize_q8_K_kernel_7aadb2 >> ( 430 sycl::nd_range < 3 > (sycl::range (1 ,1 ,grid )* 431 sycl::range (1 ,1 ,threads ), 432 sycl::range (1 ,1 ,threads )), 433exp_props , [= ](sycl::nd_item < 3 > item_ct1 ) { 434quantize_q8_K_kernel (x ,blocks ,nb ); 435 }); 436 } 437/* 438DPCT1010: SYCL uses exceptions to report errors and does not use the 439error codes. The cudaGetLastError function call was replaced with 0. You 440need to rewrite this code. 441*/ 442const dpct::err0 e = 0 ; 443 444if (stream == nullptr ) dpct::get_current_device ().queues_wait_and_throw (); 445} 446 447void dequant_q8_K (const uint8_t * blocks ,float * x ,int64_t n ,void * stream ) { 448if (n <=0 )return ; 449const long long nb = n /QK_K ; 450const int threads = 64 ; 451const unsigned grid = (unsigned ) ((nb + threads - 1 ) /threads ); 452 { 453auto exp_props = sycl::ext::oneapi::experimental::properties { 454 sycl::ext::oneapi::experimental::use_root_sync }; 455 456 strata::kprof::kp (strata::q_of (stream ),__FILE__ ,__func__ ,__LINE__ ) 457-> template parallel_for < dpct_kernel_name < class dequant_q8_K_kernel_e03426 >> ( 458 sycl::nd_range < 3 > (sycl::range (1 ,1 ,grid )* 459 sycl::range (1 ,1 ,threads ), 460 sycl::range (1 ,1 ,threads )), 461exp_props , [= ](sycl::nd_item < 3 > item_ct1 ) { 462dequant_q8_K_kernel (blocks ,x ,nb ); 463 }); 464 } 465/* 466DPCT1010: SYCL uses exceptions to report errors and does not use the 467error codes. The cudaGetLastError function call was replaced with 0. You 468need to rewrite this code. 469*/ 470const dpct::err0 e = 0 ; 471 472if (stream == nullptr ) dpct::get_current_device ().queues_wait_and_throw (); 473} 474 475}// namespace strata::kernels