llvm / llvm/llvm-project

[AMDGPU][Clang] How Can I Make the Same HIP Source Code Compile for Both WaveFront32 and WaveFront64?

Open
#198,360 6 comments 0 reactions 0 assignees View on GitHub
backend:AMDGPU clang
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

I am looking for a way (or a clean, non-intrusive workaround) to invoke Clang to compile HIP source code for both wavefront32 and wavefront64 on GPUs that support it, and include it in my final FAT binary. If I understand correctly, there is `-mwavefrontsize64`, a clang-level option that globally controls the wavefront size of all ISAs included in the FAT binary, but it globally changes the wavefront size for all architectures included in the final bundle.

My motivation is to support [Luthier's device tool code loading feature](https://github.com/matinraayai/Luthier/blob/mra/ir-translator/include/luthier/HSATooling/DeviceToolCodeFatBinaryLoader.h). For instrumenting a device side binary running on a newer RDNA GPU, a Luthier tool has to have the LLVM bitcode of both wavefront32 and wavefront64 version of the same instrumentation logic in its FAT binary. That way, it can instrument whichever wavefront size kernel the target application decides to run.

Dumping the individual device code objects on disk instead of bundling them with Luthier tool's shared object library is an option, but I'd rather keep all the code objects in a single FAT binary for ease of use.

Thanks

CC @shiltian

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.