[all-commits] [llvm/llvm-project] 228c8f: [ObjectYAML] Add offloading binary implementations...

Joseph Huber via All-commits all-commits at lists.llvm.org
Fri Jul 1 18:13:49 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 228c8f9cc0b2bf615706567f121a422b1b0e7f83
      https://github.com/llvm/llvm-project/commit/228c8f9cc0b2bf615706567f121a422b1b0e7f83
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2022-07-01 (Fri, 01 Jul 2022)

  Changed paths:
    M llvm/include/llvm/Object/OffloadBinary.h
    M llvm/include/llvm/ObjectYAML/ObjectYAML.h
    A llvm/include/llvm/ObjectYAML/OffloadYAML.h
    M llvm/include/llvm/ObjectYAML/yaml2obj.h
    M llvm/lib/ObjectYAML/CMakeLists.txt
    M llvm/lib/ObjectYAML/ObjectYAML.cpp
    A llvm/lib/ObjectYAML/OffloadEmitter.cpp
    A llvm/lib/ObjectYAML/OffloadYAML.cpp
    M llvm/lib/ObjectYAML/yaml2obj.cpp
    A llvm/test/ObjectYAML/Offload/binary.yaml
    A llvm/test/ObjectYAML/Offload/default.yaml
    A llvm/test/ObjectYAML/Offload/enumeration_kinds.yaml
    A llvm/test/ObjectYAML/Offload/malformed-entry-size.yaml
    A llvm/test/ObjectYAML/Offload/malformed-offset.yaml
    A llvm/test/ObjectYAML/Offload/malformed-size.yaml
    A llvm/test/ObjectYAML/Offload/malformed-version.yaml
    A llvm/test/ObjectYAML/Offload/multiple_members.yaml
    M llvm/tools/obj2yaml/CMakeLists.txt
    M llvm/tools/obj2yaml/obj2yaml.cpp
    M llvm/tools/obj2yaml/obj2yaml.h
    A llvm/tools/obj2yaml/offload2yaml.cpp

  Log Message:
  -----------
  [ObjectYAML] Add offloading binary implementations for obj2yaml and yaml2obj

This patchs adds the necessary code for inspecting or creating offloading
binaries using the standing `obj2yaml` and `yaml2obj` features in LLVM.

Depends on D127774

Reviewed By: jhenderson

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


  Commit: d2d8b0aa4f80752722321d1e74e2d98761caaa61
      https://github.com/llvm/llvm-project/commit/d2d8b0aa4f80752722321d1e74e2d98761caaa61
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2022-07-01 (Fri, 01 Jul 2022)

  Changed paths:
    A llvm/test/tools/llvm-objdump/Offloading/Inputs/binary.yaml
    A llvm/test/tools/llvm-objdump/Offloading/Inputs/malformed.yaml
    A llvm/test/tools/llvm-objdump/Offloading/binary.test
    A llvm/test/tools/llvm-objdump/Offloading/content-failure.test
    A llvm/test/tools/llvm-objdump/Offloading/failure.test
    A llvm/test/tools/llvm-objdump/Offloading/warning.test
    M llvm/tools/llvm-objdump/CMakeLists.txt
    M llvm/tools/llvm-objdump/ObjdumpOpts.td
    A llvm/tools/llvm-objdump/OffloadDump.cpp
    A llvm/tools/llvm-objdump/OffloadDump.h
    M llvm/tools/llvm-objdump/llvm-objdump.cpp

  Log Message:
  -----------
  [llvm-objdump] Add support for dumping embedded offloading data

In Clang/LLVM we are moving towards a new binary format to store many
embedded object files to create a fatbinary. This patch adds support for
dumping these embedded images in the `llvm-objdump` tool. This will
allow users to query information about what is stored inside the binary.
This has very similar functionality to the `cuobjdump` tool for thoe familiar
with the Nvidia utilities. The proposed use is as follows:
```
$ clang input.c -fopenmp --offload-arch=sm_70 --offload-arch=sm_52 -c
$ llvm-objdump -O input.o

input.o:        file format elf64-x86-64

OFFLOADIND IMAGE [0]:
kind            cubin
arch            sm_52
triple          nvptx64-nvidia-cuda
producer        openmp

OFFLOADIND IMAGE [1]:
kind            cubin
arch            sm_70
triple          nvptx64-nvidia-cuda
producer        openmp
```

This will be expanded further once we start embedding more information
into these offloading images. Right now we are planning on adding
flags and entries for debug level, optimization, LTO usage, target
features, among others.

This patch only supports printing these sections, later we will want to
support dumping files the user may be interested in via another flag. I
am unsure if this should go here in `llvm-objdump` or `llvm-objcopy`.

Reviewed By: MaskRay, tra, jhenderson, JonChesterfield

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


Compare: https://github.com/llvm/llvm-project/compare/927156a67445...d2d8b0aa4f80


More information about the All-commits mailing list