[llvm-dev] Clang option to provide list of target-subarchs.

Rodgers, Gregory via llvm-dev llvm-dev at lists.llvm.org
Mon Feb 6 18:39:32 PST 2017

There are at least four clang frontends for offloading to accelerators:  
1 Cuda clang  2 OpenMP  3 HCC and 4 OpenCL.    These frontends will 
want to embed object code for multiple offload targets into a single 
application binary to provide portability across different subarchitectures 
(e.g. sm_35, sm_50) and across different architectures (e.g nvptx64,amdgcn).   

Problem:  Different frontends are using different flags to provide a 
list of subarchitectures.  For example, cuda clang repeats the flag
“--cuda-gpu-arch=sm_35  --cuda-gpu-arch=sm_50” and HCC uses
“--amdgpu-target=gfx701 --amdgpu-target=gfx802”.   

We propose a common clang flag to provide a list of target 
subarchitectures called “target-subarchs”. For example,


In discussions with HCC and OpenMP maintainers,  we believe a new 
flag name would have these requirements: 
   end in “s” because it is a list; 
   not have vendor specific names like cuda and amd; 
   not contain “gpu” because offloading may extend to non-gpu archs;  
   avoid “arch” by itself so as not to be confused with first field of a triple; 
   and not collide with existing flags to allow both options. 

"--target-subarchs" satisfies all the above.  Comments?

Greg Rodgers

More information about the llvm-dev mailing list