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

feat: RNG is now a planner argument, expose XORShift generation #29

Merged
merged 18 commits into from
Oct 18, 2024

Conversation

zkingston
Copy link
Contributor

No description provided.

Copy link
Contributor

@wbthomason wbthomason left a comment

Choose a reason for hiding this comment

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

Mostly looks good, thanks for this! Left some comments about style fixes and a few potential small correctness issues. Are all the formatting changes from the shift to Clang 18, or did you also change the clang-format config - in which case that's missing from this PR.

README.md Outdated Show resolved Hide resolved
scripts/README.md Outdated Show resolved Hide resolved
scripts/README.md Outdated Show resolved Hide resolved
scripts/evaluate_mbm.py Outdated Show resolved Hide resolved
scripts/flying_sphere.py Outdated Show resolved Hide resolved
float min_val;
float max_val;

avx_xorshift128plus_key_t key{};
using IntVector = Vector<SIMDVector<__m256i>, 1, dim>;
Copy link
Contributor

Choose a reason for hiding this comment

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

We should probably use a specialization of the IntVector template defined in vector.hh instead?

src/impl/vamp/random/xorshift.hh Outdated Show resolved Hide resolved
src/impl/vamp/random/xorshift.hh Outdated Show resolved Hide resolved
Comment on lines 462 to 467
constexpr float lo = -0.5F;
constexpr float hi = 0.5F;
const auto normalized = D(apply<S::template map_to_range<typename OtherT::S::VectorT>>(v.data));
return min_v + (normalized * (max_v - min_v));

return min_v + ((normalized - lo) / (hi - lo)) * (max_v - min_v);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Was this broken before? We should also be using the scalar types specified by the vector interface rather than hardcoding float.

const auto normalized = D(apply<S::template map_to_range<typename OtherT::S::VectorT>>(v.data));
return min_v + (normalized * (max_v - min_v));

return min_v + ((normalized - lo) / (hi - lo)) * (max_v - min_v);
Copy link
Contributor

Choose a reason for hiding this comment

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

Confused about this change - doesn't the division simplify to a denominator of 1?

@zkingston
Copy link
Contributor Author

All formatting changes are from updating to Clang 18. I'll take a look through the suggestions!

@zkingston zkingston requested a review from wbthomason October 18, 2024 13:22
Copy link
Contributor

@wbthomason wbthomason left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! Leaving the unresolved but out-of-scope comments open for later.

@wbthomason wbthomason merged commit 0d13c50 into main Oct 18, 2024
9 checks passed
@wbthomason wbthomason deleted the feat-rng branch October 18, 2024 18:32
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.

2 participants