[all-commits] [llvm/llvm-project] 31d8db: [CUDA/SPIR-V] Force passing aggregate type byval

Shangwu Yao via All-commits all-commits at lists.llvm.org
Fri Jul 22 13:31:06 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 31d8dbd1e5b4ee0fd04bfeb3a64d8f9f33260905
      https://github.com/llvm/llvm-project/commit/31d8dbd1e5b4ee0fd04bfeb3a64d8f9f33260905
  Author: Shangwu Yao <shangwuyao at gmail.com>
  Date:   2022-07-22 (Fri, 22 Jul 2022)

  Changed paths:
    M clang/lib/CodeGen/TargetInfo.cpp
    A clang/test/CodeGenCUDASPIRV/copy-aggregate-byval.cu

  Log Message:
  -----------
  [CUDA/SPIR-V] Force passing aggregate type byval

This patch forces copying aggregate type in kernel arguments by value when
compiling CUDA targeting SPIR-V. The original behavior is not passing by value
when there is any of destructor, copy constructor and move constructor defined
by user. This patch makes the behavior of SPIR-V generated from CUDA follow
the CUDA spec
(https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#global-function-argument-processing),
and matches the NVPTX
implementation (
https://github.com/llvm/llvm-project/blob/41958f76d8a2c47484fa176cba1de565cfe84de7/clang/lib/CodeGen/TargetInfo.cpp#L7241).

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




More information about the All-commits mailing list