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

Integrate std::prm memory tracking for class Enumeration. #4735

Merged
merged 26 commits into from
Mar 1, 2024

Conversation

abigalekim
Copy link
Contributor

@abigalekim abigalekim commented Feb 16, 2024

All member vector variables of the Enumeration class have PMR tracking.


TYPE: NO_HISTORY
DESC: Integrate std::prm memory tracking for class Enumeration.

- Deleted default constructor of class tiledb::sm::ArraySchema
- Changed copy_with_new_memory_tracker to clone
- Deleted constructor with pmr vector.

Problems remaining:
- had to make copy constructor public since a protected one does not work with our version of make_shared.
Copy link

This pull request has been linked to Shortcut Story #40878: Integrate std::prm memory tracking for class Enumeration..

@abigalekim abigalekim changed the base branch from dev to pd/abigalekim/sc-40462/pmr-memory-tracking-arrayschema February 16, 2024 03:16
@abigalekim abigalekim requested a review from davisp February 16, 2024 03:17
@abigalekim abigalekim force-pushed the abigalekim/sc-40878/pmr-memory-tracking-enumeration branch from e29d57d to f904b16 Compare February 16, 2024 06:32
@abigalekim abigalekim force-pushed the pd/abigalekim/sc-40462/pmr-memory-tracking-arrayschema branch from 841f930 to e80e797 Compare February 16, 2024 06:59
Copy link
Contributor

@davisp davisp left a comment

Choose a reason for hiding this comment

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

Few minor changes I spotted on a quick skim. Same as for the ArraySchema PR, don't feel like you have to make those argument ordering changes yourself if you don't feel like it.

tiledb/api/c_api/enumeration/enumeration_api.cc Outdated Show resolved Hide resolved
tiledb/common/memory_tracker.h Outdated Show resolved Hide resolved
tiledb/sm/array_schema/enumeration.cc Outdated Show resolved Hide resolved
tiledb/sm/array_schema/enumeration.h Outdated Show resolved Hide resolved
tiledb/sm/c_api/tiledb.cc Outdated Show resolved Hide resolved
@abigalekim abigalekim force-pushed the abigalekim/sc-40878/pmr-memory-tracking-enumeration branch from f904b16 to e2ac764 Compare February 21, 2024 01:37
@abigalekim abigalekim requested a review from davisp February 21, 2024 01:37
Copy link
Contributor

@davisp davisp left a comment

Choose a reason for hiding this comment

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

One minor nit. Other than that I'll approve this as soon as the ArrarySchema PR is merged.

tiledb/sm/array_schema/enumeration.h Outdated Show resolved Hide resolved
@abigalekim abigalekim requested a review from davisp February 22, 2024 20:24
Base automatically changed from pd/abigalekim/sc-40462/pmr-memory-tracking-arrayschema to dev February 23, 2024 08:56
Copy link
Contributor

@davisp davisp left a comment

Choose a reason for hiding this comment

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

Ope, I caught one last thing. When we're loading enumerations normally through the Array class APIs, we're inadvertently using the REST Client's MemoryTracker instead of the Array tracker. For this function:

std::vector<shared_ptr<const Enumeration>> post_enumerations_from_rest(
const URI& uri,
uint64_t timestamp_start,
uint64_t timestamp_end,
Array* array,
const std::vector<std::string>& enumeration_names);

  std::vector<shared_ptr<const Enumeration>> post_enumerations_from_rest(
      const URI& uri,
      uint64_t timestamp_start,
      uint64_t timestamp_end,
      Array* array,
      const std::vector<std::string>& enumeration_names,
      shared_ptr<MemoryTracker> memory_tracker = nullptr);

Then in the body of that function we can just do:

if (!memory_tracker) {
  memory_tracker = memory_tracker_;
}

That way it won't affect anything other than where we specify which MemoryTracker at the call site.

Then we just have to add the memory_tracker_ argument here:

https://github.com/TileDB-Inc/TileDB/blob/dev/tiledb/sm/array/array.cc#L591-L596

@abigalekim
Copy link
Contributor Author

Ope, I caught one last thing. When we're loading enumerations normally through the Array class APIs, we're inadvertently using the REST Client's MemoryTracker instead of the Array tracker. For this function:

std::vector<shared_ptr<const Enumeration>> post_enumerations_from_rest(
const URI& uri,
uint64_t timestamp_start,
uint64_t timestamp_end,
Array* array,
const std::vector<std::string>& enumeration_names);

  std::vector<shared_ptr<const Enumeration>> post_enumerations_from_rest(
      const URI& uri,
      uint64_t timestamp_start,
      uint64_t timestamp_end,
      Array* array,
      const std::vector<std::string>& enumeration_names,
      shared_ptr<MemoryTracker> memory_tracker = nullptr);

Then in the body of that function we can just do:

if (!memory_tracker) {
  memory_tracker = memory_tracker_;
}

That way it won't affect anything other than where we specify which MemoryTracker at the call site.

Then we just have to add the memory_tracker_ argument here:

https://github.com/TileDB-Inc/TileDB/blob/dev/tiledb/sm/array/array.cc#L591-L596

Fixed this comment!

Copy link
Contributor

@davisp davisp left a comment

Choose a reason for hiding this comment

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

Nice work!

@KiterLuc KiterLuc merged commit 47e70d8 into dev Mar 1, 2024
57 checks passed
@KiterLuc KiterLuc deleted the abigalekim/sc-40878/pmr-memory-tracking-enumeration branch March 1, 2024 10:50
davisp pushed a commit to davisp/TileDB that referenced this pull request Mar 3, 2024
…nc#4735)

All member vector variables of the Enumeration class have PMR tracking.

---
TYPE: NO_HISTORY
DESC: Integrate std::prm memory tracking for class `Enumeration`.

---------

Co-authored-by: Luc Rancourt <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants