Index: llvm/docs/AMDGPUUsage.rst =================================================================== --- llvm/docs/AMDGPUUsage.rst +++ llvm/docs/AMDGPUUsage.rst @@ -3960,6 +3960,9 @@ associated dispatch AQL packet. It is only required for pre-GFX9 devices for the trap handler ABI (see :ref:`amdgpu-amdhsa-trap-handler-abi`). + "hidden_dynamic_lds_size" + Size of the dynamically allocated LDS memory is passed in the kernarg. + ====================== ============== ========= ================================ .. Index: llvm/lib/BinaryFormat/AMDGPUMetadataVerifier.cpp =================================================================== --- llvm/lib/BinaryFormat/AMDGPUMetadataVerifier.cpp +++ llvm/lib/BinaryFormat/AMDGPUMetadataVerifier.cpp @@ -138,6 +138,7 @@ .Case("hidden_private_base", true) .Case("hidden_shared_base", true) .Case("hidden_queue_ptr", true) + .Case("hidden_dynamic_lds_size", true) .Default(false); })) return false; Index: llvm/lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp =================================================================== --- llvm/lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp +++ llvm/lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp @@ -1099,6 +1099,11 @@ if (MFI.hasQueuePtr()) emitKernelArg(DL, Int8PtrTy, Align(8), "hidden_queue_ptr", Offset, Args); + else + Offset += 8; // Skipped + + // emit argument for hidden dynamic lds size + emitKernelArg(DL, Int32Ty, Align(4), "hidden_dynamic_lds_size", Offset, Args); } void MetadataStreamerMsgPackV5::emitKernelAttrs(const Function &Func, Index: llvm/test/CodeGen/AMDGPU/hsa-metadata-hidden-args-v5.ll =================================================================== --- llvm/test/CodeGen/AMDGPU/hsa-metadata-hidden-args-v5.ll +++ llvm/test/CodeGen/AMDGPU/hsa-metadata-hidden-args-v5.ll @@ -87,9 +87,12 @@ ; GFX8-NEXT: - .offset: 220 ; GFX8-NEXT: .size: 4 ; GFX8-NEXT: .value_kind: hidden_shared_base -; CHECK: - .offset: 224 +; CHECK: - .offset: 224 ; CHECK-NEXT: .size: 8 ; CHECK-NEXT: .value_kind: hidden_queue_ptr +; CHECK: - .offset: 232 +; CHECK-NEXT: .size: 4 +; CHECK-NEXT: .value_kind: hidden_dynamic_lds_size ; CHECK: .name: test_v5 ; CHECK: .symbol: test_v5.kd