-
Notifications
You must be signed in to change notification settings - Fork 24
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
enable allocator for quantizers #80
Conversation
computer.buf_ = reinterpret_cast<uint8_t*>(this->allocator_->Allocate(this->code_size_)); | ||
} catch (const std::bad_alloc& e) { | ||
computer.buf_ = nullptr; | ||
logger::error("bad alloc when init computer buf"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it matter for memcpy(computer.buf_, query, this->code_size_)
when computer.buf_ is nullpter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
computer.buf_ = reinterpret_cast<uint8_t*>(this->allocator_->Allocate(aligned_size)); | ||
} catch (const std::bad_alloc& e) { | ||
computer.buf_ = nullptr; | ||
logger::error("bad alloc when init computer buf"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
0f610f9
to
91bb191
Compare
d97b00e
to
068f12a
Compare
@@ -35,7 +35,7 @@ template <typename T> | |||
class Computer : public ComputerInterface { | |||
public: | |||
~Computer() { | |||
delete[] buf_; | |||
quantizer_->ReleaseComputer(*this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why use quantizer to release anther class instance ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the buf is allocated by the quantizer
src/quantization/sq8_quantizer.h
Outdated
@@ -96,7 +101,8 @@ SQ8Quantizer<metric>::TrainImpl(const vsag::DataType* data, uint64_t count) { | |||
if (this->is_trained_) { | |||
return true; | |||
} | |||
std::vector<DataType> upperBound(this->dim_, std::numeric_limits<DataType>::lowest()); | |||
Vector<DataType> upperBound( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
upper_bound
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
- use allocator to manager Computer - use allocator for quantizer - update ip to 1-ip for InnerProduct metric - ignore flatten_datacell_test which will be enable by following pr Signed-off-by: LHT129 <tianlan.lht@antgroup.com>
068f12a
to
827a8ca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
#40