Fix result validation in benchmark-q4_0-matmult #987
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While working on #933, I noticed that the benchmark always prints zeroes instead of tensor sums:
This looks weird because these sums are later used to compare the result of quantized matrix multiplication against the result of regular one, so they are not supposed to be zero. This is my interpretation of why that happens:
tensor_sum_elements()
only sums FP32 tensors and returns 0 for everything else6
ggml
where6
corresponded toGGML_TYPE_F32
ggml_type
definition was changed later so that6
now meansGGML_TYPE_I32
tensor_sum_elements()
now returns 0 when passed a tensor withGGML_TYPE_F32
As far as I can see, there are no compelling reasons to hardcode
6
in the type comparison. Changing6
toGGML_TYPE_F32
both makes the code correct (I hope) again and prevents similar errors in the future. Here's what the benchmark prints now: