Skip to content

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

@AuroraPerego

Description

@AuroraPerego

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcudaCUDA back-end

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions