Skip to content

Complation error on Fedora release 39 (Thirty Nine) with clang 17.0.6 #509

@rrambaldi

Description

@rrambaldi

Compilation fails with message:

while building BitNet on linux with clang17 I have following error:

      |                                      ^
/root/bitnet/BitNet/src/ggml-bitnet-mad.cpp:811:18: error: cannot initialize a variable of type 'int8_t *' (aka 'signed char *') with an rvalue of type 'const int8_t *' (aka 'const signed char *')
  811 |         int8_t * y_col = y + col * by;
      |                  ^       ~~~~~~~~~~~~`

possible solution:

diff --git a/src/ggml-bitnet-mad.cpp b/src/ggml-bitnet-mad.cpp
index 4ba9d65..019e25c 100644
--- a/src/ggml-bitnet-mad.cpp
+++ b/src/ggml-bitnet-mad.cpp
@@ -808,7 +808,7 @@ void ggml_vec_dot_i2_i8_s_Nx1(int n, float * s, size_t bs, const void * vx, size
             accu[iy] = _mm256_setzero_si256();
         }

-        int8_t * y_col = y + col * by;
+        const int8_t * y_col = y + col * by;

         for (int i = 0; i < group32_num; i++) {
             const uint8_t *px = x + i * 1024;
@@ -1053,4 +1053,4 @@ void ggml_vec_dot_i2_i8_s(int n, float * s, size_t bs, const void * vx, size_t b
     {
         ggml_vec_dot_i2_i8_s_1x1(n, s, bs, vx, bx, vy, by, nrc);
     }
-}

it compiles.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions