mirror of
https://github.com/ggerganov/llama.cpp.git
synced 2025-01-03 23:34:35 +00:00
ae8de6d50a
Some checks failed
Publish Docker image / Push Docker image to Docker Hub (map[dockerfile:.devops/full-cuda.Dockerfile platforms:linux/amd64 tag:full-cuda]) (push) Waiting to run
Publish Docker image / Push Docker image to Docker Hub (map[dockerfile:.devops/full-musa.Dockerfile platforms:linux/amd64 tag:full-musa]) (push) Waiting to run
Publish Docker image / Push Docker image to Docker Hub (map[dockerfile:.devops/full.Dockerfile platforms:linux/amd64,linux/arm64 tag:full]) (push) Waiting to run
Publish Docker image / Push Docker image to Docker Hub (map[dockerfile:.devops/llama-cli-cuda.Dockerfile platforms:linux/amd64 tag:light-cuda]) (push) Waiting to run
Publish Docker image / Push Docker image to Docker Hub (map[dockerfile:.devops/llama-cli-intel.Dockerfile platforms:linux/amd64 tag:light-intel]) (push) Waiting to run
Publish Docker image / Push Docker image to Docker Hub (map[dockerfile:.devops/llama-cli-musa.Dockerfile platforms:linux/amd64 tag:light-musa]) (push) Waiting to run
Publish Docker image / Push Docker image to Docker Hub (map[dockerfile:.devops/llama-cli.Dockerfile platforms:linux/amd64,linux/arm64 tag:light]) (push) Waiting to run
Publish Docker image / Push Docker image to Docker Hub (map[dockerfile:.devops/llama-server-cuda.Dockerfile platforms:linux/amd64 tag:server-cuda]) (push) Waiting to run
Publish Docker image / Push Docker image to Docker Hub (map[dockerfile:.devops/llama-server-intel.Dockerfile platforms:linux/amd64 tag:server-intel]) (push) Waiting to run
Publish Docker image / Push Docker image to Docker Hub (map[dockerfile:.devops/llama-server-musa.Dockerfile platforms:linux/amd64 tag:server-musa]) (push) Waiting to run
Publish Docker image / Push Docker image to Docker Hub (map[dockerfile:.devops/llama-server.Dockerfile platforms:linux/amd64,linux/arm64 tag:server]) (push) Waiting to run
Nix CI / nix-eval (macos-latest) (push) Waiting to run
Nix CI / nix-eval (ubuntu-latest) (push) Waiting to run
Nix CI / nix-build (macos-latest) (push) Waiting to run
Nix CI / nix-build (ubuntu-latest) (push) Waiting to run
flake8 Lint / Lint (push) Waiting to run
Nix aarch64 builds / nix-build-aarch64 (push) Has been cancelled
* ggml : build backends as libraries --------- Signed-off-by: Xiaodong Ye <xiaodong.ye@mthreads.com> Co-authored-by: Georgi Gerganov <ggerganov@gmail.com> Co-authored-by: R0CKSTAR <xiaodong.ye@mthreads.com>
36 lines
1.0 KiB
Plaintext
36 lines
1.0 KiB
Plaintext
#version 450
|
|
|
|
#include "common.comp"
|
|
|
|
#define BLOCKS_IN_QUANT QK4_1
|
|
#define SIZE_OF_BLOCK sizeof_block_q4_1
|
|
#define N_ROWS 4
|
|
|
|
#include "op_mul_mv_q_n_pre.comp"
|
|
|
|
// The q4_1 version of this function
|
|
float block_q_n_dot_y(uint block_index, uint yb, uint il) {
|
|
vec2 acc = vec2(0.0, 0.0);
|
|
const uint index = (block_index) * SIZE_OF_BLOCK + pcs.inAOff;
|
|
float d = float(u8BufToFloat16(inA, index));
|
|
float m = float(u8BufToFloat16(inA, index+2));
|
|
|
|
float sumy = 0.0f;
|
|
for (int i = 0; i < BLOCKS_IN_QUANT/4; i+=2) {
|
|
const uint16_t b = u8BufToU16(inA, index + 4 + il + i);
|
|
|
|
const float yl0 = inB[yb + i];
|
|
const float yl1 = inB[yb + i + 1];
|
|
const float yl8 = inB[yb + i + BLOCKS_IN_QUANT/2];
|
|
const float yl9 = inB[yb + i + BLOCKS_IN_QUANT/2 + 1];
|
|
|
|
sumy += yl0 + yl1 + yl8 + yl9;
|
|
|
|
acc[0] += yl0 * (b & 0x000F) + yl1 / 256.f * (b & 0x0F00);
|
|
acc[1] += yl8 / 16.f * (b & 0x00F0) + yl9 / 4096.f * (b & 0xF000);
|
|
}
|
|
return d * (acc[0] + acc[1]) + sumy * m;
|
|
}
|
|
|
|
#include "op_mul_mv_q_n.comp"
|