different macros are defined during AOT compilation for CUDA targets
Closed this issue · 4 comments
AuroraPerego commented
Describe the bug
When compiling AOT for a specific target the corresponding macro is set to 1, while the macros for all the other targets are set to 0. However, for the CUDA backend, the macro that are set to 0 by the compiler end with *_SM**__
, while those that correspond to the target we are compiling for end with *_SM_**__
.
As an example, when compiling for NVIDIA Pascal architecture the macro defined are:
...
#define __SYCL_TARGET_NVIDIA_GPU_SM50__ 0
#define __SYCL_TARGET_NVIDIA_GPU_SM52__ 0
#define __SYCL_TARGET_NVIDIA_GPU_SM53__ 0
#define __SYCL_TARGET_NVIDIA_GPU_SM60__ 0
#define __SYCL_TARGET_NVIDIA_GPU_SM61__ 0
#define __SYCL_TARGET_NVIDIA_GPU_SM62__ 0
#define __SYCL_TARGET_NVIDIA_GPU_SM70__ 0
#define __SYCL_TARGET_NVIDIA_GPU_SM72__ 0
#define __SYCL_TARGET_NVIDIA_GPU_SM75__ 0
#define __SYCL_TARGET_NVIDIA_GPU_SM80__ 0
#define __SYCL_TARGET_NVIDIA_GPU_SM86__ 0
#define __SYCL_TARGET_NVIDIA_GPU_SM87__ 0
#define __SYCL_TARGET_NVIDIA_GPU_SM89__ 0
#define __SYCL_TARGET_NVIDIA_GPU_SM90__ 0
#define __SYCL_TARGET_NVIDIA_GPU_SM_60__ 1
...
To reproduce
- Include code snippet as short as possible
test.cpp
#include <sycl/sycl.hpp>
int main()
{
return 0;
}
- Specify the command which should be used to compile the program
icpx -fsycl -fsycl-targets=nvidia_gpu_sm_60 -dM -E test.cpp | grep "60__"
- Indicate what is wrong and what was expected
The output is:
#define __SYCL_TARGET_NVIDIA_GPU_SM60__ 0
#define __SYCL_TARGET_NVIDIA_GPU_SM_60__ 1
while only one of the two should exist.
Environment
- OS: RHEL 8.10
- Target device and vendor: Nvidia GPUs
- icpx version:
Intel(R) oneAPI DPC++/C++ Compiler 2024.2.1 (2024.2.1.20240711) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /opt/intel/oneapi/compiler/2024.2/bin/compiler Configuration file: /opt/intel/oneapi/compiler/2024.2/bin/compiler/../icpx.cfg
- Dependencies version:
nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2024 NVIDIA Corporation Built on Thu_Mar_28_02:18:24_PDT_2024 Cuda compilation tools, release 12.4, V12.4.131 Build cuda_12.4.r12.4/compiler.34097967_0
Additional context
The problem may be related to the definitions in the file /opt/intel/oneapi/compiler/latest/include/sycl/ext/oneapi/experimental/device_architecture.hpp
.
AuroraPerego commented
GeorgeWeb commented
Thanks for the issue. Nice catch!
AuroraPerego commented
@GeorgeWeb I've checked the nightly-2024-10-14
and the issue seems fixed. Thanks!
$ clang++ -fsycl -fsycl-targets=nvidia_gpu_sm_60 -dM -E test.cpp | grep "NVIDIA"
#define __SYCL_TARGET_NVIDIA_GPU_SM_50__ 0
#define __SYCL_TARGET_NVIDIA_GPU_SM_52__ 0
#define __SYCL_TARGET_NVIDIA_GPU_SM_53__ 0
#define __SYCL_TARGET_NVIDIA_GPU_SM_60__ 1
#define __SYCL_TARGET_NVIDIA_GPU_SM_61__ 0
#define __SYCL_TARGET_NVIDIA_GPU_SM_62__ 0
#define __SYCL_TARGET_NVIDIA_GPU_SM_70__ 0
#define __SYCL_TARGET_NVIDIA_GPU_SM_72__ 0
#define __SYCL_TARGET_NVIDIA_GPU_SM_75__ 0
#define __SYCL_TARGET_NVIDIA_GPU_SM_80__ 0
#define __SYCL_TARGET_NVIDIA_GPU_SM_86__ 0
#define __SYCL_TARGET_NVIDIA_GPU_SM_87__ 0
#define __SYCL_TARGET_NVIDIA_GPU_SM_89__ 0
#define __SYCL_TARGET_NVIDIA_GPU_SM_90__ 0