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

BugFix: MsgSpatial interaction radius correct when not a factor of en… #1160

Merged
merged 3 commits into from
Dec 15, 2023

Conversation

Robadob
Copy link
Member

@Robadob Robadob commented Dec 12, 2023

todo

Closes #1157

@Robadob Robadob added the bug label Dec 12, 2023
@Robadob Robadob self-assigned this Dec 12, 2023
@Robadob Robadob force-pushed the bugfix_wrapped_spatial_width_no_factor branch from b880ae9 to 346bd67 Compare December 13, 2023 11:23
@Robadob
Copy link
Member Author

Robadob commented Dec 13, 2023

I did run full test suite of a Debug build, just closed it without thinking to copy results.

@Robadob Robadob marked this pull request as ready for review December 13, 2023 12:19
Copy link
Member

@ptheywood ptheywood left a comment

Choose a reason for hiding this comment

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

Tests all pass under linux.

Code looks sane, other than maybe the comment about the epsilon value selected.
Prolly fine to merge but might be worth thinking about the epsilon / testing with some edge-casey (but still sensible, allocations will fail for very high bin counts) comm radiuses / env widths to make sure the epsilon check still behaves.

If / when we have a fp64 spatial comm (#959) that would need a different epsilon due to increased precision.

Approving anyway, but might warrent a chagne.

@@ -500,6 +500,13 @@ class MessageSpatial2D::In {
// Return iterator at min corner of env, this should be safe
return WrapFilter(metadata, metadata->min[0], metadata->min[1]);
}
if (fmodf(metadata->max[0] - metadata->min[0], metadata->radius) > 0.00001f ||
Copy link
Member

Choose a reason for hiding this comment

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

Any particular reason/justification for this particular epsilon value?.

Though our current spatial comms is fp32 only anyway, so a magic value is fine, just why this one / is it sufficient for different values

E.g. if the comm rad is a small positive number, will this work? (though if its too small then large env widths will cause other problems anyway, so can prolly get away with a fixed arbitrary epsilon)

Tests only appear to cover a single radii/width combo.

Copy link
Member Author

Choose a reason for hiding this comment

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

Any particular reason/justification for this particular epsilon value?

Nope, as mentioned in OP...

Happy for someone to update my fmod() solution to something cleaner, floating point isn't great.

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'd rather make wrapped work at a tiny cost to perf for non-wrapped to avoid this floating point crap)

Copy link
Member

Choose a reason for hiding this comment

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

I agree that hurting wrapped more and not hurting non-wrapped is the better choice.

Given the radii and width are known on the host, we could maybe do the check there once, and then set a value on the device somewhere marking if wrapped is possioble for that message list or not? for less perf loss to wrapped usage. An extra global memory read is probably cheaper than a couple of fmodf's?

Could do it entirley on the host if we made wrapped opt-in on the message list, but I assume that's not desirable?

Not sure there's a better option than fmodf, jsut the particular epsilon might need some thought / broader testing.

@Robadob
Copy link
Member Author

Robadob commented Dec 13, 2023 via email

@ptheywood ptheywood merged commit 3e166e6 into master Dec 15, 2023
20 checks passed
@ptheywood ptheywood deleted the bugfix_wrapped_spatial_width_no_factor branch December 15, 2023 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Spatial messaging shrinks interaction radius to a factor of width, when not a factor
2 participants