-
Notifications
You must be signed in to change notification settings - Fork 371
fix(//core/conversion/converters/Weights): Fix buffer allocation for weights data #378
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
Conversation
weights data that occassionally may cause segfaults and causes issues with importing FP16 weights Signed-off-by: Naren Dasan <naren@narendasan.com> Signed-off-by: Naren Dasan <narens@nvidia.com>
@andi4191 can you verify this change fixes the observed segfaults? |
I would still say that the compiler should still not be considered thread-safe yet. There's at least a few parts that may still have issues (Logger, Runtime). |
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.
Code conforms to Python style guidelines
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.
Code conforms to C++ style guidelines
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.
Code conforms to Python style guidelines
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.
Code conforms to C++ style guidelines
Tested it for a few iterations. It passes everytime. |
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.
Minor comment. LGTM
@@ -80,9 +80,29 @@ Weights::Weights(ConversionCtx* ctx, at::Tensor t) { | |||
|
|||
// Store the data in the conversion context so it remains until building is | |||
// complete | |||
void* buf = malloc(t_cpu.numel() * sizeof(float)); | |||
|
|||
void* 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.
Should be initialized to nullptr.
Signed-off-by: Naren Dasan <naren@narendasan.com> Signed-off-by: Naren Dasan <narens@nvidia.com>
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.
Code conforms to C++ style guidelines
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.
Code conforms to Python style guidelines
Description
The memcpy for weights tensors over copies when the Tensor is not a FP32 tensor. This seems to be the root cause of segfaults observed in #326 as well as failing DLA tests on aarch64 when users try to compile a model that is already in FP16.
Fixes #326
Type of change
Please delete options that are not relevant and/or add your own.
Checklist: