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

[SYCL-WEB] Fix test failures in address-space-conversions #12843

Merged
merged 1 commit into from
Feb 28, 2024

Conversation

jsji
Copy link
Contributor

@jsji jsji commented Feb 27, 2024

Per @Naghasan
The view in upstream is different as there is no device filtering yet (IIRC). sycl_device isn't there yet regardless (hence why it needs to be re-added) and in intel/llvm, nothing is emitted until you reach calls made by sycl_device function, causing the "reordering".

  1. Add attribute((sycl_device)) to so that the IR won't be empty.
  2. Replace CHECK with CHECK-DAG because of the function order
  3. Replace dso_local to {{*}} because of linkage
  4. Replace declaration of tmpl to empty define tmpl..{} to avoid compilation error.

1. Add __attribute__((sycl_device)) to so that the IR won't be empty.
2. Replace CHECK with CHECK-DAG because of the function order
3. Replace dso_local to {{*}} because of linkage
4. Replace declaration of tmpl to empty define tmpl..{}
@jsji jsji requested a review from a team as a code owner February 27, 2024 17:54
@jsji jsji self-assigned this Feb 27, 2024
@jsji jsji requested a review from mmoadeli February 27, 2024 17:55
@jsji
Copy link
Contributor Author

jsji commented Feb 27, 2024

@mmoadeli Please have a look? It would be great if these changes can be upstream to llorg so that we don't need to resolve the conflict in sycl pulldown. Thanks.

Copy link
Contributor

@elizabethandrews elizabethandrews left a comment

Choose a reason for hiding this comment

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

I don't think you should be changing the CHECKs to CHECK_DAG here. What is causing the ordering to get messed up? Why you need to add attribute((sycl_device)). How did this pass before? What commit caused these tests to start failing?

@mmoadeli
Copy link
Contributor

mmoadeli commented Feb 27, 2024

I don't think you should be changing the CHECKs to CHECK_DAG here. What is causing the ordering to get messed up? Why you need to add attribute((sycl_device)). How did this pass before? What commit caused these tests to start failing?

I agree with @elizabethandrews that simply replacing the checks with check_dag may not resolve the issue. The tests currently succeed upstream, indicating that the problem lies elsewhere. Interestingly, I've been tasked for substituting the check_dags with checks recently.

My impression is that a merge of upstream to intel/llvm has shown the issue.

@jsji
Copy link
Contributor Author

jsji commented Feb 27, 2024

I don't think you should be changing the CHECKs to CHECK_DAG here. What is causing the ordering to get messed up? Why you need to add attribute((sycl_device)). How did this pass before? What commit caused these tests to start failing?

The attribute((sycl_device)). was there before in sycl branch. It started to fail with @mmoadeli 's commit in https://github.com/llvm/llvm-project/commit//f54004475110bb0a4033261041594266c8296242
We were using check-dag before the commit.

I agree with @elizabethandrews that changing the checks with check_dag is not the solution. These tests all pass in upstream. In fact, I was asked to change the check_dags with checks.

Sure, then please have a look to see how we can fix this for sycl. Thanks.

@Naghasan
Copy link
Contributor

The view in upstream is different as there is no device filtering yet (IIRC). sycl_device isn't there yet regardless (hence why it needs to be re-added) and in intel/llvm, nothing is emitted until you reach calls made by sycl_device function, causing the "reordering".

@jsji
Copy link
Contributor Author

jsji commented Feb 27, 2024

The view in upstream is different as there is no device filtering yet (IIRC). sycl_device isn't there yet regardless (hence why it needs to be re-added) and in intel/llvm, nothing is emitted until you reach calls made by sycl_device function, causing the "reordering".

Thanks @Naghasan . This explains the major differences. @mmoadeli Can I leave this to you to figure out proper solution? Thanks.

@mmoadeli
Copy link
Contributor

mmoadeli commented Feb 27, 2024

The view in upstream is different as there is no device filtering yet (IIRC). sycl_device isn't there yet regardless (hence why it needs to be re-added) and in intel/llvm, nothing is emitted until you reach calls made by sycl_device function, causing the "reordering".

