Skip to content

Conversation

karthickai
Copy link
Contributor

@karthickai karthickai commented Sep 22, 2025

Stacked PRs:


Add hl.rand op with seed arg lowering to tl.rand

karthickai added a commit that referenced this pull request Sep 22, 2025
stack-info: PR: #652, branch: karthickai/stack/2
@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 22, 2025
karthickai added a commit that referenced this pull request Sep 22, 2025
stack-info: PR: #652, branch: karthickai/stack/2
karthickai added a commit that referenced this pull request Sep 22, 2025
stack-info: PR: #652, branch: karthickai/stack/2
@karthickai karthickai requested a review from jansel September 22, 2025 03:18
test/test_rng.py Outdated
def test_hl_rand_3d(self):
import helion

@helion.kernel(ref_mode=helion.RefMode.EAGER)
Copy link
Contributor

@yf225 yf225 Sep 22, 2025

Choose a reason for hiding this comment

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

Maybe remove the ref_mode setting? The code as-is will explicitly test ref eager mode instead of normal Helion compile mode, but here I believe the intent is to test compile mode. (We have other harness to run tests in ref eager mode automatically so usually we don't need to worry about it.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks for the catch! I added that line for debugging to check the ref implementation and forgot to remove it. I’ve updated it now.

test/test_rng.py Outdated
self.assertTrue(torch.all(output < 1.0), "All values should be < 1")

def test_hl_rand_3d(self):
import helion
Copy link
Contributor

Choose a reason for hiding this comment

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

Can likely remove

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've removed that line.

stack-info: PR: #652, branch: karthickai/stack/2
Copy link
Contributor

@yf225 yf225 left a comment

Choose a reason for hiding this comment

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

thanks @karthickai !

@karthickai karthickai merged commit 8c8b99f into main Sep 23, 2025
13 checks passed

numel = " * ".join(shape_str.strip("[]").split(","))
seed_ast = state.ast_arg(1)
offs_expr = f"tl.arange(0, {numel}).reshape({shape_str})"
Copy link
Contributor

Choose a reason for hiding this comment

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

This is incorrect.

  1. Every tile will get the same RNG values.
  2. The RNG values will depend on the tile size due to the reshape

jansel added a commit that referenced this pull request Sep 26, 2025
jansel added a commit that referenced this pull request Sep 26, 2025
This reverts commit 8c8b99f.

stack-info: PR: #698, branch: jansel/stack/154
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants