Add inline, remove unused exception variable name, safe float computation#324
Add inline, remove unused exception variable name, safe float computation#324mnorris11 wants to merge 1 commit into
Conversation
rfsaliev
left a comment
There was a problem hiding this comment.
Thank you @mnorris11 , for the contribution.
There are some suggestions, proposals and comments
| try { | ||
| unsafe_assign(fn); | ||
| } catch (const ThreadCrashedError& err) { | ||
| } catch (const ThreadCrashedError&) { |
There was a problem hiding this comment.
| } catch (const ThreadCrashedError&) { | |
| } catch (const ThreadCrashedError& SVS_UNUSED(err)) { |
| throw ANNEXCEPTION( | ||
| "Expected to get an exception from a crashed thread but no " | ||
| "exception was thrown!" | ||
| ); |
There was a problem hiding this comment.
Please, use SVS formatting rules.
| namespace svs { | ||
| namespace runtime { | ||
| namespace v0 { | ||
| inline namespace v0 { |
There was a problem hiding this comment.
IMHO, this change will negatively affect usability and maintainability for further API major versions.
Instead, a macro can be used here which value defined in version.h depending on SVS_RUNTIME_API_VERSION, e.g.:
#if (SVS_RUNTIME_API_VERSION == 0)
...
#define SVS_API_V0 inline namespace v0
...
#endif
With usage aka:
| namespace svs { | |
| namespace runtime { | |
| namespace v0 { | |
| inline namespace v0 { | |
| namespace svs { | |
| namespace runtime { | |
| SVS_API_V0 { | |
| ... | |
| } // SVS_API_V0 |
…ids (#329) This pull request updates the initialization logic for the inter-query thread pool in the `IVFIndex` class to better handle cases where the number of threads may exceed the number of centroids, and to provide improved validation and logging. The changes introduce a new static factory method, `make_inter_query_threadpool`, with multiple overloads to handle different types of thread pool prototypes and to ensure the thread pool size does not exceed the number of centroids. Note: Change in PR is inspired by #324 made by @mnorris11 **Thread pool initialization improvements:** * Added a generic static method `make_inter_query_threadpool` that validates the requested thread pool size against the number of centroids, throwing an exception if there are too many threads. ([include/svs/index/ivf/index.hR577-R629](diffhunk://#diff-1615eba8a8acc0ba0e76533aceb833421c0d885ebd224543e46490f6b8c9a50dR577-R629)) * Added a specialization for `size_t` thread pool prototypes, which automatically reduces the thread pool size to match the number of centroids and logs a warning if resizing is necessary. ( [include/svs/index/ivf/index.hR577-R629](diffhunk://#diff-1615eba8a8acc0ba0e76533aceb833421c0d885ebd224543e46490f6b8c9a50dR577-R629) ) * Added a specialization for thread pool prototypes that support resizing, which also logs a warning and resizes the thread pool if needed. ([include/svs/index/ivf/index.hR577-R629](diffhunk://#diff-1615eba8a8acc0ba0e76533aceb833421c0d885ebd224543e46490f6b8c9a50dR577-R629)) **Integration with constructor:** * Updated the `IVFIndex` constructor to use the new `make_inter_query_threadpool` method, ensuring thread pool size validation and logging are applied during initialization. ([include/svs/index/ivf/index.hL151-R153](diffhunk://#diff-1615eba8a8acc0ba0e76533aceb833421c0d885ebd224543e46490f6b8c9a50dL151-R153)) --------- Co-authored-by: mnorris11 <mnorris@meta.com>
|
Thank you @mnorris11 for the PR. |
gotcha, let me know if I should do anything on this PR! |
|
@mnorris11 are you using clang compiler internally? Or can you provide some more details about what circumstances led to these failures? We can try to align our CI with these cases to avoid issues moving forward. |
This is a patch to get it to work internally. It would be easier if things are in SVS, so next version upgrade we don't need to apply this patch.
Reason for changes: