[all-commits] [llvm/llvm-project] 631c96: [AMDGPU] Non hostcall printf support for HIP

vikramRH via All-commits all-commits at lists.llvm.org
Sat Jun 10 07:30:12 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 631c965483e03355cdc1dba578e787b259c4d79d
      https://github.com/llvm/llvm-project/commit/631c965483e03355cdc1dba578e787b259c4d79d
  Author: Vikram <Vikram.Hegde at amd.com>
  Date:   2023-06-10 (Sat, 10 Jun 2023)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/TargetOptions.h
    M clang/include/clang/Driver/Options.td
    M clang/lib/CodeGen/CGGPUBuiltin.cpp
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/test/CodeGenHIP/default-attributes.hip
    A clang/test/CodeGenHIP/printf-kind-module-flag.hip
    A clang/test/CodeGenHIP/printf_nonhostcall.cpp
    M clang/test/CodeGenHIP/sanitize-undefined-null.hip
    M clang/test/Driver/hip-options.hip
    M llvm/include/llvm/Transforms/Utils/AMDGPUEmitPrintf.h
    M llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp

  Log Message:
  -----------
  [AMDGPU] Non hostcall printf support for HIP

This is an alternative to currently existing hostcall implementation and uses printf buffer similar to OpenCL,
The data stored in the buffer (i.e the data frame) for each printf call are as follows,
1. Control DWord - contains info regarding stream, format string constness and size of data frame
2. Hash of the format string (if constant) else the format string itself
3. Printf arguments (each aligned to 8 byte boundary)

The format string Hash is generated using LLVM's MD5 Message-Digest Algorithm implementation and only low 64 bits are used.
The implementation still uses amdhsa metadata and hash is stored as part of format string itself to ensure
minimal changes in runtime.

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




More information about the All-commits mailing list