-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL] Introduce backend macros #4636
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
According to SYCL spec: backend macro should be specified for all supported backends (defined in the Khronos group). It also refers to extension macros (aka feature test macro) for other backends introduced by a vendor. Khronos group defines only OpenCL backend and other backends supported by DPC++ should be treated as extensions. The following macros are defined unconditionaly because backend support is always available on DPC++ compile stage: - OpenCL backed: SYCL_BACKEND_OPENCL - Level Zero backend: SYCL_EXT_ONEAPI_BACKEND_LEVEL_ZERO - CUDA backend: SYCL_EXT_ONEAPI_BACKEND_CUDA - ESIMD_CPU backend: SYCL_EXT_INTEL_BACKEND_ESIMD_CPU - HIP backend: SYCL_EXT_ONEAPI_BACKEND_HIP Extra libs may be required to link DPC++ application and run it.
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.
LGTM
@gmlueck, @jbrodman, @Pennycook could you please have a look? |
It looks like the backends cuda, esimd_cpu, and hip are only conditionally supported if they are enabled in the "configure.py" script. Therefore, shouldn't these macros only be conditionally defined? |
We do not remove support for BEs in headers depending on the build configuration. So we headers contain all BE specific code. that is why I decided to add these macros unconditionally. |
Conformant SYCL code might look something like this:
What will happen if DPC++ is configured without CUDA support? Will that code still compile and run without errors? Obviously, the kernel won't be submitted in this case because |
For CUDA support where was the explicit request to make DPC++ ready for CUDA (implemented in #3811). If user drop have lib_pi_cud.so and libclc-builtin libraries to the regular compiler it can be used to work with CUDA BE. |
Let's consider the DPCPP production build. I think CUDA support is not configured for that build, correct? I presume the libraries you mention are also not included in that build. Will the example code I show above compile without errors in that case? |
It will be successfully compiled. On the link step there will be an error due to missed built-in libraries. |
This is the sort of thing I was concerned about. This would be solved if we defined the macros conditionally based on the source configuration. Is that difficult? |
We can enable macros conditionally during the build of the compiler (there are no technical difficulties here). But this approach contradicts the request implemented in the scope of #3811. |
I don't see any contradiction. Let's chat offline... |
We were discussing the name of the
Can we change the name to one of those? Possibly, it makes sense to rename the enumerator in |
I will apply suggested changes later this week |
Let's use full |
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.
LGTM
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.
buildbot/configure.py looks good to me (not sure if ESIMD_CPU -> EMULATOR renaming directly related to backend macos though).
According to SYCL spec: backend macro should be specified for all supported
backends (defined in the Khronos group). It also refers to extension macros
(aka feature test macro) for other backends introduced by a vendor. Khronos
group defines only OpenCL backend and other backends supported by DPC++
should be treated as extensions.
The following macros are defined when the compiler is built with the
corresponding backend. OpenCL and Level_Zero backends are always
available, others are enabled on build time:
Extra libs may be required to link DPC++ application and run it.
backend::esimd_cpu is renamed to backend::ext_intel_esimd_emulator. Old
naming was marked as deprecated.