File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -1151,8 +1151,12 @@ static const char * GGML_GLU_OP_NAME[GGML_GLU_OP_COUNT] = {
11511151static_assert (GGML_GLU_OP_COUNT == 5 , "GGML_GLU_OP_COUNT != 5" );
11521152
11531153
1154- static_assert (sizeof (struct ggml_object )%GGML_MEM_ALIGN == 0 , "ggml_object size must be a multiple of GGML_MEM_ALIGN" );
1155- static_assert (sizeof (struct ggml_tensor )%GGML_MEM_ALIGN == 0 , "ggml_tensor size must be a multiple of GGML_MEM_ALIGN" );
1154+ #define GGML_ASSERT_ALIGNED_MSG (N , A , MSG ) \
1155+ static_assert((N) % (A) == 0, MSG " (size=" #N ", align=" #A ", padding=" #((A - (N % A)) % A) ")")
1156+
1157+ // check that the tensor and object sizes are multiples of GGML_MEM_ALIGN
1158+ GGML_ASSERT_ALIGNED_MSG (sizeof (struct ggml_object ), GGML_MEM_ALIGN , "ggml_object size must be a multiple of GGML_MEM_ALIGN" );
1159+ GGML_ASSERT_ALIGNED_MSG (sizeof (struct ggml_tensor ), GGML_MEM_ALIGN , "ggml_tensor size must be a multiple of GGML_MEM_ALIGN" );
11561160
11571161
11581162////////////////////////////////////////////////////////////////////////////////
You can’t perform that action at this time.
0 commit comments