Skip to content

Comments

Address follow-up comments on multistream pr #13495#13992

Merged
jslhcl merged 7 commits intomainfrom
leca/minimalBuild
Jan 4, 2023
Merged

Address follow-up comments on multistream pr #13495#13992
jslhcl merged 7 commits intomainfrom
leca/minimalBuild

Conversation

@jslhcl
Copy link
Contributor

@jslhcl jslhcl commented Dec 16, 2022

Description

This PR is to address follow-up comments for the multi-stream pr #13495

Changes including:

  • Make StreamAwareArena transparent to minimal build
  • Make DeviceStreamCollection transparent to minimal build
  • Replace ORT_MUST_USE_RESULT with [[nodiscard]]
  • Remove unnecessary shared_ptr

Motivation and Context

This PR is to address follow-up comments for the multi-stream pr #13495

@pranavsharma
Copy link
Contributor

pranavsharma commented Dec 16, 2022

Can you please change the title and desc of this PR to say that you're addressing follow-up comments?


In reply to: 1354076579


In reply to: 1354076579


In reply to: 1354076579

@snnn
Copy link
Contributor

snnn commented Dec 16, 2022

nodiscard is in C++17. Actually, you can replace all ORT_MUST_USE_RESULT with [[nodiscard]] to make the code more readable.


In reply to: 1354336784


In reply to: 1354336784


In reply to: 1354336784

<< stats_.DebugString();
}

#ifdef ENABLE_STREAM
Copy link
Contributor

@snnn snnn Dec 16, 2022

Choose a reason for hiding this comment

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

It's better to add a prefix to such names to avoid conflicts. You added this macro def to all external libraries, for example protobuf, which is not needed. #Resolved

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, this should be renamed to something like ORT_ENABLE_STREAM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion. Let me talk to Cheng about this name change once he is back

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed

@jslhcl jslhcl changed the title fix Scott's comments on multistream pr #13495 Address follow-up comments on multistream pr #13495 Dec 16, 2022
@jslhcl
Copy link
Contributor Author

jslhcl commented Dec 16, 2022

Changed as you suggested


In reply to: 1354076579

@jslhcl
Copy link
Contributor Author

jslhcl commented Dec 16, 2022

Thanks. I will leave it as unchanged


In reply to: 1354336784

max_dead_bytes_per_chunk,
initial_growth_chunk_size_bytes));
#else
ORT_THROW("StreamAwareArena should be transparent to minimal build.");
Copy link
Contributor

@snnn snnn Dec 18, 2022

Choose a reason for hiding this comment

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

But minimal build typical doesn't have exceptions. So, here it will simply crash? #Resolved

Copy link
Contributor

Choose a reason for hiding this comment

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

A minimal build can optionally disable exceptions (but typically if you're wanting the minimum size you'd do that).

The ORT_THROW macro in that build will log the error and abort, which is all it can do.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for clarification. Then I just close this comment

using WaitNotificationFn = std::function<void(Stream&, synchronize::Notification&)>;
void* AllocateBufferWithOptions(std::shared_ptr<IAllocator>& allocator, size_t size, bool use_reserve, Stream* stream, WaitNotificationFn wait_fn);
void* AllocateBufferWithOptions(IAllocator* allocator, size_t size, bool use_reserve, Stream* stream, WaitNotificationFn wait_fn);

Copy link
Contributor

@skottmckay skottmckay Dec 18, 2022

Choose a reason for hiding this comment

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

nit: IAllocator& so the API communicates it requires the value to be non-null (at least the current implementation does). #Resolved

@skottmckay
Copy link
Contributor

skottmckay commented Dec 19, 2022

Thanks. I will leave it as unchanged

I was actually asking from them all to change to use nodiscard to a) be consistent and b) use a built-in language feature in preference to our macro.


In reply to: 1356930685


In reply to: 1356930685

@jslhcl
Copy link
Contributor Author

jslhcl commented Dec 21, 2022

Sorry for the misunderstanding. Replaced ORT_MUST_USE_RESULT with nodiscard


In reply to: 1356930685

snnn
snnn previously approved these changes Dec 26, 2022
skottmckay
skottmckay previously approved these changes Jan 3, 2023
Copy link
Contributor

@skottmckay skottmckay left a comment

Choose a reason for hiding this comment

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

:shipit:

@jslhcl jslhcl dismissed stale reviews from skottmckay and snnn via 4f819c4 January 3, 2023 19:00
@jslhcl jslhcl merged commit b29a1c7 into main Jan 4, 2023
@jslhcl jslhcl deleted the leca/minimalBuild branch January 4, 2023 00:33
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.

5 participants