[all-commits] [llvm/llvm-project] ccac6b: [hip] Properly populate macros based on host proce...

darkbuck via All-commits all-commits at lists.llvm.org
Tue Feb 4 12:37:52 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: ccac6b2bf877337a883c3763e41a529d8f9cc1ff
      https://github.com/llvm/llvm-project/commit/ccac6b2bf877337a883c3763e41a529d8f9cc1ff
  Author: Michael Liao <michael.hliao at gmail.com>
  Date:   2020-02-04 (Tue, 04 Feb 2020)

  Changed paths:
    M clang/include/clang/Driver/CC1Options.td
    M clang/include/clang/Driver/Options.td
    M clang/include/clang/Frontend/FrontendOptions.h
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/lib/Frontend/CompilerInstance.cpp
    M clang/lib/Frontend/CompilerInvocation.cpp
    A clang/test/Driver/hip-host-cpu-features.hip
    A clang/test/Preprocessor/hip-host-cpu-macros.cu

  Log Message:
  -----------
  [hip] Properly populate macros based on host processor.

Summary:
- The device compilation needs to have a consistent source code compared
  to the corresponding host compilation. If macros based on the
  host-specific target processor is not properly populated, the device
  compilation may fail due to the inconsistent source after the
  preprocessor. So far, only the host triple is used to build the
  macros. If a detailed host CPU target or certain features are
  specified, macros derived from them won't be populated properly, e.g.
  `__SSE3__` won't be added unless `+sse3` feature is present. On
  Windows compilation compatible with MSVC, that missing macros result
  in that intrinsics are not included and cause device compilation
  failure on the host-side source.

- This patch addresses this issue by introducing two `cc1` options,
  i.e., `-aux-target-cpu` and `-aux-target-feature`. If a specific host
  CPU target or certain features are specified, the compiler driver will
  append them during the construction of the offline compilation
  actions. Then, the toolchain in `cc1` phase will populate macros
  accordingly.

- An internal option `--gpu-use-aux-triple-only` is added to fall back
  the original behavior to help diagnosing potential issues from the new
  behavior.

Reviewers: tra, yaxunl

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D73942




More information about the All-commits mailing list