-
Notifications
You must be signed in to change notification settings - Fork 249
LDS access proposal #29
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
Conversation
// sample 3: | ||
let lds = LdsWriter::<u32>::new(); | ||
|
||
lds.write_thread_idx(0); | ||
lds.write_thread_idx(666); // race? | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine. It's just consecutive writes to the same address, the later write wins due to program order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah - this was mostly to discuss what the potential rules from the Rust point of view are. However, since this shouldn't ever lead to invalid data I think we're fine. We could probably elide the first store entirely in this case.
let wrt = rdr.barrier(); | ||
wrt.write_thread_idx(12234); | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part seems fine as long as rdr.barrier()
does an OpControlBarrier. The part above with barriers in non-uniform control flow is a problem, but it's orthogonal.
Non-uniform control flow is a problem, but I think if the implementation of My understanding is that safe Rust can still deadlock, which is what may happen in the examples where barriers are inside of control flow. |
@Tobski proposed this in chat as an alternative:
|
Would it be sensible for the compiler to move the OpControlBarrier out of the controlflow? I'm expecting problems with deeply nested control flow but it might be worth exploring.
Rust can still deadlock - it's not one of it's safety guarantees. A quick search gives this: fn main() {
let (tx1, rx1) = channel();
let (tx2, rx2) = channel();
spawn(proc() {
println!("Waiting for result 1");
rx1.recv();
println!("Sending result 2");
tx2.send(());
});
println!("Waiting for result 2");
rx2.recv();
println!("Sending result 1");
tx1.send(());
} |
#8 earlier discussion |
I think you need to define what code means at the Rust level. It's possible that perhaps there's a reasonable definition which, as a consequence, requires moving That said, the |
As an non graphics programmer, I think it would nice to include more context in the RFC, as right now there's not a lot. The RFC doesn't explain what "LDS" is for example, and googling "LDS graphics" brings up graphics for the Church of Latter Day Saints, nothing about "Local Data Share". |
hey, the utah teapot is graphics-y and is clearly from utah, so church of LDS is of course related to graphics, right? :D (sorry) |
"LDS shader" gives heaps of resources that will explain every detail to you if you want, I don't think we should need to explain these things in these kinds of discussions, and I suggest we don't derail this one further. However, if you came here looking for an introduction to GPU programming, be sure to check out https://gpuopen.com/learn/optimizing-gpu-occupancy-resource-usage-large-thread-groups/ and https://anteru.net/blog/2018/even-more-compute-shaders/ |
What's maybe a little bit confusing even for non-console graphics programmers is that LDS is an AMD GCN-specific abbreviation, it might be better to use a more generic term like groupshared memory. |
I disagree - we need to keep in mind both the audience to this repository as well as contributors. Not everyone has the same expertise areas, and the real magic happens when cross-expertise discussion happens - and that means giving background and context. It doesn't have to be long, or take much time to write - for example, the second paragraph in this comment would have been immensely helpful for both me and others, and would have saved everyone time. In any case, on a pure value basis rather than culture, explaining context and definitions opens up new collaborators who may not have been able to contribute before, and that's always good. |
Closing this due to inactivity, if we'd like to start pushing on this again, we can reopen. |
No description provided.