Skip to content

[SYCL] Fix handler::copy [from|to] [raw|shared] pointer. #782

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

alexeyvoronov-intel
Copy link
Contributor

@alexeyvoronov-intel alexeyvoronov-intel commented Nov 1, 2019

Case 1:
There is a call handler copy method from a pointer (used the
accessor range and offset of 0) to an accessor(with a range
of 4 and an offset of 2).

src_ptr = [0,1,2,3,4,5,6,7] // the data that the pointer points to
dest_acc = [x,x,x,x,x,x,x,x] // the data that the accessor points to
handler.copy(src_ptr, dest_acc<1>{range{4}, offset{2}}

Before this patch dest_acc had: "x x 2 3 4 5 x x"
After this patch dest_acc has:  "x x 0 1 2 3 x x"

The root cause: the destination offset was used for the source.
The fix: use the source offset for the source.

Case 2:
There is a call handler copy method from an accessor(with a range
of 4 and an offset of 2) to a pointer (used the accessor range
and offset of 0).

src_acc = [0,1,2,3,4,5,6,7] // // the data that the accessor points to
dest_ptr = [x,x,x,x,x,x,x,x] // the data that the pointer points to
handler.copy(src_acc<1>{range{4}, offset{2}, dest_ptr}

Before this patch had dest_ptr: "0 1 2 3 x x x x"
After this patch has dest_ptr:  "2 3 4 5 x x x x"

The root cause: the destination offset was used for the source.
The fix: use the source offset for the source.

Signed-off-by: Alexey Voronov [email protected]

@alexeyvoronov-intel alexeyvoronov-intel force-pushed the private/avoronov/fix_hadler_copy_with_offset branch from 2d049d1 to 0630bf8 Compare November 6, 2019 12:05
@asavonic
Copy link
Contributor

asavonic commented Nov 6, 2019

Please add more details to the commit message. A proper commit message should describe why you make the change: what was the problem with the old code, in what situation we could hit it, and why the new code is correct.

It is also not clear how the three bullets in the description are connected. Is this a single fix for a single issue?

@alexeyvoronov-intel alexeyvoronov-intel force-pushed the private/avoronov/fix_hadler_copy_with_offset branch from 0630bf8 to 9b496ee Compare November 6, 2019 23:45
@alexeyvoronov-intel
Copy link
Contributor Author

Please add more details to the commit message. A proper commit message should describe why you make the change: what was the problem with the old code, in what situation we could hit it, and why the new code is correct.

The test did not work, in the situation used by the test, the test now passes.

It is also not clear how the three bullets in the description are connected. Is this a single fix for a single issue?

They are connected by the fact that they are in the same pull-request.
The test pass now.

@alexeyvoronov-intel alexeyvoronov-intel changed the title [SYCL] Remove adding an offset inside the handler.copy(acc<->prt) method. [SYCL] Fix handler::copy [from|to] [raw|shared] pointer. Nov 6, 2019
@asavonic
Copy link
Contributor

asavonic commented Nov 7, 2019

Please add more details to the commit message. A proper commit message should describe why you make the change: what was the problem with the old code, in what situation we could hit it, and why the new code is correct.

The test did not work, in the situation used by the test, the test now passes.

Why do you think that it is a product issue, and not a test issue?

It is also not clear how the three bullets in the description are connected. Is this a single fix for a single issue?

They are connected by the fact that they are in the same pull-request.
The test pass now.

I'm not sure I followed. Why the "simplified implementation" part have to be in this patch?

@alexeyvoronov-intel
Copy link
Contributor Author

Please add more details to the commit message. A proper commit message should describe why you make the change: what was the problem with the old code, in what situation we could hit it, and why the new code is correct.

The test did not work, in the situation used by the test, the test now passes.

Why do you think that it is a product issue, and not a test issue?

There was a logical error in our implementation, it looks something like this:

void foo(SrcPrt,SrcOffset, DstPtr, DstOffset) {
    bar(SrcPrt+DstOffset, DstPtr + DstOffset); // the variable SrcOffset was left out of business
}

It is also not clear how the three bullets in the description are connected. Is this a single fix for a single issue?

They are connected by the fact that they are in the same pull-request.
The test pass now.

I'm not sure I followed. Why the "simplified implementation" part have to be in this patch?

I would split this patch into several commits, but then they will be squashed together anyway.
In fact, this patch contains the restoration of order in the variants of the copy method. But it also fixes one known problem. So I was asked to highlight that this problem is being fixed by this patch in the title of this patch.

@bader
Copy link
Contributor

bader commented Nov 7, 2019

I'm not sure I followed. Why the "simplified implementation" part have to be in this patch?

I would split this patch into several commits, but then they will be squashed together anyway.
In fact, this patch contains the restoration of order in the variants of the copy method. But it also fixes one known problem. So I was asked to highlight that this problem is being fixed by this patch in the title of this patch.

Here is good example how to handle this case: #724.

Case 1:
    There is a call handler copy method from a pointer (used the
    accessor range and offset of 0) to an accessor(with a range
    of 4 and an offset of 2).

    src_ptr = [0,1,2,3,4,5,6,7] // the data that the pointer points to
    dest_acc = [x,x,x,x,x,x,x,x] // the data that the accessor points to
    handler.copy(src_ptr, dest_acc<1>{range{4}, offset{2}}

    Before this patch dest_acc had: "x x 2 3 4 5 x x"
    After this patch dest_acc has:  "x x 0 1 2 3 x x"

    The root cause: the destination offset was used for the source.
    The fix: use the source offset for the source.

Case 2:
    There is a call handler copy method from an accessor(with a range
    of 4 and an offset of 2) to a pointer (used the accessor range
    and offset of 0).

    src_acc = [0,1,2,3,4,5,6,7] // // the data that the accessor points to
    dest_ptr = [x,x,x,x,x,x,x,x] // the data that the pointer points to
    handler.copy(src_acc<1>{range{4}, offset{2}, dest_ptr}

    Before this patch had dest_ptr: "0 1 2 3 x x x x"
    After this patch has dest_ptr:  "2 3 4 5 x x x x"

    The root cause: the destination offset was used for the source.
    The fix: use the source offset for the source.

Signed-off-by: Alexey Voronov <[email protected]>
@alexeyvoronov-intel alexeyvoronov-intel force-pushed the private/avoronov/fix_hadler_copy_with_offset branch from 9b496ee to 99347f3 Compare November 8, 2019 12:30
@alexeyvoronov-intel
Copy link
Contributor Author

Please add more details to the commit message. A proper commit message should describe why you make the change: what was the problem with the old code, in what situation we could hit it, and why the new code is correct.

The test did not work, in the situation used by the test, the test now passes.

Why do you think that it is a product issue, and not a test issue?

It is also not clear how the three bullets in the description are connected. Is this a single fix for a single issue?

They are connected by the fact that they are in the same pull-request.
The test pass now.

I'm not sure I followed. Why the "simplified implementation" part have to be in this patch?

Please take a look. I tried to describe user cases in the commit message.

@romanovvlad romanovvlad requested a review from asavonic November 8, 2019 13:50
Copy link
Contributor

@asavonic asavonic left a comment

Choose a reason for hiding this comment

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

LGTM, thanks.

@romanovvlad romanovvlad merged commit 5c8e81f into intel:sycl Nov 8, 2019
@alexeyvoronov-intel alexeyvoronov-intel deleted the private/avoronov/fix_hadler_copy_with_offset branch November 11, 2019 16:27
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

Successfully merging this pull request may close these issues.

4 participants