You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b431bdb
Browse filesBrowse the repository at this point in the historyBrowse files
On Turing (sm_75) mmq_own.cu multiplies a prompt's quantized matrices as halves: each matrix dequantized and given to
cuBLAS, since gemm_iq_i8_grouped (i8_mma.cuh) needs Ampere's m16n8k32 and m16n8k16 int8 MMAs. Turing has the int8
MMA as m8n8k16: an m16n8k32 is four of them and an m16n8k16 two, on the same operand registers, and ldmatrix exists
from sm_75. So the same kernel now also builds for sm_75, with integer sums equal to Ampere's to the bit; the raw
stage copy (cp.async, Ampere only) stays off there, the weights are read through registers as for the other types.
gemm_iq_i8_turing() turns it on for the process. Inkling 2 does so with --prompt-int8; without it nothing changes on
Turing (main's default, halves and cuBLAS), and on Ampere and newer the kernel is the default already. The flag is
lossy against Turing's default: the activations are int8 with a scale per 32 values, as on Ampere. It covers the
types of Inkling 2 Mini's GGUFs: IQ4_NL, Q8_0, IQ3_S, IQ3_XXS, IQ2_*, Q2_0 and the K-quants.
poly_mmq_paths_test and poly_mmq_k32_test take --turing-int8 (ctest *_turing_int8).
Class: lossy (opt-in, Inkling 2 only); the default path is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
constint32_t* bounds, int n_experts, int max_rows, float* Y, int ldy, void* stream);
205
205
/// The same products on the int8 tensor cores, for matrices of any number of rows (src/kernels/cuda/i8_mma.cuh):
206
206
/// the weights decoded to int8 a tile at a time, the activations int8 with a scale per 32 values, FP32 sums.
207
-
/// CUDA, Ampere and newer. gemm_iq_i8_takes: the current card runs it for K columns of type ty (K a multiple of 256,
207
+
/// CUDA, Ampere and newer (Turing with gemm_iq_i8_turing()). gemm_iq_i8_takes: the current card runs it for K columns of type ty (K a multiple of 256,
208
208
/// or of 32 for a type of 32-value blocks; STRATA_PF_I8MMA=0 turns it off). gemm_iq_i8_quantize: row i of xq = row ids[i] of x (row i without ids), ld
209
209
/// floats a row; xq holds rows * K * 5 / 4 bytes, 16-byte aligned. gemm_iq_i8_grouped: matrix e (n_out rows,
210
210
/// mat_bytes apart) times rows bounds[e]..bounds[e+1] of an xq of total_rows rows; row i's products go to row ids[i]
211
211
/// of Y (row i without ids). With `from`, row i is row from[i] of xq. false: not launched.
212
212
boolgemm_iq_i8_takes(int ty, int K);
213
+
/// The int8 kernel on Turing (sm_75) too, from now on in this process, by m8n8k16 MMAs: the same sums as on Ampere.
214
+
/// Off by default, where Turing's products are the halves' (mmq_own.cu); a model's engine turns it on when asked.
Copy file name to clipboardExpand all lines: engine/src/poly/mmq_k32_test.cu
+4-2Lines changed: 4 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -4,8 +4,9 @@
4
4
// must agree to the bit. The unpadded matrices are allocated to their last byte, so that a read past them shows
5
5
// under compute-sanitizer. Q4_0's products are checked against its weights' values as well.
6
6
//
7
-
// usage: poly_mmq_k32_test (exit 0: every case agrees; 77: no card, or no int8 product on it)
7
+
// usage: poly_mmq_k32_test [--turing-int8] (--turing-int8: the int8 product on Turing too, gemm_iq_i8_turing(); exit 0: every case agrees; 77: no card, or no int8 product on it)
8
8
#include"mmq.hpp"
9
+
#include"strata/kernels/iq_kernels.hpp"
9
10
10
11
#include<cuda_runtime.h>
11
12
@@ -121,7 +122,8 @@ int run_case(const Quant& q, int k, int n, const std::vector<int>& rows, std::mt
121
122
122
123
} // namespace
123
124
124
-
intmain() {
125
+
intmain(int argc, char** argv) {
126
+
if (argc > 1 && std::strcmp(argv[1], "--turing-int8") == 0) strata::kernels::gemm_iq_i8_turing(true);
125
127
int devices = 0;
126
128
if (cudaGetDeviceCount(&devices) != cudaSuccess || devices == 0) {
0 commit comments