Skip to content

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

Merged
ZihengJiang merged 5 commits into
apache:mainfrom
tkonolige:wrapping_test
Jan 27, 2021
Merged

ZihengJiang merged 5 commits into
apache:mainfrom
tkonolige:wrapping_test

Conversation

@tkonolige

Copy link
Copy Markdown
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

tqchen commented Jan 15, 2021

Copy link
Copy Markdown
Member

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.

@altanh altanh left a comment

Copy link
Copy Markdown
Contributor

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

Comment thread python/tvm/topi/random/kernel.py Outdated
Comment thread python/tvm/topi/random/kernel.py
@altanh

altanh commented Jan 27, 2021

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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