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

Support 'var' intent on gpuizables loop #25972

Open
stonea opened this issue Sep 20, 2024 · 1 comment
Open

Support 'var' intent on gpuizables loop #25972

stonea opened this issue Sep 20, 2024 · 1 comment

Comments

@stonea
Copy link
Contributor

stonea commented Sep 20, 2024

Currently we error out (saying that var intents aren't supported for foreach) if you attempt something like this:

foreach i in 1..100 with (var x = new MyThing()) { } 

But this might be a useful way of making a thread-private variable for a gpuizable loop (which might be useful in cases where @gpu.itersPerThread is not 1).

@stonea stonea changed the title Support 'var' intent on gpuizable loop Support 'var' intent on gpuizables loop Sep 20, 2024
@e-kayrakli
Copy link
Contributor

I bumped into a case where I needed this. In my case, I am using curand to have a per-thread RNG for a Monte Carlo simulation. I realized that the RNG initialization was my bottleneck. So, I wanted to use gpu.itersPerThread combined with a thread-private RNG.

In this particular case, doing it manually was relatively easy and non-heroic. Therefore, this is not a blocker for me, but with itersPerThread, it would certainly be a valuable addition.

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

No branches or pull requests

2 participants