Skip to content

[Feature Request]: Support for Treating Device Functions As hsa_executable_symbol_t's #203

@matinraayai

Description

@matinraayai

As of right now, the HSA standard only supports identifying the following symbols types:

  • Kernels
  • Variables

The standard has listed indirect functions as a symbol type, but the AMD ROCr runtime does not implement it.

Device functions on the other hand, are absent from this list, even though they can be identified by inspecting the Loaded Code Object's storage ELF directly, and are emitted by the LLVM AMDGPU compiler.

Supporting device functions as hsa_executable_symbol_t's can have the following benefits:

  1. The CUDA runtime treats device functions as symbols. Adding support in ROCr means HIP can also behave in the same manner as CUDA.
  2. Supporting device functions as hsa_executable_symbol_ts means the loader can resolve their relocations. A user can have a library of device functions in a separate code object and another one that uses said library. Instead of having to link both code objects together before loading, the user can simply add both code objects into a single executable before freezing the executable.
  3. In dynamic instrumentation, device functions are treated as symbols:
    a. A tool writer inserts callbacks in the kernel to device functions they have written in the tool; The instrumentation runtime should be able to identify where the device function is loaded, so that it can perform insert the requested callback into the target application.
    b. When analyzing the target kernel, a list of possible device functions called from it needs to be identified and returned to the tool writer, in case they want to instrument them as well. Exposing these as hsa_executable_symbol_t seems like the logical option.

cc @kzhuravl

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions