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

[PRNG] Add check to PRNG to make sure that unsigned integer arithmetic is wrapping #7287

Merged
merged 5 commits into from
Jan 27, 2021

Conversation

tkonolige
Copy link
Contributor

This PR adds a simple test to threefry_generate to make sure that unsigned integer arithmetic is wrapping. We have no guarantee of wrapping on our platforms, so this is the best we can do. I've added the test to threefry_generate as it should be called before other threefry functions and it should called infrequently.

@altanh @antinucleon @junrushao1994 @eric-haibin-lin @MarisaKirisame

@tqchen
Copy link
Member

tqchen commented Jan 15, 2021

Thanks @tkonolige. One thing to note that assert may not be available in every platform, better to put down a comment. Might be useful to have it as a separate testing function.

Copy link
Contributor

@altanh altanh left a comment

Choose a reason for hiding this comment

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

LGTM, I'd prefer if we could have the test function defined in the test file since it doesn't depend on any TOPI PRNG internals but not a huge deal

python/tvm/topi/random/kernel.py Outdated Show resolved Hide resolved
@altanh
Copy link
Contributor

altanh commented Jan 27, 2021

bump @tqchen @ZihengJiang

I think this is good to go since we resolved the assert discussion

@ZihengJiang ZihengJiang merged commit eae21b0 into apache:main Jan 27, 2021
@ZihengJiang
Copy link
Contributor

Merged. Thanks @tkonolige @altanh

alexwong pushed a commit to alexwong/tvm that referenced this pull request Feb 11, 2021
…c is wrapping (apache#7287)

* [PRNG] Add check to PRNG to make sure that unsigned integer arithmetic is wrapping

* Add threefry_test_wrapping: a manual test for wrapping unsigned arithmetic.

* fix test to actually run on the target

* formatting

* lint
electriclilies pushed a commit to electriclilies/tvm that referenced this pull request Feb 18, 2021
…c is wrapping (apache#7287)

* [PRNG] Add check to PRNG to make sure that unsigned integer arithmetic is wrapping

* Add threefry_test_wrapping: a manual test for wrapping unsigned arithmetic.

* fix test to actually run on the target

* formatting

* lint
Lokiiiiii pushed a commit to Lokiiiiii/tvm that referenced this pull request Mar 2, 2021
…c is wrapping (apache#7287)

* [PRNG] Add check to PRNG to make sure that unsigned integer arithmetic is wrapping

* Add threefry_test_wrapping: a manual test for wrapping unsigned arithmetic.

* fix test to actually run on the target

* formatting

* lint
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Mar 2, 2021
…c is wrapping (apache#7287)

* [PRNG] Add check to PRNG to make sure that unsigned integer arithmetic is wrapping

* Add threefry_test_wrapping: a manual test for wrapping unsigned arithmetic.

* fix test to actually run on the target

* formatting

* lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants