gem5 v24.0.0.0
|
Classes | |
struct | hsa_code_object_s |
Struct containing an opaque handle to a code object, which contains ISA for finalized kernels and indirect functions together with information about the global or readonly segment variables they reference. More... | |
struct | hsa_callback_data_s |
Application data handle that is passed to the serialization and deserialization functions. More... | |
struct | hsa_code_symbol_s |
Code object symbol handle. More... | |
Typedefs | |
typedef struct hsa_code_object_s | hsa_code_object_t |
Struct containing an opaque handle to a code object, which contains ISA for finalized kernels and indirect functions together with information about the global or readonly segment variables they reference. | |
typedef struct hsa_callback_data_s | hsa_callback_data_t |
Application data handle that is passed to the serialization and deserialization functions. | |
typedef struct hsa_code_symbol_s | hsa_code_symbol_t |
Code object symbol handle. | |
Functions | |
hsa_status_t HSA_API HSA_DEPRECATED | hsa_code_object_serialize (hsa_code_object_t code_object, hsa_status_t(*alloc_callback)(size_t size, hsa_callback_data_t data, void **address), hsa_callback_data_t callback_data, const char *options, void **serialized_code_object, size_t *serialized_code_object_size) |
Serialize a code object. Can be used for offline finalization, install-time finalization, disk code caching, etc. | |
hsa_status_t HSA_API HSA_DEPRECATED | hsa_code_object_deserialize (void *serialized_code_object, size_t serialized_code_object_size, const char *options, hsa_code_object_t *code_object) |
Deserialize a code object. | |
hsa_status_t HSA_API HSA_DEPRECATED | hsa_code_object_destroy (hsa_code_object_t code_object) |
Destroy a code object. | |
hsa_status_t HSA_API HSA_DEPRECATED | hsa_code_object_get_info (hsa_code_object_t code_object, hsa_code_object_info_t attribute, void *value) |
Get the current value of an attribute for a given code object. | |
hsa_status_t HSA_API HSA_DEPRECATED | hsa_executable_load_code_object (hsa_executable_t executable, hsa_agent_t agent, hsa_code_object_t code_object, const char *options) |
Load code object into the executable. | |
hsa_status_t HSA_API HSA_DEPRECATED | hsa_code_object_get_symbol (hsa_code_object_t code_object, const char *symbol_name, hsa_code_symbol_t *symbol) |
Get the symbol handle within a code object for a given a symbol name. | |
hsa_status_t HSA_API HSA_DEPRECATED | hsa_code_object_get_symbol_from_name (hsa_code_object_t code_object, const char *module_name, const char *symbol_name, hsa_code_symbol_t *symbol) |
Get the symbol handle within a code object for a given a symbol name. | |
hsa_status_t HSA_API HSA_DEPRECATED | hsa_code_symbol_get_info (hsa_code_symbol_t code_symbol, hsa_code_symbol_info_t attribute, void *value) |
Get the current value of an attribute for a given code symbol. | |
hsa_status_t HSA_API HSA_DEPRECATED | hsa_code_object_iterate_symbols (hsa_code_object_t code_object, hsa_status_t(*callback)(hsa_code_object_t code_object, hsa_code_symbol_t symbol, void *data), void *data) |
Iterate over the symbols in a code object, and invoke an application-defined callback on every iteration. | |
typedef struct hsa_callback_data_s hsa_callback_data_t |
Application data handle that is passed to the serialization and deserialization functions.
typedef struct hsa_code_object_s hsa_code_object_t |
Struct containing an opaque handle to a code object, which contains ISA for finalized kernels and indirect functions together with information about the global or readonly segment variables they reference.
typedef struct hsa_code_symbol_s hsa_code_symbol_t |
Code object symbol handle.
The lifetime of a code object symbol matches that of the code object associated with it. An operation on a symbol whose associated code object has been destroyed results in undefined behavior.
Code object attributes.
Enumerator | |
---|---|
HSA_CODE_OBJECT_INFO_VERSION | The version of the code object. The type of this attribute is a NUL-terminated char[64]. The name must be at most 63 characters long (not including the NUL terminator) and all array elements not used for the name must be NUL. |
HSA_CODE_OBJECT_INFO_TYPE | Type of code object. The type of this attribute is hsa_code_object_type_t. |
HSA_CODE_OBJECT_INFO_ISA | Instruction set architecture this code object is produced for. The type of this attribute is hsa_isa_t. |
HSA_CODE_OBJECT_INFO_MACHINE_MODEL | Machine model this code object is produced for. The type of this attribute is hsa_machine_model_t. |
HSA_CODE_OBJECT_INFO_PROFILE | Profile this code object is produced for. The type of this attribute is hsa_profile_t. |
HSA_CODE_OBJECT_INFO_DEFAULT_FLOAT_ROUNDING_MODE | Default floating-point rounding mode used when the code object is produced. The type of this attribute is hsa_default_float_rounding_mode_t. |
Code object symbol attributes.
Enumerator | |
---|---|
HSA_CODE_SYMBOL_INFO_TYPE | The type of the symbol. The type of this attribute is hsa_symbol_kind_t. |
HSA_CODE_SYMBOL_INFO_NAME_LENGTH | The length of the symbol name in bytes, not including the NUL terminator. The type of this attribute is uint32_t. |
HSA_CODE_SYMBOL_INFO_NAME | The name of the symbol. The type of this attribute is character array with the length equal to the value of HSA_CODE_SYMBOL_INFO_NAME_LENGTH attribute. |
HSA_CODE_SYMBOL_INFO_MODULE_NAME_LENGTH | The length of the module name in bytes (not including the NUL terminator) to which this symbol belongs if this symbol has module linkage, otherwise 0 is returned. The type of this attribute is uint32_t. |
HSA_CODE_SYMBOL_INFO_MODULE_NAME | The module name to which this symbol belongs if this symbol has module linkage, otherwise an empty string is returned. The type of this attribute is character array with the length equal to the value of HSA_CODE_SYMBOL_INFO_MODULE_NAME_LENGTH attribute. |
HSA_CODE_SYMBOL_INFO_LINKAGE | The linkage kind of the symbol. The type of this attribute is hsa_symbol_linkage_t. |
HSA_CODE_SYMBOL_INFO_IS_DEFINITION | Indicates whether the symbol corresponds to a definition. The type of this attribute is bool. |
HSA_CODE_SYMBOL_INFO_VARIABLE_ALLOCATION | The allocation kind of the variable. The value of this attribute is undefined if the symbol is not a variable. The type of this attribute is hsa_variable_allocation_t. |
HSA_CODE_SYMBOL_INFO_VARIABLE_SEGMENT | The segment kind of the variable. The value of this attribute is undefined if the symbol is not a variable. The type of this attribute is hsa_variable_segment_t. |
HSA_CODE_SYMBOL_INFO_VARIABLE_ALIGNMENT | Alignment of the symbol in memory. The value of this attribute is undefined if the symbol is not a variable. The type of this attribute is uint32_t. The current alignment of the variable in memory may be greater than the value specified in the source program variable declaration. |
HSA_CODE_SYMBOL_INFO_VARIABLE_SIZE | Size of the variable. The value of this attribute is undefined if the symbol is not a variable. The type of this attribute is uint32_t. A size of 0 is returned if the variable is an external variable and has an unknown dimension. |
HSA_CODE_SYMBOL_INFO_VARIABLE_IS_CONST | Indicates whether the variable is constant. The value of this attribute is undefined if the symbol is not a variable. The type of this attribute is bool. |
HSA_CODE_SYMBOL_INFO_KERNEL_KERNARG_SEGMENT_SIZE | Size of kernarg segment memory that is required to hold the values of the kernel arguments, in bytes. Must be a multiple of 16. The value of this attribute is undefined if the symbol is not a kernel. The type of this attribute is uint32_t. |
HSA_CODE_SYMBOL_INFO_KERNEL_KERNARG_SEGMENT_ALIGNMENT | Alignment (in bytes) of the buffer used to pass arguments to the kernel, which is the maximum of 16 and the maximum alignment of any of the kernel arguments. The value of this attribute is undefined if the symbol is not a kernel. The type of this attribute is uint32_t. |
HSA_CODE_SYMBOL_INFO_KERNEL_GROUP_SEGMENT_SIZE | Size of static group segment memory required by the kernel (per work-group), in bytes. The value of this attribute is undefined if the symbol is not a kernel. The type of this attribute is uint32_t. The reported amount does not include any dynamically allocated group segment memory that may be requested by the application when a kernel is dispatched. |
HSA_CODE_SYMBOL_INFO_KERNEL_PRIVATE_SEGMENT_SIZE | Size of static private, spill, and arg segment memory required by this kernel (per work-item), in bytes. The value of this attribute is undefined if the symbol is not a kernel. The type of this attribute is uint32_t. If the value of HSA_CODE_SYMBOL_INFO_KERNEL_DYNAMIC_CALLSTACK is true, the kernel may use more private memory than the reported value, and the application must add the dynamic call stack usage to private_segment_size when populating a kernel dispatch packet. |
HSA_CODE_SYMBOL_INFO_KERNEL_DYNAMIC_CALLSTACK | Dynamic callstack flag. The value of this attribute is undefined if the symbol is not a kernel. The type of this attribute is bool. If this flag is set (the value is true), the kernel uses a dynamically sized call stack. This can happen if recursive calls, calls to indirect functions, or the HSAIL alloca instruction are present in the kernel. |
HSA_CODE_SYMBOL_INFO_KERNEL_CALL_CONVENTION | Call convention of the kernel. The value of this attribute is undefined if the symbol is not a kernel. The type of this attribute is uint32_t. |
HSA_CODE_SYMBOL_INFO_INDIRECT_FUNCTION_CALL_CONVENTION | Call convention of the indirect function. The value of this attribute is undefined if the symbol is not an indirect function. The type of this attribute is uint32_t. |
hsa_status_t HSA_API HSA_DEPRECATED hsa_code_object_deserialize | ( | void * | serialized_code_object, |
size_t | serialized_code_object_size, | ||
const char * | options, | ||
hsa_code_object_t * | code_object ) |
Deserialize a code object.
[in] | serialized_code_object | A serialized code object. Must not be NULL. |
[in] | serialized_code_object_size | The size (in bytes) of serialized_code_object . Must not be 0. |
[in] | options | Standard and vendor-specific options. Unknown options are ignored. A standard option begins with the "-hsa_" prefix. Options beginning with the "-hsa_ext_<extension_name>_" prefix are reserved for extensions. A vendor-specific option begins with the "-<vendor_name>_" prefix. Must be a NUL-terminated string. May be NULL. |
[out] | code_object | Memory location where the HSA runtime stores the deserialized code object. |
HSA_STATUS_SUCCESS | The function has been executed successfully. |
HSA_STATUS_ERROR_NOT_INITIALIZED | The HSA runtime has not been initialized. |
HSA_STATUS_ERROR_OUT_OF_RESOURCES | The HSA runtime failed to allocate the required resources. |
HSA_STATUS_ERROR_INVALID_ARGUMENT | serialized_code_object , or code_object are NULL, or serialized_code_object_size is 0. |
hsa_status_t HSA_API HSA_DEPRECATED hsa_code_object_destroy | ( | hsa_code_object_t | code_object | ) |
Destroy a code object.
The lifetime of a code object must exceed that of any executable where it has been loaded. If an executable that loaded code_object
has not been destroyed, the behavior is undefined.
[in] | code_object | Code object. The handle becomes invalid after it has been destroyed. |
HSA_STATUS_SUCCESS | The function has been executed successfully. |
HSA_STATUS_ERROR_NOT_INITIALIZED | The HSA runtime has not been initialized. |
HSA_STATUS_ERROR_INVALID_CODE_OBJECT | code_object is invalid. |
hsa_status_t HSA_API HSA_DEPRECATED hsa_code_object_get_info | ( | hsa_code_object_t | code_object, |
hsa_code_object_info_t | attribute, | ||
void * | value ) |
Get the current value of an attribute for a given code object.
[in] | code_object | Code object. |
[in] | attribute | Attribute to query. |
[out] | value | Pointer to an application-allocated buffer where to store the value of the attribute. If the buffer passed by the application is not large enough to hold the value of attribute , the behavior is undefined. |
HSA_STATUS_SUCCESS | The function has been executed successfully. |
HSA_STATUS_ERROR_NOT_INITIALIZED | The HSA runtime has not been initialized. |
HSA_STATUS_ERROR_INVALID_CODE_OBJECT | code_object is invalid. |
HSA_STATUS_ERROR_INVALID_ARGUMENT | attribute is an invalid code object attribute, or value is NULL. |
hsa_status_t HSA_API HSA_DEPRECATED hsa_code_object_get_symbol | ( | hsa_code_object_t | code_object, |
const char * | symbol_name, | ||
hsa_code_symbol_t * | symbol ) |
Get the symbol handle within a code object for a given a symbol name.
[in] | code_object | Code object. |
[in] | symbol_name | Symbol name. |
[out] | symbol | Memory location where the HSA runtime stores the symbol handle. |
HSA_STATUS_SUCCESS | The function has been executed successfully. |
HSA_STATUS_ERROR_NOT_INITIALIZED | The HSA runtime has not been initialized. |
HSA_STATUS_ERROR_INVALID_CODE_OBJECT | code_object is invalid. |
HSA_STATUS_ERROR_INVALID_SYMBOL_NAME | There is no symbol with a name that matches symbol_name . |
HSA_STATUS_ERROR_INVALID_ARGUMENT | symbol_name is NULL, or symbol is NULL. |
hsa_status_t HSA_API HSA_DEPRECATED hsa_code_object_get_symbol_from_name | ( | hsa_code_object_t | code_object, |
const char * | module_name, | ||
const char * | symbol_name, | ||
hsa_code_symbol_t * | symbol ) |
Get the symbol handle within a code object for a given a symbol name.
[in] | code_object | Code object. |
[in] | module_name | Module name. Must be NULL if the symbol has program linkage. |
[in] | symbol_name | Symbol name. |
[out] | symbol | Memory location where the HSA runtime stores the symbol handle. |
HSA_STATUS_SUCCESS | The function has been executed successfully. |
HSA_STATUS_ERROR_NOT_INITIALIZED | The HSA runtime has not been initialized. |
HSA_STATUS_ERROR_INVALID_CODE_OBJECT | code_object is invalid. |
HSA_STATUS_ERROR_INVALID_SYMBOL_NAME | There is no symbol with a name that matches symbol_name . |
HSA_STATUS_ERROR_INVALID_ARGUMENT | symbol_name is NULL, or symbol is NULL. |
hsa_status_t HSA_API HSA_DEPRECATED hsa_code_object_iterate_symbols | ( | hsa_code_object_t | code_object, |
hsa_status_t(* | callback )(hsa_code_object_t code_object, hsa_code_symbol_t symbol, void *data), | ||
void * | data ) |
Iterate over the symbols in a code object, and invoke an application-defined callback on every iteration.
[in] | code_object | Code object. |
[in] | callback | Callback to be invoked once per code object symbol. The HSA runtime passes three arguments to the callback: the code object, a symbol, and the application data. If callback returns a status other than HSA_STATUS_SUCCESS for a particular iteration, the traversal stops and hsa_code_object_iterate_symbols returns that status value. |
[in] | data | Application data that is passed to callback on every iteration. May be NULL. |
HSA_STATUS_SUCCESS | The function has been executed successfully. |
HSA_STATUS_ERROR_NOT_INITIALIZED | The HSA runtime has not been initialized. |
HSA_STATUS_ERROR_INVALID_CODE_OBJECT | code_object is invalid. |
HSA_STATUS_ERROR_INVALID_ARGUMENT | callback is NULL. |
hsa_status_t HSA_API HSA_DEPRECATED hsa_code_object_serialize | ( | hsa_code_object_t | code_object, |
hsa_status_t(* | alloc_callback )(size_t size, hsa_callback_data_t data, void **address), | ||
hsa_callback_data_t | callback_data, | ||
const char * | options, | ||
void ** | serialized_code_object, | ||
size_t * | serialized_code_object_size ) |
Serialize a code object. Can be used for offline finalization, install-time finalization, disk code caching, etc.
[in] | code_object | Code object. |
[in] | alloc_callback | Callback function for memory allocation. Must not be NULL. The HSA runtime passes three arguments to the callback: the allocation size, the application data, and a pointer to a memory location where the application stores the allocation result. The HSA runtime invokes alloc_callback once to allocate a buffer that contains the serialized version of code_object . If the callback returns a status code other than HSA_STATUS_SUCCESS, this function returns the same code. |
[in] | callback_data | Application data that is passed to alloc_callback . May be NULL. |
[in] | options | Standard and vendor-specific options. Unknown options are ignored. A standard option begins with the "-hsa_" prefix. Options beginning with the "-hsa_ext_<extension_name>_" prefix are reserved for extensions. A vendor-specific option begins with the "-<vendor_name>_" prefix. Must be a NUL-terminated string. May be NULL. |
[out] | serialized_code_object | Memory location where the HSA runtime stores a pointer to the serialized code object. Must not be NULL. |
[out] | serialized_code_object_size | Memory location where the HSA runtime stores the size (in bytes) of serialized_code_object . The returned value matches the allocation size passed by the HSA runtime to alloc_callback . Must not be NULL. |
HSA_STATUS_SUCCESS | The function has been executed successfully. |
HSA_STATUS_ERROR_NOT_INITIALIZED | The HSA runtime has not been initialized. |
HSA_STATUS_ERROR_OUT_OF_RESOURCES | The HSA runtime failed to allocate the required resources. |
HSA_STATUS_ERROR_INVALID_CODE_OBJECT | code_object is invalid. |
HSA_STATUS_ERROR_INVALID_ARGUMENT | alloc_callback , serialized_code_object , or serialized_code_object_size are NULL. |
hsa_status_t HSA_API HSA_DEPRECATED hsa_code_symbol_get_info | ( | hsa_code_symbol_t | code_symbol, |
hsa_code_symbol_info_t | attribute, | ||
void * | value ) |
Get the current value of an attribute for a given code symbol.
[in] | code_symbol | Code symbol. |
[in] | attribute | Attribute to query. |
[out] | value | Pointer to an application-allocated buffer where to store the value of the attribute. If the buffer passed by the application is not large enough to hold the value of attribute , the behavior is undefined. |
HSA_STATUS_SUCCESS | The function has been executed successfully. |
HSA_STATUS_ERROR_NOT_INITIALIZED | The HSA runtime has not been initialized. |
HSA_STATUS_ERROR_INVALID_CODE_SYMBOL | The code symbol is invalid. |
HSA_STATUS_ERROR_INVALID_ARGUMENT | attribute is an invalid code symbol attribute, or value is NULL. |
hsa_status_t HSA_API HSA_DEPRECATED hsa_executable_load_code_object | ( | hsa_executable_t | executable, |
hsa_agent_t | agent, | ||
hsa_code_object_t | code_object, | ||
const char * | options ) |
Load code object into the executable.
Every global or readonly variable that is external must be defined before loading the code object. An internal global or readonly variable is allocated once the code object, that is being loaded, references this variable and this variable is not allocated.
Any module linkage declaration must have been defined either by a define variable or by loading a code object that has a symbol with module linkage definition.
[in] | executable | Executable. |
[in] | agent | Agent to load code object for. The agent must support the default floating-point rounding mode used by code_object . |
[in] | code_object | Code object to load. The lifetime of the code object must exceed that of the executable: if code_object is destroyed before executable , the behavior is undefined. |
[in] | options | Standard and vendor-specific options. Unknown options are ignored. A standard option begins with the "-hsa_" prefix. Options beginning with the "-hsa_ext_<extension_name>_" prefix are reserved for extensions. A vendor-specific option begins with the "-<vendor_name>_" prefix. Must be a NUL-terminated string. May be NULL. |
HSA_STATUS_SUCCESS | The function has been executed successfully. |
HSA_STATUS_ERROR_NOT_INITIALIZED | The HSA runtime has not been initialized. |
HSA_STATUS_ERROR_OUT_OF_RESOURCES | The HSA runtime failed to allocate the required resources. |
HSA_STATUS_ERROR_INVALID_EXECUTABLE | The executable is invalid. |
HSA_STATUS_ERROR_INVALID_AGENT | The agent is invalid. |
HSA_STATUS_ERROR_INVALID_CODE_OBJECT | code_object is invalid. |
HSA_STATUS_ERROR_INCOMPATIBLE_ARGUMENTS | agent is not compatible with code_object (for example, agent does not support the default floating-point rounding mode specified by code_object ), or code_object is not compatible with executable (for example, code_object and executable have different machine models or profiles). |
HSA_STATUS_ERROR_FROZEN_EXECUTABLE | executable is frozen. |