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

Core: rework Tag handling #340

Merged
merged 2 commits into from
Jun 14, 2024
Merged

Core: rework Tag handling #340

merged 2 commits into from
Jun 14, 2024

Conversation

wirew0rm
Copy link
Member

@wirew0rm wirew0rm commented May 8, 2024

The automatic tag forwarding implemented in Block::workInternal was was not working for ASYNC ports since in this case the Block cannot determine a priori if samples will be consumed and consequently cannot perform an early return ahead of the unconditional tag forwarding and consumption.

This change introduces an extension of the ConsumableInputRange, which additionally takes care of consuming all tags up to the first sample of the currently processed chunk.

Also all tag merging logic is moved from Port to Block, while the logic for preparing the consumableInput or producableOutput ranges is moved into the Port.

Copy link

sonarcloud bot commented May 8, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
49.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

@@ -311,6 +311,12 @@ struct DummyConsumableSpan {
};
static_assert(ConsumableSpan<DummyConsumableSpan<int>>);

template<typename T>
struct DummyConsumablePortSpan: public DummyConsumableSpan<T> {
Copy link
Member

Choose a reason for hiding this comment

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

The tags etc should be absorbed in the concept ConsumableSpan etc.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure I understand.
There are 2 concepts ConsumableSpan(no tag handling) and ConsumablePortSpan(the former + added tag handling). DummyConsumableSpan and DummyConsumablePortSpan are mock implementations of the respective concepts needed by the machinery of Block::prepareStreams.

@wirew0rm wirew0rm force-pushed the BlockTagHandling branch 5 times, most recently from a784c5e to ff97be4 Compare June 14, 2024 09:47
Copy link
Contributor

@drslebedev drslebedev left a comment

Choose a reason for hiding this comment

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

Thanks for the great PR and all your effort in making all the unit tests run smoothly. 👍

The changes look good to me. We’ve already discussed some modifications privately, and I worked with this update while attempting to fix a failing test!

I’ve added a few minor comments and suggestions for improvements. The PR can be merged after reviewing the comments.

blocks/basic/test/qa_DataSink.cpp Outdated Show resolved Hide resolved
blocks/basic/test/qa_sources.cpp Outdated Show resolved Hide resolved
core/include/gnuradio-4.0/Block.hpp Outdated Show resolved Hide resolved
core/include/gnuradio-4.0/Block.hpp Outdated Show resolved Hide resolved
core/include/gnuradio-4.0/CircularBuffer.hpp Outdated Show resolved Hide resolved
core/test/qa_Settings.cpp Outdated Show resolved Hide resolved
core/include/gnuradio-4.0/CircularBuffer.hpp Outdated Show resolved Hide resolved
core/include/gnuradio-4.0/CircularBuffer.hpp Outdated Show resolved Hide resolved
core/test/qa_Settings.cpp Outdated Show resolved Hide resolved
core/test/qa_buffer.cpp Outdated Show resolved Hide resolved
@wirew0rm wirew0rm force-pushed the BlockTagHandling branch 2 times, most recently from f294593 to 9c28ab0 Compare June 14, 2024 13:44
The automatic tag forwarding implemented in Block::workInternal was was not working for
ASYNC ports since in this case the Block cannot determine a priori if samples will
be consumed and consequently cannot perform an early return ahead of the unconditional
tag forwarding and consumption.

This change introduces an extension of the ConsumableInputRange, which additionally takes
care of consuming all tags up to the first sample of the currently processed chunk.

Also all tag merging logic is moved from Port to Block, while the logic for preparing the
consumableInput or producableOutput ranges is moved into the Port.

Only forward initial tags before starting the flowgraph instead of
during initialisation, when the buffers are not connected yet.

In CircularBuffer, make PublishableOutputRange pubblish in destructor

This makes the PublishableOutputRange behave like the corresponding
InputRange by only marking samples for being published and only
publishing in the destructor.

Evaluate actually processed samples after process bulk was called.

Add port unittest and fix off by one problem

Change sequence from -1 to 0 to avoid tag offset

Signed-off-by: Alexander Krimm <[email protected]>
Signed-off-by: Alexander Krimm <[email protected]>
Copy link

sonarcloud bot commented Jun 14, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
30.4% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

@wirew0rm wirew0rm merged commit c51a5d5 into main Jun 14, 2024
8 of 10 checks passed
@wirew0rm wirew0rm deleted the BlockTagHandling branch June 14, 2024 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants