[PATCH] D25781: AMDGPU: Emit runtime metadata as a note element in .note section

Konstantin Zhuravlyov via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 25 20:21:54 PDT 2016


kzhuravl added a comment.

> The runtime needs to know the enum value for note type for runtime. To avoid maintaining two copies of enum definitions, I moved these enum definitions to the shared header file.

+ @tony-tye .

This is the right direction, but I think we should discuss this in more details. There are a few files that need to be shared between compiler and runtime (some elf stuff, amd_kernel_code_t, amd_queue_t? amd_signal_t?). Creating a file specifically for note stuff seems like an overkill to me IMHO.

I cleaned up files that are shared between compiler and runtime files a while ago, they are here:

- https://github.com/RadeonOpenCompute/ROCR-Runtime/blob/master/src/inc/amd_hsa_common.h
- https://github.com/RadeonOpenCompute/ROCR-Runtime/blob/master/src/inc/amd_hsa_elf.h
- https://github.com/RadeonOpenCompute/ROCR-Runtime/blob/master/src/inc/amd_hsa_kernel_code.h
- https://github.com/RadeonOpenCompute/ROCR-Runtime/blob/master/src/inc/amd_hsa_queue.h
- https://github.com/RadeonOpenCompute/ROCR-Runtime/blob/master/src/inc/amd_hsa_signal.h

They still need more clean up since we switched to code object v2+. But maybe we can take those as a base.



================
Comment at: lib/Target/AMDGPU/AMDGPUPTNote.h:26
+
+const char NoteName[] = "AMD";
+
----------------
AMD\0


================
Comment at: lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp:111
   MCSectionELF *Note =
       OS.getContext().getELFSection(".note", ELF::SHT_NOTE, ELF::SHF_ALLOC);
 
----------------
.note -> PT_NOTE::NoteName, same in the below one.


================
Comment at: lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp:496
+
+void AMDGPUTargetStreamer::emitRuntimeMetadataAsNoteElement(Module &M) {
+  auto &S = getStreamer();
----------------
I think ELF streaming belongs to AMDGPUTargetELFStreamer?


================
Comment at: lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.h:46
+
+  // Emit runtime metadata as a note element.
+  void emitRuntimeMetadataAsNoteElement(Module &M);
----------------
Doxygenify?


https://reviews.llvm.org/D25781





More information about the llvm-commits mailing list