Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for empty loops and memory handling, handling of generated files #67

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,6 @@ __pycache__/
poetry.toml

build/
logs/
logs/
include/bitnet-lut-kernels.h
include/kernel_config.ini
18 changes: 0 additions & 18 deletions src/ggml-bitnet-lut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ void ggml_bitnet_init(void) {
}
initialized = true;

// if (wrapper == nullptr) {
// wrapper = new BITNET::BITNETGeMMWrapper<bitnet_bitnet_float_type>();
// }
if (bitnet_tensor_extras == nullptr) {
bitnet_tensor_extras = new bitnet_tensor_extra[GGML_BITNET_MAX_NODES];
}
Expand All @@ -32,12 +29,6 @@ void ggml_bitnet_free(void) {
}
initialized = false;

// delete wrapper;
// wrapper = nullptr;
for (size_t i = 0; i < bitnet_tensor_extras_index; i++) {
// aligned_free(bitnet_tensor_extras[i].qweights);
// aligned_free(bitnet_tensor_extras[i].scales);
}
delete[] bitnet_tensor_extras;
bitnet_tensor_extras = nullptr;
}
Expand Down Expand Up @@ -99,9 +90,6 @@ void ggml_bitnet_init(void) {
}
initialized = true;

// if (wrapper == nullptr) {
// wrapper = new BITNET::BITNETGeMMWrapper<bitnet_bitnet_float_type>();
// }
if (bitnet_tensor_extras == nullptr) {
bitnet_tensor_extras = new bitnet_tensor_extra[GGML_BITNET_MAX_NODES];
}
Expand All @@ -116,12 +104,6 @@ void ggml_bitnet_free(void) {
}
initialized = false;

// delete wrapper;
// wrapper = nullptr;
for (size_t i = 0; i < bitnet_tensor_extras_index; i++) {
// aligned_free(bitnet_tensor_extras[i].qweights);
// aligned_free(bitnet_tensor_extras[i].scales);
}
delete[] bitnet_tensor_extras;
bitnet_tensor_extras = nullptr;
}
Expand Down
2 changes: 2 additions & 0 deletions src/ggml-bitnet-mad.cpp

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good Job!

Copy link
Author

@bmerkle bmerkle Nov 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Gabrielfernandes7 Can you merge this into main ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfortunatelly, i cannot, but i would like.

Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ size_t quantize_i2_s(const float * src, void * dst, int64_t nrow, int64_t n_per_
float* scale_ptr = (float*)((char*)i2_weight + n / 4);
scale_ptr[0] = i2_scale;

free(q8);

// 32B for alignment
return nrow * row_size / 4 + 32;
}
Expand Down