Description
Is your feature request related to a problem? Please describe
This is a generalization #8016.
Before #7348, it was possible to specify any target architecture for NVIDIA/AMD backends using -fsycl-targets=amdgcn-amd-amdhsa -Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=gfxXXXX
or -fsycl-targets=nvptx64-nvidia-cuda -Xsycl-target-backend=nvptx64-nvidia-cuda --offload-arch=sm_XX
, or a combination of those.
Now, trying to specify an architecture not explicitly listed leads to a weird compile-time error:
$ clang++ -fsycl -fsycl-targets=amdgcn-amd-amdhsa -Xsycl-target-backend --offload-arch=gfx940 abc.cpp -c -o abc.cpp.o
In file included from <built-in>:849:
<command line>:1:9: error: macro name must be an identifier
#define -emit-llvm-bc 1
^
1 error generated.
Such commands worked fine before (as long as the respective backend recognized the architecture), but now only architectures explicitly listed in clang/lib/Driver/ToolChains/SYCL.cpp
are allowed.
While having a list of "officially supported" architectures is very convenient, it is also useful to be able to compile for other architectures supported by the backend. See e.g., #8016 (consumer GPU) or comments in #8106 about RDNA3 and CDNA3, for which there already is some support in the backend. This would greatly facilitate testing on a new hardware.
Describe the solution you would like
As described in #8016, the code introduced in #7348 uses some hardcoded values to construct an interim Clang command line, which fails if the architecture is not explicitly allowed. Making the code more robust would allow using any architecture.
Describe alternatives you have considered
- Not testing the new hardware
- Opening an issue and waiting for a fix for every new piece of hardware
- Manually applying a patch like [HIP] ICE when compiling for gfx1034 #8016 (comment)