Thanks @Naghasan. With that explanation the fix seems fine to me. It also explains why they used CHECK_DAG in first place.

@mmoadeli
Copy link
Contributor

mmoadeli commented Feb 27, 2024

The view in upstream is different as there is no device filtering yet (IIRC). sycl_device isn't there yet regardless (hence why it needs to be re-added) and in intel/llvm, nothing is emitted until you reach calls made by sycl_device function, causing the "reordering".

Thanks @Naghasan . This explains the major differences. @mmoadeli Can I leave this to you to figure out proper solution? Thanks.

@jsji, Considering @Naghasan's input, I believe the approach you've taken is right.

@bader
Copy link
Contributor

bader commented Feb 27, 2024

The view in upstream is different as there is no device filtering yet (IIRC). sycl_device isn't there yet regardless (hence why it needs to be re-added) and in intel/llvm, nothing is emitted until you reach calls made by sycl_device function, causing the "reordering".

I would expect different ordering of function declarations, but not checks for instructions within functions. Do we still need to apply -DAG there?

@jsji
Copy link
Contributor Author

jsji commented Feb 27, 2024

The view in upstream is different as there is no device filtering yet (IIRC). sycl_device isn't there yet regardless (hence why it needs to be re-added) and in intel/llvm, nothing is emitted until you reach calls made by sycl_device function, causing the "reordering".

Thanks @Naghasan . This explains the major differences. @mmoadeli Can I leave this to you to figure out proper solution? Thanks.

@jsji, Considering @Naghasan's input, I believe the approach you've taken is right.

@elizabethandrews What is your opinion?

@jsji
Copy link
Contributor Author

jsji commented Feb 27, 2024

I would expect different ordering of function declarations, but not checks for instructions within functions. Do we still need to apply -DAG there?

The function declaration are after all the instructions now. So we either add -DAG to all, or we move all the function checks to AFTER instruction checks. Replacing CHECK with CHECK-DAG is more consistent with our old test file.
If we want to move all the functions instead, some of the reference in instructions will need to be updated as well.

@jsji
Copy link
Contributor Author

jsji commented Feb 27, 2024

Another conflict friendly fix is the use some option to control the device filtering. Do we know is there an existing option or env that can do this? SYCL_DEVICE_FILTER/ONEAPI_DEVICE_SELECTOR are runtime env, so won't take effect in compile time here.

@bader
Copy link
Contributor

bader commented Feb 27, 2024

What @Naghasan mean by "device filtering" is source code separation into host and device parts. Upstream compiler does not do this separation yet. The device compiler in llorg compiles all functions as device code. DPC++ has no option to disable "device filtering".

@jsji
Copy link
Contributor Author

jsji commented Feb 27, 2024

What @Naghasan mean by "device filtering" is source code separation into host and device parts. Upstream compiler does not do this separation yet. The device compiler in llorg compiles all functions as device code. DPC++ has no option to disable "device filtering".

OK. Thanks @bader . Then I guess we have to use current solution until we upstream the "device filtering" to llorg.

@elizabethandrews
Copy link
Contributor

The view in upstream is different as there is no device filtering yet (IIRC). sycl_device isn't there yet regardless (hence why it needs to be re-added) and in intel/llvm, nothing is emitted until you reach calls made by sycl_device function, causing the "reordering".

Thanks @Naghasan . This explains the major differences. @mmoadeli Can I leave this to you to figure out proper solution? Thanks.

@jsji, Considering @Naghasan's input, I believe the approach you've taken is right.

@elizabethandrews What is your opinion?

The explanation makes sense to me. I'm ok with this change. Thanks for explaining!

@jsji
Copy link
Contributor Author

jsji commented Feb 27, 2024

@bader Any further comments? If not, I will merge it.

@bader
Copy link
Contributor

bader commented Feb 27, 2024

@bader Any further comments? If not, I will merge it.

No other comments.

@jsji jsji merged commit 1ea43e2 into intel:sycl-web Feb 28, 2024
1 check passed
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.

5 participants