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

Allow any manifestly constant-evaluated expression and conversion in device function #388

Merged

Conversation

keryell
Copy link
Member

@keryell keryell commented Mar 22, 2023

This should address #267

@TApplencourt
Copy link
Contributor

Look good enough to get us started :). In theory, if recursion is tail-recurvice if you be allowed to (as it will not need a call stack on the GPU)

@keryell
Copy link
Member Author

keryell commented Apr 13, 2023

Look good enough to get us started :). In theory, if recursion is tail-recurvice if you be allowed to (as it will not need a call stack on the GPU)

You assume that the compiler is smart enough to replace a tail-recursion by a loop. What if -O0? It looks like a QoI problem to be included in the specification.

@Naghasan
Copy link
Member

I agree with Ronan, What if -O0? and what happens in debug as well (you may not want optimization there as well)

@TApplencourt
Copy link
Contributor

TApplencourt commented Apr 13, 2023

https://reviews.llvm.org/D99517, LLVM have now a pragma that should force it for example. But I see your point that it's "just an optimization". Same as constexpr, so if by constant evaluation. we mean manifestly constant evaluated, it looks good to me.

The goal is only to ensure that the generated accelerator backend code should not have recursion; how we achieve this goal can be multiple.

@tomdeakin
Copy link
Contributor

WG: Better approach is to add sentence about constexpr, and recursion example is a non-normative note.

@keryell keryell changed the title Allow recursion in kernels in the context of constant evaluation Allow any manifestly constant evaluation in kernel context May 4, 2023
@keryell keryell marked this pull request as draft May 11, 2023 15:07
In the case of a manifestly constant-evaluated expression or
conversion, any code accepted by the C++ standard in this case is also
accepted in SYCL device function.
@keryell keryell force-pushed the ronan/SYCL-2020/constant-evaluation-recursion branch from ef19c48 to bdc8fea Compare May 17, 2023 23:35
@keryell keryell changed the title Allow any manifestly constant evaluation in kernel context Allow any manifestly constant-evaluated expression and conversion in kernel context May 17, 2023
@keryell keryell changed the title Allow any manifestly constant-evaluated expression and conversion in kernel context Allow any manifestly constant-evaluated expression and conversion in device function May 17, 2023
@keryell
Copy link
Member Author

keryell commented May 17, 2023

This has been generalized to address #379

@keryell keryell marked this pull request as ready for review May 17, 2023 23:38
@fraggamuffin
Copy link

bug fix or NEXT or KHR?
NEXT or KHR?

@keryell keryell marked this pull request as draft May 31, 2023 23:58
@keryell
Copy link
Member Author

keryell commented May 31, 2023

Changing to a draft to wait for SYCL Next.

@tomdeakin
Copy link
Contributor

Please open MR on GitLab. Thanks!

@keryell
Copy link
Member Author

keryell commented Feb 8, 2024

I have rebased this PR for SYCL Next as internal https://gitlab.khronos.org/sycl/Specification/-/merge_requests/740

@keryell keryell requested a review from TApplencourt February 8, 2024 17:53
@keryell keryell marked this pull request as ready for review February 8, 2024 17:54
@keryell
Copy link
Member Author

keryell commented Feb 8, 2024

Just removing the Draft status to consider this to be closed during next meeting and look at GitLab.

@gmlueck
Copy link
Contributor

gmlueck commented Sep 30, 2024

Recording our decision from the WG meeting on September 26, 2024:

  • We should re-target this PR as a "big fix" to SYCL 2020
  • @keryell volunteered to update the PR

(cherry picked from commit bde612085fe849640f3136558e6750895b691509)
@keryell keryell requested a review from gmlueck October 2, 2024 04:51
Copy link
Contributor

@gmlueck gmlueck left a comment

Choose a reason for hiding this comment

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

I think this looks good. Just one small comment below.

adoc/chapters/device_compiler.adoc Outdated Show resolved Hide resolved
@gmlueck
Copy link
Contributor

gmlueck commented Oct 2, 2024

When this PR is merged, we should close #379 and #267.

Take into account Greg Lueck comment
KhronosGroup#388 (comment)

Also reformat some text to pass the CI.
@keryell keryell added the CTS May require changes to CTS label Oct 2, 2024
@keryell keryell force-pushed the ronan/SYCL-2020/constant-evaluation-recursion branch from 344e8ce to 54c476e Compare October 3, 2024 14:40
@tomdeakin
Copy link
Contributor

Please add "manifestly constant-evaluated expression" as a Glossary term with definition saying it is as defined in the C++20 specification.

keryell added a commit to keryell/SYCL-CTS that referenced this pull request Oct 30, 2024
There are a lot of restrictions for kernel code, except when present in a
constant evaluated context.

This is a test corresponding to the specification clarification introduced by PR
KhronosGroup/SYCL-Docs#388
keryell added a commit to keryell/SYCL-CTS that referenced this pull request Oct 30, 2024
There are a lot of restrictions for kernel code, except when present in a
constant evaluated context.

This is a test corresponding to the specification clarification introduced by PR
KhronosGroup/SYCL-Docs#388
keryell added a commit to keryell/SYCL-CTS that referenced this pull request Oct 30, 2024
There are a lot of restrictions for kernel code, except when present in a
constant evaluated context.

This is a test corresponding to the specification clarification introduced by PR
KhronosGroup/SYCL-Docs#388
keryell added a commit to keryell/SYCL-CTS that referenced this pull request Oct 30, 2024
There are a lot of restrictions for kernel code, except when present in a
constant evaluated context.

This is a test corresponding to the specification clarification introduced by PR
KhronosGroup/SYCL-Docs#388
@tomdeakin
Copy link
Contributor

WG approved to merge to SYCL 2020

@gmlueck gmlueck merged commit 94eb558 into KhronosGroup:main Nov 14, 2024
2 checks passed
gmlueck added a commit to gmlueck/SYCL-Docs that referenced this pull request Nov 14, 2024
…device function

Cherry pick KhronosGroup#388 from main
(cherry picked from commit 94eb558)
gmlueck added a commit that referenced this pull request Dec 5, 2024
…ion-recursion

Allow any manifestly constant-evaluated expression and conversion in device function

(cherry picked from commit 94eb558)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working CTS May require changes to CTS enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants