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

Unexpected behavior when performing operations involving multiple window reads #12

Open
MMukundi opened this issue Sep 29, 2022 · 6 comments

Comments

@MMukundi
Copy link
Collaborator

Reproduction:

int main() {
    // -- SNIP --
    win.fill(1);
    std::vector<int> result(25);

    // Problem here:
    4*win(1,{0,0},{4,4})*win(1,{0,0},{4,4}) >> result.data();

    win.flush();
    // -- SNIP --
}

Expected behavior:

result[0] == 4

Observed behavior:

result[0] == 64

Temporary solution:

    // Quick fix; add parenthesis around the window operations
    4*(win(1,{0,0},{4,4})*win(1,{0,0},{4,4}))>> result.data();
@MMukundi MMukundi changed the title Unexpected behaviour when performing operations involving two windows Unexpected behavior when performing operations involving multiple window reads Sep 29, 2022
@sg0
Copy link
Owner

sg0 commented Sep 29, 2022

Good catch, I think this is a bug.

@sg0
Copy link
Owner

sg0 commented Sep 29, 2022

Does 4*win(1,{0,0},{4,4})>> result.data(); evaluate correctly?

@MMukundi
Copy link
Collaborator Author

Oddly, 4*win(1,{0,0},{4,4})>> result.data(); correctly evaluates to 4

@sg0
Copy link
Owner

sg0 commented Sep 29, 2022

And what does win(1,{0,0},{4,4}) >> result.data() return after 4*win(1,{0,0},{4,4})>> result.data();? I'm trying to determine if temporaries are stored in the buffer underlying a window itself.

@MMukundi
Copy link
Collaborator Author

MMukundi commented Oct 4, 2022

4*win(1,{0,0},{4,4}) = 4
win(1,{0,0},{4,4}) = 1
This is true whether or not there is a synchronization call between the two operations

@sg0
Copy link
Owner

sg0 commented Oct 9, 2022

In shared memory, data can be loaded on another process's memory without relying on synch, especially if data size is small. This is something we must poke into, as in assessing this issue.

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

No branches or pull requests

2 participants