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

__CUDA_ARCH__ is defined when compiling AOT for HIP #15544

Open
AuroraPerego opened this issue Sep 27, 2024 · 3 comments · May be fixed by #15443
Open

__CUDA_ARCH__ is defined when compiling AOT for HIP #15544

AuroraPerego opened this issue Sep 27, 2024 · 3 comments · May be fixed by #15443
Assignees
Labels
bug Something isn't working hip Issues related to execution on HIP backend.

Comments

@AuroraPerego
Copy link

Describe the bug

During ahead-of-time compilation for the HIP backend, the macro __CUDA_ARCH__ is defined as 0, while it should not be defined at all. Usually, libraries check only if __CUDA_ARCH__ is defined to enable CUDA specific code, without checking its value, causing compilation for the HIP backend to fail.

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=amd_gpu_gfx90a -dM -E test.cpp | grep CUDA_ARCH
  1. Indicate what is wrong and what was expected
    the output of the command above is
#define __CUDA_ARCH__ 0

while it should not be defined.

Environment

  • OS: RHEL 8.10
  • Target device and vendor: AMD GPU MI250X
  • 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:
    HIP version: 6.2.41133-dd7f95766
    AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.2.0 24292 26466ce804ac523b398608f17388eb6d605a3f09)
    Target: x86_64-unknown-linux-gnu
    Thread model: posix
    InstalledDir: /opt/rocm-6.2.0/lib/llvm/bin
    Configuration file: /opt/rocm-6.2.0/lib/llvm/bin/clang++.cfg
    

Additional context

No response

@AuroraPerego AuroraPerego added bug Something isn't working hip Issues related to execution on HIP backend. labels Sep 27, 2024
@AuroraPerego
Copy link
Author

FYI @fwyzard @ivorobts

@GeorgeWeb
Copy link
Contributor

GeorgeWeb commented Sep 28, 2024

Hi, good timing with this and good catch. I also noticed that happening while fixing another regression defining this macro in the SYCL for Cuda AOT compilation (where we want 'SYCL_CUDA_ARCH' instead) and intended to follow up with a HIP patch-fix afterwards.
I'll ping you when it's up. :)

@npmiller
Copy link
Contributor

npmiller commented Sep 30, 2024

This should be fixed by: #15441

Nevermind I got my patches mixed up, the patches for this isn't up yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working hip Issues related to execution on HIP backend.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants