Skip to content

Allow specifying arbitrary target architecture via backend flags #8112

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

Closed
al42and opened this issue Jan 26, 2023 · 0 comments · Fixed by #11254
Closed

Allow specifying arbitrary target architecture via backend flags #8112

al42and opened this issue Jan 26, 2023 · 0 comments · Fixed by #11254
Assignees
Labels
enhancement New feature or request

Comments

@al42and
Copy link
Contributor

al42and commented Jan 26, 2023

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

@al42and al42and added the enhancement New feature or request label Jan 26, 2023
@mmoadeli mmoadeli self-assigned this Jan 26, 2023
al42and added a commit to al42and/llvm that referenced this issue Sep 21, 2023
Don't throw ICE when an unknown device is specified explicitly via
`-Xsycl-target-backend --offload-arch=`. We don't enable macros or other
niceties from sycl_ext_oneapi_device_architecture, but at least the code
compiles.

Fixes intel#8112, intel#11203
againull pushed a commit that referenced this issue Nov 28, 2023
Don't throw ICE when an unknown device is specified explicitly via
`-Xsycl-target-backend --offload-arch=`. We don't enable macros or other
niceties from sycl_ext_oneapi_device_architecture, but at least the code
compiles.

Fixes #8112, #11203, #12010
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants