summaryrefslogtreecommitdiff
path: root/ggml.c
diff options
context:
space:
mode:
authorslaren <slarengh@gmail.com>2023-12-22 12:12:53 +0100
committerGitHub <noreply@github.com>2023-12-22 13:12:53 +0200
commit48b7ff193e64c97ab174280ba0eb8d14b47c49ba (patch)
treefed96d9eb1f1cf9778409219dbbe18cccb1b9fe5 /ggml.c
parent48b24b170e3b4f9dc28200306840cb07d1c123df (diff)
llama : fix platforms without mmap (#4578)
* llama : fix platforms without mmap * win32 : limit prefetch size to the file size * fix win32 error clobber, unnecessary std::string in std::runtime_error
Diffstat (limited to 'ggml.c')
-rw-r--r--ggml.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ggml.c b/ggml.c
index 15e1984d..3656422d 100644
--- a/ggml.c
+++ b/ggml.c
@@ -10335,7 +10335,8 @@ static void ggml_compute_forward_scale_f32(
}
// scale factor
- const float v = *(float *) dst->op_params;
+ float v;
+ memcpy(&v, dst->op_params, sizeof(float));
const int ith = params->ith;
const int nth = params->nth;
@@ -15152,7 +15153,8 @@ static void ggml_compute_backward(struct ggml_context * ctx, struct ggml_tensor
{
// necessary for llama
if (src0->grad) {
- const float s = ((float *) tensor->op_params)[0];
+ float s;
+ memcpy(&s, tensor->op_params, sizeof(float));
src0->grad =
ggml_add_or_set(ctx,