This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Add dynamic LDS size implicit kernel argument to v5
Needs RevisionPublic

Authored by skc7 on Aug 17 2023, 12:18 AM.

Details

Reviewers
b-sumner
arsenm
Summary

Add hidden kernel argument "hidden_dynamic_lds_size" to CO v5.

This argument will have the size of dynamic LDS memory allocated by hip runtime to the kernel.

Diff Detail

Unit TestsFailed

Event Timeline

skc7 created this revision.Aug 17 2023, 12:18 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 17 2023, 12:19 AM
skc7 requested review of this revision.Aug 17 2023, 12:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 17 2023, 12:19 AM
skc7 retitled this revision from [WIP] Add dynamic LDS implicit argument to v5 to [WIP] Add dynamic LDS size implicit argument to v5.Aug 17 2023, 2:05 AM

Why do we need this? I thought this was already available in the dispatch packet, you just need to subtract the statically known size

llvm/docs/AMDGPUUsage.rst
3964

S/passes/passed

llvm/lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp
1106

This just just be an i32

llvm/test/CodeGen/AMDGPU/hsa-metadata-hidden-args-v5.ll
95

This should have optimized out

skc7 updated this revision to Diff 551083.Aug 17 2023, 4:02 AM

Make lds size argument 32 bit int type.

skc7 added a subscriber: b-sumner.Aug 17 2023, 4:11 AM

Why do we need this? I thought this was already available in the dispatch packet, you just need to subtract the statically known size

For ASAN LDS support, we want runtime to place to dynamic LDS size as hidden kernel argument. This is the approach we assume might work. (considering if recycling of dispatch pointer would be done in future runtime version)
cc: @b-sumner

Why do we need this? I thought this was already available in the dispatch packet, you just need to subtract the statically known size

For ASAN LDS support, we want runtime to place to dynamic LDS size as hidden kernel argument. This is the approach we assume might work. (considering if recycling of dispatch pointer would be done in future runtime version)
cc: @b-sumner

With code object v5 we eliminated the need for the dispatch packet pointer and don't want to bring it back.

skc7 retitled this revision from [WIP] Add dynamic LDS size implicit argument to v5 to [AMDGPU] Add dynamic LDS size implicit argument to v5.Aug 17 2023, 7:45 AM
skc7 set the repository for this revision to rG LLVM Github Monorepo.
arsenm added inline comments.Aug 17 2023, 7:48 AM
llvm/lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp
1106

It also doesn't need 8 byte alignment

skc7 updated this revision to Diff 551381.Aug 17 2023, 10:06 PM
skc7 retitled this revision from [AMDGPU] Add dynamic LDS size implicit argument to v5 to [AMDGPU] Add dynamic LDS size implicit kernel argument to v5.

Update alignment for int32 type lds_size argument

arsenm requested changes to this revision.Aug 23 2023, 3:01 PM

Discussed not bothering defining metadata when this is implied to the runtime by using dynamic LDS

This revision now requires changes to proceed.Aug 23 2023, 3:01 PM