[all-commits] [llvm/llvm-project] d67750: [NVPTX] Set default version of architecture to SM_...

PavelKopyl via All-commits all-commits at lists.llvm.org
Tue Jan 10 04:23:19 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d6775052de6b7aaeaef17fdac1c796c2b99a91ee
      https://github.com/llvm/llvm-project/commit/d6775052de6b7aaeaef17fdac1c796c2b99a91ee
  Author: Pavel Kopyl <pavelkopyl at gmail.com>
  Date:   2023-01-10 (Tue, 10 Jan 2023)

  Changed paths:
    M llvm/lib/Target/NVPTX/NVPTX.td
    M llvm/lib/Target/NVPTX/NVPTXSubtarget.cpp
    M llvm/test/CodeGen/NVPTX/nvvm-reflect-arch.ll
    M llvm/test/CodeGen/NVPTX/nvvm-reflect-ocl.ll
    M llvm/test/CodeGen/NVPTX/sm-version.ll
    M llvm/test/CodeGen/NVPTX/surf-tex.py
    M llvm/test/DebugInfo/NVPTX/dbg-declare-alloca.ll

  Log Message:
  -----------
  [NVPTX] Set default version of architecture to SM_30, PTX to 6.0.

Support of variadic functions triggers an assertion on several tests
from llvm/test/CodeGen/Generic/ if nvptx64-* is specified as a default
triplet:

Support for variadic functions (unsized array parameter) introduced in
PTX ISA version 6.0 and requires target sm_30.

That happens because those tests contain variadic function calls and
default versions of both PTX ISA (3.2) and architecture (sm_20) are
below the minimally required.

There were no observable problems with these tests before adding
support of variadic functions, because nvptx backend just didn't
handle them properly generating invalid PTX code.

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


  Commit: 8913b35f082d4514318ffb9f8445bbb7ab726508
      https://github.com/llvm/llvm-project/commit/8913b35f082d4514318ffb9f8445bbb7ab726508
  Author: Pavel Kopyl <pavelkopyl at gmail.com>
  Date:   2023-01-10 (Tue, 10 Jan 2023)

  Changed paths:
    M llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
    M llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
    M llvm/lib/Target/NVPTX/NVPTXISelLowering.h
    M llvm/test/CodeGen/NVPTX/call_bitcast_byval.ll
    M llvm/test/CodeGen/NVPTX/param-align.ll

  Log Message:
  -----------
  [NVPTX] Enforce minumum alignment of 4 for byval parametrs in a function prototype

As a result, we have identical alignment calculation of byval
parameters for:

  - LowerCall() - getting alignment of an argument (.param)

  - emitFunctionParamList() - getting alignment of a
    parameter (.param) in a function declaration

  - getPrototype() - getting alignment of a parameter (.param) in a
    function prototypes that is used for indirect calls

This change is required to avoid ptxas error: 'Alignment of argument
does not match formal parameter'. This error happens even in cases
where it logically shouldn't.

For instance:

  .param .align 4 .b8 param0[4];
  ...
  callprototype ()_ (.param .align 2 .b8 _[4]);
  ...

Here we allocate 'param0' with alignment of 4 and it should be fine to
pass it to a function that requires minimum alignment of 2.

At least ptxas v12.0 rejects this code.

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


Compare: https://github.com/llvm/llvm-project/compare/482898d9e219...8913b35f082d


More information about the All-commits mailing list