Aaron Teo Aleksei Nikiforov commited on
Commit
2458d68
·
1 Parent(s): ee7706c

ggml: fix compilation error s390x (llama/12848)

Browse files

* ggml: fixes #12846 compilation error

Signed-off-by: Aaron Teo <[email protected]>

Co-authored-by: Aleksei Nikiforov <[email protected]>

* ggml: add documentation for code change

Signed-off-by: Aaron Teo <[email protected]>

Co-authored-by: Aleksei Nikiforov <[email protected]>

* ggml: refactor to type-cast and update documentation

Signed-off-by: Aaron Teo <[email protected]>

Co-authored-by: Aleksei Nikiforov <[email protected]>

* ggml: update documentation to provide full issue link

Signed-off-by: Aaron Teo <[email protected]>

Co-authored-by: Aleksei Nikiforov <[email protected]>

---------

Co-authored-by: Aleksei Nikiforov <[email protected]>

Files changed (1) hide show
  1. ggml/src/ggml-cpu/simd-mappings.h +6 -2
ggml/src/ggml-cpu/simd-mappings.h CHANGED
@@ -855,13 +855,17 @@ static inline __vector float __lzs_f16cx4_load(const ggml_fp16_t * x) {
855
  tmp[i] = GGML_FP16_TO_FP32(x[i]);
856
  }
857
 
858
- return vec_xl(0, tmp);
 
 
859
  }
860
 
861
  static inline void __lzs_f16cx4_store(ggml_fp16_t * x, __vector float y) {
862
  float arr[4];
863
 
864
- vec_xst(y, 0, arr);
 
 
865
 
866
  for (int i = 0; i < 4; i++) {
867
  x[i] = GGML_FP32_TO_FP16(arr[i]);
 
855
  tmp[i] = GGML_FP16_TO_FP32(x[i]);
856
  }
857
 
858
+ // note: keep type-cast here to prevent compiler bugs
859
+ // see: https://github.com/ggml-org/llama.cpp/issues/12846
860
+ return vec_xl(0, (const float *)(tmp));
861
  }
862
 
863
  static inline void __lzs_f16cx4_store(ggml_fp16_t * x, __vector float y) {
864
  float arr[4];
865
 
866
+ // note: keep type-cast here to prevent compiler bugs
867
+ // see: https://github.com/ggml-org/llama.cpp/issues/12846
868
+ vec_xst(y, 0, (float *)(arr));
869
 
870
  for (int i = 0; i < 4; i++) {
871
  x[i] = GGML_FP32_TO_FP16(arr[i]);