[PATCH] D104904: [OpenMP][AMDGCN] Initial math headers support

Jon Chesterfield via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 30 10:15:21 PDT 2021


JonChesterfield added a comment.

Weird pre-existing stuff in cuda_complex_builtins. It has an #ifdef AMDGCN macro in it, despite 'cuda' in the name. I note there is no corresponding 'hip' complex builtins.

The ifdef logic for stubbing out some functions (which is done with macros...) isn't ideal, it's:

  #if !defined (_OPENMP_NVPTX)
  // use std:: functions from cmath.h, which isn't included, though math.h is included from openmp before it
  #else 
  #ifdef __AMDGCN__
  // use ocml functions
  #else
  // use nv functions
  #end
  #end

None of this uses `#define __CUDA__` so we could drop that from the openmp wrapper. Or, as far as I can tell, we could drop all the macro obfuscation in that header and just call the libm functions directly, which will already resolve to the appropriate platform specific thing.

Instead of revising that as part of this patch, how about we wrap the openmp_wrappers/complex.h logic in `#ifndef __AMDGCN__`, which will cut it from the graph for openmp while leaving nvptx openmp untouched?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104904/new/

https://reviews.llvm.org/D104904



More information about the cfe-commits mailing list