[PATCH] D139931: [AMDGPU] Add `.workgroup_processor_mode` to v5 MD
Pierre van Houtryve via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 13 05:57:35 PST 2022
Pierre-vh created this revision.
Herald added subscribers: kosarev, foad, kerbowa, hiraditya, tpr, dstuttard, yaxunl, jvesely, kzhuravl, arsenm.
Herald added a project: All.
Pierre-vh requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.
Adds Workgroup Processor Mode (WGM) to the HSA Metadata for Code Object v5/GFX10+.
The field is already present as an asm directive and in the compute program resource register but is also needed in the MD.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D139931
Files:
llvm/docs/AMDGPUUsage.rst
llvm/include/llvm/Support/AMDHSAKernelDescriptor.h
llvm/lib/BinaryFormat/AMDGPUMetadataVerifier.cpp
llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
llvm/lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp
Index: llvm/lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp
@@ -877,6 +877,10 @@
if (AMDGPU::getAmdhsaCodeObjectVersion() >= 5)
Kern[".uses_dynamic_stack"] =
Kern.getDocument()->getNode(ProgramInfo.DynamicCallStack);
+ if (AMDGPU::getAmdhsaCodeObjectVersion() >= 5 &&
+ STM.getGeneration() >= GCNSubtarget::GFX10)
+ Kern[".workgroup_processor_mode"] =
+ Kern.getDocument()->getNode(ProgramInfo.WgpMode);
// FIXME: The metadata treats the minimum as 16?
Kern[".kernarg_segment_align"] =
Index: llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
@@ -414,6 +414,10 @@
amdhsa::KERNEL_CODE_PROPERTY_ENABLE_WAVEFRONT_SIZE32;
}
+ if (CurrentProgramInfo.WgpMode && AMDGPU::getAmdhsaCodeObjectVersion() >= 5 &&
+ MF.getSubtarget<GCNSubtarget>().getGeneration() >= GCNSubtarget::GFX10)
+ KernelCodeProperties |= amdhsa::KERNEL_CODE_PROPERTY_WGP_MODE;
+
if (CurrentProgramInfo.DynamicCallStack &&
AMDGPU::getAmdhsaCodeObjectVersion() >= 5) {
KernelCodeProperties |= amdhsa::KERNEL_CODE_PROPERTY_USES_DYNAMIC_STACK;
Index: llvm/lib/BinaryFormat/AMDGPUMetadataVerifier.cpp
===================================================================
--- llvm/lib/BinaryFormat/AMDGPUMetadataVerifier.cpp
+++ llvm/lib/BinaryFormat/AMDGPUMetadataVerifier.cpp
@@ -262,6 +262,9 @@
if (!verifyScalarEntry(KernelMap, ".uses_dynamic_stack", false,
msgpack::Type::Boolean))
return false;
+ if (!verifyScalarEntry(KernelMap, ".workgroup_processor_mode", false,
+ msgpack::Type::Boolean))
+ return false;
if (!verifyIntegerEntry(KernelMap, ".kernarg_segment_align", true))
return false;
if (!verifyIntegerEntry(KernelMap, ".wavefront_size", true))
Index: llvm/include/llvm/Support/AMDHSAKernelDescriptor.h
===================================================================
--- llvm/include/llvm/Support/AMDHSAKernelDescriptor.h
+++ llvm/include/llvm/Support/AMDHSAKernelDescriptor.h
@@ -162,7 +162,8 @@
KERNEL_CODE_PROPERTY(RESERVED0, 7, 3),
KERNEL_CODE_PROPERTY(ENABLE_WAVEFRONT_SIZE32, 10, 1), // GFX10+
KERNEL_CODE_PROPERTY(USES_DYNAMIC_STACK, 11, 1),
- KERNEL_CODE_PROPERTY(RESERVED1, 12, 4),
+ KERNEL_CODE_PROPERTY(WGP_MODE, 11, 1), // GFX10+
+ KERNEL_CODE_PROPERTY(RESERVED1, 13, 3),
};
#undef KERNEL_CODE_PROPERTY
Index: llvm/docs/AMDGPUUsage.rst
===================================================================
--- llvm/docs/AMDGPUUsage.rst
+++ llvm/docs/AMDGPUUsage.rst
@@ -3571,12 +3571,14 @@
.. table:: AMDHSA Code Object V5 Kernel Metadata Map Additions
:name: amdgpu-amdhsa-code-object-kernel-metadata-map-table-v5
- ===================== ============= ========== =======================================
- String Key Value Type Required? Description
- ===================== ============= ========== =======================================
- ".uses_dynamic_stack" boolean Indicates if the generated machine code
- is using a dynamically sized stack.
- ===================== ============= ========== =======================================
+ ============================= ============= ========== =======================================
+ String Key Value Type Required? Description
+ ============================= ============= ========== =======================================
+ ".uses_dynamic_stack" boolean Indicates if the generated machine code
+ is using a dynamically sized stack.
+ ".workgroup_processor_mode" boolean (GFX10+) Controls ENABLE_WGP_MODE in
+ :ref:`amdgpu-amdhsa-kernel-descriptor-v3-table`.
+ ============================= ============= ========== =======================================
..
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139931.482445.patch
Type: text/x-patch
Size: 4333 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221213/288f223c/attachment.bin>
More information about the llvm-commits
mailing list