SWDEV-433371 - Support new comgr unbundling action

Support new comgr unbundling action api to extract codebjects
in compressed and uncompressed modes.

Create HIP_ALWAYS_USE_NEW_COMGR_UNBUNDLING_ACTION ENV to
toggle new path and old path.
If HIP_ALWAYS_USE_NEW_COMGR_UNBUNDLING_ACTION=false(default),
   uncompressed codeobject will go old path for better perf,
   compressed   codeobject will go new path.
If HIP_ALWAYS_USE_NEW_COMGR_UNBUNDLING_ACTION=true,
   both uncompressed and compressed codeobjects will go new
   path.

Add comgr wrapper for
   amd_comgr_action_info_set_bundle_entry_ids()

Change-Id: I79952f132fe21249296685ee12cae05a4f9aec32


[ROCm/clr commit: d0050ce309]
このコミットが含まれているのは:
Tao Sang
2024-05-15 14:57:13 -04:00
committed by Maneesh Gupta
コミット 7bf8d102fc
7個のファイルの変更552行の追加34行の削除
+27 -3
ファイルの表示
@@ -63,15 +63,39 @@ class CodeObject {
static uint64_t ElfSize(const void* emi);
static bool IsClangOffloadMagicBundle(const void* data);
static bool IsClangOffloadMagicBundle(const void* data, bool& isCompressed);
protected:
// Return size of fat bin
static size_t getFatbinSize(const void* data, const bool isCompressed = false);
/**
* @brief Extract code object from fatbin using comgr unbundling action
*
* @param[in] data the bundle data(fatbin or loaded module data). It can be in uncompressed,
* compressed and even SPIR-V(to be supported later) mode.
* @param[in] size the size of the bundle data
* @param[in] agent_triple_target_ids isa names of concerned devices
* @param[out] code_objs the buffer address and size pairs of extracted code objects of
* concerned devices
* Returned error code
*
* @return #hipSuccess, #hipErrorInvalidKernelFile, #hipErrorInvalidValue,
* #hipErrorNoBinaryForGpu
*
* @see FatBinaryInfo::ExtractFatBinaryUsingCOMGR(const void* data,
* const std::vector<hip::Device*>& devices)
*/
static hipError_t extractCodeObjectFromFatBinaryUsingComgr(
const void* data, size_t size, const std::vector<std::string>& devices,
std::vector<std::pair<const void*, size_t>>& code_objs);
protected:
//Given an ptr to image or file, extracts to code object
//for corresponding devices
static hipError_t extractCodeObjectFromFatBinary(const void*,
const std::vector<std::string>&,
std::vector<std::pair<const void*, size_t>>&);
CodeObject() {}
private:
friend const std::vector<hipModule_t>& modules();