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

different macros are defined during AOT compilation for CUDA targets #15545

Open
AuroraPerego opened this issue Sep 27, 2024 · 2 comments
Open
Assignees
Labels
bug Something isn't working cuda CUDA back-end

Comments

@AuroraPerego
Copy link

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

  1. Include code snippet as short as possible

test.cpp

#include <sycl/sycl.hpp>
int main()
{
    return 0;
}
  1. 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__"
  1. 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 AuroraPerego added bug Something isn't working cuda CUDA back-end labels Sep 27, 2024
@AuroraPerego
Copy link
Author

FYI @fwyzard @ivorobts

@GeorgeWeb GeorgeWeb self-assigned this Oct 4, 2024
@GeorgeWeb
Copy link
Contributor

Thanks for the issue. Nice catch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cuda CUDA back-end
Projects
None yet
Development

No branches or pull requests

2 participants