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

gccbuiltins: Add AMD GCN and Nvidia PTX #3411

Merged
merged 1 commit into from
May 15, 2020

Conversation

kinke
Copy link
Member

@kinke kinke commented Apr 25, 2020

This is sort of a reboot of #2556. @thewilsonator: The generated files are .di headers, do those really need any special dcompute handling?

@thewilsonator
Copy link
Contributor

Shouldn't. LLVM handles the intrinsics.

@kinke
Copy link
Member Author

kinke commented Apr 25, 2020

Yeah that's what I thought too. - I've only checked the generated NVPTX file, which contains ~550 builtins, and this works:

// ldc2 -c bla.d -betterC -mtriple=nvptx64 -mcpu=sm_50
import ldc.gccbuiltins_nvvm;
double foo(double a, double b) { return __nvvm_add_rm_d(a, b); }

My LLVM doesn't include the AMDGPU backend (which AFAICT features 2 targets, r600 and amdgcn; I've only taken the more recent one).

set(target_arch "AArch64;ARM;Mips;PowerPC;SystemZ;X86")
set(target_name "aarch64;arm;mips;ppc;s390;x86")
set(target_arch "AArch64;AMDGPU;ARM;Mips;NVPTX;PowerPC;SystemZ;X86")
set(target_name "aarch64;amdgcn;arm;mips;nvvm;ppc;s390;x86")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this done as a whitelist anyway? Are there any targets we want to exclude builtins for?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • IIRC, there are targets like BPF and Hexagon (no idea what those are) with a handful of GCC builtins.
  • AFAICT, you need to know the target prefix (nvvm) for the tblgen invocation.
  • We additionally filter this list and only keep those for which the LLVM backend is available. That restriction can probably be lifted for a uniform ldc.gccbuiltins_* imports set, independent from the LLVM build config.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAICT, you need to know the target prefix (nvvm) for the tblgen invocation.

Thats annoying.

@kinke kinke merged commit 5b64112 into ldc-developers:master May 15, 2020
@kinke kinke deleted the gccbuiltins branch May 15, 2020 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants