[clang] [NVPTX] Allow compiling LLVM-IR without `-march` set (PR #79873)

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 29 12:23:25 PST 2024


jhuber6 wrote:

> Relying on something _not_ being defined is probably not the best way to handle 'generic' target. For starters it makes it hard or impossible to recreate the same compilation state by undoing already-specified option. It also breaks established assumption that there _is_ a default target CPU/GPU. If we do want to have a generic GPU target, then we should grow an explicit 'generic' GPU variant, IMO. It would be a functional opposite of 'native'.

AMDGPU uses a missing `-mcpu` on the OpenCL target to build their "generic" device libraries and it's also missing from NVIDIA's `libdevice.10.bc` in the same way. I think there's some precedent from both vendors to treat missing attributes as a more generic target. The default target to me is more of the domain of the driver. So if you're using CUDA and don't specify anything you get `sm_52`. This patch also creates a hard error if it's unspecified before it makes it to the tools like ptxas and nvlink.

https://github.com/llvm/llvm-project/pull/79873


More information about the cfe-commits mailing list