| 1 |
//////////////////////////////////////////////////////////////////////////////// |
| 2 |
// |
| 3 |
// Copyright (C) 2014-2020 Advanced Micro Devices Inc. All rights reserved. |
| 4 |
// |
| 5 |
// Permission is hereby granted, free of charge, to any person or organization |
| 6 |
// obtaining a copy of the software and accompanying documentation covered by |
| 7 |
// this license (the "Software") to use, reproduce, display, distribute, |
| 8 |
// execute, and transmit the Software, and to prepare derivative works of the |
| 9 |
// Software, and to permit third-parties to whom the Software is furnished to |
| 10 |
// do so, all subject to the following: |
| 11 |
// |
| 12 |
// The copyright notices in the Software and this entire statement, including |
| 13 |
// the above license grant, this restriction and the following disclaimer, |
| 14 |
// must be included in all copies of the Software, in whole or in part, and |
| 15 |
// all derivative works of the Software, unless such copies or derivative |
| 16 |
// works are solely in the form of machine-executable object code generated by |
| 17 |
// a source language processor. |
| 18 |
// |
| 19 |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 20 |
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 21 |
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT |
| 22 |
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE |
| 23 |
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, |
| 24 |
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 25 |
// DEALINGS IN THE SOFTWARE. |
| 26 |
// |
| 27 |
//////////////////////////////////////////////////////////////////////////////// |
| 28 |
|
| 29 |
#ifndef HSA_RUNTIME_INC_HSA_H_ |
| 30 |
#define HSA_RUNTIME_INC_HSA_H_ |
| 31 |
|
| 32 |
#include <stddef.h> /* size_t */ |
| 33 |
#include <stdint.h> /* uintXX_t */ |
| 34 |
|
| 35 |
#ifndef __cplusplus |
| 36 |
#include <stdbool.h> /* bool */ |
| 37 |
#endif /* __cplusplus */ |
| 38 |
|
| 39 |
// Placeholder for calling convention and import/export macros |
| 40 |
#ifndef HSA_CALL |
| 41 |
#define HSA_CALL |
| 42 |
#endif |
| 43 |
|
| 44 |
#ifndef HSA_EXPORT_DECORATOR |
| 45 |
#ifdef __GNUC__ |
| 46 |
#define HSA_EXPORT_DECORATOR __attribute__ ((visibility ("default"))) |
| 47 |
#else |
| 48 |
#define HSA_EXPORT_DECORATOR |
| 49 |
#endif |
| 50 |
#endif |
| 51 |
#define HSA_API_EXPORT HSA_EXPORT_DECORATOR HSA_CALL |
| 52 |
#define HSA_API_IMPORT HSA_CALL |
| 53 |
|
| 54 |
#if !defined(HSA_API) && defined(HSA_EXPORT) |
| 55 |
#define HSA_API HSA_API_EXPORT |
| 56 |
#else |
| 57 |
#define HSA_API HSA_API_IMPORT |
| 58 |
#endif |
| 59 |
|
| 60 |
// Detect and set large model builds. |
| 61 |
#undef HSA_LARGE_MODEL |
| 62 |
#if defined(__LP64__) || defined(_M_X64) |
| 63 |
#define HSA_LARGE_MODEL |
| 64 |
#endif |
| 65 |
|
| 66 |
// Try to detect CPU endianness |
| 67 |
#if !defined(LITTLEENDIAN_CPU) && !defined(BIGENDIAN_CPU) |
| 68 |
#if defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || \ |
| 69 |
defined(_M_X64) |
| 70 |
#define LITTLEENDIAN_CPU |
| 71 |
#endif |
| 72 |
#endif |
| 73 |
|
| 74 |
#undef HSA_LITTLE_ENDIAN |
| 75 |
#if defined(LITTLEENDIAN_CPU) |
| 76 |
#define HSA_LITTLE_ENDIAN |
| 77 |
#elif defined(BIGENDIAN_CPU) |
| 78 |
#else |
| 79 |
#error "BIGENDIAN_CPU or LITTLEENDIAN_CPU must be defined" |
| 80 |
#endif |
| 81 |
|
| 82 |
#ifndef HSA_DEPRECATED |
| 83 |
#define HSA_DEPRECATED |
| 84 |
//#ifdef __GNUC__ |
| 85 |
//#define HSA_DEPRECATED __attribute__((deprecated)) |
| 86 |
//#else |
| 87 |
//#define HSA_DEPRECATED __declspec(deprecated) |
| 88 |
//#endif |
| 89 |
#endif |
| 90 |
|
| 91 |
#define HSA_VERSION_1_0 1 |
| 92 |
|
| 93 |
#ifdef __cplusplus |
| 94 |
extern "C" { |
| 95 |
#endif /* __cplusplus */ |
| 96 |
|
| 97 |
/** \defgroup status Runtime Notifications |
| 98 |
* @{ |
| 99 |
*/ |
| 100 |
|
| 101 |
/** |
| 102 |
* @brief Status codes. |
| 103 |
*/ |
| 104 |
typedef enum { |
| 105 |
/** |
| 106 |
* The function has been executed successfully. |
| 107 |
*/ |
| 108 |
HSA_STATUS_SUCCESS = 0x0, |
| 109 |
/** |
| 110 |
* A traversal over a list of elements has been interrupted by the |
| 111 |
* application before completing. |
| 112 |
*/ |
| 113 |
HSA_STATUS_INFO_BREAK = 0x1, |
| 114 |
/** |
| 115 |
* A generic error has occurred. |
| 116 |
*/ |
| 117 |
HSA_STATUS_ERROR = 0x1000, |
| 118 |
/** |
| 119 |
* One of the actual arguments does not meet a precondition stated in the |
| 120 |
* documentation of the corresponding formal argument. |
| 121 |
*/ |
| 122 |
HSA_STATUS_ERROR_INVALID_ARGUMENT = 0x1001, |
| 123 |
/** |
| 124 |
* The requested queue creation is not valid. |
| 125 |
*/ |
| 126 |
HSA_STATUS_ERROR_INVALID_QUEUE_CREATION = 0x1002, |
| 127 |
/** |
| 128 |
* The requested allocation is not valid. |
| 129 |
*/ |
| 130 |
HSA_STATUS_ERROR_INVALID_ALLOCATION = 0x1003, |
| 131 |
/** |
| 132 |
* The agent is invalid. |
| 133 |
*/ |
| 134 |
HSA_STATUS_ERROR_INVALID_AGENT = 0x1004, |
| 135 |
/** |
| 136 |
* The memory region is invalid. |
| 137 |
*/ |
| 138 |
HSA_STATUS_ERROR_INVALID_REGION = 0x1005, |
| 139 |
/** |
| 140 |
* The signal is invalid. |
| 141 |
*/ |
| 142 |
HSA_STATUS_ERROR_INVALID_SIGNAL = 0x1006, |
| 143 |
/** |
| 144 |
* The queue is invalid. |
| 145 |
*/ |
| 146 |
HSA_STATUS_ERROR_INVALID_QUEUE = 0x1007, |
| 147 |
/** |
| 148 |
* The HSA runtime failed to allocate the necessary resources. This error |
| 149 |
* may also occur when the HSA runtime needs to spawn threads or create |
| 150 |
* internal OS-specific events. |
| 151 |
*/ |
| 152 |
HSA_STATUS_ERROR_OUT_OF_RESOURCES = 0x1008, |
| 153 |
/** |
| 154 |
* The AQL packet is malformed. |
| 155 |
*/ |
| 156 |
HSA_STATUS_ERROR_INVALID_PACKET_FORMAT = 0x1009, |
| 157 |
/** |
| 158 |
* An error has been detected while releasing a resource. |
| 159 |
*/ |
| 160 |
HSA_STATUS_ERROR_RESOURCE_FREE = 0x100A, |
| 161 |
/** |
| 162 |
* An API other than ::hsa_init has been invoked while the reference count |
| 163 |
* of the HSA runtime is 0. |
| 164 |
*/ |
| 165 |
HSA_STATUS_ERROR_NOT_INITIALIZED = 0x100B, |
| 166 |
/** |
| 167 |
* The maximum reference count for the object has been reached. |
| 168 |
*/ |
| 169 |
HSA_STATUS_ERROR_REFCOUNT_OVERFLOW = 0x100C, |
| 170 |
/** |
| 171 |
* The arguments passed to a functions are not compatible. |
| 172 |
*/ |
| 173 |
HSA_STATUS_ERROR_INCOMPATIBLE_ARGUMENTS = 0x100D, |
| 174 |
/** |
| 175 |
* The index is invalid. |
| 176 |
*/ |
| 177 |
HSA_STATUS_ERROR_INVALID_INDEX = 0x100E, |
| 178 |
/** |
| 179 |
* The instruction set architecture is invalid. |
| 180 |
*/ |
| 181 |
HSA_STATUS_ERROR_INVALID_ISA = 0x100F, |
| 182 |
/** |
| 183 |
* The instruction set architecture name is invalid. |
| 184 |
*/ |
| 185 |
HSA_STATUS_ERROR_INVALID_ISA_NAME = 0x1017, |
| 186 |
/** |
| 187 |
* The code object is invalid. |
| 188 |
*/ |
| 189 |
HSA_STATUS_ERROR_INVALID_CODE_OBJECT = 0x1010, |
| 190 |
/** |
| 191 |
* The executable is invalid. |
| 192 |
*/ |
| 193 |
HSA_STATUS_ERROR_INVALID_EXECUTABLE = 0x1011, |
| 194 |
/** |
| 195 |
* The executable is frozen. |
| 196 |
*/ |
| 197 |
HSA_STATUS_ERROR_FROZEN_EXECUTABLE = 0x1012, |
| 198 |
/** |
| 199 |
* There is no symbol with the given name. |
| 200 |
*/ |
| 201 |
HSA_STATUS_ERROR_INVALID_SYMBOL_NAME = 0x1013, |
| 202 |
/** |
| 203 |
* The variable is already defined. |
| 204 |
*/ |
| 205 |
HSA_STATUS_ERROR_VARIABLE_ALREADY_DEFINED = 0x1014, |
| 206 |
/** |
| 207 |
* The variable is undefined. |
| 208 |
*/ |
| 209 |
HSA_STATUS_ERROR_VARIABLE_UNDEFINED = 0x1015, |
| 210 |
/** |
| 211 |
* An HSAIL operation resulted in a hardware exception. |
| 212 |
*/ |
| 213 |
HSA_STATUS_ERROR_EXCEPTION = 0x1016, |
| 214 |
/** |
| 215 |
* The code object symbol is invalid. |
| 216 |
*/ |
| 217 |
HSA_STATUS_ERROR_INVALID_CODE_SYMBOL = 0x1018, |
| 218 |
/** |
| 219 |
* The executable symbol is invalid. |
| 220 |
*/ |
| 221 |
HSA_STATUS_ERROR_INVALID_EXECUTABLE_SYMBOL = 0x1019, |
| 222 |
/** |
| 223 |
* The file descriptor is invalid. |
| 224 |
*/ |
| 225 |
HSA_STATUS_ERROR_INVALID_FILE = 0x1020, |
| 226 |
/** |
| 227 |
* The code object reader is invalid. |
| 228 |
*/ |
| 229 |
HSA_STATUS_ERROR_INVALID_CODE_OBJECT_READER = 0x1021, |
| 230 |
/** |
| 231 |
* The cache is invalid. |
| 232 |
*/ |
| 233 |
HSA_STATUS_ERROR_INVALID_CACHE = 0x1022, |
| 234 |
/** |
| 235 |
* The wavefront is invalid. |
| 236 |
*/ |
| 237 |
HSA_STATUS_ERROR_INVALID_WAVEFRONT = 0x1023, |
| 238 |
/** |
| 239 |
* The signal group is invalid. |
| 240 |
*/ |
| 241 |
HSA_STATUS_ERROR_INVALID_SIGNAL_GROUP = 0x1024, |
| 242 |
/** |
| 243 |
* The HSA runtime is not in the configuration state. |
| 244 |
*/ |
| 245 |
HSA_STATUS_ERROR_INVALID_RUNTIME_STATE = 0x1025, |
| 246 |
/** |
| 247 |
* The queue received an error that may require process termination. |
| 248 |
*/ |
| 249 |
HSA_STATUS_ERROR_FATAL = 0x1026 |
| 250 |
} hsa_status_t; |
| 251 |
|
| 252 |
/** |
| 253 |
* @brief Query additional information about a status code. |
| 254 |
* |
| 255 |
* @param[in] status Status code. |
| 256 |
* |
| 257 |
* @param[out] status_string A NUL-terminated string that describes the error |
| 258 |
* status. |
| 259 |
* |
| 260 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 261 |
* |
| 262 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 263 |
* initialized. |
| 264 |
* |
| 265 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p status is an invalid |
| 266 |
* status code, or @p status_string is NULL. |
| 267 |
*/ |
| 268 |
hsa_status_t HSA_API hsa_status_string( |
| 269 |
hsa_status_t status, |
| 270 |
const char ** status_string); |
| 271 |
|
| 272 |
/** @} */ |
| 273 |
|
| 274 |
/** \defgroup common Common Definitions |
| 275 |
* @{ |
| 276 |
*/ |
| 277 |
|
| 278 |
/** |
| 279 |
* @brief Three-dimensional coordinate. |
| 280 |
*/ |
| 281 |
typedef struct hsa_dim3_s { |
| 282 |
/** |
| 283 |
* X dimension. |
| 284 |
*/ |
| 285 |
uint32_t x; |
| 286 |
|
| 287 |
/** |
| 288 |
* Y dimension. |
| 289 |
*/ |
| 290 |
uint32_t y; |
| 291 |
|
| 292 |
/** |
| 293 |
* Z dimension. |
| 294 |
*/ |
| 295 |
uint32_t z; |
| 296 |
} hsa_dim3_t; |
| 297 |
|
| 298 |
/** |
| 299 |
* @brief Access permissions. |
| 300 |
*/ |
| 301 |
typedef enum { |
| 302 |
/** |
| 303 |
* Read-only access. |
| 304 |
*/ |
| 305 |
HSA_ACCESS_PERMISSION_RO = 1, |
| 306 |
/** |
| 307 |
* Write-only access. |
| 308 |
*/ |
| 309 |
HSA_ACCESS_PERMISSION_WO = 2, |
| 310 |
/** |
| 311 |
* Read and write access. |
| 312 |
*/ |
| 313 |
HSA_ACCESS_PERMISSION_RW = 3 |
| 314 |
} hsa_access_permission_t; |
| 315 |
|
| 316 |
/** |
| 317 |
* @brief POSIX file descriptor. |
| 318 |
*/ |
| 319 |
typedef int hsa_file_t; |
| 320 |
|
| 321 |
/** @} **/ |
| 322 |
|
| 323 |
|
| 324 |
/** \defgroup initshutdown Initialization and Shut Down |
| 325 |
* @{ |
| 326 |
*/ |
| 327 |
|
| 328 |
/** |
| 329 |
* @brief Initialize the HSA runtime. |
| 330 |
* |
| 331 |
* @details Initializes the HSA runtime if it is not already initialized, and |
| 332 |
* increases the reference counter associated with the HSA runtime for the |
| 333 |
* current process. Invocation of any HSA function other than ::hsa_init results |
| 334 |
* in undefined behavior if the current HSA runtime reference counter is less |
| 335 |
* than one. |
| 336 |
* |
| 337 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 338 |
* |
| 339 |
* @retval ::HSA_STATUS_ERROR_OUT_OF_RESOURCES The HSA runtime failed to allocate |
| 340 |
* the required resources. |
| 341 |
* |
| 342 |
* @retval ::HSA_STATUS_ERROR_REFCOUNT_OVERFLOW The HSA runtime reference |
| 343 |
* count reaches INT32_MAX. |
| 344 |
*/ |
| 345 |
hsa_status_t HSA_API hsa_init(); |
| 346 |
|
| 347 |
/** |
| 348 |
* @brief Shut down the HSA runtime. |
| 349 |
* |
| 350 |
* @details Decreases the reference count of the HSA runtime instance. When the |
| 351 |
* reference count reaches 0, the HSA runtime is no longer considered valid |
| 352 |
* but the application might call ::hsa_init to initialize the HSA runtime |
| 353 |
* again. |
| 354 |
* |
| 355 |
* Once the reference count of the HSA runtime reaches 0, all the resources |
| 356 |
* associated with it (queues, signals, agent information, etc.) are |
| 357 |
* considered invalid and any attempt to reference them in subsequent API calls |
| 358 |
* results in undefined behavior. When the reference count reaches 0, the HSA |
| 359 |
* runtime may release resources associated with it. |
| 360 |
* |
| 361 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 362 |
* |
| 363 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 364 |
* initialized. |
| 365 |
* |
| 366 |
*/ |
| 367 |
hsa_status_t HSA_API hsa_shut_down(); |
| 368 |
|
| 369 |
/** @} **/ |
| 370 |
|
| 371 |
/** \defgroup agentinfo System and Agent Information |
| 372 |
* @{ |
| 373 |
*/ |
| 374 |
|
| 375 |
/** |
| 376 |
* @brief Endianness. A convention used to interpret the bytes making up a data |
| 377 |
* word. |
| 378 |
*/ |
| 379 |
typedef enum { |
| 380 |
/** |
| 381 |
* The least significant byte is stored in the smallest address. |
| 382 |
*/ |
| 383 |
HSA_ENDIANNESS_LITTLE = 0, |
| 384 |
/** |
| 385 |
* The most significant byte is stored in the smallest address. |
| 386 |
*/ |
| 387 |
HSA_ENDIANNESS_BIG = 1 |
| 388 |
} hsa_endianness_t; |
| 389 |
|
| 390 |
/** |
| 391 |
* @brief Machine model. A machine model determines the size of certain data |
| 392 |
* types in HSA runtime and an agent. |
| 393 |
*/ |
| 394 |
typedef enum { |
| 395 |
/** |
| 396 |
* Small machine model. Addresses use 32 bits. |
| 397 |
*/ |
| 398 |
HSA_MACHINE_MODEL_SMALL = 0, |
| 399 |
/** |
| 400 |
* Large machine model. Addresses use 64 bits. |
| 401 |
*/ |
| 402 |
HSA_MACHINE_MODEL_LARGE = 1 |
| 403 |
} hsa_machine_model_t; |
| 404 |
|
| 405 |
/** |
| 406 |
* @brief Profile. A profile indicates a particular level of feature |
| 407 |
* support. For example, in the base profile the application must use the HSA |
| 408 |
* runtime allocator to reserve shared virtual memory, while in the full profile |
| 409 |
* any host pointer can be shared across all the agents. |
| 410 |
*/ |
| 411 |
typedef enum { |
| 412 |
/** |
| 413 |
* Base profile. |
| 414 |
*/ |
| 415 |
HSA_PROFILE_BASE = 0, |
| 416 |
/** |
| 417 |
* Full profile. |
| 418 |
*/ |
| 419 |
HSA_PROFILE_FULL = 1 |
| 420 |
} hsa_profile_t; |
| 421 |
|
| 422 |
/** |
| 423 |
* @brief System attributes. |
| 424 |
*/ |
| 425 |
typedef enum { |
| 426 |
/** |
| 427 |
* Major version of the HSA runtime specification supported by the |
| 428 |
* implementation. The type of this attribute is uint16_t. |
| 429 |
*/ |
| 430 |
HSA_SYSTEM_INFO_VERSION_MAJOR = 0, |
| 431 |
/** |
| 432 |
* Minor version of the HSA runtime specification supported by the |
| 433 |
* implementation. The type of this attribute is uint16_t. |
| 434 |
*/ |
| 435 |
HSA_SYSTEM_INFO_VERSION_MINOR = 1, |
| 436 |
/** |
| 437 |
* Current timestamp. The value of this attribute monotonically increases at a |
| 438 |
* constant rate. The type of this attribute is uint64_t. |
| 439 |
*/ |
| 440 |
HSA_SYSTEM_INFO_TIMESTAMP = 2, |
| 441 |
/** |
| 442 |
* Timestamp value increase rate, in Hz. The timestamp (clock) frequency is |
| 443 |
* in the range 1-400MHz. The type of this attribute is uint64_t. |
| 444 |
*/ |
| 445 |
HSA_SYSTEM_INFO_TIMESTAMP_FREQUENCY = 3, |
| 446 |
/** |
| 447 |
* Maximum duration of a signal wait operation. Expressed as a count based on |
| 448 |
* the timestamp frequency. The type of this attribute is uint64_t. |
| 449 |
*/ |
| 450 |
HSA_SYSTEM_INFO_SIGNAL_MAX_WAIT = 4, |
| 451 |
/** |
| 452 |
* Endianness of the system. The type of this attribute is ::hsa_endianness_t. |
| 453 |
*/ |
| 454 |
HSA_SYSTEM_INFO_ENDIANNESS = 5, |
| 455 |
/** |
| 456 |
* Machine model supported by the HSA runtime. The type of this attribute is |
| 457 |
* ::hsa_machine_model_t. |
| 458 |
*/ |
| 459 |
HSA_SYSTEM_INFO_MACHINE_MODEL = 6, |
| 460 |
/** |
| 461 |
* Bit-mask indicating which extensions are supported by the |
| 462 |
* implementation. An extension with an ID of @p i is supported if the bit at |
| 463 |
* position @p i is set. The type of this attribute is uint8_t[128]. |
| 464 |
*/ |
| 465 |
HSA_SYSTEM_INFO_EXTENSIONS = 7, |
| 466 |
/** |
| 467 |
* String containing the ROCr build identifier. |
| 468 |
*/ |
| 469 |
HSA_AMD_SYSTEM_INFO_BUILD_VERSION = 0x200, |
| 470 |
|
| 471 |
HSA_AMD_SYSTEM_INFO_SVM_ACCESSIBLE_BY_DEFAULT = 0x202 |
| 472 |
} hsa_system_info_t; |
| 473 |
|
| 474 |
/** |
| 475 |
* @brief Get the current value of a system attribute. |
| 476 |
* |
| 477 |
* @param[in] attribute Attribute to query. |
| 478 |
* |
| 479 |
* @param[out] value Pointer to an application-allocated buffer where to store |
| 480 |
* the value of the attribute. If the buffer passed by the application is not |
| 481 |
* large enough to hold the value of @p attribute, the behavior is undefined. |
| 482 |
* |
| 483 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 484 |
* |
| 485 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 486 |
* initialized. |
| 487 |
* |
| 488 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p attribute is an invalid |
| 489 |
* system attribute, or @p value is NULL. |
| 490 |
*/ |
| 491 |
hsa_status_t HSA_API hsa_system_get_info( |
| 492 |
hsa_system_info_t attribute, |
| 493 |
void* value); |
| 494 |
|
| 495 |
/** |
| 496 |
* @brief HSA extensions. |
| 497 |
*/ |
| 498 |
typedef enum { |
| 499 |
/** |
| 500 |
* Finalizer extension. |
| 501 |
*/ |
| 502 |
HSA_EXTENSION_FINALIZER = 0, |
| 503 |
/** |
| 504 |
* Images extension. |
| 505 |
*/ |
| 506 |
HSA_EXTENSION_IMAGES = 1, |
| 507 |
|
| 508 |
/** |
| 509 |
* Performance counter extension. |
| 510 |
*/ |
| 511 |
HSA_EXTENSION_PERFORMANCE_COUNTERS = 2, |
| 512 |
|
| 513 |
/** |
| 514 |
* Profiling events extension. |
| 515 |
*/ |
| 516 |
HSA_EXTENSION_PROFILING_EVENTS = 3, |
| 517 |
/** |
| 518 |
* Extension count. |
| 519 |
*/ |
| 520 |
HSA_EXTENSION_STD_LAST = 3, |
| 521 |
/** |
| 522 |
* First AMD extension number. |
| 523 |
*/ |
| 524 |
HSA_AMD_FIRST_EXTENSION = 0x200, |
| 525 |
/** |
| 526 |
* Profiler extension. |
| 527 |
*/ |
| 528 |
HSA_EXTENSION_AMD_PROFILER = 0x200, |
| 529 |
/** |
| 530 |
* Loader extension. |
| 531 |
*/ |
| 532 |
HSA_EXTENSION_AMD_LOADER = 0x201, |
| 533 |
/** |
| 534 |
* AqlProfile extension. |
| 535 |
*/ |
| 536 |
HSA_EXTENSION_AMD_AQLPROFILE = 0x202, |
| 537 |
/** |
| 538 |
* Last AMD extension. |
| 539 |
*/ |
| 540 |
HSA_AMD_LAST_EXTENSION = 0x202 |
| 541 |
} hsa_extension_t; |
| 542 |
|
| 543 |
/** |
| 544 |
* @brief Query the name of a given extension. |
| 545 |
* |
| 546 |
* @param[in] extension Extension identifier. If the extension is not supported |
| 547 |
* by the implementation (see ::HSA_SYSTEM_INFO_EXTENSIONS), the behavior |
| 548 |
* is undefined. |
| 549 |
* |
| 550 |
* @param[out] name Pointer to a memory location where the HSA runtime stores |
| 551 |
* the extension name. The extension name is a NUL-terminated string. |
| 552 |
* |
| 553 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 554 |
* |
| 555 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 556 |
* initialized. |
| 557 |
* |
| 558 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p extension is not a valid |
| 559 |
* extension, or @p name is NULL. |
| 560 |
*/ |
| 561 |
hsa_status_t HSA_API hsa_extension_get_name( |
| 562 |
uint16_t extension, |
| 563 |
const char **name); |
| 564 |
|
| 565 |
/** |
| 566 |
* @deprecated |
| 567 |
* |
| 568 |
* @brief Query if a given version of an extension is supported by the HSA |
| 569 |
* implementation. |
| 570 |
* |
| 571 |
* @param[in] extension Extension identifier. |
| 572 |
* |
| 573 |
* @param[in] version_major Major version number. |
| 574 |
* |
| 575 |
* @param[in] version_minor Minor version number. |
| 576 |
* |
| 577 |
* @param[out] result Pointer to a memory location where the HSA runtime stores |
| 578 |
* the result of the check. The result is true if the specified version of the |
| 579 |
* extension is supported, and false otherwise. |
| 580 |
* |
| 581 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 582 |
* |
| 583 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 584 |
* initialized. |
| 585 |
* |
| 586 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p extension is not a valid |
| 587 |
* extension, or @p result is NULL. |
| 588 |
*/ |
| 589 |
hsa_status_t HSA_API HSA_DEPRECATED hsa_system_extension_supported( |
| 590 |
uint16_t extension, |
| 591 |
uint16_t version_major, |
| 592 |
uint16_t version_minor, |
| 593 |
bool* result); |
| 594 |
|
| 595 |
/** |
| 596 |
* @brief Query if a given version of an extension is supported by the HSA |
| 597 |
* implementation. All minor versions from 0 up to the returned @p version_minor |
| 598 |
* must be supported by the implementation. |
| 599 |
* |
| 600 |
* @param[in] extension Extension identifier. |
| 601 |
* |
| 602 |
* @param[in] version_major Major version number. |
| 603 |
* |
| 604 |
* @param[out] version_minor Minor version number. |
| 605 |
* |
| 606 |
* @param[out] result Pointer to a memory location where the HSA runtime stores |
| 607 |
* the result of the check. The result is true if the specified version of the |
| 608 |
* extension is supported, and false otherwise. |
| 609 |
* |
| 610 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 611 |
* |
| 612 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 613 |
* initialized. |
| 614 |
* |
| 615 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p extension is not a valid |
| 616 |
* extension, or @p version_minor is NULL, or @p result is NULL. |
| 617 |
*/ |
| 618 |
hsa_status_t HSA_API hsa_system_major_extension_supported( |
| 619 |
uint16_t extension, |
| 620 |
uint16_t version_major, |
| 621 |
uint16_t *version_minor, |
| 622 |
bool* result); |
| 623 |
|
| 624 |
|
| 625 |
/** |
| 626 |
* @deprecated |
| 627 |
* |
| 628 |
* @brief Retrieve the function pointers corresponding to a given version of an |
| 629 |
* extension. Portable applications are expected to invoke the extension API |
| 630 |
* using the returned function pointers |
| 631 |
* |
| 632 |
* @details The application is responsible for verifying that the given version |
| 633 |
* of the extension is supported by the HSA implementation (see |
| 634 |
* ::hsa_system_extension_supported). If the given combination of extension, |
| 635 |
* major version, and minor version is not supported by the implementation, the |
| 636 |
* behavior is undefined. |
| 637 |
* |
| 638 |
* @param[in] extension Extension identifier. |
| 639 |
* |
| 640 |
* @param[in] version_major Major version number for which to retrieve the |
| 641 |
* function pointer table. |
| 642 |
* |
| 643 |
* @param[in] version_minor Minor version number for which to retrieve the |
| 644 |
* function pointer table. |
| 645 |
* |
| 646 |
* @param[out] table Pointer to an application-allocated function pointer table |
| 647 |
* that is populated by the HSA runtime. Must not be NULL. The memory associated |
| 648 |
* with table can be reused or freed after the function returns. |
| 649 |
* |
| 650 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 651 |
* |
| 652 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 653 |
* initialized. |
| 654 |
* |
| 655 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p extension is not a valid |
| 656 |
* extension, or @p table is NULL. |
| 657 |
*/ |
| 658 |
hsa_status_t HSA_API HSA_DEPRECATED hsa_system_get_extension_table( |
| 659 |
uint16_t extension, |
| 660 |
uint16_t version_major, |
| 661 |
uint16_t version_minor, |
| 662 |
void *table); |
| 663 |
|
| 664 |
/** |
| 665 |
* @brief Retrieve the function pointers corresponding to a given major version |
| 666 |
* of an extension. Portable applications are expected to invoke the extension |
| 667 |
* API using the returned function pointers. |
| 668 |
* |
| 669 |
* @details The application is responsible for verifying that the given major |
| 670 |
* version of the extension is supported by the HSA implementation (see |
| 671 |
* ::hsa_system_major_extension_supported). If the given combination of extension |
| 672 |
* and major version is not supported by the implementation, the behavior is |
| 673 |
* undefined. Additionally if the length doesn't allow space for a full minor |
| 674 |
* version, it is implementation defined if only some of the function pointers for |
| 675 |
* that minor version get written. |
| 676 |
* |
| 677 |
* @param[in] extension Extension identifier. |
| 678 |
* |
| 679 |
* @param[in] version_major Major version number for which to retrieve the |
| 680 |
* function pointer table. |
| 681 |
* |
| 682 |
* @param[in] table_length Size in bytes of the function pointer table to be |
| 683 |
* populated. The implementation will not write more than this many bytes to the |
| 684 |
* table. |
| 685 |
* |
| 686 |
* @param[out] table Pointer to an application-allocated function pointer table |
| 687 |
* that is populated by the HSA runtime. Must not be NULL. The memory associated |
| 688 |
* with table can be reused or freed after the function returns. |
| 689 |
* |
| 690 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 691 |
* |
| 692 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 693 |
* initialized. |
| 694 |
* |
| 695 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p extension is not a valid |
| 696 |
* extension, or @p table is NULL. |
| 697 |
*/ |
| 698 |
hsa_status_t HSA_API hsa_system_get_major_extension_table( |
| 699 |
uint16_t extension, |
| 700 |
uint16_t version_major, |
| 701 |
size_t table_length, |
| 702 |
void *table); |
| 703 |
|
| 704 |
/** |
| 705 |
* @brief Struct containing an opaque handle to an agent, a device that participates in |
| 706 |
* the HSA memory model. An agent can submit AQL packets for execution, and |
| 707 |
* may also accept AQL packets for execution (agent dispatch packets or kernel |
| 708 |
* dispatch packets launching HSAIL-derived binaries). |
| 709 |
*/ |
| 710 |
typedef struct hsa_agent_s { |
| 711 |
/** |
| 712 |
* Opaque handle. Two handles reference the same object of the enclosing type |
| 713 |
* if and only if they are equal. |
| 714 |
*/ |
| 715 |
uint64_t handle; |
| 716 |
} hsa_agent_t; |
| 717 |
|
| 718 |
/** |
| 719 |
* @brief Agent features. |
| 720 |
*/ |
| 721 |
typedef enum { |
| 722 |
/** |
| 723 |
* The agent supports AQL packets of kernel dispatch type. If this |
| 724 |
* feature is enabled, the agent is also a kernel agent. |
| 725 |
*/ |
| 726 |
HSA_AGENT_FEATURE_KERNEL_DISPATCH = 1, |
| 727 |
/** |
| 728 |
* The agent supports AQL packets of agent dispatch type. |
| 729 |
*/ |
| 730 |
HSA_AGENT_FEATURE_AGENT_DISPATCH = 2 |
| 731 |
} hsa_agent_feature_t; |
| 732 |
|
| 733 |
/** |
| 734 |
* @brief Hardware device type. |
| 735 |
*/ |
| 736 |
typedef enum { |
| 737 |
/** |
| 738 |
* CPU device. |
| 739 |
*/ |
| 740 |
HSA_DEVICE_TYPE_CPU = 0, |
| 741 |
/** |
| 742 |
* GPU device. |
| 743 |
*/ |
| 744 |
HSA_DEVICE_TYPE_GPU = 1, |
| 745 |
/** |
| 746 |
* DSP device. |
| 747 |
*/ |
| 748 |
HSA_DEVICE_TYPE_DSP = 2 |
| 749 |
} hsa_device_type_t; |
| 750 |
|
| 751 |
/** |
| 752 |
* @brief Default floating-point rounding mode. |
| 753 |
*/ |
| 754 |
typedef enum { |
| 755 |
/** |
| 756 |
* Use a default floating-point rounding mode specified elsewhere. |
| 757 |
*/ |
| 758 |
HSA_DEFAULT_FLOAT_ROUNDING_MODE_DEFAULT = 0, |
| 759 |
/** |
| 760 |
* Operations that specify the default floating-point mode are rounded to zero |
| 761 |
* by default. |
| 762 |
*/ |
| 763 |
HSA_DEFAULT_FLOAT_ROUNDING_MODE_ZERO = 1, |
| 764 |
/** |
| 765 |
* Operations that specify the default floating-point mode are rounded to the |
| 766 |
* nearest representable number and that ties should be broken by selecting |
| 767 |
* the value with an even least significant bit. |
| 768 |
*/ |
| 769 |
HSA_DEFAULT_FLOAT_ROUNDING_MODE_NEAR = 2 |
| 770 |
} hsa_default_float_rounding_mode_t; |
| 771 |
|
| 772 |
/** |
| 773 |
* @brief Agent attributes. |
| 774 |
*/ |
| 775 |
typedef enum { |
| 776 |
/** |
| 777 |
* Agent name. The type of this attribute is a NUL-terminated char[64]. The |
| 778 |
* name must be at most 63 characters long (not including the NUL terminator) |
| 779 |
* and all array elements not used for the name must be NUL. |
| 780 |
*/ |
| 781 |
HSA_AGENT_INFO_NAME = 0, |
| 782 |
/** |
| 783 |
* Name of vendor. The type of this attribute is a NUL-terminated char[64]. |
| 784 |
* The name must be at most 63 characters long (not including the NUL |
| 785 |
* terminator) and all array elements not used for the name must be NUL. |
| 786 |
*/ |
| 787 |
HSA_AGENT_INFO_VENDOR_NAME = 1, |
| 788 |
/** |
| 789 |
* Agent capability. The type of this attribute is ::hsa_agent_feature_t. |
| 790 |
*/ |
| 791 |
HSA_AGENT_INFO_FEATURE = 2, |
| 792 |
/** |
| 793 |
* @deprecated Query ::HSA_ISA_INFO_MACHINE_MODELS for a given intruction set |
| 794 |
* architecture supported by the agent instead. If more than one ISA is |
| 795 |
* supported by the agent, the returned value corresponds to the first ISA |
| 796 |
* enumerated by ::hsa_agent_iterate_isas. |
| 797 |
* |
| 798 |
* Machine model supported by the agent. The type of this attribute is |
| 799 |
* ::hsa_machine_model_t. |
| 800 |
*/ |
| 801 |
HSA_AGENT_INFO_MACHINE_MODEL = 3, |
| 802 |
/** |
| 803 |
* @deprecated Query ::HSA_ISA_INFO_PROFILES for a given intruction set |
| 804 |
* architecture supported by the agent instead. If more than one ISA is |
| 805 |
* supported by the agent, the returned value corresponds to the first ISA |
| 806 |
* enumerated by ::hsa_agent_iterate_isas. |
| 807 |
* |
| 808 |
* Profile supported by the agent. The type of this attribute is |
| 809 |
* ::hsa_profile_t. |
| 810 |
*/ |
| 811 |
HSA_AGENT_INFO_PROFILE = 4, |
| 812 |
/** |
| 813 |
* @deprecated Query ::HSA_ISA_INFO_DEFAULT_FLOAT_ROUNDING_MODES for a given |
| 814 |
* intruction set architecture supported by the agent instead. If more than |
| 815 |
* one ISA is supported by the agent, the returned value corresponds to the |
| 816 |
* first ISA enumerated by ::hsa_agent_iterate_isas. |
| 817 |
* |
| 818 |
* Default floating-point rounding mode. The type of this attribute is |
| 819 |
* ::hsa_default_float_rounding_mode_t, but the value |
| 820 |
* ::HSA_DEFAULT_FLOAT_ROUNDING_MODE_DEFAULT is not allowed. |
| 821 |
*/ |
| 822 |
HSA_AGENT_INFO_DEFAULT_FLOAT_ROUNDING_MODE = 5, |
| 823 |
/** |
| 824 |
* @deprecated Query ::HSA_ISA_INFO_BASE_PROFILE_DEFAULT_FLOAT_ROUNDING_MODES |
| 825 |
* for a given intruction set architecture supported by the agent instead. If |
| 826 |
* more than one ISA is supported by the agent, the returned value corresponds |
| 827 |
* to the first ISA enumerated by ::hsa_agent_iterate_isas. |
| 828 |
* |
| 829 |
* A bit-mask of ::hsa_default_float_rounding_mode_t values, representing the |
| 830 |
* default floating-point rounding modes supported by the agent in the Base |
| 831 |
* profile. The type of this attribute is uint32_t. The default floating-point |
| 832 |
* rounding mode (::HSA_AGENT_INFO_DEFAULT_FLOAT_ROUNDING_MODE) bit must not |
| 833 |
* be set. |
| 834 |
*/ |
| 835 |
HSA_AGENT_INFO_BASE_PROFILE_DEFAULT_FLOAT_ROUNDING_MODES = 23, |
| 836 |
/** |
| 837 |
* @deprecated Query ::HSA_ISA_INFO_FAST_F16_OPERATION for a given intruction |
| 838 |
* set architecture supported by the agent instead. If more than one ISA is |
| 839 |
* supported by the agent, the returned value corresponds to the first ISA |
| 840 |
* enumerated by ::hsa_agent_iterate_isas. |
| 841 |
* |
| 842 |
* Flag indicating that the f16 HSAIL operation is at least as fast as the |
| 843 |
* f32 operation in the current agent. The value of this attribute is |
| 844 |
* undefined if the agent is not a kernel agent. The type of this |
| 845 |
* attribute is bool. |
| 846 |
*/ |
| 847 |
HSA_AGENT_INFO_FAST_F16_OPERATION = 24, |
| 848 |
/** |
| 849 |
* @deprecated Query ::HSA_WAVEFRONT_INFO_SIZE for a given wavefront and |
| 850 |
* intruction set architecture supported by the agent instead. If more than |
| 851 |
* one ISA is supported by the agent, the returned value corresponds to the |
| 852 |
* first ISA enumerated by ::hsa_agent_iterate_isas and the first wavefront |
| 853 |
* enumerated by ::hsa_isa_iterate_wavefronts for that ISA. |
| 854 |
* |
| 855 |
* Number of work-items in a wavefront. Must be a power of 2 in the range |
| 856 |
* [1,256]. The value of this attribute is undefined if the agent is not |
| 857 |
* a kernel agent. The type of this attribute is uint32_t. |
| 858 |
*/ |
| 859 |
HSA_AGENT_INFO_WAVEFRONT_SIZE = 6, |
| 860 |
/** |
| 861 |
* @deprecated Query ::HSA_ISA_INFO_WORKGROUP_MAX_DIM for a given intruction |
| 862 |
* set architecture supported by the agent instead. If more than one ISA is |
| 863 |
* supported by the agent, the returned value corresponds to the first ISA |
| 864 |
* enumerated by ::hsa_agent_iterate_isas. |
| 865 |
* |
| 866 |
* Maximum number of work-items of each dimension of a work-group. Each |
| 867 |
* maximum must be greater than 0. No maximum can exceed the value of |
| 868 |
* ::HSA_AGENT_INFO_WORKGROUP_MAX_SIZE. The value of this attribute is |
| 869 |
* undefined if the agent is not a kernel agent. The type of this |
| 870 |
* attribute is uint16_t[3]. |
| 871 |
*/ |
| 872 |
HSA_AGENT_INFO_WORKGROUP_MAX_DIM = 7, |
| 873 |
/** |
| 874 |
* @deprecated Query ::HSA_ISA_INFO_WORKGROUP_MAX_SIZE for a given intruction |
| 875 |
* set architecture supported by the agent instead. If more than one ISA is |
| 876 |
* supported by the agent, the returned value corresponds to the first ISA |
| 877 |
* enumerated by ::hsa_agent_iterate_isas. |
| 878 |
* |
| 879 |
* Maximum total number of work-items in a work-group. The value of this |
| 880 |
* attribute is undefined if the agent is not a kernel agent. The type |
| 881 |
* of this attribute is uint32_t. |
| 882 |
*/ |
| 883 |
HSA_AGENT_INFO_WORKGROUP_MAX_SIZE = 8, |
| 884 |
/** |
| 885 |
* @deprecated Query ::HSA_ISA_INFO_GRID_MAX_DIM for a given intruction set |
| 886 |
* architecture supported by the agent instead. |
| 887 |
* |
| 888 |
* Maximum number of work-items of each dimension of a grid. Each maximum must |
| 889 |
* be greater than 0, and must not be smaller than the corresponding value in |
| 890 |
* ::HSA_AGENT_INFO_WORKGROUP_MAX_DIM. No maximum can exceed the value of |
| 891 |
* ::HSA_AGENT_INFO_GRID_MAX_SIZE. The value of this attribute is undefined |
| 892 |
* if the agent is not a kernel agent. The type of this attribute is |
| 893 |
* ::hsa_dim3_t. |
| 894 |
*/ |
| 895 |
HSA_AGENT_INFO_GRID_MAX_DIM = 9, |
| 896 |
/** |
| 897 |
* @deprecated Query ::HSA_ISA_INFO_GRID_MAX_SIZE for a given intruction set |
| 898 |
* architecture supported by the agent instead. If more than one ISA is |
| 899 |
* supported by the agent, the returned value corresponds to the first ISA |
| 900 |
* enumerated by ::hsa_agent_iterate_isas. |
| 901 |
* |
| 902 |
* Maximum total number of work-items in a grid. The value of this attribute |
| 903 |
* is undefined if the agent is not a kernel agent. The type of this |
| 904 |
* attribute is uint32_t. |
| 905 |
*/ |
| 906 |
HSA_AGENT_INFO_GRID_MAX_SIZE = 10, |
| 907 |
/** |
| 908 |
* @deprecated Query ::HSA_ISA_INFO_FBARRIER_MAX_SIZE for a given intruction |
| 909 |
* set architecture supported by the agent instead. If more than one ISA is |
| 910 |
* supported by the agent, the returned value corresponds to the first ISA |
| 911 |
* enumerated by ::hsa_agent_iterate_isas. |
| 912 |
* |
| 913 |
* Maximum number of fbarriers per work-group. Must be at least 32. The value |
| 914 |
* of this attribute is undefined if the agent is not a kernel agent. The |
| 915 |
* type of this attribute is uint32_t. |
| 916 |
*/ |
| 917 |
HSA_AGENT_INFO_FBARRIER_MAX_SIZE = 11, |
| 918 |
/** |
| 919 |
* @deprecated The maximum number of queues is not statically determined. |
| 920 |
* |
| 921 |
* Maximum number of queues that can be active (created but not destroyed) at |
| 922 |
* one time in the agent. The type of this attribute is uint32_t. |
| 923 |
*/ |
| 924 |
HSA_AGENT_INFO_QUEUES_MAX = 12, |
| 925 |
/** |
| 926 |
* Minimum number of packets that a queue created in the agent |
| 927 |
* can hold. Must be a power of 2 greater than 0. Must not exceed |
| 928 |
* the value of ::HSA_AGENT_INFO_QUEUE_MAX_SIZE. The type of this |
| 929 |
* attribute is uint32_t. |
| 930 |
*/ |
| 931 |
HSA_AGENT_INFO_QUEUE_MIN_SIZE = 13, |
| 932 |
/** |
| 933 |
* Maximum number of packets that a queue created in the agent can |
| 934 |
* hold. Must be a power of 2 greater than 0. The type of this attribute |
| 935 |
* is uint32_t. |
| 936 |
*/ |
| 937 |
HSA_AGENT_INFO_QUEUE_MAX_SIZE = 14, |
| 938 |
/** |
| 939 |
* Type of a queue created in the agent. The type of this attribute is |
| 940 |
* ::hsa_queue_type32_t. |
| 941 |
*/ |
| 942 |
HSA_AGENT_INFO_QUEUE_TYPE = 15, |
| 943 |
/** |
| 944 |
* @deprecated NUMA information is not exposed anywhere else in the API. |
| 945 |
* |
| 946 |
* Identifier of the NUMA node associated with the agent. The type of this |
| 947 |
* attribute is uint32_t. |
| 948 |
*/ |
| 949 |
HSA_AGENT_INFO_NODE = 16, |
| 950 |
/** |
| 951 |
* Type of hardware device associated with the agent. The type of this |
| 952 |
* attribute is ::hsa_device_type_t. |
| 953 |
*/ |
| 954 |
HSA_AGENT_INFO_DEVICE = 17, |
| 955 |
/** |
| 956 |
* @deprecated Query ::hsa_agent_iterate_caches to retrieve information about |
| 957 |
* the caches present in a given agent. |
| 958 |
* |
| 959 |
* Array of data cache sizes (L1..L4). Each size is expressed in bytes. A size |
| 960 |
* of 0 for a particular level indicates that there is no cache information |
| 961 |
* for that level. The type of this attribute is uint32_t[4]. |
| 962 |
*/ |
| 963 |
HSA_AGENT_INFO_CACHE_SIZE = 18, |
| 964 |
/** |
| 965 |
* @deprecated An agent may support multiple instruction set |
| 966 |
* architectures. See ::hsa_agent_iterate_isas. If more than one ISA is |
| 967 |
* supported by the agent, the returned value corresponds to the first ISA |
| 968 |
* enumerated by ::hsa_agent_iterate_isas. |
| 969 |
* |
| 970 |
* Instruction set architecture of the agent. The type of this attribute |
| 971 |
* is ::hsa_isa_t. |
| 972 |
*/ |
| 973 |
HSA_AGENT_INFO_ISA = 19, |
| 974 |
/** |
| 975 |
* Bit-mask indicating which extensions are supported by the agent. An |
| 976 |
* extension with an ID of @p i is supported if the bit at position @p i is |
| 977 |
* set. The type of this attribute is uint8_t[128]. |
| 978 |
*/ |
| 979 |
HSA_AGENT_INFO_EXTENSIONS = 20, |
| 980 |
/** |
| 981 |
* Major version of the HSA runtime specification supported by the |
| 982 |
* agent. The type of this attribute is uint16_t. |
| 983 |
*/ |
| 984 |
HSA_AGENT_INFO_VERSION_MAJOR = 21, |
| 985 |
/** |
| 986 |
* Minor version of the HSA runtime specification supported by the |
| 987 |
* agent. The type of this attribute is uint16_t. |
| 988 |
*/ |
| 989 |
HSA_AGENT_INFO_VERSION_MINOR = 22 |
| 990 |
|
| 991 |
} hsa_agent_info_t; |
| 992 |
|
| 993 |
/** |
| 994 |
* @brief Get the current value of an attribute for a given agent. |
| 995 |
* |
| 996 |
* @param[in] agent A valid agent. |
| 997 |
* |
| 998 |
* @param[in] attribute Attribute to query. |
| 999 |
* |
| 1000 |
* @param[out] value Pointer to an application-allocated buffer where to store |
| 1001 |
* the value of the attribute. If the buffer passed by the application is not |
| 1002 |
* large enough to hold the value of @p attribute, the behavior is undefined. |
| 1003 |
* |
| 1004 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 1005 |
* |
| 1006 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 1007 |
* initialized. |
| 1008 |
* |
| 1009 |
* @retval ::HSA_STATUS_ERROR_INVALID_AGENT The agent is invalid. |
| 1010 |
* |
| 1011 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p attribute is an invalid |
| 1012 |
* agent attribute, or @p value is NULL. |
| 1013 |
*/ |
| 1014 |
hsa_status_t HSA_API hsa_agent_get_info( |
| 1015 |
hsa_agent_t agent, |
| 1016 |
hsa_agent_info_t attribute, |
| 1017 |
void* value); |
| 1018 |
|
| 1019 |
/** |
| 1020 |
* @brief Iterate over the available agents, and invoke an |
| 1021 |
* application-defined callback on every iteration. |
| 1022 |
* |
| 1023 |
* @param[in] callback Callback to be invoked once per agent. The HSA |
| 1024 |
* runtime passes two arguments to the callback: the agent and the |
| 1025 |
* application data. If @p callback returns a status other than |
| 1026 |
* ::HSA_STATUS_SUCCESS for a particular iteration, the traversal stops and |
| 1027 |
* ::hsa_iterate_agents returns that status value. |
| 1028 |
* |
| 1029 |
* @param[in] data Application data that is passed to @p callback on every |
| 1030 |
* iteration. May be NULL. |
| 1031 |
* |
| 1032 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 1033 |
* |
| 1034 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 1035 |
* initialized. |
| 1036 |
* |
| 1037 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p callback is NULL. |
| 1038 |
*/ |
| 1039 |
hsa_status_t HSA_API hsa_iterate_agents( |
| 1040 |
hsa_status_t (*callback)(hsa_agent_t agent, void* data), |
| 1041 |
void* data); |
| 1042 |
|
| 1043 |
/* |
| 1044 |
|
| 1045 |
// If we do not know the size of an attribute, we need to query it first |
| 1046 |
// Note: this API will not be in the spec unless needed |
| 1047 |
hsa_status_t HSA_API hsa_agent_get_info_size( |
| 1048 |
hsa_agent_t agent, |
| 1049 |
hsa_agent_info_t attribute, |
| 1050 |
size_t* size); |
| 1051 |
|
| 1052 |
// Set the value of an agents attribute |
| 1053 |
// Note: this API will not be in the spec unless needed |
| 1054 |
hsa_status_t HSA_API hsa_agent_set_info( |
| 1055 |
hsa_agent_t agent, |
| 1056 |
hsa_agent_info_t attribute, |
| 1057 |
void* value); |
| 1058 |
|
| 1059 |
*/ |
| 1060 |
|
| 1061 |
/** |
| 1062 |
* @brief Exception policies applied in the presence of hardware exceptions. |
| 1063 |
*/ |
| 1064 |
typedef enum { |
| 1065 |
/** |
| 1066 |
* If a hardware exception is detected, a work-item signals an exception. |
| 1067 |
*/ |
| 1068 |
HSA_EXCEPTION_POLICY_BREAK = 1, |
| 1069 |
/** |
| 1070 |
* If a hardware exception is detected, a hardware status bit is set. |
| 1071 |
*/ |
| 1072 |
HSA_EXCEPTION_POLICY_DETECT = 2 |
| 1073 |
} hsa_exception_policy_t; |
| 1074 |
|
| 1075 |
/** |
| 1076 |
* @deprecated Use ::hsa_isa_get_exception_policies for a given intruction set |
| 1077 |
* architecture supported by the agent instead. If more than one ISA is |
| 1078 |
* supported by the agent, this function uses the first value returned by |
| 1079 |
* ::hsa_agent_iterate_isas. |
| 1080 |
* |
| 1081 |
* @brief Retrieve the exception policy support for a given combination of |
| 1082 |
* agent and profile |
| 1083 |
* |
| 1084 |
* @param[in] agent Agent. |
| 1085 |
* |
| 1086 |
* @param[in] profile Profile. |
| 1087 |
* |
| 1088 |
* @param[out] mask Pointer to a memory location where the HSA runtime stores a |
| 1089 |
* mask of ::hsa_exception_policy_t values. Must not be NULL. |
| 1090 |
* |
| 1091 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 1092 |
* |
| 1093 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 1094 |
* initialized. |
| 1095 |
* |
| 1096 |
* @retval ::HSA_STATUS_ERROR_INVALID_AGENT The agent is invalid. |
| 1097 |
* |
| 1098 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p profile is not a valid |
| 1099 |
* profile, or @p mask is NULL. |
| 1100 |
* |
| 1101 |
*/ |
| 1102 |
hsa_status_t HSA_API HSA_DEPRECATED hsa_agent_get_exception_policies( |
| 1103 |
hsa_agent_t agent, |
| 1104 |
hsa_profile_t profile, |
| 1105 |
uint16_t *mask); |
| 1106 |
|
| 1107 |
/** |
| 1108 |
* @brief Cache handle. |
| 1109 |
*/ |
| 1110 |
typedef struct hsa_cache_s { |
| 1111 |
/** |
| 1112 |
* Opaque handle. Two handles reference the same object of the enclosing type |
| 1113 |
* if and only if they are equal. |
| 1114 |
*/ |
| 1115 |
uint64_t handle; |
| 1116 |
} hsa_cache_t; |
| 1117 |
|
| 1118 |
/** |
| 1119 |
* @brief Cache attributes. |
| 1120 |
*/ |
| 1121 |
typedef enum { |
| 1122 |
/** |
| 1123 |
* The length of the cache name in bytes, not including the NUL terminator. |
| 1124 |
* The type of this attribute is uint32_t. |
| 1125 |
*/ |
| 1126 |
HSA_CACHE_INFO_NAME_LENGTH = 0, |
| 1127 |
/** |
| 1128 |
* Human-readable description. The type of this attribute is a NUL-terminated |
| 1129 |
* character array with the length equal to the value of |
| 1130 |
* ::HSA_CACHE_INFO_NAME_LENGTH attribute. |
| 1131 |
*/ |
| 1132 |
HSA_CACHE_INFO_NAME = 1, |
| 1133 |
/** |
| 1134 |
* Cache level. A L1 cache must return a value of 1, a L2 must return a value |
| 1135 |
* of 2, and so on. The type of this attribute is uint8_t. |
| 1136 |
*/ |
| 1137 |
HSA_CACHE_INFO_LEVEL = 2, |
| 1138 |
/** |
| 1139 |
* Cache size, in bytes. A value of 0 indicates that there is no size |
| 1140 |
* information available. The type of this attribute is uint32_t. |
| 1141 |
*/ |
| 1142 |
HSA_CACHE_INFO_SIZE = 3 |
| 1143 |
} hsa_cache_info_t; |
| 1144 |
|
| 1145 |
/** |
| 1146 |
* @brief Get the current value of an attribute for a given cache object. |
| 1147 |
* |
| 1148 |
* @param[in] cache Cache. |
| 1149 |
* |
| 1150 |
* @param[in] attribute Attribute to query. |
| 1151 |
* |
| 1152 |
* @param[out] value Pointer to an application-allocated buffer where to store |
| 1153 |
* the value of the attribute. If the buffer passed by the application is not |
| 1154 |
* large enough to hold the value of @p attribute, the behavior is undefined. |
| 1155 |
* |
| 1156 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 1157 |
* |
| 1158 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 1159 |
* initialized. |
| 1160 |
* |
| 1161 |
* @retval ::HSA_STATUS_ERROR_INVALID_CACHE The cache is invalid. |
| 1162 |
* |
| 1163 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p attribute is an invalid |
| 1164 |
* instruction set architecture attribute, or @p value is |
| 1165 |
* NULL. |
| 1166 |
*/ |
| 1167 |
hsa_status_t HSA_API hsa_cache_get_info( |
| 1168 |
hsa_cache_t cache, |
| 1169 |
hsa_cache_info_t attribute, |
| 1170 |
void* value); |
| 1171 |
|
| 1172 |
/** |
| 1173 |
* @brief Iterate over the memory caches of a given agent, and |
| 1174 |
* invoke an application-defined callback on every iteration. |
| 1175 |
* |
| 1176 |
* @details Caches are visited in ascending order according to the value of the |
| 1177 |
* ::HSA_CACHE_INFO_LEVEL attribute. |
| 1178 |
* |
| 1179 |
* @param[in] agent A valid agent. |
| 1180 |
* |
| 1181 |
* @param[in] callback Callback to be invoked once per cache that is present in |
| 1182 |
* the agent. The HSA runtime passes two arguments to the callback: the cache |
| 1183 |
* and the application data. If @p callback returns a status other than |
| 1184 |
* ::HSA_STATUS_SUCCESS for a particular iteration, the traversal stops and |
| 1185 |
* that value is returned. |
| 1186 |
* |
| 1187 |
* @param[in] data Application data that is passed to @p callback on every |
| 1188 |
* iteration. May be NULL. |
| 1189 |
* |
| 1190 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 1191 |
* |
| 1192 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 1193 |
* initialized. |
| 1194 |
* |
| 1195 |
* @retval ::HSA_STATUS_ERROR_INVALID_AGENT The agent is invalid. |
| 1196 |
* |
| 1197 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p callback is NULL. |
| 1198 |
*/ |
| 1199 |
hsa_status_t HSA_API hsa_agent_iterate_caches( |
| 1200 |
hsa_agent_t agent, |
| 1201 |
hsa_status_t (*callback)(hsa_cache_t cache, void* data), |
| 1202 |
void* data); |
| 1203 |
|
| 1204 |
/** |
| 1205 |
* @deprecated |
| 1206 |
* |
| 1207 |
* @brief Query if a given version of an extension is supported by an agent |
| 1208 |
* |
| 1209 |
* @param[in] extension Extension identifier. |
| 1210 |
* |
| 1211 |
* @param[in] agent Agent. |
| 1212 |
* |
| 1213 |
* @param[in] version_major Major version number. |
| 1214 |
* |
| 1215 |
* @param[in] version_minor Minor version number. |
| 1216 |
* |
| 1217 |
* @param[out] result Pointer to a memory location where the HSA runtime stores |
| 1218 |
* the result of the check. The result is true if the specified version of the |
| 1219 |
* extension is supported, and false otherwise. The result must be false if |
| 1220 |
* ::hsa_system_extension_supported returns false for the same extension |
| 1221 |
* version. |
| 1222 |
* |
| 1223 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 1224 |
* |
| 1225 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 1226 |
* initialized. |
| 1227 |
* |
| 1228 |
* @retval ::HSA_STATUS_ERROR_INVALID_AGENT The agent is invalid. |
| 1229 |
* |
| 1230 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p extension is not a valid |
| 1231 |
* extension, or @p result is NULL. |
| 1232 |
*/ |
| 1233 |
hsa_status_t HSA_API HSA_DEPRECATED hsa_agent_extension_supported( |
| 1234 |
uint16_t extension, |
| 1235 |
hsa_agent_t agent, |
| 1236 |
uint16_t version_major, |
| 1237 |
uint16_t version_minor, |
| 1238 |
bool* result); |
| 1239 |
|
| 1240 |
/** |
| 1241 |
* @brief Query if a given version of an extension is supported by an agent. All |
| 1242 |
* minor versions from 0 up to the returned @p version_minor must be supported. |
| 1243 |
* |
| 1244 |
* @param[in] extension Extension identifier. |
| 1245 |
* |
| 1246 |
* @param[in] agent Agent. |
| 1247 |
* |
| 1248 |
* @param[in] version_major Major version number. |
| 1249 |
* |
| 1250 |
* @param[out] version_minor Minor version number. |
| 1251 |
* |
| 1252 |
* @param[out] result Pointer to a memory location where the HSA runtime stores |
| 1253 |
* the result of the check. The result is true if the specified version of the |
| 1254 |
* extension is supported, and false otherwise. The result must be false if |
| 1255 |
* ::hsa_system_extension_supported returns false for the same extension |
| 1256 |
* version. |
| 1257 |
* |
| 1258 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 1259 |
* |
| 1260 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 1261 |
* initialized. |
| 1262 |
* |
| 1263 |
* @retval ::HSA_STATUS_ERROR_INVALID_AGENT The agent is invalid. |
| 1264 |
* |
| 1265 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p extension is not a valid |
| 1266 |
* extension, or @p version_minor is NULL, or @p result is NULL. |
| 1267 |
*/ |
| 1268 |
hsa_status_t HSA_API hsa_agent_major_extension_supported( |
| 1269 |
uint16_t extension, |
| 1270 |
hsa_agent_t agent, |
| 1271 |
uint16_t version_major, |
| 1272 |
uint16_t *version_minor, |
| 1273 |
bool* result); |
| 1274 |
|
| 1275 |
|
| 1276 |
/** @} */ |
| 1277 |
|
| 1278 |
|
| 1279 |
/** \defgroup signals Signals |
| 1280 |
* @{ |
| 1281 |
*/ |
| 1282 |
|
| 1283 |
/** |
| 1284 |
* @brief Signal handle. |
| 1285 |
*/ |
| 1286 |
typedef struct hsa_signal_s { |
| 1287 |
/** |
| 1288 |
* Opaque handle. Two handles reference the same object of the enclosing type |
| 1289 |
* if and only if they are equal. The value 0 is reserved. |
| 1290 |
*/ |
| 1291 |
uint64_t handle; |
| 1292 |
} hsa_signal_t; |
| 1293 |
|
| 1294 |
/** |
| 1295 |
* @brief Signal value. The value occupies 32 bits in small machine mode, and 64 |
| 1296 |
* bits in large machine mode. |
| 1297 |
*/ |
| 1298 |
#ifdef HSA_LARGE_MODEL |
| 1299 |
typedef int64_t hsa_signal_value_t; |
| 1300 |
#else |
| 1301 |
typedef int32_t hsa_signal_value_t; |
| 1302 |
#endif |
| 1303 |
|
| 1304 |
/** |
| 1305 |
* @brief Create a signal. |
| 1306 |
* |
| 1307 |
* @param[in] initial_value Initial value of the signal. |
| 1308 |
* |
| 1309 |
* @param[in] num_consumers Size of @p consumers. A value of 0 indicates that |
| 1310 |
* any agent might wait on the signal. |
| 1311 |
* |
| 1312 |
* @param[in] consumers List of agents that might consume (wait on) the |
| 1313 |
* signal. If @p num_consumers is 0, this argument is ignored; otherwise, the |
| 1314 |
* HSA runtime might use the list to optimize the handling of the signal |
| 1315 |
* object. If an agent not listed in @p consumers waits on the returned |
| 1316 |
* signal, the behavior is undefined. The memory associated with @p consumers |
| 1317 |
* can be reused or freed after the function returns. |
| 1318 |
* |
| 1319 |
* @param[out] signal Pointer to a memory location where the HSA runtime will |
| 1320 |
* store the newly created signal handle. Must not be NULL. |
| 1321 |
* |
| 1322 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 1323 |
* |
| 1324 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 1325 |
* initialized. |
| 1326 |
* |
| 1327 |
* @retval ::HSA_STATUS_ERROR_OUT_OF_RESOURCES The HSA runtime failed to allocate |
| 1328 |
* the required resources. |
| 1329 |
* |
| 1330 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p signal is NULL, @p |
| 1331 |
* num_consumers is greater than 0 but @p consumers is NULL, or @p consumers |
| 1332 |
* contains duplicates. |
| 1333 |
*/ |
| 1334 |
hsa_status_t HSA_API hsa_signal_create( |
| 1335 |
hsa_signal_value_t initial_value, |
| 1336 |
uint32_t num_consumers, |
| 1337 |
const hsa_agent_t *consumers, |
| 1338 |
hsa_signal_t *signal); |
| 1339 |
|
| 1340 |
/** |
| 1341 |
* @brief Destroy a signal previous created by ::hsa_signal_create. |
| 1342 |
* |
| 1343 |
* @param[in] signal Signal. |
| 1344 |
* |
| 1345 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 1346 |
* |
| 1347 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 1348 |
* initialized. |
| 1349 |
* |
| 1350 |
* @retval ::HSA_STATUS_ERROR_INVALID_SIGNAL @p signal is invalid. |
| 1351 |
* |
| 1352 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT The handle in @p signal is 0. |
| 1353 |
*/ |
| 1354 |
hsa_status_t HSA_API hsa_signal_destroy( |
| 1355 |
hsa_signal_t signal); |
| 1356 |
|
| 1357 |
/** |
| 1358 |
* @brief Atomically read the current value of a signal. |
| 1359 |
* |
| 1360 |
* @param[in] signal Signal. |
| 1361 |
* |
| 1362 |
* @return Value of the signal. |
| 1363 |
*/ |
| 1364 |
hsa_signal_value_t HSA_API hsa_signal_load_scacquire( |
| 1365 |
hsa_signal_t signal); |
| 1366 |
|
| 1367 |
/** |
| 1368 |
* @copydoc hsa_signal_load_scacquire |
| 1369 |
*/ |
| 1370 |
hsa_signal_value_t HSA_API hsa_signal_load_relaxed( |
| 1371 |
hsa_signal_t signal); |
| 1372 |
|
| 1373 |
/** |
| 1374 |
* @deprecated Renamed as ::hsa_signal_load_scacquire. |
| 1375 |
* |
| 1376 |
* @copydoc hsa_signal_load_scacquire |
| 1377 |
*/ |
| 1378 |
hsa_signal_value_t HSA_API HSA_DEPRECATED hsa_signal_load_acquire( |
| 1379 |
hsa_signal_t signal); |
| 1380 |
|
| 1381 |
/** |
| 1382 |
* @brief Atomically set the value of a signal. |
| 1383 |
* |
| 1384 |
* @details If the value of the signal is changed, all the agents waiting |
| 1385 |
* on @p signal for which @p value satisfies their wait condition are awakened. |
| 1386 |
* |
| 1387 |
* @param[in] signal Signal. |
| 1388 |
* |
| 1389 |
* @param[in] value New signal value. |
| 1390 |
*/ |
| 1391 |
void HSA_API hsa_signal_store_relaxed( |
| 1392 |
hsa_signal_t signal, |
| 1393 |
hsa_signal_value_t value); |
| 1394 |
|
| 1395 |
/** |
| 1396 |
* @copydoc hsa_signal_store_relaxed |
| 1397 |
*/ |
| 1398 |
void HSA_API hsa_signal_store_screlease( |
| 1399 |
hsa_signal_t signal, |
| 1400 |
hsa_signal_value_t value); |
| 1401 |
|
| 1402 |
/** |
| 1403 |
* @deprecated Renamed as ::hsa_signal_store_screlease. |
| 1404 |
* |
| 1405 |
* @copydoc hsa_signal_store_screlease |
| 1406 |
*/ |
| 1407 |
void HSA_API HSA_DEPRECATED hsa_signal_store_release( |
| 1408 |
hsa_signal_t signal, |
| 1409 |
hsa_signal_value_t value); |
| 1410 |
|
| 1411 |
/** |
| 1412 |
* @brief Atomically set the value of a signal without necessarily notifying the |
| 1413 |
* the agents waiting on it. |
| 1414 |
* |
| 1415 |
* @details The agents waiting on @p signal may not wake up even when the new |
| 1416 |
* value satisfies their wait condition. If the application wants to update the |
| 1417 |
* signal and there is no need to notify any agent, invoking this function can |
| 1418 |
* be more efficient than calling the non-silent counterpart. |
| 1419 |
* |
| 1420 |
* @param[in] signal Signal. |
| 1421 |
* |
| 1422 |
* @param[in] value New signal value. |
| 1423 |
*/ |
| 1424 |
void HSA_API hsa_signal_silent_store_relaxed( |
| 1425 |
hsa_signal_t signal, |
| 1426 |
hsa_signal_value_t value); |
| 1427 |
|
| 1428 |
/** |
| 1429 |
* @copydoc hsa_signal_silent_store_relaxed |
| 1430 |
*/ |
| 1431 |
void HSA_API hsa_signal_silent_store_screlease( |
| 1432 |
hsa_signal_t signal, |
| 1433 |
hsa_signal_value_t value); |
| 1434 |
|
| 1435 |
/** |
| 1436 |
* @brief Atomically set the value of a signal and return its previous value. |
| 1437 |
* |
| 1438 |
* @details If the value of the signal is changed, all the agents waiting |
| 1439 |
* on @p signal for which @p value satisfies their wait condition are awakened. |
| 1440 |
* |
| 1441 |
* @param[in] signal Signal. If @p signal is a queue doorbell signal, the |
| 1442 |
* behavior is undefined. |
| 1443 |
* |
| 1444 |
* @param[in] value New value. |
| 1445 |
* |
| 1446 |
* @return Value of the signal prior to the exchange. |
| 1447 |
* |
| 1448 |
*/ |
| 1449 |
hsa_signal_value_t HSA_API hsa_signal_exchange_scacq_screl( |
| 1450 |
hsa_signal_t signal, |
| 1451 |
hsa_signal_value_t value); |
| 1452 |
|
| 1453 |
/** |
| 1454 |
* @deprecated Renamed as ::hsa_signal_exchange_scacq_screl. |
| 1455 |
* |
| 1456 |
* @copydoc hsa_signal_exchange_scacq_screl |
| 1457 |
*/ |
| 1458 |
hsa_signal_value_t HSA_API HSA_DEPRECATED hsa_signal_exchange_acq_rel( |
| 1459 |
hsa_signal_t signal, |
| 1460 |
hsa_signal_value_t value); |
| 1461 |
|
| 1462 |
/** |
| 1463 |
* @copydoc hsa_signal_exchange_scacq_screl |
| 1464 |
*/ |
| 1465 |
hsa_signal_value_t HSA_API hsa_signal_exchange_scacquire( |
| 1466 |
hsa_signal_t signal, |
| 1467 |
hsa_signal_value_t value); |
| 1468 |
|
| 1469 |
/** |
| 1470 |
* @deprecated Renamed as ::hsa_signal_exchange_scacquire. |
| 1471 |
* |
| 1472 |
* @copydoc hsa_signal_exchange_scacquire |
| 1473 |
*/ |
| 1474 |
hsa_signal_value_t HSA_API HSA_DEPRECATED hsa_signal_exchange_acquire( |
| 1475 |
hsa_signal_t signal, |
| 1476 |
hsa_signal_value_t value); |
| 1477 |
|
| 1478 |
/** |
| 1479 |
* @copydoc hsa_signal_exchange_scacq_screl |
| 1480 |
*/ |
| 1481 |
hsa_signal_value_t HSA_API hsa_signal_exchange_relaxed( |
| 1482 |
hsa_signal_t signal, |
| 1483 |
hsa_signal_value_t value); |
| 1484 |
/** |
| 1485 |
* @copydoc hsa_signal_exchange_scacq_screl |
| 1486 |
*/ |
| 1487 |
hsa_signal_value_t HSA_API hsa_signal_exchange_screlease( |
| 1488 |
hsa_signal_t signal, |
| 1489 |
hsa_signal_value_t value); |
| 1490 |
|
| 1491 |
/** |
| 1492 |
* @deprecated Renamed as ::hsa_signal_exchange_screlease. |
| 1493 |
* |
| 1494 |
* @copydoc hsa_signal_exchange_screlease |
| 1495 |
*/ |
| 1496 |
hsa_signal_value_t HSA_API HSA_DEPRECATED hsa_signal_exchange_release( |
| 1497 |
hsa_signal_t signal, |
| 1498 |
hsa_signal_value_t value); |
| 1499 |
|
| 1500 |
/** |
| 1501 |
* @brief Atomically set the value of a signal if the observed value is equal to |
| 1502 |
* the expected value. The observed value is returned regardless of whether the |
| 1503 |
* replacement was done. |
| 1504 |
* |
| 1505 |
* @details If the value of the signal is changed, all the agents waiting |
| 1506 |
* on @p signal for which @p value satisfies their wait condition are awakened. |
| 1507 |
* |
| 1508 |
* @param[in] signal Signal. If @p signal is a queue |
| 1509 |
* doorbell signal, the behavior is undefined. |
| 1510 |
* |
| 1511 |
* @param[in] expected Value to compare with. |
| 1512 |
* |
| 1513 |
* @param[in] value New value. |
| 1514 |
* |
| 1515 |
* @return Observed value of the signal. |
| 1516 |
* |
| 1517 |
*/ |
| 1518 |
hsa_signal_value_t HSA_API hsa_signal_cas_scacq_screl( |
| 1519 |
hsa_signal_t signal, |
| 1520 |
hsa_signal_value_t expected, |
| 1521 |
hsa_signal_value_t value); |
| 1522 |
|
| 1523 |
|
| 1524 |
/** |
| 1525 |
* @deprecated Renamed as ::hsa_signal_cas_scacq_screl. |
| 1526 |
* |
| 1527 |
* @copydoc hsa_signal_cas_scacq_screl |
| 1528 |
*/ |
| 1529 |
hsa_signal_value_t HSA_API HSA_DEPRECATED hsa_signal_cas_acq_rel( |
| 1530 |
hsa_signal_t signal, |
| 1531 |
hsa_signal_value_t expected, |
| 1532 |
hsa_signal_value_t value); |
| 1533 |
|
| 1534 |
/** |
| 1535 |
* @copydoc hsa_signal_cas_scacq_screl |
| 1536 |
*/ |
| 1537 |
hsa_signal_value_t HSA_API hsa_signal_cas_scacquire( |
| 1538 |
hsa_signal_t signal, |
| 1539 |
hsa_signal_value_t expected, |
| 1540 |
hsa_signal_value_t value); |
| 1541 |
|
| 1542 |
/** |
| 1543 |
* @deprecated Renamed as ::hsa_signal_cas_scacquire. |
| 1544 |
* |
| 1545 |
* @copydoc hsa_signal_cas_scacquire |
| 1546 |
*/ |
| 1547 |
hsa_signal_value_t HSA_API HSA_DEPRECATED hsa_signal_cas_acquire( |
| 1548 |
hsa_signal_t signal, |
| 1549 |
hsa_signal_value_t expected, |
| 1550 |
hsa_signal_value_t value); |
| 1551 |
|
| 1552 |
/** |
| 1553 |
* @copydoc hsa_signal_cas_scacq_screl |
| 1554 |
*/ |
| 1555 |
hsa_signal_value_t HSA_API hsa_signal_cas_relaxed( |
| 1556 |
hsa_signal_t signal, |
| 1557 |
hsa_signal_value_t expected, |
| 1558 |
hsa_signal_value_t value); |
| 1559 |
|
| 1560 |
/** |
| 1561 |
* @copydoc hsa_signal_cas_scacq_screl |
| 1562 |
*/ |
| 1563 |
hsa_signal_value_t HSA_API hsa_signal_cas_screlease( |
| 1564 |
hsa_signal_t signal, |
| 1565 |
hsa_signal_value_t expected, |
| 1566 |
hsa_signal_value_t value); |
| 1567 |
|
| 1568 |
/** |
| 1569 |
* @deprecated Renamed as ::hsa_signal_cas_screlease. |
| 1570 |
* |
| 1571 |
* @copydoc hsa_signal_cas_screlease |
| 1572 |
*/ |
| 1573 |
hsa_signal_value_t HSA_API HSA_DEPRECATED hsa_signal_cas_release( |
| 1574 |
hsa_signal_t signal, |
| 1575 |
hsa_signal_value_t expected, |
| 1576 |
hsa_signal_value_t value); |
| 1577 |
|
| 1578 |
/** |
| 1579 |
* @brief Atomically increment the value of a signal by a given amount. |
| 1580 |
* |
| 1581 |
* @details If the value of the signal is changed, all the agents waiting on |
| 1582 |
* @p signal for which @p value satisfies their wait condition are awakened. |
| 1583 |
* |
| 1584 |
* @param[in] signal Signal. If @p signal is a queue doorbell signal, the |
| 1585 |
* behavior is undefined. |
| 1586 |
* |
| 1587 |
* @param[in] value Value to add to the value of the signal. |
| 1588 |
* |
| 1589 |
*/ |
| 1590 |
void HSA_API hsa_signal_add_scacq_screl( |
| 1591 |
hsa_signal_t signal, |
| 1592 |
hsa_signal_value_t value); |
| 1593 |
|
| 1594 |
/** |
| 1595 |
* @deprecated Renamed as ::hsa_signal_add_scacq_screl. |
| 1596 |
* |
| 1597 |
* @copydoc hsa_signal_add_scacq_screl |
| 1598 |
*/ |
| 1599 |
void HSA_API HSA_DEPRECATED hsa_signal_add_acq_rel( |
| 1600 |
hsa_signal_t signal, |
| 1601 |
hsa_signal_value_t value); |
| 1602 |
|
| 1603 |
/** |
| 1604 |
* @copydoc hsa_signal_add_scacq_screl |
| 1605 |
*/ |
| 1606 |
void HSA_API hsa_signal_add_scacquire( |
| 1607 |
hsa_signal_t signal, |
| 1608 |
hsa_signal_value_t value); |
| 1609 |
|
| 1610 |
/** |
| 1611 |
* @deprecated Renamed as ::hsa_signal_add_scacquire. |
| 1612 |
* |
| 1613 |
* @copydoc hsa_signal_add_scacquire |
| 1614 |
*/ |
| 1615 |
void HSA_API HSA_DEPRECATED hsa_signal_add_acquire( |
| 1616 |
hsa_signal_t signal, |
| 1617 |
hsa_signal_value_t value); |
| 1618 |
|
| 1619 |
/** |
| 1620 |
* @copydoc hsa_signal_add_scacq_screl |
| 1621 |
*/ |
| 1622 |
void HSA_API hsa_signal_add_relaxed( |
| 1623 |
hsa_signal_t signal, |
| 1624 |
hsa_signal_value_t value); |
| 1625 |
|
| 1626 |
/** |
| 1627 |
* @copydoc hsa_signal_add_scacq_screl |
| 1628 |
*/ |
| 1629 |
void HSA_API hsa_signal_add_screlease( |
| 1630 |
hsa_signal_t signal, |
| 1631 |
hsa_signal_value_t value); |
| 1632 |
|
| 1633 |
|
| 1634 |
/** |
| 1635 |
* @deprecated Renamed as ::hsa_signal_add_screlease. |
| 1636 |
* |
| 1637 |
* @copydoc hsa_signal_add_screlease |
| 1638 |
*/ |
| 1639 |
void HSA_API HSA_DEPRECATED hsa_signal_add_release( |
| 1640 |
hsa_signal_t signal, |
| 1641 |
hsa_signal_value_t value); |
| 1642 |
|
| 1643 |
/** |
| 1644 |
* @brief Atomically decrement the value of a signal by a given amount. |
| 1645 |
* |
| 1646 |
* @details If the value of the signal is changed, all the agents waiting on |
| 1647 |
* @p signal for which @p value satisfies their wait condition are awakened. |
| 1648 |
* |
| 1649 |
* @param[in] signal Signal. If @p signal is a queue doorbell signal, the |
| 1650 |
* behavior is undefined. |
| 1651 |
* |
| 1652 |
* @param[in] value Value to subtract from the value of the signal. |
| 1653 |
* |
| 1654 |
*/ |
| 1655 |
void HSA_API hsa_signal_subtract_scacq_screl( |
| 1656 |
hsa_signal_t signal, |
| 1657 |
hsa_signal_value_t value); |
| 1658 |
|
| 1659 |
|
| 1660 |
/** |
| 1661 |
* @deprecated Renamed as ::hsa_signal_subtract_scacq_screl. |
| 1662 |
* |
| 1663 |
* @copydoc hsa_signal_subtract_scacq_screl |
| 1664 |
*/ |
| 1665 |
void HSA_API HSA_DEPRECATED hsa_signal_subtract_acq_rel( |
| 1666 |
hsa_signal_t signal, |
| 1667 |
hsa_signal_value_t value); |
| 1668 |
|
| 1669 |
/** |
| 1670 |
* @copydoc hsa_signal_subtract_scacq_screl |
| 1671 |
*/ |
| 1672 |
void HSA_API hsa_signal_subtract_scacquire( |
| 1673 |
hsa_signal_t signal, |
| 1674 |
hsa_signal_value_t value); |
| 1675 |
|
| 1676 |
/** |
| 1677 |
* @deprecated Renamed as ::hsa_signal_subtract_scacquire. |
| 1678 |
* |
| 1679 |
* @copydoc hsa_signal_subtract_scacquire |
| 1680 |
*/ |
| 1681 |
void HSA_API HSA_DEPRECATED hsa_signal_subtract_acquire( |
| 1682 |
hsa_signal_t signal, |
| 1683 |
hsa_signal_value_t value); |
| 1684 |
|
| 1685 |
/** |
| 1686 |
* @copydoc hsa_signal_subtract_scacq_screl |
| 1687 |
*/ |
| 1688 |
void HSA_API hsa_signal_subtract_relaxed( |
| 1689 |
hsa_signal_t signal, |
| 1690 |
hsa_signal_value_t value); |
| 1691 |
|
| 1692 |
/** |
| 1693 |
* @copydoc hsa_signal_subtract_scacq_screl |
| 1694 |
*/ |
| 1695 |
void HSA_API hsa_signal_subtract_screlease( |
| 1696 |
hsa_signal_t signal, |
| 1697 |
hsa_signal_value_t value); |
| 1698 |
|
| 1699 |
|
| 1700 |
/** |
| 1701 |
* @deprecated Renamed as ::hsa_signal_subtract_screlease. |
| 1702 |
* |
| 1703 |
* @copydoc hsa_signal_subtract_screlease |
| 1704 |
*/ |
| 1705 |
void HSA_API HSA_DEPRECATED hsa_signal_subtract_release( |
| 1706 |
hsa_signal_t signal, |
| 1707 |
hsa_signal_value_t value); |
| 1708 |
|
| 1709 |
/** |
| 1710 |
* @brief Atomically perform a bitwise AND operation between the value of a |
| 1711 |
* signal and a given value. |
| 1712 |
* |
| 1713 |
* @details If the value of the signal is changed, all the agents waiting on |
| 1714 |
* @p signal for which @p value satisfies their wait condition are awakened. |
| 1715 |
* |
| 1716 |
* @param[in] signal Signal. If @p signal is a queue doorbell signal, the |
| 1717 |
* behavior is undefined. |
| 1718 |
* |
| 1719 |
* @param[in] value Value to AND with the value of the signal. |
| 1720 |
* |
| 1721 |
*/ |
| 1722 |
void HSA_API hsa_signal_and_scacq_screl( |
| 1723 |
hsa_signal_t signal, |
| 1724 |
hsa_signal_value_t value); |
| 1725 |
|
| 1726 |
/** |
| 1727 |
* @deprecated Renamed as ::hsa_signal_and_scacq_screl. |
| 1728 |
* |
| 1729 |
* @copydoc hsa_signal_and_scacq_screl |
| 1730 |
*/ |
| 1731 |
void HSA_API HSA_DEPRECATED hsa_signal_and_acq_rel( |
| 1732 |
hsa_signal_t signal, |
| 1733 |
hsa_signal_value_t value); |
| 1734 |
|
| 1735 |
/** |
| 1736 |
* @copydoc hsa_signal_and_scacq_screl |
| 1737 |
*/ |
| 1738 |
void HSA_API hsa_signal_and_scacquire( |
| 1739 |
hsa_signal_t signal, |
| 1740 |
hsa_signal_value_t value); |
| 1741 |
|
| 1742 |
/** |
| 1743 |
* @deprecated Renamed as ::hsa_signal_and_scacquire. |
| 1744 |
* |
| 1745 |
* @copydoc hsa_signal_and_scacquire |
| 1746 |
*/ |
| 1747 |
void HSA_API HSA_DEPRECATED hsa_signal_and_acquire( |
| 1748 |
hsa_signal_t signal, |
| 1749 |
hsa_signal_value_t value); |
| 1750 |
|
| 1751 |
/** |
| 1752 |
* @copydoc hsa_signal_and_scacq_screl |
| 1753 |
*/ |
| 1754 |
void HSA_API hsa_signal_and_relaxed( |
| 1755 |
hsa_signal_t signal, |
| 1756 |
hsa_signal_value_t value); |
| 1757 |
|
| 1758 |
/** |
| 1759 |
* @copydoc hsa_signal_and_scacq_screl |
| 1760 |
*/ |
| 1761 |
void HSA_API hsa_signal_and_screlease( |
| 1762 |
hsa_signal_t signal, |
| 1763 |
hsa_signal_value_t value); |
| 1764 |
|
| 1765 |
|
| 1766 |
/** |
| 1767 |
* @deprecated Renamed as ::hsa_signal_and_screlease. |
| 1768 |
* |
| 1769 |
* @copydoc hsa_signal_and_screlease |
| 1770 |
*/ |
| 1771 |
void HSA_API HSA_DEPRECATED hsa_signal_and_release( |
| 1772 |
hsa_signal_t signal, |
| 1773 |
hsa_signal_value_t value); |
| 1774 |
|
| 1775 |
/** |
| 1776 |
* @brief Atomically perform a bitwise OR operation between the value of a |
| 1777 |
* signal and a given value. |
| 1778 |
* |
| 1779 |
* @details If the value of the signal is changed, all the agents waiting on |
| 1780 |
* @p signal for which @p value satisfies their wait condition are awakened. |
| 1781 |
* |
| 1782 |
* @param[in] signal Signal. If @p signal is a queue doorbell signal, the |
| 1783 |
* behavior is undefined. |
| 1784 |
* |
| 1785 |
* @param[in] value Value to OR with the value of the signal. |
| 1786 |
*/ |
| 1787 |
void HSA_API hsa_signal_or_scacq_screl( |
| 1788 |
hsa_signal_t signal, |
| 1789 |
hsa_signal_value_t value); |
| 1790 |
|
| 1791 |
|
| 1792 |
/** |
| 1793 |
* @deprecated Renamed as ::hsa_signal_or_scacq_screl. |
| 1794 |
* |
| 1795 |
* @copydoc hsa_signal_or_scacq_screl |
| 1796 |
*/ |
| 1797 |
void HSA_API HSA_DEPRECATED hsa_signal_or_acq_rel( |
| 1798 |
hsa_signal_t signal, |
| 1799 |
hsa_signal_value_t value); |
| 1800 |
|
| 1801 |
/** |
| 1802 |
* @copydoc hsa_signal_or_scacq_screl |
| 1803 |
*/ |
| 1804 |
void HSA_API hsa_signal_or_scacquire( |
| 1805 |
hsa_signal_t signal, |
| 1806 |
hsa_signal_value_t value); |
| 1807 |
|
| 1808 |
/** |
| 1809 |
* @deprecated Renamed as ::hsa_signal_or_scacquire. |
| 1810 |
* |
| 1811 |
* @copydoc hsa_signal_or_scacquire |
| 1812 |
*/ |
| 1813 |
void HSA_API HSA_DEPRECATED hsa_signal_or_acquire( |
| 1814 |
hsa_signal_t signal, |
| 1815 |
hsa_signal_value_t value); |
| 1816 |
|
| 1817 |
/** |
| 1818 |
* @copydoc hsa_signal_or_scacq_screl |
| 1819 |
*/ |
| 1820 |
void HSA_API hsa_signal_or_relaxed( |
| 1821 |
hsa_signal_t signal, |
| 1822 |
hsa_signal_value_t value); |
| 1823 |
|
| 1824 |
/** |
| 1825 |
* @copydoc hsa_signal_or_scacq_screl |
| 1826 |
*/ |
| 1827 |
void HSA_API hsa_signal_or_screlease( |
| 1828 |
hsa_signal_t signal, |
| 1829 |
hsa_signal_value_t value); |
| 1830 |
|
| 1831 |
/** |
| 1832 |
* @deprecated Renamed as ::hsa_signal_or_screlease. |
| 1833 |
* |
| 1834 |
* @copydoc hsa_signal_or_screlease |
| 1835 |
*/ |
| 1836 |
void HSA_API HSA_DEPRECATED hsa_signal_or_release( |
| 1837 |
hsa_signal_t signal, |
| 1838 |
hsa_signal_value_t value); |
| 1839 |
|
| 1840 |
/** |
| 1841 |
* @brief Atomically perform a bitwise XOR operation between the value of a |
| 1842 |
* signal and a given value. |
| 1843 |
* |
| 1844 |
* @details If the value of the signal is changed, all the agents waiting on |
| 1845 |
* @p signal for which @p value satisfies their wait condition are awakened. |
| 1846 |
* |
| 1847 |
* @param[in] signal Signal. If @p signal is a queue doorbell signal, the |
| 1848 |
* behavior is undefined. |
| 1849 |
* |
| 1850 |
* @param[in] value Value to XOR with the value of the signal. |
| 1851 |
* |
| 1852 |
*/ |
| 1853 |
void HSA_API hsa_signal_xor_scacq_screl( |
| 1854 |
hsa_signal_t signal, |
| 1855 |
hsa_signal_value_t value); |
| 1856 |
|
| 1857 |
|
| 1858 |
/** |
| 1859 |
* @deprecated Renamed as ::hsa_signal_xor_scacq_screl. |
| 1860 |
* |
| 1861 |
* @copydoc hsa_signal_xor_scacq_screl |
| 1862 |
*/ |
| 1863 |
void HSA_API HSA_DEPRECATED hsa_signal_xor_acq_rel( |
| 1864 |
hsa_signal_t signal, |
| 1865 |
hsa_signal_value_t value); |
| 1866 |
|
| 1867 |
/** |
| 1868 |
* @copydoc hsa_signal_xor_scacq_screl |
| 1869 |
*/ |
| 1870 |
void HSA_API hsa_signal_xor_scacquire( |
| 1871 |
hsa_signal_t signal, |
| 1872 |
hsa_signal_value_t value); |
| 1873 |
|
| 1874 |
/** |
| 1875 |
* @deprecated Renamed as ::hsa_signal_xor_scacquire. |
| 1876 |
* |
| 1877 |
* @copydoc hsa_signal_xor_scacquire |
| 1878 |
*/ |
| 1879 |
void HSA_API HSA_DEPRECATED hsa_signal_xor_acquire( |
| 1880 |
hsa_signal_t signal, |
| 1881 |
hsa_signal_value_t value); |
| 1882 |
|
| 1883 |
/** |
| 1884 |
* @copydoc hsa_signal_xor_scacq_screl |
| 1885 |
*/ |
| 1886 |
void HSA_API hsa_signal_xor_relaxed( |
| 1887 |
hsa_signal_t signal, |
| 1888 |
hsa_signal_value_t value); |
| 1889 |
|
| 1890 |
/** |
| 1891 |
* @copydoc hsa_signal_xor_scacq_screl |
| 1892 |
*/ |
| 1893 |
void HSA_API hsa_signal_xor_screlease( |
| 1894 |
hsa_signal_t signal, |
| 1895 |
hsa_signal_value_t value); |
| 1896 |
|
| 1897 |
/** |
| 1898 |
* @deprecated Renamed as ::hsa_signal_xor_screlease. |
| 1899 |
* |
| 1900 |
* @copydoc hsa_signal_xor_screlease |
| 1901 |
*/ |
| 1902 |
void HSA_API HSA_DEPRECATED hsa_signal_xor_release( |
| 1903 |
hsa_signal_t signal, |
| 1904 |
hsa_signal_value_t value); |
| 1905 |
|
| 1906 |
/** |
| 1907 |
* @brief Wait condition operator. |
| 1908 |
*/ |
| 1909 |
typedef enum { |
| 1910 |
/** |
| 1911 |
* The two operands are equal. |
| 1912 |
*/ |
| 1913 |
HSA_SIGNAL_CONDITION_EQ = 0, |
| 1914 |
/** |
| 1915 |
* The two operands are not equal. |
| 1916 |
*/ |
| 1917 |
HSA_SIGNAL_CONDITION_NE = 1, |
| 1918 |
/** |
| 1919 |
* The first operand is less than the second operand. |
| 1920 |
*/ |
| 1921 |
HSA_SIGNAL_CONDITION_LT = 2, |
| 1922 |
/** |
| 1923 |
* The first operand is greater than or equal to the second operand. |
| 1924 |
*/ |
| 1925 |
HSA_SIGNAL_CONDITION_GTE = 3 |
| 1926 |
} hsa_signal_condition_t; |
| 1927 |
|
| 1928 |
/** |
| 1929 |
* @brief State of the application thread during a signal wait. |
| 1930 |
*/ |
| 1931 |
typedef enum { |
| 1932 |
/** |
| 1933 |
* The application thread may be rescheduled while waiting on the signal. |
| 1934 |
*/ |
| 1935 |
HSA_WAIT_STATE_BLOCKED = 0, |
| 1936 |
/** |
| 1937 |
* The application thread stays active while waiting on a signal. |
| 1938 |
*/ |
| 1939 |
HSA_WAIT_STATE_ACTIVE = 1 |
| 1940 |
} hsa_wait_state_t; |
| 1941 |
|
| 1942 |
|
| 1943 |
/** |
| 1944 |
* @brief Wait until a signal value satisfies a specified condition, or a |
| 1945 |
* certain amount of time has elapsed. |
| 1946 |
* |
| 1947 |
* @details A wait operation can spuriously resume at any time sooner than the |
| 1948 |
* timeout (for example, due to system or other external factors) even when the |
| 1949 |
* condition has not been met. |
| 1950 |
* |
| 1951 |
* The function is guaranteed to return if the signal value satisfies the |
| 1952 |
* condition at some point in time during the wait, but the value returned to |
| 1953 |
* the application might not satisfy the condition. The application must ensure |
| 1954 |
* that signals are used in such way that wait wakeup conditions are not |
| 1955 |
* invalidated before dependent threads have woken up. |
| 1956 |
* |
| 1957 |
* When the wait operation internally loads the value of the passed signal, it |
| 1958 |
* uses the memory order indicated in the function name. |
| 1959 |
* |
| 1960 |
* @param[in] signal Signal. |
| 1961 |
* |
| 1962 |
* @param[in] condition Condition used to compare the signal value with @p |
| 1963 |
* compare_value. |
| 1964 |
* |
| 1965 |
* @param[in] compare_value Value to compare with. |
| 1966 |
* |
| 1967 |
* @param[in] timeout_hint Maximum duration of the wait. Specified in the same |
| 1968 |
* unit as the system timestamp. The operation might block for a shorter or |
| 1969 |
* longer time even if the condition is not met. A value of UINT64_MAX indicates |
| 1970 |
* no maximum. |
| 1971 |
* |
| 1972 |
* @param[in] wait_state_hint Hint used by the application to indicate the |
| 1973 |
* preferred waiting state. The actual waiting state is ultimately decided by |
| 1974 |
* HSA runtime and may not match the provided hint. A value of |
| 1975 |
* ::HSA_WAIT_STATE_ACTIVE may improve the latency of response to a signal |
| 1976 |
* update by avoiding rescheduling overhead. |
| 1977 |
* |
| 1978 |
* @return Observed value of the signal, which might not satisfy the specified |
| 1979 |
* condition. |
| 1980 |
* |
| 1981 |
*/ |
| 1982 |
hsa_signal_value_t HSA_API hsa_signal_wait_scacquire( |
| 1983 |
hsa_signal_t signal, |
| 1984 |
hsa_signal_condition_t condition, |
| 1985 |
hsa_signal_value_t compare_value, |
| 1986 |
uint64_t timeout_hint, |
| 1987 |
hsa_wait_state_t wait_state_hint); |
| 1988 |
|
| 1989 |
/** |
| 1990 |
* @copydoc hsa_signal_wait_scacquire |
| 1991 |
*/ |
| 1992 |
hsa_signal_value_t HSA_API hsa_signal_wait_relaxed( |
| 1993 |
hsa_signal_t signal, |
| 1994 |
hsa_signal_condition_t condition, |
| 1995 |
hsa_signal_value_t compare_value, |
| 1996 |
uint64_t timeout_hint, |
| 1997 |
hsa_wait_state_t wait_state_hint); |
| 1998 |
|
| 1999 |
/** |
| 2000 |
* @deprecated Renamed as ::hsa_signal_wait_scacquire. |
| 2001 |
* |
| 2002 |
* @copydoc hsa_signal_wait_scacquire |
| 2003 |
*/ |
| 2004 |
hsa_signal_value_t HSA_API HSA_DEPRECATED hsa_signal_wait_acquire( |
| 2005 |
hsa_signal_t signal, |
| 2006 |
hsa_signal_condition_t condition, |
| 2007 |
hsa_signal_value_t compare_value, |
| 2008 |
uint64_t timeout_hint, |
| 2009 |
hsa_wait_state_t wait_state_hint); |
| 2010 |
|
| 2011 |
/** |
| 2012 |
* @brief Group of signals. |
| 2013 |
*/ |
| 2014 |
typedef struct hsa_signal_group_s { |
| 2015 |
/** |
| 2016 |
* Opaque handle. Two handles reference the same object of the enclosing type |
| 2017 |
* if and only if they are equal. |
| 2018 |
*/ |
| 2019 |
uint64_t handle; |
| 2020 |
} hsa_signal_group_t; |
| 2021 |
|
| 2022 |
/** |
| 2023 |
* @brief Create a signal group. |
| 2024 |
* |
| 2025 |
* @param[in] num_signals Number of elements in @p signals. Must not be 0. |
| 2026 |
* |
| 2027 |
* @param[in] signals List of signals in the group. The list must not contain |
| 2028 |
* any repeated elements. Must not be NULL. |
| 2029 |
* |
| 2030 |
* @param[in] num_consumers Number of elements in @p consumers. Must not be 0. |
| 2031 |
* |
| 2032 |
* @param[in] consumers List of agents that might consume (wait on) the signal |
| 2033 |
* group. The list must not contain repeated elements, and must be a subset of |
| 2034 |
* the set of agents that are allowed to wait on all the signals in the |
| 2035 |
* group. If an agent not listed in @p consumers waits on the returned group, |
| 2036 |
* the behavior is undefined. The memory associated with @p consumers can be |
| 2037 |
* reused or freed after the function returns. Must not be NULL. |
| 2038 |
* |
| 2039 |
* @param[out] signal_group Pointer to newly created signal group. Must not be |
| 2040 |
* NULL. |
| 2041 |
* |
| 2042 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 2043 |
* |
| 2044 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 2045 |
* initialized. |
| 2046 |
* |
| 2047 |
* @retval ::HSA_STATUS_ERROR_OUT_OF_RESOURCES The HSA runtime failed to allocate |
| 2048 |
* the required resources. |
| 2049 |
* |
| 2050 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p num_signals is 0, @p signals |
| 2051 |
* is NULL, @p num_consumers is 0, @p consumers is NULL, or @p signal_group is |
| 2052 |
* NULL. |
| 2053 |
*/ |
| 2054 |
hsa_status_t HSA_API hsa_signal_group_create( |
| 2055 |
uint32_t num_signals, |
| 2056 |
const hsa_signal_t *signals, |
| 2057 |
uint32_t num_consumers, |
| 2058 |
const hsa_agent_t *consumers, |
| 2059 |
hsa_signal_group_t *signal_group); |
| 2060 |
|
| 2061 |
/** |
| 2062 |
* @brief Destroy a signal group previous created by ::hsa_signal_group_create. |
| 2063 |
* |
| 2064 |
* @param[in] signal_group Signal group. |
| 2065 |
* |
| 2066 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 2067 |
* |
| 2068 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 2069 |
* initialized. |
| 2070 |
* |
| 2071 |
* @retval ::HSA_STATUS_ERROR_INVALID_SIGNAL_GROUP @p signal_group is invalid. |
| 2072 |
*/ |
| 2073 |
hsa_status_t HSA_API hsa_signal_group_destroy( |
| 2074 |
hsa_signal_group_t signal_group); |
| 2075 |
|
| 2076 |
/** |
| 2077 |
* @brief Wait until the value of at least one of the signals in a signal group |
| 2078 |
* satisfies its associated condition. |
| 2079 |
* |
| 2080 |
* @details The function is guaranteed to return if the value of at least one of |
| 2081 |
* the signals in the group satisfies its associated condition at some point in |
| 2082 |
* time during the wait, but the signal value returned to the application may no |
| 2083 |
* longer satisfy the condition. The application must ensure that signals in the |
| 2084 |
* group are used in such way that wait wakeup conditions are not invalidated |
| 2085 |
* before dependent threads have woken up. |
| 2086 |
* |
| 2087 |
* When this operation internally loads the value of the passed signal, it uses |
| 2088 |
* the memory order indicated in the function name. |
| 2089 |
* |
| 2090 |
* @param[in] signal_group Signal group. |
| 2091 |
* |
| 2092 |
* @param[in] conditions List of conditions. Each condition, and the value at |
| 2093 |
* the same index in @p compare_values, is used to compare the value of the |
| 2094 |
* signal at that index in @p signal_group (the signal passed by the application |
| 2095 |
* to ::hsa_signal_group_create at that particular index). The size of @p |
| 2096 |
* conditions must not be smaller than the number of signals in @p signal_group; |
| 2097 |
* any extra elements are ignored. Must not be NULL. |
| 2098 |
* |
| 2099 |
* @param[in] compare_values List of comparison values. The size of @p |
| 2100 |
* compare_values must not be smaller than the number of signals in @p |
| 2101 |
* signal_group; any extra elements are ignored. Must not be NULL. |
| 2102 |
* |
| 2103 |
* @param[in] wait_state_hint Hint used by the application to indicate the |
| 2104 |
* preferred waiting state. The actual waiting state is decided by the HSA runtime |
| 2105 |
* and may not match the provided hint. A value of ::HSA_WAIT_STATE_ACTIVE may |
| 2106 |
* improve the latency of response to a signal update by avoiding rescheduling |
| 2107 |
* overhead. |
| 2108 |
* |
| 2109 |
* @param[out] signal Signal in the group that satisfied the associated |
| 2110 |
* condition. If several signals satisfied their condition, the function can |
| 2111 |
* return any of those signals. Must not be NULL. |
| 2112 |
* |
| 2113 |
* @param[out] value Observed value for @p signal, which might no longer satisfy |
| 2114 |
* the specified condition. Must not be NULL. |
| 2115 |
* |
| 2116 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 2117 |
* |
| 2118 |
* @retval ::HSA_STATUS_ERROR_INVALID_SIGNAL_GROUP @p signal_group is invalid. |
| 2119 |
* |
| 2120 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p conditions is NULL, @p |
| 2121 |
* compare_values is NULL, @p signal is NULL, or @p value is NULL. |
| 2122 |
*/ |
| 2123 |
hsa_status_t HSA_API hsa_signal_group_wait_any_scacquire( |
| 2124 |
hsa_signal_group_t signal_group, |
| 2125 |
const hsa_signal_condition_t *conditions, |
| 2126 |
const hsa_signal_value_t *compare_values, |
| 2127 |
hsa_wait_state_t wait_state_hint, |
| 2128 |
hsa_signal_t *signal, |
| 2129 |
hsa_signal_value_t *value); |
| 2130 |
|
| 2131 |
/** |
| 2132 |
* @copydoc hsa_signal_group_wait_any_scacquire |
| 2133 |
*/ |
| 2134 |
hsa_status_t HSA_API hsa_signal_group_wait_any_relaxed( |
| 2135 |
hsa_signal_group_t signal_group, |
| 2136 |
const hsa_signal_condition_t *conditions, |
| 2137 |
const hsa_signal_value_t *compare_values, |
| 2138 |
hsa_wait_state_t wait_state_hint, |
| 2139 |
hsa_signal_t *signal, |
| 2140 |
hsa_signal_value_t *value); |
| 2141 |
|
| 2142 |
/** @} */ |
| 2143 |
|
| 2144 |
/** \defgroup memory Memory |
| 2145 |
* @{ |
| 2146 |
*/ |
| 2147 |
|
| 2148 |
/** |
| 2149 |
* @brief A memory region represents a block of virtual memory with certain |
| 2150 |
* properties. For example, the HSA runtime represents fine-grained memory in |
| 2151 |
* the global segment using a region. A region might be associated with more |
| 2152 |
* than one agent. |
| 2153 |
*/ |
| 2154 |
typedef struct hsa_region_s { |
| 2155 |
/** |
| 2156 |
* Opaque handle. Two handles reference the same object of the enclosing type |
| 2157 |
* if and only if they are equal. |
| 2158 |
*/ |
| 2159 |
uint64_t handle; |
| 2160 |
} hsa_region_t; |
| 2161 |
|
| 2162 |
/** @} */ |
| 2163 |
|
| 2164 |
|
| 2165 |
/** \defgroup queue Queues |
| 2166 |
* @{ |
| 2167 |
*/ |
| 2168 |
|
| 2169 |
/** |
| 2170 |
* @brief Queue type. Intended to be used for dynamic queue protocol |
| 2171 |
* determination. |
| 2172 |
*/ |
| 2173 |
typedef enum { |
| 2174 |
/** |
| 2175 |
* Queue supports multiple producers. Use of multiproducer queue mechanics is |
| 2176 |
* required. |
| 2177 |
*/ |
| 2178 |
HSA_QUEUE_TYPE_MULTI = 0, |
| 2179 |
/** |
| 2180 |
* Queue only supports a single producer. In some scenarios, the application |
| 2181 |
* may want to limit the submission of AQL packets to a single agent. Queues |
| 2182 |
* that support a single producer may be more efficient than queues supporting |
| 2183 |
* multiple producers. Use of multiproducer queue mechanics is not supported. |
| 2184 |
*/ |
| 2185 |
HSA_QUEUE_TYPE_SINGLE = 1, |
| 2186 |
/** |
| 2187 |
* Queue supports multiple producers and cooperative dispatches. Cooperative |
| 2188 |
* dispatches are able to use GWS synchronization. Queues of this type may be |
| 2189 |
* limited in number. The runtime may return the same queue to serve multiple |
| 2190 |
* ::hsa_queue_create calls when this type is given. Callers must inspect the |
| 2191 |
* returned queue to discover queue size. Queues of this type are reference |
| 2192 |
* counted and require a matching number of ::hsa_queue_destroy calls to |
| 2193 |
* release. Use of multiproducer queue mechanics is required. See |
| 2194 |
* ::HSA_AMD_AGENT_INFO_COOPERATIVE_QUEUES to query agent support for this |
| 2195 |
* type. |
| 2196 |
*/ |
| 2197 |
HSA_QUEUE_TYPE_COOPERATIVE = 2 |
| 2198 |
} hsa_queue_type_t; |
| 2199 |
|
| 2200 |
/** |
| 2201 |
* @brief A fixed-size type used to represent ::hsa_queue_type_t constants. |
| 2202 |
*/ |
| 2203 |
typedef uint32_t hsa_queue_type32_t; |
| 2204 |
|
| 2205 |
/** |
| 2206 |
* @brief Queue features. |
| 2207 |
*/ |
| 2208 |
typedef enum { |
| 2209 |
/** |
| 2210 |
* Queue supports kernel dispatch packets. |
| 2211 |
*/ |
| 2212 |
HSA_QUEUE_FEATURE_KERNEL_DISPATCH = 1, |
| 2213 |
|
| 2214 |
/** |
| 2215 |
* Queue supports agent dispatch packets. |
| 2216 |
*/ |
| 2217 |
HSA_QUEUE_FEATURE_AGENT_DISPATCH = 2 |
| 2218 |
} hsa_queue_feature_t; |
| 2219 |
|
| 2220 |
/** |
| 2221 |
* @brief User mode queue. |
| 2222 |
* |
| 2223 |
* @details The queue structure is read-only and allocated by the HSA runtime, |
| 2224 |
* but agents can directly modify the contents of the buffer pointed by @a |
| 2225 |
* base_address, or use HSA runtime APIs to access the doorbell signal. |
| 2226 |
* |
| 2227 |
*/ |
| 2228 |
typedef struct hsa_queue_s { |
| 2229 |
/** |
| 2230 |
* Queue type. |
| 2231 |
*/ |
| 2232 |
hsa_queue_type32_t type; |
| 2233 |
|
| 2234 |
/** |
| 2235 |
* Queue features mask. This is a bit-field of ::hsa_queue_feature_t |
| 2236 |
* values. Applications should ignore any unknown set bits. |
| 2237 |
*/ |
| 2238 |
uint32_t features; |
| 2239 |
|
| 2240 |
#ifdef HSA_LARGE_MODEL |
| 2241 |
void* base_address; |
| 2242 |
#elif defined HSA_LITTLE_ENDIAN |
| 2243 |
/** |
| 2244 |
* Starting address of the HSA runtime-allocated buffer used to store the AQL |
| 2245 |
* packets. Must be aligned to the size of an AQL packet. |
| 2246 |
*/ |
| 2247 |
void* base_address; |
| 2248 |
/** |
| 2249 |
* Reserved. Must be 0. |
| 2250 |
*/ |
| 2251 |
uint32_t reserved0; |
| 2252 |
#else |
| 2253 |
uint32_t reserved0; |
| 2254 |
void* base_address; |
| 2255 |
#endif |
| 2256 |
|
| 2257 |
/** |
| 2258 |
* Signal object used by the application to indicate the ID of a packet that |
| 2259 |
* is ready to be processed. The HSA runtime manages the doorbell signal. If |
| 2260 |
* the application tries to replace or destroy this signal, the behavior is |
| 2261 |
* undefined. |
| 2262 |
* |
| 2263 |
* If @a type is ::HSA_QUEUE_TYPE_SINGLE, the doorbell signal value must be |
| 2264 |
* updated in a monotonically increasing fashion. If @a type is |
| 2265 |
* ::HSA_QUEUE_TYPE_MULTI, the doorbell signal value can be updated with any |
| 2266 |
* value. |
| 2267 |
*/ |
| 2268 |
hsa_signal_t doorbell_signal; |
| 2269 |
|
| 2270 |
/** |
| 2271 |
* Maximum number of packets the queue can hold. Must be a power of 2. |
| 2272 |
*/ |
| 2273 |
uint32_t size; |
| 2274 |
/** |
| 2275 |
* Reserved. Must be 0. |
| 2276 |
*/ |
| 2277 |
uint32_t reserved1; |
| 2278 |
/** |
| 2279 |
* Queue identifier, which is unique over the lifetime of the application. |
| 2280 |
*/ |
| 2281 |
uint64_t id; |
| 2282 |
|
| 2283 |
} hsa_queue_t; |
| 2284 |
|
| 2285 |
/** |
| 2286 |
* @brief Create a user mode queue. |
| 2287 |
* |
| 2288 |
* @details The HSA runtime creates the queue structure, the underlying packet |
| 2289 |
* buffer, the completion signal, and the write and read indexes. The initial |
| 2290 |
* value of the write and read indexes is 0. The type of every packet in the |
| 2291 |
* buffer is initialized to ::HSA_PACKET_TYPE_INVALID. |
| 2292 |
* |
| 2293 |
* The application should only rely on the error code returned to determine if |
| 2294 |
* the queue is valid. |
| 2295 |
* |
| 2296 |
* @param[in] agent Agent where to create the queue. |
| 2297 |
* |
| 2298 |
* @param[in] size Number of packets the queue is expected to |
| 2299 |
* hold. Must be a power of 2 between 1 and the value of |
| 2300 |
* ::HSA_AGENT_INFO_QUEUE_MAX_SIZE in @p agent. The size of the newly |
| 2301 |
* created queue is the maximum of @p size and the value of |
| 2302 |
* ::HSA_AGENT_INFO_QUEUE_MIN_SIZE in @p agent. |
| 2303 |
* |
| 2304 |
* @param[in] type Type of the queue, a bitwise OR of hsa_queue_type_t values. |
| 2305 |
* If the value of ::HSA_AGENT_INFO_QUEUE_TYPE in @p agent is ::HSA_QUEUE_TYPE_SINGLE, |
| 2306 |
* then @p type must also be ::HSA_QUEUE_TYPE_SINGLE. |
| 2307 |
* |
| 2308 |
* @param[in] callback Callback invoked by the HSA runtime for every |
| 2309 |
* asynchronous event related to the newly created queue. May be NULL. The HSA |
| 2310 |
* runtime passes three arguments to the callback: a code identifying the event |
| 2311 |
* that triggered the invocation, a pointer to the queue where the event |
| 2312 |
* originated, and the application data. |
| 2313 |
* |
| 2314 |
* @param[in] data Application data that is passed to @p callback on every |
| 2315 |
* iteration. May be NULL. |
| 2316 |
* |
| 2317 |
* @param[in] private_segment_size Hint indicating the maximum |
| 2318 |
* expected private segment usage per work-item, in bytes. There may |
| 2319 |
* be performance degradation if the application places a kernel |
| 2320 |
* dispatch packet in the queue and the corresponding private segment |
| 2321 |
* usage exceeds @p private_segment_size. If the application does not |
| 2322 |
* want to specify any particular value for this argument, @p |
| 2323 |
* private_segment_size must be UINT32_MAX. If the queue does not |
| 2324 |
* support kernel dispatch packets, this argument is ignored. |
| 2325 |
* |
| 2326 |
* @param[in] group_segment_size Hint indicating the maximum expected |
| 2327 |
* group segment usage per work-group, in bytes. There may be |
| 2328 |
* performance degradation if the application places a kernel dispatch |
| 2329 |
* packet in the queue and the corresponding group segment usage |
| 2330 |
* exceeds @p group_segment_size. If the application does not want to |
| 2331 |
* specify any particular value for this argument, @p |
| 2332 |
* group_segment_size must be UINT32_MAX. If the queue does not |
| 2333 |
* support kernel dispatch packets, this argument is ignored. |
| 2334 |
* |
| 2335 |
* @param[out] queue Memory location where the HSA runtime stores a pointer to |
| 2336 |
* the newly created queue. |
| 2337 |
* |
| 2338 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 2339 |
* |
| 2340 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 2341 |
* initialized. |
| 2342 |
* |
| 2343 |
* @retval ::HSA_STATUS_ERROR_OUT_OF_RESOURCES The HSA runtime failed to allocate |
| 2344 |
* the required resources. |
| 2345 |
* |
| 2346 |
* @retval ::HSA_STATUS_ERROR_INVALID_AGENT The agent is invalid. |
| 2347 |
* |
| 2348 |
* @retval ::HSA_STATUS_ERROR_INVALID_QUEUE_CREATION @p agent does not |
| 2349 |
* support queues of the given type. |
| 2350 |
* |
| 2351 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p size is not a power of two, |
| 2352 |
* @p size is 0, @p type is an invalid queue type, or @p queue is NULL. |
| 2353 |
* |
| 2354 |
*/ |
| 2355 |
hsa_status_t HSA_API hsa_queue_create( |
| 2356 |
hsa_agent_t agent, |
| 2357 |
uint32_t size, |
| 2358 |
hsa_queue_type32_t type, |
| 2359 |
void (*callback)(hsa_status_t status, hsa_queue_t *source, void *data), |
| 2360 |
void *data, |
| 2361 |
uint32_t private_segment_size, |
| 2362 |
uint32_t group_segment_size, |
| 2363 |
hsa_queue_t **queue); |
| 2364 |
|
| 2365 |
/** |
| 2366 |
* @brief Create a queue for which the application or a kernel is responsible |
| 2367 |
* for processing the AQL packets. |
| 2368 |
* |
| 2369 |
* @details The application can use this function to create queues where AQL |
| 2370 |
* packets are not parsed by the packet processor associated with an agent, |
| 2371 |
* but rather by a unit of execution running on that agent (for example, a |
| 2372 |
* thread in the host application). |
| 2373 |
* |
| 2374 |
* The application is responsible for ensuring that all the producers and |
| 2375 |
* consumers of the resulting queue can access the provided doorbell signal |
| 2376 |
* and memory region. The application is also responsible for ensuring that the |
| 2377 |
* unit of execution processing the queue packets supports the indicated |
| 2378 |
* features (AQL packet types). |
| 2379 |
* |
| 2380 |
* When the queue is created, the HSA runtime allocates the packet buffer using |
| 2381 |
* @p region, and the write and read indexes. The initial value of the write and |
| 2382 |
* read indexes is 0, and the type of every packet in the buffer is initialized |
| 2383 |
* to ::HSA_PACKET_TYPE_INVALID. The value of the @e size, @e type, @e features, |
| 2384 |
* and @e doorbell_signal fields in the returned queue match the values passed |
| 2385 |
* by the application. |
| 2386 |
* |
| 2387 |
* @param[in] region Memory region that the HSA runtime should use to allocate |
| 2388 |
* the AQL packet buffer and any other queue metadata. |
| 2389 |
* |
| 2390 |
* @param[in] size Number of packets the queue is expected to hold. Must be a |
| 2391 |
* power of 2 greater than 0. |
| 2392 |
* |
| 2393 |
* @param[in] type Queue type. |
| 2394 |
* |
| 2395 |
* @param[in] features Supported queue features. This is a bit-field of |
| 2396 |
* ::hsa_queue_feature_t values. |
| 2397 |
* |
| 2398 |
* @param[in] doorbell_signal Doorbell signal that the HSA runtime must |
| 2399 |
* associate with the returned queue. The signal handle must not be 0. |
| 2400 |
* |
| 2401 |
* @param[out] queue Memory location where the HSA runtime stores a pointer to |
| 2402 |
* the newly created queue. The application should not rely on the value |
| 2403 |
* returned for this argument but only in the status code to determine if the |
| 2404 |
* queue is valid. Must not be NULL. |
| 2405 |
* |
| 2406 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 2407 |
* |
| 2408 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 2409 |
* initialized. |
| 2410 |
* |
| 2411 |
* @retval ::HSA_STATUS_ERROR_OUT_OF_RESOURCES The HSA runtime failed to allocate |
| 2412 |
* the required resources. |
| 2413 |
* |
| 2414 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p size is not a power of two, @p |
| 2415 |
* size is 0, @p type is an invalid queue type, the doorbell signal handle is |
| 2416 |
* 0, or @p queue is NULL. |
| 2417 |
* |
| 2418 |
*/ |
| 2419 |
hsa_status_t HSA_API hsa_soft_queue_create( |
| 2420 |
hsa_region_t region, |
| 2421 |
uint32_t size, |
| 2422 |
hsa_queue_type32_t type, |
| 2423 |
uint32_t features, |
| 2424 |
hsa_signal_t doorbell_signal, |
| 2425 |
hsa_queue_t **queue); |
| 2426 |
|
| 2427 |
/** |
| 2428 |
* @brief Destroy a user mode queue. |
| 2429 |
* |
| 2430 |
* @details When a queue is destroyed, the state of the AQL packets that have |
| 2431 |
* not been yet fully processed (their completion phase has not finished) |
| 2432 |
* becomes undefined. It is the responsibility of the application to ensure that |
| 2433 |
* all pending queue operations are finished if their results are required. |
| 2434 |
* |
| 2435 |
* The resources allocated by the HSA runtime during queue creation (queue |
| 2436 |
* structure, ring buffer, doorbell signal) are released. The queue should not |
| 2437 |
* be accessed after being destroyed. |
| 2438 |
* |
| 2439 |
* @param[in] queue Pointer to a queue created using ::hsa_queue_create. |
| 2440 |
* |
| 2441 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 2442 |
* |
| 2443 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 2444 |
* initialized. |
| 2445 |
* |
| 2446 |
* @retval ::HSA_STATUS_ERROR_INVALID_QUEUE The queue is invalid. |
| 2447 |
* |
| 2448 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p queue is NULL. |
| 2449 |
*/ |
| 2450 |
hsa_status_t HSA_API hsa_queue_destroy( |
| 2451 |
hsa_queue_t *queue); |
| 2452 |
|
| 2453 |
/** |
| 2454 |
* @brief Inactivate a queue. |
| 2455 |
* |
| 2456 |
* @details Inactivating the queue aborts any pending executions and prevent any |
| 2457 |
* new packets from being processed. Any more packets written to the queue once |
| 2458 |
* it is inactivated will be ignored by the packet processor. |
| 2459 |
* |
| 2460 |
* @param[in] queue Pointer to a queue. |
| 2461 |
* |
| 2462 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 2463 |
* |
| 2464 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 2465 |
* initialized. |
| 2466 |
* |
| 2467 |
* @retval ::HSA_STATUS_ERROR_INVALID_QUEUE The queue is invalid. |
| 2468 |
* |
| 2469 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p queue is NULL. |
| 2470 |
*/ |
| 2471 |
hsa_status_t HSA_API hsa_queue_inactivate( |
| 2472 |
hsa_queue_t *queue); |
| 2473 |
|
| 2474 |
/** |
| 2475 |
* @deprecated Renamed as ::hsa_queue_load_read_index_scacquire. |
| 2476 |
* |
| 2477 |
* @copydoc hsa_queue_load_read_index_scacquire |
| 2478 |
*/ |
| 2479 |
uint64_t HSA_API HSA_DEPRECATED hsa_queue_load_read_index_acquire( |
| 2480 |
const hsa_queue_t *queue); |
| 2481 |
|
| 2482 |
/** |
| 2483 |
* @brief Atomically load the read index of a queue. |
| 2484 |
* |
| 2485 |
* @param[in] queue Pointer to a queue. |
| 2486 |
* |
| 2487 |
* @return Read index of the queue pointed by @p queue. |
| 2488 |
*/ |
| 2489 |
uint64_t HSA_API hsa_queue_load_read_index_scacquire( |
| 2490 |
const hsa_queue_t *queue); |
| 2491 |
|
| 2492 |
/** |
| 2493 |
* @copydoc hsa_queue_load_read_index_scacquire |
| 2494 |
*/ |
| 2495 |
uint64_t HSA_API hsa_queue_load_read_index_relaxed( |
| 2496 |
const hsa_queue_t *queue); |
| 2497 |
|
| 2498 |
/** |
| 2499 |
* @deprecated Renamed as ::hsa_queue_load_write_index_scacquire. |
| 2500 |
* |
| 2501 |
* @copydoc hsa_queue_load_write_index_scacquire |
| 2502 |
*/ |
| 2503 |
uint64_t HSA_API HSA_DEPRECATED hsa_queue_load_write_index_acquire( |
| 2504 |
const hsa_queue_t *queue); |
| 2505 |
|
| 2506 |
/** |
| 2507 |
* @brief Atomically load the write index of a queue. |
| 2508 |
* |
| 2509 |
* @param[in] queue Pointer to a queue. |
| 2510 |
* |
| 2511 |
* @return Write index of the queue pointed by @p queue. |
| 2512 |
*/ |
| 2513 |
uint64_t HSA_API hsa_queue_load_write_index_scacquire( |
| 2514 |
const hsa_queue_t *queue); |
| 2515 |
|
| 2516 |
/** |
| 2517 |
* @copydoc hsa_queue_load_write_index_scacquire |
| 2518 |
*/ |
| 2519 |
uint64_t HSA_API hsa_queue_load_write_index_relaxed( |
| 2520 |
const hsa_queue_t *queue); |
| 2521 |
|
| 2522 |
/** |
| 2523 |
* @brief Atomically set the write index of a queue. |
| 2524 |
* |
| 2525 |
* @details It is recommended that the application uses this function to update |
| 2526 |
* the write index when there is a single agent submitting work to the queue |
| 2527 |
* (the queue type is ::HSA_QUEUE_TYPE_SINGLE). |
| 2528 |
* |
| 2529 |
* @param[in] queue Pointer to a queue. |
| 2530 |
* |
| 2531 |
* @param[in] value Value to assign to the write index. |
| 2532 |
* |
| 2533 |
*/ |
| 2534 |
void HSA_API hsa_queue_store_write_index_relaxed( |
| 2535 |
const hsa_queue_t *queue, |
| 2536 |
uint64_t value); |
| 2537 |
|
| 2538 |
/** |
| 2539 |
* @deprecated Renamed as ::hsa_queue_store_write_index_screlease. |
| 2540 |
* |
| 2541 |
* @copydoc hsa_queue_store_write_index_screlease |
| 2542 |
*/ |
| 2543 |
void HSA_API HSA_DEPRECATED hsa_queue_store_write_index_release( |
| 2544 |
const hsa_queue_t *queue, |
| 2545 |
uint64_t value); |
| 2546 |
|
| 2547 |
/** |
| 2548 |
* @copydoc hsa_queue_store_write_index_relaxed |
| 2549 |
*/ |
| 2550 |
void HSA_API hsa_queue_store_write_index_screlease( |
| 2551 |
const hsa_queue_t *queue, |
| 2552 |
uint64_t value); |
| 2553 |
|
| 2554 |
/** |
| 2555 |
* @deprecated Renamed as ::hsa_queue_cas_write_index_scacq_screl. |
| 2556 |
* |
| 2557 |
* @copydoc hsa_queue_cas_write_index_scacq_screl |
| 2558 |
*/ |
| 2559 |
uint64_t HSA_API HSA_DEPRECATED hsa_queue_cas_write_index_acq_rel( |
| 2560 |
const hsa_queue_t *queue, |
| 2561 |
uint64_t expected, |
| 2562 |
uint64_t value); |
| 2563 |
|
| 2564 |
/** |
| 2565 |
* @brief Atomically set the write index of a queue if the observed value is |
| 2566 |
* equal to the expected value. The application can inspect the returned value |
| 2567 |
* to determine if the replacement was done. |
| 2568 |
* |
| 2569 |
* @param[in] queue Pointer to a queue. |
| 2570 |
* |
| 2571 |
* @param[in] expected Expected value. |
| 2572 |
* |
| 2573 |
* @param[in] value Value to assign to the write index if @p expected matches |
| 2574 |
* the observed write index. Must be greater than @p expected. |
| 2575 |
* |
| 2576 |
* @return Previous value of the write index. |
| 2577 |
*/ |
| 2578 |
uint64_t HSA_API hsa_queue_cas_write_index_scacq_screl( |
| 2579 |
const hsa_queue_t *queue, |
| 2580 |
uint64_t expected, |
| 2581 |
uint64_t value); |
| 2582 |
|
| 2583 |
/** |
| 2584 |
* @deprecated Renamed as ::hsa_queue_cas_write_index_scacquire. |
| 2585 |
* |
| 2586 |
* @copydoc hsa_queue_cas_write_index_scacquire |
| 2587 |
*/ |
| 2588 |
uint64_t HSA_API HSA_DEPRECATED hsa_queue_cas_write_index_acquire( |
| 2589 |
const hsa_queue_t *queue, |
| 2590 |
uint64_t expected, |
| 2591 |
uint64_t value); |
| 2592 |
|
| 2593 |
/** |
| 2594 |
* @copydoc hsa_queue_cas_write_index_scacq_screl |
| 2595 |
*/ |
| 2596 |
uint64_t HSA_API hsa_queue_cas_write_index_scacquire( |
| 2597 |
const hsa_queue_t *queue, |
| 2598 |
uint64_t expected, |
| 2599 |
uint64_t value); |
| 2600 |
|
| 2601 |
/** |
| 2602 |
* @copydoc hsa_queue_cas_write_index_scacq_screl |
| 2603 |
*/ |
| 2604 |
uint64_t HSA_API hsa_queue_cas_write_index_relaxed( |
| 2605 |
const hsa_queue_t *queue, |
| 2606 |
uint64_t expected, |
| 2607 |
uint64_t value); |
| 2608 |
|
| 2609 |
/** |
| 2610 |
* @deprecated Renamed as ::hsa_queue_cas_write_index_screlease. |
| 2611 |
* |
| 2612 |
* @copydoc hsa_queue_cas_write_index_screlease |
| 2613 |
*/ |
| 2614 |
uint64_t HSA_API HSA_DEPRECATED hsa_queue_cas_write_index_release( |
| 2615 |
const hsa_queue_t *queue, |
| 2616 |
uint64_t expected, |
| 2617 |
uint64_t value); |
| 2618 |
|
| 2619 |
/** |
| 2620 |
* @copydoc hsa_queue_cas_write_index_scacq_screl |
| 2621 |
*/ |
| 2622 |
uint64_t HSA_API hsa_queue_cas_write_index_screlease( |
| 2623 |
const hsa_queue_t *queue, |
| 2624 |
uint64_t expected, |
| 2625 |
uint64_t value); |
| 2626 |
|
| 2627 |
/** |
| 2628 |
* @deprecated Renamed as ::hsa_queue_add_write_index_scacq_screl. |
| 2629 |
* |
| 2630 |
* @copydoc hsa_queue_add_write_index_scacq_screl |
| 2631 |
*/ |
| 2632 |
uint64_t HSA_API HSA_DEPRECATED hsa_queue_add_write_index_acq_rel( |
| 2633 |
const hsa_queue_t *queue, |
| 2634 |
uint64_t value); |
| 2635 |
|
| 2636 |
/** |
| 2637 |
* @brief Atomically increment the write index of a queue by an offset. |
| 2638 |
* |
| 2639 |
* @param[in] queue Pointer to a queue. |
| 2640 |
* |
| 2641 |
* @param[in] value Value to add to the write index. |
| 2642 |
* |
| 2643 |
* @return Previous value of the write index. |
| 2644 |
*/ |
| 2645 |
uint64_t HSA_API hsa_queue_add_write_index_scacq_screl( |
| 2646 |
const hsa_queue_t *queue, |
| 2647 |
uint64_t value); |
| 2648 |
|
| 2649 |
/** |
| 2650 |
* @deprecated Renamed as ::hsa_queue_add_write_index_scacquire. |
| 2651 |
* |
| 2652 |
* @copydoc hsa_queue_add_write_index_scacquire |
| 2653 |
*/ |
| 2654 |
uint64_t HSA_API HSA_DEPRECATED hsa_queue_add_write_index_acquire( |
| 2655 |
const hsa_queue_t *queue, |
| 2656 |
uint64_t value); |
| 2657 |
|
| 2658 |
/** |
| 2659 |
* @copydoc hsa_queue_add_write_index_scacq_screl |
| 2660 |
*/ |
| 2661 |
uint64_t HSA_API hsa_queue_add_write_index_scacquire( |
| 2662 |
const hsa_queue_t *queue, |
| 2663 |
uint64_t value); |
| 2664 |
|
| 2665 |
/** |
| 2666 |
* @copydoc hsa_queue_add_write_index_scacq_screl |
| 2667 |
*/ |
| 2668 |
uint64_t HSA_API hsa_queue_add_write_index_relaxed( |
| 2669 |
const hsa_queue_t *queue, |
| 2670 |
uint64_t value); |
| 2671 |
|
| 2672 |
/** |
| 2673 |
* @deprecated Renamed as ::hsa_queue_add_write_index_screlease. |
| 2674 |
* |
| 2675 |
* @copydoc hsa_queue_add_write_index_screlease |
| 2676 |
*/ |
| 2677 |
uint64_t HSA_API HSA_DEPRECATED hsa_queue_add_write_index_release( |
| 2678 |
const hsa_queue_t *queue, |
| 2679 |
uint64_t value); |
| 2680 |
|
| 2681 |
/** |
| 2682 |
* @copydoc hsa_queue_add_write_index_scacq_screl |
| 2683 |
*/ |
| 2684 |
uint64_t HSA_API hsa_queue_add_write_index_screlease( |
| 2685 |
const hsa_queue_t *queue, |
| 2686 |
uint64_t value); |
| 2687 |
|
| 2688 |
/** |
| 2689 |
* @brief Atomically set the read index of a queue. |
| 2690 |
* |
| 2691 |
* @details Modifications of the read index are not allowed and result in |
| 2692 |
* undefined behavior if the queue is associated with an agent for which |
| 2693 |
* only the corresponding packet processor is permitted to update the read |
| 2694 |
* index. |
| 2695 |
* |
| 2696 |
* @param[in] queue Pointer to a queue. |
| 2697 |
* |
| 2698 |
* @param[in] value Value to assign to the read index. |
| 2699 |
* |
| 2700 |
*/ |
| 2701 |
void HSA_API hsa_queue_store_read_index_relaxed( |
| 2702 |
const hsa_queue_t *queue, |
| 2703 |
uint64_t value); |
| 2704 |
|
| 2705 |
/** |
| 2706 |
* @deprecated Renamed as ::hsa_queue_store_read_index_screlease. |
| 2707 |
* |
| 2708 |
* @copydoc hsa_queue_store_read_index_screlease |
| 2709 |
*/ |
| 2710 |
void HSA_API HSA_DEPRECATED hsa_queue_store_read_index_release( |
| 2711 |
const hsa_queue_t *queue, |
| 2712 |
uint64_t value); |
| 2713 |
|
| 2714 |
/** |
| 2715 |
* @copydoc hsa_queue_store_read_index_relaxed |
| 2716 |
*/ |
| 2717 |
void HSA_API hsa_queue_store_read_index_screlease( |
| 2718 |
const hsa_queue_t *queue, |
| 2719 |
uint64_t value); |
| 2720 |
/** @} */ |
| 2721 |
|
| 2722 |
|
| 2723 |
/** \defgroup aql Architected Queuing Language |
| 2724 |
* @{ |
| 2725 |
*/ |
| 2726 |
|
| 2727 |
/** |
| 2728 |
* @brief Packet type. |
| 2729 |
*/ |
| 2730 |
typedef enum { |
| 2731 |
/** |
| 2732 |
* Vendor-specific packet. |
| 2733 |
*/ |
| 2734 |
HSA_PACKET_TYPE_VENDOR_SPECIFIC = 0, |
| 2735 |
/** |
| 2736 |
* The packet has been processed in the past, but has not been reassigned to |
| 2737 |
* the packet processor. A packet processor must not process a packet of this |
| 2738 |
* type. All queues support this packet type. |
| 2739 |
*/ |
| 2740 |
HSA_PACKET_TYPE_INVALID = 1, |
| 2741 |
/** |
| 2742 |
* Packet used by agents for dispatching jobs to kernel agents. Not all |
| 2743 |
* queues support packets of this type (see ::hsa_queue_feature_t). |
| 2744 |
*/ |
| 2745 |
HSA_PACKET_TYPE_KERNEL_DISPATCH = 2, |
| 2746 |
/** |
| 2747 |
* Packet used by agents to delay processing of subsequent packets, and to |
| 2748 |
* express complex dependencies between multiple packets. All queues support |
| 2749 |
* this packet type. |
| 2750 |
*/ |
| 2751 |
HSA_PACKET_TYPE_BARRIER_AND = 3, |
| 2752 |
/** |
| 2753 |
* Packet used by agents for dispatching jobs to agents. Not all |
| 2754 |
* queues support packets of this type (see ::hsa_queue_feature_t). |
| 2755 |
*/ |
| 2756 |
HSA_PACKET_TYPE_AGENT_DISPATCH = 4, |
| 2757 |
/** |
| 2758 |
* Packet used by agents to delay processing of subsequent packets, and to |
| 2759 |
* express complex dependencies between multiple packets. All queues support |
| 2760 |
* this packet type. |
| 2761 |
*/ |
| 2762 |
HSA_PACKET_TYPE_BARRIER_OR = 5 |
| 2763 |
} hsa_packet_type_t; |
| 2764 |
|
| 2765 |
/** |
| 2766 |
* @brief Scope of the memory fence operation associated with a packet. |
| 2767 |
*/ |
| 2768 |
typedef enum { |
| 2769 |
/** |
| 2770 |
* No scope (no fence is applied). The packet relies on external fences to |
| 2771 |
* ensure visibility of memory updates. |
| 2772 |
*/ |
| 2773 |
HSA_FENCE_SCOPE_NONE = 0, |
| 2774 |
/** |
| 2775 |
* The fence is applied with agent scope for the global segment. |
| 2776 |
*/ |
| 2777 |
HSA_FENCE_SCOPE_AGENT = 1, |
| 2778 |
/** |
| 2779 |
* The fence is applied across both agent and system scope for the global |
| 2780 |
* segment. |
| 2781 |
*/ |
| 2782 |
HSA_FENCE_SCOPE_SYSTEM = 2 |
| 2783 |
} hsa_fence_scope_t; |
| 2784 |
|
| 2785 |
/** |
| 2786 |
* @brief Sub-fields of the @a header field that is present in any AQL |
| 2787 |
* packet. The offset (with respect to the address of @a header) of a sub-field |
| 2788 |
* is identical to its enumeration constant. The width of each sub-field is |
| 2789 |
* determined by the corresponding value in ::hsa_packet_header_width_t. The |
| 2790 |
* offset and the width are expressed in bits. |
| 2791 |
*/ |
| 2792 |
typedef enum { |
| 2793 |
/** |
| 2794 |
* Packet type. The value of this sub-field must be one of |
| 2795 |
* ::hsa_packet_type_t. If the type is ::HSA_PACKET_TYPE_VENDOR_SPECIFIC, the |
| 2796 |
* packet layout is vendor-specific. |
| 2797 |
*/ |
| 2798 |
HSA_PACKET_HEADER_TYPE = 0, |
| 2799 |
/** |
| 2800 |
* Barrier bit. If the barrier bit is set, the processing of the current |
| 2801 |
* packet only launches when all preceding packets (within the same queue) are |
| 2802 |
* complete. |
| 2803 |
*/ |
| 2804 |
HSA_PACKET_HEADER_BARRIER = 8, |
| 2805 |
/** |
| 2806 |
* Acquire fence scope. The value of this sub-field determines the scope and |
| 2807 |
* type of the memory fence operation applied before the packet enters the |
| 2808 |
* active phase. An acquire fence ensures that any subsequent global segment |
| 2809 |
* or image loads by any unit of execution that belongs to a dispatch that has |
| 2810 |
* not yet entered the active phase on any queue of the same kernel agent, |
| 2811 |
* sees any data previously released at the scopes specified by the acquire |
| 2812 |
* fence. The value of this sub-field must be one of ::hsa_fence_scope_t. |
| 2813 |
*/ |
| 2814 |
HSA_PACKET_HEADER_SCACQUIRE_FENCE_SCOPE = 9, |
| 2815 |
/** |
| 2816 |
* @deprecated Renamed as ::HSA_PACKET_HEADER_SCACQUIRE_FENCE_SCOPE. |
| 2817 |
*/ |
| 2818 |
HSA_PACKET_HEADER_ACQUIRE_FENCE_SCOPE = 9, |
| 2819 |
/** |
| 2820 |
* Release fence scope, The value of this sub-field determines the scope and |
| 2821 |
* type of the memory fence operation applied after kernel completion but |
| 2822 |
* before the packet is completed. A release fence makes any global segment or |
| 2823 |
* image data that was stored by any unit of execution that belonged to a |
| 2824 |
* dispatch that has completed the active phase on any queue of the same |
| 2825 |
* kernel agent visible in all the scopes specified by the release fence. The |
| 2826 |
* value of this sub-field must be one of ::hsa_fence_scope_t. |
| 2827 |
*/ |
| 2828 |
HSA_PACKET_HEADER_SCRELEASE_FENCE_SCOPE = 11, |
| 2829 |
/** |
| 2830 |
* @deprecated Renamed as ::HSA_PACKET_HEADER_SCRELEASE_FENCE_SCOPE. |
| 2831 |
*/ |
| 2832 |
HSA_PACKET_HEADER_RELEASE_FENCE_SCOPE = 11 |
| 2833 |
} hsa_packet_header_t; |
| 2834 |
|
| 2835 |
/** |
| 2836 |
* @brief Width (in bits) of the sub-fields in ::hsa_packet_header_t. |
| 2837 |
*/ |
| 2838 |
typedef enum { |
| 2839 |
HSA_PACKET_HEADER_WIDTH_TYPE = 8, |
| 2840 |
HSA_PACKET_HEADER_WIDTH_BARRIER = 1, |
| 2841 |
HSA_PACKET_HEADER_WIDTH_SCACQUIRE_FENCE_SCOPE = 2, |
| 2842 |
/** |
| 2843 |
* @deprecated Use HSA_PACKET_HEADER_WIDTH_SCACQUIRE_FENCE_SCOPE. |
| 2844 |
*/ |
| 2845 |
HSA_PACKET_HEADER_WIDTH_ACQUIRE_FENCE_SCOPE = 2, |
| 2846 |
HSA_PACKET_HEADER_WIDTH_SCRELEASE_FENCE_SCOPE = 2, |
| 2847 |
/** |
| 2848 |
* @deprecated Use HSA_PACKET_HEADER_WIDTH_SCRELEASE_FENCE_SCOPE. |
| 2849 |
*/ |
| 2850 |
HSA_PACKET_HEADER_WIDTH_RELEASE_FENCE_SCOPE = 2 |
| 2851 |
} hsa_packet_header_width_t; |
| 2852 |
|
| 2853 |
/** |
| 2854 |
* @brief Sub-fields of the kernel dispatch packet @a setup field. The offset |
| 2855 |
* (with respect to the address of @a setup) of a sub-field is identical to its |
| 2856 |
* enumeration constant. The width of each sub-field is determined by the |
| 2857 |
* corresponding value in ::hsa_kernel_dispatch_packet_setup_width_t. The |
| 2858 |
* offset and the width are expressed in bits. |
| 2859 |
*/ |
| 2860 |
typedef enum { |
| 2861 |
/** |
| 2862 |
* Number of dimensions of the grid. Valid values are 1, 2, or 3. |
| 2863 |
* |
| 2864 |
*/ |
| 2865 |
HSA_KERNEL_DISPATCH_PACKET_SETUP_DIMENSIONS = 0 |
| 2866 |
} hsa_kernel_dispatch_packet_setup_t; |
| 2867 |
|
| 2868 |
/** |
| 2869 |
* @brief Width (in bits) of the sub-fields in |
| 2870 |
* ::hsa_kernel_dispatch_packet_setup_t. |
| 2871 |
*/ |
| 2872 |
typedef enum { |
| 2873 |
HSA_KERNEL_DISPATCH_PACKET_SETUP_WIDTH_DIMENSIONS = 2 |
| 2874 |
} hsa_kernel_dispatch_packet_setup_width_t; |
| 2875 |
|
| 2876 |
/** |
| 2877 |
* @brief AQL kernel dispatch packet |
| 2878 |
*/ |
| 2879 |
typedef struct hsa_kernel_dispatch_packet_s { |
| 2880 |
/** |
| 2881 |
* Packet header. Used to configure multiple packet parameters such as the |
| 2882 |
* packet type. The parameters are described by ::hsa_packet_header_t. |
| 2883 |
*/ |
| 2884 |
uint16_t header; |
| 2885 |
|
| 2886 |
/** |
| 2887 |
* Dispatch setup parameters. Used to configure kernel dispatch parameters |
| 2888 |
* such as the number of dimensions in the grid. The parameters are described |
| 2889 |
* by ::hsa_kernel_dispatch_packet_setup_t. |
| 2890 |
*/ |
| 2891 |
uint16_t setup; |
| 2892 |
|
| 2893 |
/** |
| 2894 |
* X dimension of work-group, in work-items. Must be greater than 0. |
| 2895 |
*/ |
| 2896 |
uint16_t workgroup_size_x; |
| 2897 |
|
| 2898 |
/** |
| 2899 |
* Y dimension of work-group, in work-items. Must be greater than |
| 2900 |
* 0. If the grid has 1 dimension, the only valid value is 1. |
| 2901 |
*/ |
| 2902 |
uint16_t workgroup_size_y; |
| 2903 |
|
| 2904 |
/** |
| 2905 |
* Z dimension of work-group, in work-items. Must be greater than |
| 2906 |
* 0. If the grid has 1 or 2 dimensions, the only valid value is 1. |
| 2907 |
*/ |
| 2908 |
uint16_t workgroup_size_z; |
| 2909 |
|
| 2910 |
/** |
| 2911 |
* Reserved. Must be 0. |
| 2912 |
*/ |
| 2913 |
uint16_t reserved0; |
| 2914 |
|
| 2915 |
/** |
| 2916 |
* X dimension of grid, in work-items. Must be greater than 0. Must |
| 2917 |
* not be smaller than @a workgroup_size_x. |
| 2918 |
*/ |
| 2919 |
uint32_t grid_size_x; |
| 2920 |
|
| 2921 |
/** |
| 2922 |
* Y dimension of grid, in work-items. Must be greater than 0. If the grid has |
| 2923 |
* 1 dimension, the only valid value is 1. Must not be smaller than @a |
| 2924 |
* workgroup_size_y. |
| 2925 |
*/ |
| 2926 |
uint32_t grid_size_y; |
| 2927 |
|
| 2928 |
/** |
| 2929 |
* Z dimension of grid, in work-items. Must be greater than 0. If the grid has |
| 2930 |
* 1 or 2 dimensions, the only valid value is 1. Must not be smaller than @a |
| 2931 |
* workgroup_size_z. |
| 2932 |
*/ |
| 2933 |
uint32_t grid_size_z; |
| 2934 |
|
| 2935 |
/** |
| 2936 |
* Size in bytes of private memory allocation request (per work-item). |
| 2937 |
*/ |
| 2938 |
uint32_t private_segment_size; |
| 2939 |
|
| 2940 |
/** |
| 2941 |
* Size in bytes of group memory allocation request (per work-group). Must not |
| 2942 |
* be less than the sum of the group memory used by the kernel (and the |
| 2943 |
* functions it calls directly or indirectly) and the dynamically allocated |
| 2944 |
* group segment variables. |
| 2945 |
*/ |
| 2946 |
uint32_t group_segment_size; |
| 2947 |
|
| 2948 |
/** |
| 2949 |
* Opaque handle to a code object that includes an implementation-defined |
| 2950 |
* executable code for the kernel. |
| 2951 |
*/ |
| 2952 |
uint64_t kernel_object; |
| 2953 |
|
| 2954 |
#ifdef HSA_LARGE_MODEL |
| 2955 |
void* kernarg_address; |
| 2956 |
#elif defined HSA_LITTLE_ENDIAN |
| 2957 |
/** |
| 2958 |
* Pointer to a buffer containing the kernel arguments. May be NULL. |
| 2959 |
* |
| 2960 |
* The buffer must be allocated using ::hsa_memory_allocate, and must not be |
| 2961 |
* modified once the kernel dispatch packet is enqueued until the dispatch has |
| 2962 |
* completed execution. |
| 2963 |
*/ |
| 2964 |
void* kernarg_address; |
| 2965 |
/** |
| 2966 |
* Reserved. Must be 0. |
| 2967 |
*/ |
| 2968 |
uint32_t reserved1; |
| 2969 |
#else |
| 2970 |
uint32_t reserved1; |
| 2971 |
void* kernarg_address; |
| 2972 |
#endif |
| 2973 |
|
| 2974 |
/** |
| 2975 |
* Reserved. Must be 0. |
| 2976 |
*/ |
| 2977 |
uint64_t reserved2; |
| 2978 |
|
| 2979 |
/** |
| 2980 |
* Signal used to indicate completion of the job. The application can use the |
| 2981 |
* special signal handle 0 to indicate that no signal is used. |
| 2982 |
*/ |
| 2983 |
hsa_signal_t completion_signal; |
| 2984 |
|
| 2985 |
} hsa_kernel_dispatch_packet_t; |
| 2986 |
|
| 2987 |
/** |
| 2988 |
* @brief Agent dispatch packet. |
| 2989 |
*/ |
| 2990 |
typedef struct hsa_agent_dispatch_packet_s { |
| 2991 |
/** |
| 2992 |
* Packet header. Used to configure multiple packet parameters such as the |
| 2993 |
* packet type. The parameters are described by ::hsa_packet_header_t. |
| 2994 |
*/ |
| 2995 |
uint16_t header; |
| 2996 |
|
| 2997 |
/** |
| 2998 |
* Application-defined function to be performed by the destination agent. |
| 2999 |
*/ |
| 3000 |
uint16_t type; |
| 3001 |
|
| 3002 |
/** |
| 3003 |
* Reserved. Must be 0. |
| 3004 |
*/ |
| 3005 |
uint32_t reserved0; |
| 3006 |
|
| 3007 |
#ifdef HSA_LARGE_MODEL |
| 3008 |
void* return_address; |
| 3009 |
#elif defined HSA_LITTLE_ENDIAN |
| 3010 |
/** |
| 3011 |
* Address where to store the function return values, if any. |
| 3012 |
*/ |
| 3013 |
void* return_address; |
| 3014 |
/** |
| 3015 |
* Reserved. Must be 0. |
| 3016 |
*/ |
| 3017 |
uint32_t reserved1; |
| 3018 |
#else |
| 3019 |
uint32_t reserved1; |
| 3020 |
void* return_address; |
| 3021 |
#endif |
| 3022 |
|
| 3023 |
/** |
| 3024 |
* Function arguments. |
| 3025 |
*/ |
| 3026 |
uint64_t arg[4]; |
| 3027 |
|
| 3028 |
/** |
| 3029 |
* Reserved. Must be 0. |
| 3030 |
*/ |
| 3031 |
uint64_t reserved2; |
| 3032 |
|
| 3033 |
/** |
| 3034 |
* Signal used to indicate completion of the job. The application can use the |
| 3035 |
* special signal handle 0 to indicate that no signal is used. |
| 3036 |
*/ |
| 3037 |
hsa_signal_t completion_signal; |
| 3038 |
|
| 3039 |
} hsa_agent_dispatch_packet_t; |
| 3040 |
|
| 3041 |
/** |
| 3042 |
* @brief Barrier-AND packet. |
| 3043 |
*/ |
| 3044 |
typedef struct hsa_barrier_and_packet_s { |
| 3045 |
/** |
| 3046 |
* Packet header. Used to configure multiple packet parameters such as the |
| 3047 |
* packet type. The parameters are described by ::hsa_packet_header_t. |
| 3048 |
*/ |
| 3049 |
uint16_t header; |
| 3050 |
|
| 3051 |
/** |
| 3052 |
* Reserved. Must be 0. |
| 3053 |
*/ |
| 3054 |
uint16_t reserved0; |
| 3055 |
|
| 3056 |
/** |
| 3057 |
* Reserved. Must be 0. |
| 3058 |
*/ |
| 3059 |
uint32_t reserved1; |
| 3060 |
|
| 3061 |
/** |
| 3062 |
* Array of dependent signal objects. Signals with a handle value of 0 are |
| 3063 |
* allowed and are interpreted by the packet processor as satisfied |
| 3064 |
* dependencies. |
| 3065 |
*/ |
| 3066 |
hsa_signal_t dep_signal[5]; |
| 3067 |
|
| 3068 |
/** |
| 3069 |
* Reserved. Must be 0. |
| 3070 |
*/ |
| 3071 |
uint64_t reserved2; |
| 3072 |
|
| 3073 |
/** |
| 3074 |
* Signal used to indicate completion of the job. The application can use the |
| 3075 |
* special signal handle 0 to indicate that no signal is used. |
| 3076 |
*/ |
| 3077 |
hsa_signal_t completion_signal; |
| 3078 |
|
| 3079 |
} hsa_barrier_and_packet_t; |
| 3080 |
|
| 3081 |
/** |
| 3082 |
* @brief Barrier-OR packet. |
| 3083 |
*/ |
| 3084 |
typedef struct hsa_barrier_or_packet_s { |
| 3085 |
/** |
| 3086 |
* Packet header. Used to configure multiple packet parameters such as the |
| 3087 |
* packet type. The parameters are described by ::hsa_packet_header_t. |
| 3088 |
*/ |
| 3089 |
uint16_t header; |
| 3090 |
|
| 3091 |
/** |
| 3092 |
* Reserved. Must be 0. |
| 3093 |
*/ |
| 3094 |
uint16_t reserved0; |
| 3095 |
|
| 3096 |
/** |
| 3097 |
* Reserved. Must be 0. |
| 3098 |
*/ |
| 3099 |
uint32_t reserved1; |
| 3100 |
|
| 3101 |
/** |
| 3102 |
* Array of dependent signal objects. Signals with a handle value of 0 are |
| 3103 |
* allowed and are interpreted by the packet processor as dependencies not |
| 3104 |
* satisfied. |
| 3105 |
*/ |
| 3106 |
hsa_signal_t dep_signal[5]; |
| 3107 |
|
| 3108 |
/** |
| 3109 |
* Reserved. Must be 0. |
| 3110 |
*/ |
| 3111 |
uint64_t reserved2; |
| 3112 |
|
| 3113 |
/** |
| 3114 |
* Signal used to indicate completion of the job. The application can use the |
| 3115 |
* special signal handle 0 to indicate that no signal is used. |
| 3116 |
*/ |
| 3117 |
hsa_signal_t completion_signal; |
| 3118 |
|
| 3119 |
} hsa_barrier_or_packet_t; |
| 3120 |
|
| 3121 |
/** @} */ |
| 3122 |
|
| 3123 |
/** \addtogroup memory Memory |
| 3124 |
* @{ |
| 3125 |
*/ |
| 3126 |
|
| 3127 |
/** |
| 3128 |
* @brief Memory segments associated with a region. |
| 3129 |
*/ |
| 3130 |
typedef enum { |
| 3131 |
/** |
| 3132 |
* Global segment. Used to hold data that is shared by all agents. |
| 3133 |
*/ |
| 3134 |
HSA_REGION_SEGMENT_GLOBAL = 0, |
| 3135 |
/** |
| 3136 |
* Read-only segment. Used to hold data that remains constant during the |
| 3137 |
* execution of a kernel. |
| 3138 |
*/ |
| 3139 |
HSA_REGION_SEGMENT_READONLY = 1, |
| 3140 |
/** |
| 3141 |
* Private segment. Used to hold data that is local to a single work-item. |
| 3142 |
*/ |
| 3143 |
HSA_REGION_SEGMENT_PRIVATE = 2, |
| 3144 |
/** |
| 3145 |
* Group segment. Used to hold data that is shared by the work-items of a |
| 3146 |
* work-group. |
| 3147 |
*/ |
| 3148 |
HSA_REGION_SEGMENT_GROUP = 3, |
| 3149 |
/** |
| 3150 |
* Kernarg segment. Used to store kernel arguments. |
| 3151 |
*/ |
| 3152 |
HSA_REGION_SEGMENT_KERNARG = 4 |
| 3153 |
} hsa_region_segment_t; |
| 3154 |
|
| 3155 |
/** |
| 3156 |
* @brief Global region flags. |
| 3157 |
*/ |
| 3158 |
typedef enum { |
| 3159 |
/** |
| 3160 |
* The application can use memory in the region to store kernel arguments, and |
| 3161 |
* provide the values for the kernarg segment of a kernel dispatch. If this |
| 3162 |
* flag is set, then ::HSA_REGION_GLOBAL_FLAG_FINE_GRAINED must be set. |
| 3163 |
*/ |
| 3164 |
HSA_REGION_GLOBAL_FLAG_KERNARG = 1, |
| 3165 |
/** |
| 3166 |
* Updates to memory in this region are immediately visible to all the |
| 3167 |
* agents under the terms of the HSA memory model. If this |
| 3168 |
* flag is set, then ::HSA_REGION_GLOBAL_FLAG_COARSE_GRAINED must not be set. |
| 3169 |
*/ |
| 3170 |
HSA_REGION_GLOBAL_FLAG_FINE_GRAINED = 2, |
| 3171 |
/** |
| 3172 |
* Updates to memory in this region can be performed by a single agent at |
| 3173 |
* a time. If a different agent in the system is allowed to access the |
| 3174 |
* region, the application must explicitely invoke ::hsa_memory_assign_agent |
| 3175 |
* in order to transfer ownership to that agent for a particular buffer. |
| 3176 |
*/ |
| 3177 |
HSA_REGION_GLOBAL_FLAG_COARSE_GRAINED = 4 |
| 3178 |
} hsa_region_global_flag_t; |
| 3179 |
|
| 3180 |
/** |
| 3181 |
* @brief Attributes of a memory region. |
| 3182 |
*/ |
| 3183 |
typedef enum { |
| 3184 |
/** |
| 3185 |
* Segment where memory in the region can be used. The type of this |
| 3186 |
* attribute is ::hsa_region_segment_t. |
| 3187 |
*/ |
| 3188 |
HSA_REGION_INFO_SEGMENT = 0, |
| 3189 |
/** |
| 3190 |
* Flag mask. The value of this attribute is undefined if the value of |
| 3191 |
* ::HSA_REGION_INFO_SEGMENT is not ::HSA_REGION_SEGMENT_GLOBAL. The type of |
| 3192 |
* this attribute is uint32_t, a bit-field of ::hsa_region_global_flag_t |
| 3193 |
* values. |
| 3194 |
*/ |
| 3195 |
HSA_REGION_INFO_GLOBAL_FLAGS = 1, |
| 3196 |
/** |
| 3197 |
* Size of this region, in bytes. The type of this attribute is size_t. |
| 3198 |
*/ |
| 3199 |
HSA_REGION_INFO_SIZE = 2, |
| 3200 |
/** |
| 3201 |
* Maximum allocation size in this region, in bytes. Must not exceed the value |
| 3202 |
* of ::HSA_REGION_INFO_SIZE. The type of this attribute is size_t. |
| 3203 |
* |
| 3204 |
* If the region is in the global or readonly segments, this is the maximum |
| 3205 |
* size that the application can pass to ::hsa_memory_allocate. |
| 3206 |
* |
| 3207 |
* If the region is in the group segment, this is the maximum size (per |
| 3208 |
* work-group) that can be requested for a given kernel dispatch. If the |
| 3209 |
* region is in the private segment, this is the maximum size (per work-item) |
| 3210 |
* that can be requested for a specific kernel dispatch, and must be at least |
| 3211 |
* 256 bytes. |
| 3212 |
*/ |
| 3213 |
HSA_REGION_INFO_ALLOC_MAX_SIZE = 4, |
| 3214 |
/** |
| 3215 |
* Maximum size (per work-group) of private memory that can be requested for a |
| 3216 |
* specific kernel dispatch. Must be at least 65536 bytes. The type of this |
| 3217 |
* attribute is uint32_t. The value of this attribute is undefined if the |
| 3218 |
* region is not in the private segment. |
| 3219 |
*/ |
| 3220 |
HSA_REGION_INFO_ALLOC_MAX_PRIVATE_WORKGROUP_SIZE = 8, |
| 3221 |
/** |
| 3222 |
* Indicates whether memory in this region can be allocated using |
| 3223 |
* ::hsa_memory_allocate. The type of this attribute is bool. |
| 3224 |
* |
| 3225 |
* The value of this flag is always false for regions in the group and private |
| 3226 |
* segments. |
| 3227 |
*/ |
| 3228 |
HSA_REGION_INFO_RUNTIME_ALLOC_ALLOWED = 5, |
| 3229 |
/** |
| 3230 |
* Allocation granularity of buffers allocated by ::hsa_memory_allocate in |
| 3231 |
* this region. The size of a buffer allocated in this region is a multiple of |
| 3232 |
* the value of this attribute. The value of this attribute is only defined if |
| 3233 |
* ::HSA_REGION_INFO_RUNTIME_ALLOC_ALLOWED is true for this region. The type |
| 3234 |
* of this attribute is size_t. |
| 3235 |
*/ |
| 3236 |
HSA_REGION_INFO_RUNTIME_ALLOC_GRANULE = 6, |
| 3237 |
/** |
| 3238 |
* Alignment of buffers allocated by ::hsa_memory_allocate in this region. The |
| 3239 |
* value of this attribute is only defined if |
| 3240 |
* ::HSA_REGION_INFO_RUNTIME_ALLOC_ALLOWED is true for this region, and must be |
| 3241 |
* a power of 2. The type of this attribute is size_t. |
| 3242 |
*/ |
| 3243 |
HSA_REGION_INFO_RUNTIME_ALLOC_ALIGNMENT = 7 |
| 3244 |
} hsa_region_info_t; |
| 3245 |
|
| 3246 |
/** |
| 3247 |
* @brief Get the current value of an attribute of a region. |
| 3248 |
* |
| 3249 |
* @param[in] region A valid region. |
| 3250 |
* |
| 3251 |
* @param[in] attribute Attribute to query. |
| 3252 |
* |
| 3253 |
* @param[out] value Pointer to a application-allocated buffer where to store |
| 3254 |
* the value of the attribute. If the buffer passed by the application is not |
| 3255 |
* large enough to hold the value of @p attribute, the behavior is undefined. |
| 3256 |
* |
| 3257 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 3258 |
* |
| 3259 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 3260 |
* initialized. |
| 3261 |
* |
| 3262 |
* @retval ::HSA_STATUS_ERROR_INVALID_REGION The region is invalid. |
| 3263 |
* |
| 3264 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p attribute is an invalid |
| 3265 |
* region attribute, or @p value is NULL. |
| 3266 |
*/ |
| 3267 |
hsa_status_t HSA_API hsa_region_get_info( |
| 3268 |
hsa_region_t region, |
| 3269 |
hsa_region_info_t attribute, |
| 3270 |
void* value); |
| 3271 |
|
| 3272 |
/** |
| 3273 |
* @brief Iterate over the memory regions associated with a given agent, and |
| 3274 |
* invoke an application-defined callback on every iteration. |
| 3275 |
* |
| 3276 |
* @param[in] agent A valid agent. |
| 3277 |
* |
| 3278 |
* @param[in] callback Callback to be invoked once per region that is |
| 3279 |
* accessible from the agent. The HSA runtime passes two arguments to the |
| 3280 |
* callback, the region and the application data. If @p callback returns a |
| 3281 |
* status other than ::HSA_STATUS_SUCCESS for a particular iteration, the |
| 3282 |
* traversal stops and ::hsa_agent_iterate_regions returns that status value. |
| 3283 |
* |
| 3284 |
* @param[in] data Application data that is passed to @p callback on every |
| 3285 |
* iteration. May be NULL. |
| 3286 |
* |
| 3287 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 3288 |
* |
| 3289 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 3290 |
* initialized. |
| 3291 |
* |
| 3292 |
* @retval ::HSA_STATUS_ERROR_INVALID_AGENT The agent is invalid. |
| 3293 |
* |
| 3294 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p callback is NULL. |
| 3295 |
*/ |
| 3296 |
hsa_status_t HSA_API hsa_agent_iterate_regions( |
| 3297 |
hsa_agent_t agent, |
| 3298 |
hsa_status_t (*callback)(hsa_region_t region, void* data), |
| 3299 |
void* data); |
| 3300 |
|
| 3301 |
/** |
| 3302 |
* @brief Allocate a block of memory in a given region. |
| 3303 |
* |
| 3304 |
* @param[in] region Region where to allocate memory from. The region must have |
| 3305 |
* the ::HSA_REGION_INFO_RUNTIME_ALLOC_ALLOWED flag set. |
| 3306 |
* |
| 3307 |
* @param[in] size Allocation size, in bytes. Must not be zero. This value is |
| 3308 |
* rounded up to the nearest multiple of ::HSA_REGION_INFO_RUNTIME_ALLOC_GRANULE |
| 3309 |
* in @p region. |
| 3310 |
* |
| 3311 |
* @param[out] ptr Pointer to the location where to store the base address of |
| 3312 |
* the allocated block. The returned base address is aligned to the value of |
| 3313 |
* ::HSA_REGION_INFO_RUNTIME_ALLOC_ALIGNMENT in @p region. If the allocation |
| 3314 |
* fails, the returned value is undefined. |
| 3315 |
* |
| 3316 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 3317 |
* |
| 3318 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 3319 |
* initialized. |
| 3320 |
* |
| 3321 |
* @retval ::HSA_STATUS_ERROR_OUT_OF_RESOURCES The HSA runtime failed to allocate |
| 3322 |
* the required resources. |
| 3323 |
* |
| 3324 |
* @retval ::HSA_STATUS_ERROR_INVALID_REGION The region is invalid. |
| 3325 |
* |
| 3326 |
* @retval ::HSA_STATUS_ERROR_INVALID_ALLOCATION The host is not allowed to |
| 3327 |
* allocate memory in @p region, or @p size is greater than the value of |
| 3328 |
* HSA_REGION_INFO_ALLOC_MAX_SIZE in @p region. |
| 3329 |
* |
| 3330 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p ptr is NULL, or @p size is 0. |
| 3331 |
*/ |
| 3332 |
hsa_status_t HSA_API hsa_memory_allocate(hsa_region_t region, |
| 3333 |
size_t size, |
| 3334 |
void** ptr); |
| 3335 |
|
| 3336 |
/** |
| 3337 |
* @brief Deallocate a block of memory previously allocated using |
| 3338 |
* ::hsa_memory_allocate. |
| 3339 |
* |
| 3340 |
* @param[in] ptr Pointer to a memory block. If @p ptr does not match a value |
| 3341 |
* previously returned by ::hsa_memory_allocate, the behavior is undefined. |
| 3342 |
* |
| 3343 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 3344 |
* |
| 3345 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 3346 |
* initialized. |
| 3347 |
*/ |
| 3348 |
hsa_status_t HSA_API hsa_memory_free(void* ptr); |
| 3349 |
|
| 3350 |
/** |
| 3351 |
* @brief Copy a block of memory from the location pointed to by @p src to the |
| 3352 |
* memory block pointed to by @p dst. |
| 3353 |
* |
| 3354 |
* @param[out] dst Buffer where the content is to be copied. If @p dst is in |
| 3355 |
* coarse-grained memory, the copied data is only visible to the agent currently |
| 3356 |
* assigned (::hsa_memory_assign_agent) to @p dst. |
| 3357 |
* |
| 3358 |
* @param[in] src A valid pointer to the source of data to be copied. The source |
| 3359 |
* buffer must not overlap with the destination buffer. If the source buffer is |
| 3360 |
* in coarse-grained memory then it must be assigned to an agent, from which the |
| 3361 |
* data will be retrieved. |
| 3362 |
* |
| 3363 |
* @param[in] size Number of bytes to copy. If @p size is 0, no copy is |
| 3364 |
* performed and the function returns success. Copying a number of bytes larger |
| 3365 |
* than the size of the buffers pointed by @p dst or @p src results in undefined |
| 3366 |
* behavior. |
| 3367 |
* |
| 3368 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 3369 |
* |
| 3370 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 3371 |
* initialized. |
| 3372 |
* |
| 3373 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT The source or destination |
| 3374 |
* pointers are NULL. |
| 3375 |
*/ |
| 3376 |
hsa_status_t HSA_API hsa_memory_copy( |
| 3377 |
void *dst, |
| 3378 |
const void *src, |
| 3379 |
size_t size); |
| 3380 |
|
| 3381 |
/** |
| 3382 |
* @brief Change the ownership of a global, coarse-grained buffer. |
| 3383 |
* |
| 3384 |
* @details The contents of a coarse-grained buffer are visible to an agent |
| 3385 |
* only after ownership has been explicitely transferred to that agent. Once the |
| 3386 |
* operation completes, the previous owner cannot longer access the data in the |
| 3387 |
* buffer. |
| 3388 |
* |
| 3389 |
* An implementation of the HSA runtime is allowed, but not required, to change |
| 3390 |
* the physical location of the buffer when ownership is transferred to a |
| 3391 |
* different agent. In general the application must not assume this |
| 3392 |
* behavior. The virtual location (address) of the passed buffer is never |
| 3393 |
* modified. |
| 3394 |
* |
| 3395 |
* @param[in] ptr Base address of a global buffer. The pointer must match an |
| 3396 |
* address previously returned by ::hsa_memory_allocate. The size of the buffer |
| 3397 |
* affected by the ownership change is identical to the size of that previous |
| 3398 |
* allocation. If @p ptr points to a fine-grained global buffer, no operation is |
| 3399 |
* performed and the function returns success. If @p ptr does not point to |
| 3400 |
* global memory, the behavior is undefined. |
| 3401 |
* |
| 3402 |
* @param[in] agent Agent that becomes the owner of the buffer. The |
| 3403 |
* application is responsible for ensuring that @p agent has access to the |
| 3404 |
* region that contains the buffer. It is allowed to change ownership to an |
| 3405 |
* agent that is already the owner of the buffer, with the same or different |
| 3406 |
* access permissions. |
| 3407 |
* |
| 3408 |
* @param[in] access Access permissions requested for the new owner. |
| 3409 |
* |
| 3410 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 3411 |
* |
| 3412 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 3413 |
* initialized. |
| 3414 |
* |
| 3415 |
* @retval ::HSA_STATUS_ERROR_INVALID_AGENT The agent is invalid. |
| 3416 |
* |
| 3417 |
* @retval ::HSA_STATUS_ERROR_OUT_OF_RESOURCES The HSA runtime failed to allocate |
| 3418 |
* the required resources. |
| 3419 |
* |
| 3420 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p ptr is NULL, or @p access is |
| 3421 |
* not a valid access value. |
| 3422 |
*/ |
| 3423 |
hsa_status_t HSA_API hsa_memory_assign_agent( |
| 3424 |
void *ptr, |
| 3425 |
hsa_agent_t agent, |
| 3426 |
hsa_access_permission_t access); |
| 3427 |
|
| 3428 |
/** |
| 3429 |
* |
| 3430 |
* @brief Register a global, fine-grained buffer. |
| 3431 |
* |
| 3432 |
* @details Registering a buffer serves as an indication to the HSA runtime that |
| 3433 |
* the memory might be accessed from a kernel agent other than the |
| 3434 |
* host. Registration is a performance hint that allows the HSA runtime |
| 3435 |
* implementation to know which buffers will be accessed by some of the kernel |
| 3436 |
* agents ahead of time. |
| 3437 |
* |
| 3438 |
* Registration is only recommended for buffers in the global segment that have |
| 3439 |
* not been allocated using the HSA allocator (::hsa_memory_allocate), but an OS |
| 3440 |
* allocator instead. Registering an OS-allocated buffer in the base profile is |
| 3441 |
* equivalent to a no-op. |
| 3442 |
* |
| 3443 |
* Registrations should not overlap. |
| 3444 |
* |
| 3445 |
* @param[in] ptr A buffer in global, fine-grained memory. If a NULL pointer is |
| 3446 |
* passed, no operation is performed. If the buffer has been allocated using |
| 3447 |
* ::hsa_memory_allocate, or has already been registered, no operation is |
| 3448 |
* performed. |
| 3449 |
* |
| 3450 |
* @param[in] size Requested registration size in bytes. A size of 0 is |
| 3451 |
* only allowed if @p ptr is NULL. |
| 3452 |
* |
| 3453 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 3454 |
* |
| 3455 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 3456 |
* initialized. |
| 3457 |
* |
| 3458 |
* @retval ::HSA_STATUS_ERROR_OUT_OF_RESOURCES The HSA runtime failed to allocate |
| 3459 |
* the required resources. |
| 3460 |
* |
| 3461 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p size is 0 but @p ptr |
| 3462 |
* is not NULL. |
| 3463 |
*/ |
| 3464 |
hsa_status_t HSA_API hsa_memory_register( |
| 3465 |
void *ptr, |
| 3466 |
size_t size); |
| 3467 |
|
| 3468 |
/** |
| 3469 |
* |
| 3470 |
* @brief Deregister memory previously registered using ::hsa_memory_register. |
| 3471 |
* |
| 3472 |
* @details If the memory interval being deregistered does not match a previous |
| 3473 |
* registration (start and end addresses), the behavior is undefined. |
| 3474 |
* |
| 3475 |
* @param[in] ptr A pointer to the base of the buffer to be deregistered. If |
| 3476 |
* a NULL pointer is passed, no operation is performed. |
| 3477 |
* |
| 3478 |
* @param[in] size Size of the buffer to be deregistered. |
| 3479 |
* |
| 3480 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 3481 |
* |
| 3482 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 3483 |
* initialized. |
| 3484 |
* |
| 3485 |
*/ |
| 3486 |
hsa_status_t HSA_API hsa_memory_deregister( |
| 3487 |
void *ptr, |
| 3488 |
size_t size); |
| 3489 |
|
| 3490 |
/** @} */ |
| 3491 |
|
| 3492 |
|
| 3493 |
/** \defgroup instruction-set-architecture Instruction Set Architecture. |
| 3494 |
* @{ |
| 3495 |
*/ |
| 3496 |
|
| 3497 |
/** |
| 3498 |
* @brief Instruction set architecture. |
| 3499 |
*/ |
| 3500 |
typedef struct hsa_isa_s { |
| 3501 |
/** |
| 3502 |
* Opaque handle. Two handles reference the same object of the enclosing type |
| 3503 |
* if and only if they are equal. |
| 3504 |
*/ |
| 3505 |
uint64_t handle; |
| 3506 |
} hsa_isa_t; |
| 3507 |
|
| 3508 |
/** |
| 3509 |
* @brief Retrieve a reference to an instruction set architecture handle out of |
| 3510 |
* a symbolic name. |
| 3511 |
* |
| 3512 |
* @param[in] name Vendor-specific name associated with a a particular |
| 3513 |
* instruction set architecture. @p name must start with the vendor name and a |
| 3514 |
* colon (for example, "AMD:"). The rest of the name is vendor-specific. Must be |
| 3515 |
* a NUL-terminated string. |
| 3516 |
* |
| 3517 |
* @param[out] isa Memory location where the HSA runtime stores the ISA handle |
| 3518 |
* corresponding to the given name. Must not be NULL. |
| 3519 |
* |
| 3520 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 3521 |
* |
| 3522 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 3523 |
* initialized. |
| 3524 |
* |
| 3525 |
* @retval ::HSA_STATUS_ERROR_INVALID_ISA_NAME The given name does not |
| 3526 |
* correspond to any instruction set architecture. |
| 3527 |
* |
| 3528 |
* @retval ::HSA_STATUS_ERROR_OUT_OF_RESOURCES The HSA runtime failed to |
| 3529 |
* allocate the required resources. |
| 3530 |
* |
| 3531 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p name is NULL, or @p isa is |
| 3532 |
* NULL. |
| 3533 |
*/ |
| 3534 |
hsa_status_t HSA_API hsa_isa_from_name( |
| 3535 |
const char *name, |
| 3536 |
hsa_isa_t *isa); |
| 3537 |
|
| 3538 |
/** |
| 3539 |
* @brief Iterate over the instruction sets supported by the given agent, and |
| 3540 |
* invoke an application-defined callback on every iteration. The iterator is |
| 3541 |
* deterministic: if an agent supports several instruction set architectures, |
| 3542 |
* they are traversed in the same order in every invocation of this function. |
| 3543 |
* |
| 3544 |
* @param[in] agent A valid agent. |
| 3545 |
* |
| 3546 |
* @param[in] callback Callback to be invoked once per instruction set |
| 3547 |
* architecture. The HSA runtime passes two arguments to the callback: the |
| 3548 |
* ISA and the application data. If @p callback returns a status other than |
| 3549 |
* ::HSA_STATUS_SUCCESS for a particular iteration, the traversal stops and |
| 3550 |
* that status value is returned. |
| 3551 |
* |
| 3552 |
* @param[in] data Application data that is passed to @p callback on every |
| 3553 |
* iteration. May be NULL. |
| 3554 |
* |
| 3555 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 3556 |
* |
| 3557 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 3558 |
* initialized. |
| 3559 |
* |
| 3560 |
* @retval ::HSA_STATUS_ERROR_INVALID_AGENT The agent is invalid. |
| 3561 |
* |
| 3562 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p callback is NULL. |
| 3563 |
*/ |
| 3564 |
hsa_status_t HSA_API hsa_agent_iterate_isas( |
| 3565 |
hsa_agent_t agent, |
| 3566 |
hsa_status_t (*callback)(hsa_isa_t isa, void *data), |
| 3567 |
void *data); |
| 3568 |
|
| 3569 |
/** |
| 3570 |
* @brief Instruction set architecture attributes. |
| 3571 |
*/ |
| 3572 |
typedef enum { |
| 3573 |
/** |
| 3574 |
* The length of the ISA name in bytes, not including the NUL terminator. The |
| 3575 |
* type of this attribute is uint32_t. |
| 3576 |
*/ |
| 3577 |
HSA_ISA_INFO_NAME_LENGTH = 0, |
| 3578 |
/** |
| 3579 |
* Human-readable description. The type of this attribute is character array |
| 3580 |
* with the length equal to the value of ::HSA_ISA_INFO_NAME_LENGTH attribute. |
| 3581 |
*/ |
| 3582 |
HSA_ISA_INFO_NAME = 1, |
| 3583 |
/** |
| 3584 |
* @deprecated |
| 3585 |
* |
| 3586 |
* Number of call conventions supported by the instruction set architecture. |
| 3587 |
* Must be greater than zero. The type of this attribute is uint32_t. |
| 3588 |
*/ |
| 3589 |
HSA_ISA_INFO_CALL_CONVENTION_COUNT = 2, |
| 3590 |
/** |
| 3591 |
* @deprecated |
| 3592 |
* |
| 3593 |
* Number of work-items in a wavefront for a given call convention. Must be a |
| 3594 |
* power of 2 in the range [1,256]. The type of this attribute is uint32_t. |
| 3595 |
*/ |
| 3596 |
HSA_ISA_INFO_CALL_CONVENTION_INFO_WAVEFRONT_SIZE = 3, |
| 3597 |
/** |
| 3598 |
* @deprecated |
| 3599 |
* |
| 3600 |
* Number of wavefronts per compute unit for a given call convention. In |
| 3601 |
* practice, other factors (for example, the amount of group memory used by a |
| 3602 |
* work-group) may further limit the number of wavefronts per compute |
| 3603 |
* unit. The type of this attribute is uint32_t. |
| 3604 |
*/ |
| 3605 |
HSA_ISA_INFO_CALL_CONVENTION_INFO_WAVEFRONTS_PER_COMPUTE_UNIT = 4, |
| 3606 |
/** |
| 3607 |
* Machine models supported by the instruction set architecture. The type of |
| 3608 |
* this attribute is a bool[2]. If the ISA supports the small machine model, |
| 3609 |
* the element at index ::HSA_MACHINE_MODEL_SMALL is true. If the ISA supports |
| 3610 |
* the large model, the element at index ::HSA_MACHINE_MODEL_LARGE is true. |
| 3611 |
*/ |
| 3612 |
HSA_ISA_INFO_MACHINE_MODELS = 5, |
| 3613 |
/** |
| 3614 |
* Profiles supported by the instruction set architecture. The type of this |
| 3615 |
* attribute is a bool[2]. If the ISA supports the base profile, the element |
| 3616 |
* at index ::HSA_PROFILE_BASE is true. If the ISA supports the full profile, |
| 3617 |
* the element at index ::HSA_PROFILE_FULL is true. |
| 3618 |
*/ |
| 3619 |
HSA_ISA_INFO_PROFILES = 6, |
| 3620 |
/** |
| 3621 |
* Default floating-point rounding modes supported by the instruction set |
| 3622 |
* architecture. The type of this attribute is a bool[3]. The value at a given |
| 3623 |
* index is true if the corresponding rounding mode in |
| 3624 |
* ::hsa_default_float_rounding_mode_t is supported. At least one default mode |
| 3625 |
* has to be supported. |
| 3626 |
* |
| 3627 |
* If the default mode is supported, then |
| 3628 |
* ::HSA_ISA_INFO_BASE_PROFILE_DEFAULT_FLOAT_ROUNDING_MODES must report that |
| 3629 |
* both the zero and the near roundings modes are supported. |
| 3630 |
*/ |
| 3631 |
HSA_ISA_INFO_DEFAULT_FLOAT_ROUNDING_MODES = 7, |
| 3632 |
/** |
| 3633 |
* Default floating-point rounding modes supported by the instruction set |
| 3634 |
* architecture in the Base profile. The type of this attribute is a |
| 3635 |
* bool[3]. The value at a given index is true if the corresponding rounding |
| 3636 |
* mode in ::hsa_default_float_rounding_mode_t is supported. The value at |
| 3637 |
* index HSA_DEFAULT_FLOAT_ROUNDING_MODE_DEFAULT must be false. At least one |
| 3638 |
* of the values at indexes ::HSA_DEFAULT_FLOAT_ROUNDING_MODE_ZERO or |
| 3639 |
* HSA_DEFAULT_FLOAT_ROUNDING_MODE_NEAR must be true. |
| 3640 |
*/ |
| 3641 |
HSA_ISA_INFO_BASE_PROFILE_DEFAULT_FLOAT_ROUNDING_MODES = 8, |
| 3642 |
/** |
| 3643 |
* Flag indicating that the f16 HSAIL operation is at least as fast as the |
| 3644 |
* f32 operation in the instruction set architecture. The type of this |
| 3645 |
* attribute is bool. |
| 3646 |
*/ |
| 3647 |
HSA_ISA_INFO_FAST_F16_OPERATION = 9, |
| 3648 |
/** |
| 3649 |
* Maximum number of work-items of each dimension of a work-group. Each |
| 3650 |
* maximum must be greater than 0. No maximum can exceed the value of |
| 3651 |
* ::HSA_ISA_INFO_WORKGROUP_MAX_SIZE. The type of this attribute is |
| 3652 |
* uint16_t[3]. |
| 3653 |
*/ |
| 3654 |
HSA_ISA_INFO_WORKGROUP_MAX_DIM = 12, |
| 3655 |
/** |
| 3656 |
* Maximum total number of work-items in a work-group. The type |
| 3657 |
* of this attribute is uint32_t. |
| 3658 |
*/ |
| 3659 |
HSA_ISA_INFO_WORKGROUP_MAX_SIZE = 13, |
| 3660 |
/** |
| 3661 |
* Maximum number of work-items of each dimension of a grid. Each maximum must |
| 3662 |
* be greater than 0, and must not be smaller than the corresponding value in |
| 3663 |
* ::HSA_ISA_INFO_WORKGROUP_MAX_DIM. No maximum can exceed the value of |
| 3664 |
* ::HSA_ISA_INFO_GRID_MAX_SIZE. The type of this attribute is |
| 3665 |
* ::hsa_dim3_t. |
| 3666 |
*/ |
| 3667 |
HSA_ISA_INFO_GRID_MAX_DIM = 14, |
| 3668 |
/** |
| 3669 |
* Maximum total number of work-items in a grid. The type of this |
| 3670 |
* attribute is uint64_t. |
| 3671 |
*/ |
| 3672 |
HSA_ISA_INFO_GRID_MAX_SIZE = 16, |
| 3673 |
/** |
| 3674 |
* Maximum number of fbarriers per work-group. Must be at least 32. The |
| 3675 |
* type of this attribute is uint32_t. |
| 3676 |
*/ |
| 3677 |
HSA_ISA_INFO_FBARRIER_MAX_SIZE = 17 |
| 3678 |
} hsa_isa_info_t; |
| 3679 |
|
| 3680 |
/** |
| 3681 |
* @deprecated The concept of call convention has been deprecated. If the |
| 3682 |
* application wants to query the value of an attribute for a given instruction |
| 3683 |
* set architecture, use ::hsa_isa_get_info_alt instead. If the application |
| 3684 |
* wants to query an attribute that is specific to a given combination of ISA |
| 3685 |
* and wavefront, use ::hsa_wavefront_get_info. |
| 3686 |
* |
| 3687 |
* @brief Get the current value of an attribute for a given instruction set |
| 3688 |
* architecture (ISA). |
| 3689 |
* |
| 3690 |
* @param[in] isa A valid instruction set architecture. |
| 3691 |
* |
| 3692 |
* @param[in] attribute Attribute to query. |
| 3693 |
* |
| 3694 |
* @param[in] index Call convention index. Used only for call convention |
| 3695 |
* attributes, otherwise ignored. Must have a value between 0 (inclusive) and |
| 3696 |
* the value of the attribute ::HSA_ISA_INFO_CALL_CONVENTION_COUNT (not |
| 3697 |
* inclusive) in @p isa. |
| 3698 |
* |
| 3699 |
* @param[out] value Pointer to an application-allocated buffer where to store |
| 3700 |
* the value of the attribute. If the buffer passed by the application is not |
| 3701 |
* large enough to hold the value of @p attribute, the behavior is undefined. |
| 3702 |
* |
| 3703 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 3704 |
* |
| 3705 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 3706 |
* initialized. |
| 3707 |
* |
| 3708 |
* @retval ::HSA_STATUS_ERROR_INVALID_ISA The instruction set architecture is |
| 3709 |
* invalid. |
| 3710 |
* |
| 3711 |
* @retval ::HSA_STATUS_ERROR_INVALID_INDEX The index is out of range. |
| 3712 |
* |
| 3713 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p attribute is an invalid |
| 3714 |
* instruction set architecture attribute, or @p value is |
| 3715 |
* NULL. |
| 3716 |
*/ |
| 3717 |
hsa_status_t HSA_API HSA_DEPRECATED hsa_isa_get_info( |
| 3718 |
hsa_isa_t isa, |
| 3719 |
hsa_isa_info_t attribute, |
| 3720 |
uint32_t index, |
| 3721 |
void *value); |
| 3722 |
|
| 3723 |
/** |
| 3724 |
* @brief Get the current value of an attribute for a given instruction set |
| 3725 |
* architecture (ISA). |
| 3726 |
* |
| 3727 |
* @param[in] isa A valid instruction set architecture. |
| 3728 |
* |
| 3729 |
* @param[in] attribute Attribute to query. |
| 3730 |
* |
| 3731 |
* @param[out] value Pointer to an application-allocated buffer where to store |
| 3732 |
* the value of the attribute. If the buffer passed by the application is not |
| 3733 |
* large enough to hold the value of @p attribute, the behavior is undefined. |
| 3734 |
* |
| 3735 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 3736 |
* |
| 3737 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 3738 |
* initialized. |
| 3739 |
* |
| 3740 |
* @retval ::HSA_STATUS_ERROR_INVALID_ISA The instruction set architecture is |
| 3741 |
* invalid. |
| 3742 |
* |
| 3743 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p attribute is an invalid |
| 3744 |
* instruction set architecture attribute, or @p value is |
| 3745 |
* NULL. |
| 3746 |
*/ |
| 3747 |
hsa_status_t HSA_API hsa_isa_get_info_alt( |
| 3748 |
hsa_isa_t isa, |
| 3749 |
hsa_isa_info_t attribute, |
| 3750 |
void *value); |
| 3751 |
|
| 3752 |
/** |
| 3753 |
* @brief Retrieve the exception policy support for a given combination of |
| 3754 |
* instruction set architecture and profile. |
| 3755 |
* |
| 3756 |
* @param[in] isa A valid instruction set architecture. |
| 3757 |
* |
| 3758 |
* @param[in] profile Profile. |
| 3759 |
* |
| 3760 |
* @param[out] mask Pointer to a memory location where the HSA runtime stores a |
| 3761 |
* mask of ::hsa_exception_policy_t values. Must not be NULL. |
| 3762 |
* |
| 3763 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 3764 |
* |
| 3765 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 3766 |
* initialized. |
| 3767 |
* |
| 3768 |
* @retval ::HSA_STATUS_ERROR_INVALID_ISA The instruction set architecture is |
| 3769 |
* invalid. |
| 3770 |
* |
| 3771 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p profile is not a valid |
| 3772 |
* profile, or @p mask is NULL. |
| 3773 |
*/ |
| 3774 |
hsa_status_t HSA_API hsa_isa_get_exception_policies( |
| 3775 |
hsa_isa_t isa, |
| 3776 |
hsa_profile_t profile, |
| 3777 |
uint16_t *mask); |
| 3778 |
|
| 3779 |
/** |
| 3780 |
* @brief Floating-point types. |
| 3781 |
*/ |
| 3782 |
typedef enum { |
| 3783 |
/** |
| 3784 |
* 16-bit floating-point type. |
| 3785 |
*/ |
| 3786 |
HSA_FP_TYPE_16 = 1, |
| 3787 |
/** |
| 3788 |
* 32-bit floating-point type. |
| 3789 |
*/ |
| 3790 |
HSA_FP_TYPE_32 = 2, |
| 3791 |
/** |
| 3792 |
* 64-bit floating-point type. |
| 3793 |
*/ |
| 3794 |
HSA_FP_TYPE_64 = 4 |
| 3795 |
} hsa_fp_type_t; |
| 3796 |
|
| 3797 |
/** |
| 3798 |
* @brief Flush to zero modes. |
| 3799 |
*/ |
| 3800 |
typedef enum { |
| 3801 |
/** |
| 3802 |
* Flush to zero. |
| 3803 |
*/ |
| 3804 |
HSA_FLUSH_MODE_FTZ = 1, |
| 3805 |
/** |
| 3806 |
* Do not flush to zero. |
| 3807 |
*/ |
| 3808 |
HSA_FLUSH_MODE_NON_FTZ = 2 |
| 3809 |
} hsa_flush_mode_t; |
| 3810 |
|
| 3811 |
/** |
| 3812 |
* @brief Round methods. |
| 3813 |
*/ |
| 3814 |
typedef enum { |
| 3815 |
/** |
| 3816 |
* Single round method. |
| 3817 |
*/ |
| 3818 |
HSA_ROUND_METHOD_SINGLE = 1, |
| 3819 |
/** |
| 3820 |
* Double round method. |
| 3821 |
*/ |
| 3822 |
HSA_ROUND_METHOD_DOUBLE = 2 |
| 3823 |
} hsa_round_method_t; |
| 3824 |
|
| 3825 |
/** |
| 3826 |
* @brief Retrieve the round method (single or double) used to implement the |
| 3827 |
* floating-point multiply add instruction (mad) for a given combination of |
| 3828 |
* instruction set architecture, floating-point type, and flush to zero |
| 3829 |
* modifier. |
| 3830 |
* |
| 3831 |
* @param[in] isa Instruction set architecture. |
| 3832 |
* |
| 3833 |
* @param[in] fp_type Floating-point type. |
| 3834 |
* |
| 3835 |
* @param[in] flush_mode Flush to zero modifier. |
| 3836 |
* |
| 3837 |
* @param[out] round_method Pointer to a memory location where the HSA |
| 3838 |
* runtime stores the round method used by the implementation. Must not be NULL. |
| 3839 |
* |
| 3840 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 3841 |
* |
| 3842 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 3843 |
* initialized. |
| 3844 |
* |
| 3845 |
* @retval ::HSA_STATUS_ERROR_INVALID_ISA The instruction set architecture is |
| 3846 |
* invalid. |
| 3847 |
* |
| 3848 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p fp_type is not a valid |
| 3849 |
* floating-point type, or @p flush_mode is not a valid flush to zero modifier, |
| 3850 |
* or @p round_method is NULL. |
| 3851 |
*/ |
| 3852 |
hsa_status_t HSA_API hsa_isa_get_round_method( |
| 3853 |
hsa_isa_t isa, |
| 3854 |
hsa_fp_type_t fp_type, |
| 3855 |
hsa_flush_mode_t flush_mode, |
| 3856 |
hsa_round_method_t *round_method); |
| 3857 |
|
| 3858 |
/** |
| 3859 |
* @brief Wavefront handle |
| 3860 |
*/ |
| 3861 |
typedef struct hsa_wavefront_s { |
| 3862 |
/** |
| 3863 |
* Opaque handle. Two handles reference the same object of the enclosing type |
| 3864 |
* if and only if they are equal. |
| 3865 |
*/ |
| 3866 |
uint64_t handle; |
| 3867 |
} hsa_wavefront_t; |
| 3868 |
|
| 3869 |
/** |
| 3870 |
* @brief Wavefront attributes. |
| 3871 |
*/ |
| 3872 |
typedef enum { |
| 3873 |
/** |
| 3874 |
* Number of work-items in the wavefront. Must be a power of 2 in the range |
| 3875 |
* [1,256]. The type of this attribute is uint32_t. |
| 3876 |
*/ |
| 3877 |
HSA_WAVEFRONT_INFO_SIZE = 0 |
| 3878 |
} hsa_wavefront_info_t; |
| 3879 |
|
| 3880 |
/** |
| 3881 |
* @brief Get the current value of a wavefront attribute. |
| 3882 |
* |
| 3883 |
* @param[in] wavefront A wavefront. |
| 3884 |
* |
| 3885 |
* @param[in] attribute Attribute to query. |
| 3886 |
* |
| 3887 |
* @param[out] value Pointer to an application-allocated buffer where to store |
| 3888 |
* the value of the attribute. If the buffer passed by the application is not |
| 3889 |
* large enough to hold the value of @p attribute, the behavior is undefined. |
| 3890 |
* |
| 3891 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 3892 |
* |
| 3893 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 3894 |
* initialized. |
| 3895 |
* |
| 3896 |
* @retval ::HSA_STATUS_ERROR_INVALID_WAVEFRONT The wavefront is invalid. |
| 3897 |
* |
| 3898 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p attribute is an invalid |
| 3899 |
* wavefront attribute, or @p value is NULL. |
| 3900 |
*/ |
| 3901 |
hsa_status_t HSA_API hsa_wavefront_get_info( |
| 3902 |
hsa_wavefront_t wavefront, |
| 3903 |
hsa_wavefront_info_t attribute, |
| 3904 |
void *value); |
| 3905 |
|
| 3906 |
/** |
| 3907 |
* @brief Iterate over the different wavefronts supported by an instruction set |
| 3908 |
* architecture, and invoke an application-defined callback on every iteration. |
| 3909 |
* |
| 3910 |
* @param[in] isa Instruction set architecture. |
| 3911 |
* |
| 3912 |
* @param[in] callback Callback to be invoked once per wavefront that is |
| 3913 |
* supported by the agent. The HSA runtime passes two arguments to the callback: |
| 3914 |
* the wavefront handle and the application data. If @p callback returns a |
| 3915 |
* status other than ::HSA_STATUS_SUCCESS for a particular iteration, the |
| 3916 |
* traversal stops and that value is returned. |
| 3917 |
* |
| 3918 |
* @param[in] data Application data that is passed to @p callback on every |
| 3919 |
* iteration. May be NULL. |
| 3920 |
* |
| 3921 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 3922 |
* |
| 3923 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 3924 |
* initialized. |
| 3925 |
* |
| 3926 |
* @retval ::HSA_STATUS_ERROR_INVALID_ISA The instruction set architecture is |
| 3927 |
* invalid. |
| 3928 |
* |
| 3929 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p callback is NULL. |
| 3930 |
*/ |
| 3931 |
hsa_status_t HSA_API hsa_isa_iterate_wavefronts( |
| 3932 |
hsa_isa_t isa, |
| 3933 |
hsa_status_t (*callback)(hsa_wavefront_t wavefront, void *data), |
| 3934 |
void *data); |
| 3935 |
|
| 3936 |
/** |
| 3937 |
* @deprecated Use ::hsa_agent_iterate_isas to query which instructions set |
| 3938 |
* architectures are supported by a given agent. |
| 3939 |
* |
| 3940 |
* @brief Check if the instruction set architecture of a code object can be |
| 3941 |
* executed on an agent associated with another architecture. |
| 3942 |
* |
| 3943 |
* @param[in] code_object_isa Instruction set architecture associated with a |
| 3944 |
* code object. |
| 3945 |
* |
| 3946 |
* @param[in] agent_isa Instruction set architecture associated with an agent. |
| 3947 |
* |
| 3948 |
* @param[out] result Pointer to a memory location where the HSA runtime stores |
| 3949 |
* the result of the check. If the two architectures are compatible, the result |
| 3950 |
* is true; if they are incompatible, the result is false. |
| 3951 |
* |
| 3952 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 3953 |
* |
| 3954 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 3955 |
* initialized. |
| 3956 |
* |
| 3957 |
* @retval ::HSA_STATUS_ERROR_INVALID_ISA @p code_object_isa or @p agent_isa are |
| 3958 |
* invalid. |
| 3959 |
* |
| 3960 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p result is NULL. |
| 3961 |
*/ |
| 3962 |
hsa_status_t HSA_API HSA_DEPRECATED hsa_isa_compatible( |
| 3963 |
hsa_isa_t code_object_isa, |
| 3964 |
hsa_isa_t agent_isa, |
| 3965 |
bool *result); |
| 3966 |
|
| 3967 |
/** @} */ |
| 3968 |
|
| 3969 |
|
| 3970 |
/** \defgroup executable Executable |
| 3971 |
* @{ |
| 3972 |
*/ |
| 3973 |
|
| 3974 |
/** |
| 3975 |
* @brief Code object reader handle. A code object reader is used to |
| 3976 |
* load a code object from file (when created using |
| 3977 |
* ::hsa_code_object_reader_create_from_file), or from memory (if created using |
| 3978 |
* ::hsa_code_object_reader_create_from_memory). |
| 3979 |
*/ |
| 3980 |
typedef struct hsa_code_object_reader_s { |
| 3981 |
/** |
| 3982 |
* Opaque handle. Two handles reference the same object of the enclosing type |
| 3983 |
* if and only if they are equal. |
| 3984 |
*/ |
| 3985 |
uint64_t handle; |
| 3986 |
} hsa_code_object_reader_t; |
| 3987 |
|
| 3988 |
/** |
| 3989 |
* @brief Create a code object reader to operate on a file. |
| 3990 |
* |
| 3991 |
* @param[in] file File descriptor. The file must have been opened by |
| 3992 |
* application with at least read permissions prior calling this function. The |
| 3993 |
* file must contain a vendor-specific code object. |
| 3994 |
* |
| 3995 |
* The file is owned and managed by the application; the lifetime of the file |
| 3996 |
* descriptor must exceed that of any associated code object reader. |
| 3997 |
* |
| 3998 |
* @param[out] code_object_reader Memory location to store the newly created |
| 3999 |
* code object reader handle. Must not be NULL. |
| 4000 |
* |
| 4001 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 4002 |
* |
| 4003 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 4004 |
* initialized. |
| 4005 |
* |
| 4006 |
* @retval ::HSA_STATUS_ERROR_INVALID_FILE @p file is invalid. |
| 4007 |
* |
| 4008 |
* @retval ::HSA_STATUS_ERROR_OUT_OF_RESOURCES The HSA runtime failed to |
| 4009 |
* allocate the required resources. |
| 4010 |
* |
| 4011 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p code_object_reader is NULL. |
| 4012 |
*/ |
| 4013 |
hsa_status_t HSA_API hsa_code_object_reader_create_from_file( |
| 4014 |
hsa_file_t file, |
| 4015 |
hsa_code_object_reader_t *code_object_reader); |
| 4016 |
|
| 4017 |
/** |
| 4018 |
* @brief Create a code object reader to operate on memory. |
| 4019 |
* |
| 4020 |
* @param[in] code_object Memory buffer that contains a vendor-specific code |
| 4021 |
* object. The buffer is owned and managed by the application; the lifetime of |
| 4022 |
* the buffer must exceed that of any associated code object reader. |
| 4023 |
* |
| 4024 |
* @param[in] size Size of the buffer pointed to by @p code_object. Must not be |
| 4025 |
* 0. |
| 4026 |
* |
| 4027 |
* @param[out] code_object_reader Memory location to store newly created code |
| 4028 |
* object reader handle. Must not be NULL. |
| 4029 |
* |
| 4030 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 4031 |
* |
| 4032 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 4033 |
* initialized. |
| 4034 |
* |
| 4035 |
* @retval ::HSA_STATUS_ERROR_OUT_OF_RESOURCES The HSA runtime failed to |
| 4036 |
* allocate the required resources. |
| 4037 |
* |
| 4038 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p code_object is NULL, @p size |
| 4039 |
* is zero, or @p code_object_reader is NULL. |
| 4040 |
*/ |
| 4041 |
hsa_status_t HSA_API hsa_code_object_reader_create_from_memory( |
| 4042 |
const void *code_object, |
| 4043 |
size_t size, |
| 4044 |
hsa_code_object_reader_t *code_object_reader); |
| 4045 |
|
| 4046 |
/** |
| 4047 |
* @brief Destroy a code object reader. |
| 4048 |
* |
| 4049 |
* @details The code object reader handle becomes invalid after completion of |
| 4050 |
* this function. Any file or memory used to create the code object read is not |
| 4051 |
* closed, removed, or deallocated by this function. |
| 4052 |
* |
| 4053 |
* @param[in] code_object_reader Code object reader to destroy. |
| 4054 |
* |
| 4055 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 4056 |
* |
| 4057 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 4058 |
* initialized. |
| 4059 |
* |
| 4060 |
* @retval ::HSA_STATUS_ERROR_INVALID_CODE_OBJECT_READER @p code_object_reader |
| 4061 |
* is invalid. |
| 4062 |
*/ |
| 4063 |
hsa_status_t HSA_API hsa_code_object_reader_destroy( |
| 4064 |
hsa_code_object_reader_t code_object_reader); |
| 4065 |
|
| 4066 |
/** |
| 4067 |
* @brief Struct containing an opaque handle to an executable, which contains |
| 4068 |
* ISA for finalized kernels and indirect functions together with the allocated |
| 4069 |
* global or readonly segment variables they reference. |
| 4070 |
*/ |
| 4071 |
typedef struct hsa_executable_s { |
| 4072 |
/** |
| 4073 |
* Opaque handle. Two handles reference the same object of the enclosing type |
| 4074 |
* if and only if they are equal. |
| 4075 |
*/ |
| 4076 |
uint64_t handle; |
| 4077 |
} hsa_executable_t; |
| 4078 |
|
| 4079 |
/** |
| 4080 |
* @brief Executable state. |
| 4081 |
*/ |
| 4082 |
typedef enum { |
| 4083 |
/** |
| 4084 |
* Executable state, which allows the user to load code objects and define |
| 4085 |
* external variables. Variable addresses, kernel code handles, and |
| 4086 |
* indirect function code handles are not available in query operations until |
| 4087 |
* the executable is frozen (zero always returned). |
| 4088 |
*/ |
| 4089 |
HSA_EXECUTABLE_STATE_UNFROZEN = 0, |
| 4090 |
/** |
| 4091 |
* Executable state, which allows the user to query variable addresses, |
| 4092 |
* kernel code handles, and indirect function code handles using query |
| 4093 |
* operations. Loading new code objects, as well as defining external |
| 4094 |
* variables, is not allowed in this state. |
| 4095 |
*/ |
| 4096 |
HSA_EXECUTABLE_STATE_FROZEN = 1 |
| 4097 |
} hsa_executable_state_t; |
| 4098 |
|
| 4099 |
/** |
| 4100 |
* @deprecated Use ::hsa_executable_create_alt instead, which allows the |
| 4101 |
* application to specify the default floating-point rounding mode of the |
| 4102 |
* executable and assumes an unfrozen initial state. |
| 4103 |
* |
| 4104 |
* @brief Create an empty executable. |
| 4105 |
* |
| 4106 |
* @param[in] profile Profile used in the executable. |
| 4107 |
* |
| 4108 |
* @param[in] executable_state Executable state. If the state is |
| 4109 |
* ::HSA_EXECUTABLE_STATE_FROZEN, the resulting executable is useless because no |
| 4110 |
* code objects can be loaded, and no variables can be defined. |
| 4111 |
* |
| 4112 |
* @param[in] options Standard and vendor-specific options. Unknown options are |
| 4113 |
* ignored. A standard option begins with the "-hsa_" prefix. Options beginning |
| 4114 |
* with the "-hsa_ext_<extension_name>_" prefix are reserved for extensions. A |
| 4115 |
* vendor-specific option begins with the "-<vendor_name>_" prefix. Must be a |
| 4116 |
* NUL-terminated string. May be NULL. |
| 4117 |
* |
| 4118 |
* @param[out] executable Memory location where the HSA runtime stores the newly |
| 4119 |
* created executable handle. |
| 4120 |
* |
| 4121 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 4122 |
* |
| 4123 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 4124 |
* initialized. |
| 4125 |
* |
| 4126 |
* @retval ::HSA_STATUS_ERROR_OUT_OF_RESOURCES The HSA runtime failed to |
| 4127 |
* allocate the required resources. |
| 4128 |
* |
| 4129 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p profile is invalid, or |
| 4130 |
* @p executable is NULL. |
| 4131 |
*/ |
| 4132 |
hsa_status_t HSA_API HSA_DEPRECATED hsa_executable_create( |
| 4133 |
hsa_profile_t profile, |
| 4134 |
hsa_executable_state_t executable_state, |
| 4135 |
const char *options, |
| 4136 |
hsa_executable_t *executable); |
| 4137 |
|
| 4138 |
/** |
| 4139 |
* @brief Create an empty executable. |
| 4140 |
* |
| 4141 |
* @param[in] profile Profile used in the executable. |
| 4142 |
* |
| 4143 |
* @param[in] default_float_rounding_mode Default floating-point rounding mode |
| 4144 |
* used in the executable. Allowed rounding modes are near and zero (default is |
| 4145 |
* not allowed). |
| 4146 |
* |
| 4147 |
* @param[in] options Standard and vendor-specific options. Unknown options are |
| 4148 |
* ignored. A standard option begins with the "-hsa_" prefix. Options beginning |
| 4149 |
* with the "-hsa_ext_<extension_name>_" prefix are reserved for extensions. A |
| 4150 |
* vendor-specific option begins with the "-<vendor_name>_" prefix. Must be a |
| 4151 |
* NUL-terminated string. May be NULL. |
| 4152 |
* |
| 4153 |
* @param[out] executable Memory location where the HSA runtime stores newly |
| 4154 |
* created executable handle. The initial state of the executable is |
| 4155 |
* ::HSA_EXECUTABLE_STATE_UNFROZEN. |
| 4156 |
* |
| 4157 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 4158 |
* |
| 4159 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 4160 |
* initialized. |
| 4161 |
* |
| 4162 |
* @retval ::HSA_STATUS_ERROR_OUT_OF_RESOURCES The HSA runtime failed to |
| 4163 |
* allocate the required resources. |
| 4164 |
* |
| 4165 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p profile is invalid, or |
| 4166 |
* @p executable is NULL. |
| 4167 |
*/ |
| 4168 |
hsa_status_t HSA_API hsa_executable_create_alt( |
| 4169 |
hsa_profile_t profile, |
| 4170 |
hsa_default_float_rounding_mode_t default_float_rounding_mode, |
| 4171 |
const char *options, |
| 4172 |
hsa_executable_t *executable); |
| 4173 |
|
| 4174 |
/** |
| 4175 |
* @brief Destroy an executable. |
| 4176 |
* |
| 4177 |
* @details An executable handle becomes invalid after the executable has been |
| 4178 |
* destroyed. Code object handles that were loaded into this executable are |
| 4179 |
* still valid after the executable has been destroyed, and can be used as |
| 4180 |
* intended. Resources allocated outside and associated with this executable |
| 4181 |
* (such as external global or readonly variables) can be released after the |
| 4182 |
* executable has been destroyed. |
| 4183 |
* |
| 4184 |
* Executable should not be destroyed while kernels are in flight. |
| 4185 |
* |
| 4186 |
* @param[in] executable Executable. |
| 4187 |
* |
| 4188 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 4189 |
* |
| 4190 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 4191 |
* initialized. |
| 4192 |
* |
| 4193 |
* @retval ::HSA_STATUS_ERROR_INVALID_EXECUTABLE The executable is invalid. |
| 4194 |
*/ |
| 4195 |
hsa_status_t HSA_API hsa_executable_destroy( |
| 4196 |
hsa_executable_t executable); |
| 4197 |
|
| 4198 |
/** |
| 4199 |
* @brief Loaded code object handle. |
| 4200 |
*/ |
| 4201 |
typedef struct hsa_loaded_code_object_s { |
| 4202 |
/** |
| 4203 |
* Opaque handle. Two handles reference the same object of the enclosing type |
| 4204 |
* if and only if they are equal. |
| 4205 |
*/ |
| 4206 |
uint64_t handle; |
| 4207 |
} hsa_loaded_code_object_t; |
| 4208 |
|
| 4209 |
/** |
| 4210 |
* @brief Load a program code object into an executable. |
| 4211 |
* |
| 4212 |
* @details A program code object contains information about resources that are |
| 4213 |
* accessible by all kernel agents that run the executable, and can be loaded |
| 4214 |
* at most once into an executable. |
| 4215 |
* |
| 4216 |
* If the program code object uses extensions, the implementation must support |
| 4217 |
* them for this operation to return successfully. |
| 4218 |
* |
| 4219 |
* @param[in] executable Executable. |
| 4220 |
* |
| 4221 |
* @param[in] code_object_reader A code object reader that holds the program |
| 4222 |
* code object to load. If a code object reader is destroyed before all the |
| 4223 |
* associated executables are destroyed, the behavior is undefined. |
| 4224 |
* |
| 4225 |
* @param[in] options Standard and vendor-specific options. Unknown options are |
| 4226 |
* ignored. A standard option begins with the "-hsa_" prefix. Options beginning |
| 4227 |
* with the "-hsa_ext_<extension_name>_" prefix are reserved for extensions. A |
| 4228 |
* vendor-specific option begins with the "-<vendor_name>_" prefix. Must be a |
| 4229 |
* NUL-terminated string. May be NULL. |
| 4230 |
* |
| 4231 |
* @param[out] loaded_code_object Pointer to a memory location where the HSA |
| 4232 |
* runtime stores the loaded code object handle. May be NULL. |
| 4233 |
* |
| 4234 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 4235 |
* |
| 4236 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 4237 |
* initialized. |
| 4238 |
* |
| 4239 |
* @retval ::HSA_STATUS_ERROR_OUT_OF_RESOURCES The HSA runtime failed to |
| 4240 |
* allocate the required resources. |
| 4241 |
* |
| 4242 |
* @retval ::HSA_STATUS_ERROR_INVALID_EXECUTABLE The executable is invalid. |
| 4243 |
* |
| 4244 |
* @retval ::HSA_STATUS_ERROR_FROZEN_EXECUTABLE The executable is frozen. |
| 4245 |
* |
| 4246 |
* @retval ::HSA_STATUS_ERROR_INVALID_CODE_OBJECT_READER @p code_object_reader |
| 4247 |
* is invalid. |
| 4248 |
* |
| 4249 |
* @retval ::HSA_STATUS_ERROR_INCOMPATIBLE_ARGUMENTS The program code object is |
| 4250 |
* not compatible with the executable or the implementation (for example, the |
| 4251 |
* code object uses an extension that is not supported by the implementation). |
| 4252 |
*/ |
| 4253 |
hsa_status_t HSA_API hsa_executable_load_program_code_object( |
| 4254 |
hsa_executable_t executable, |
| 4255 |
hsa_code_object_reader_t code_object_reader, |
| 4256 |
const char *options, |
| 4257 |
hsa_loaded_code_object_t *loaded_code_object); |
| 4258 |
|
| 4259 |
/** |
| 4260 |
* @brief Load an agent code object into an executable. |
| 4261 |
* |
| 4262 |
* @details The agent code object contains all defined agent |
| 4263 |
* allocation variables, functions, indirect functions, and kernels in a given |
| 4264 |
* program for a given instruction set architecture. |
| 4265 |
* |
| 4266 |
* Any module linkage declaration must have been defined either by a define |
| 4267 |
* variable or by loading a code object that has a symbol with module linkage |
| 4268 |
* definition. |
| 4269 |
* |
| 4270 |
* The default floating-point rounding mode of the code object associated with |
| 4271 |
* @p code_object_reader must match that of the executable |
| 4272 |
* (::HSA_EXECUTABLE_INFO_DEFAULT_FLOAT_ROUNDING_MODE), or be default (in which |
| 4273 |
* case the value of ::HSA_EXECUTABLE_INFO_DEFAULT_FLOAT_ROUNDING_MODE is used). |
| 4274 |
* If the agent code object uses extensions, the implementation and the agent |
| 4275 |
* must support them for this operation to return successfully. |
| 4276 |
* |
| 4277 |
* @param[in] executable Executable. |
| 4278 |
* |
| 4279 |
* @param[in] agent Agent to load code object for. A code object can be loaded |
| 4280 |
* into an executable at most once for a given agent. The instruction set |
| 4281 |
* architecture of the code object must be supported by the agent. |
| 4282 |
* |
| 4283 |
* @param[in] code_object_reader A code object reader that holds the code object |
| 4284 |
* to load. If a code object reader is destroyed before all the associated |
| 4285 |
* executables are destroyed, the behavior is undefined. |
| 4286 |
* |
| 4287 |
* @param[in] options Standard and vendor-specific options. Unknown options are |
| 4288 |
* ignored. A standard option begins with the "-hsa_" prefix. Options beginning |
| 4289 |
* with the "-hsa_ext_<extension_name>_" prefix are reserved for extensions. A |
| 4290 |
* vendor-specific option begins with the "-<vendor_name>_" prefix. Must be a |
| 4291 |
* NUL-terminated string. May be NULL. |
| 4292 |
* |
| 4293 |
* @param[out] loaded_code_object Pointer to a memory location where the HSA |
| 4294 |
* runtime stores the loaded code object handle. May be NULL. |
| 4295 |
* |
| 4296 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 4297 |
* |
| 4298 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 4299 |
* initialized. |
| 4300 |
* |
| 4301 |
* @retval ::HSA_STATUS_ERROR_OUT_OF_RESOURCES The HSA runtime failed to |
| 4302 |
* allocate the required resources. |
| 4303 |
* |
| 4304 |
* @retval ::HSA_STATUS_ERROR_INVALID_EXECUTABLE The executable is invalid. |
| 4305 |
* |
| 4306 |
* @retval ::HSA_STATUS_ERROR_FROZEN_EXECUTABLE The executable is frozen. |
| 4307 |
* |
| 4308 |
* @retval ::HSA_STATUS_ERROR_INVALID_AGENT The agent is invalid. |
| 4309 |
* |
| 4310 |
* @retval ::HSA_STATUS_ERROR_INVALID_CODE_OBJECT_READER @p code_object_reader |
| 4311 |
* is invalid. |
| 4312 |
* |
| 4313 |
* @retval ::HSA_STATUS_ERROR_INCOMPATIBLE_ARGUMENTS The code object read by @p |
| 4314 |
* code_object_reader is not compatible with the agent (for example, the agent |
| 4315 |
* does not support the instruction set architecture of the code object), the |
| 4316 |
* executable (for example, there is a default floating-point mode mismatch |
| 4317 |
* between the two), or the implementation. |
| 4318 |
*/ |
| 4319 |
hsa_status_t HSA_API hsa_executable_load_agent_code_object( |
| 4320 |
hsa_executable_t executable, |
| 4321 |
hsa_agent_t agent, |
| 4322 |
hsa_code_object_reader_t code_object_reader, |
| 4323 |
const char *options, |
| 4324 |
hsa_loaded_code_object_t *loaded_code_object); |
| 4325 |
|
| 4326 |
/** |
| 4327 |
* @brief Freeze the executable. |
| 4328 |
* |
| 4329 |
* @details No modifications to executable can be made after freezing: no code |
| 4330 |
* objects can be loaded to the executable, and no external variables can be |
| 4331 |
* defined. Freezing the executable does not prevent querying the executable's |
| 4332 |
* attributes. The application must define all the external variables in an |
| 4333 |
* executable before freezing it. |
| 4334 |
* |
| 4335 |
* @param[in] executable Executable. |
| 4336 |
* |
| 4337 |
* @param[in] options Standard and vendor-specific options. Unknown options are |
| 4338 |
* ignored. A standard option begins with the "-hsa_" prefix. Options beginning |
| 4339 |
* with the "-hsa_ext_<extension_name>_" prefix are reserved for extensions. A |
| 4340 |
* vendor-specific option begins with the "-<vendor_name>_" prefix. Must be a |
| 4341 |
* NUL-terminated string. May be NULL. |
| 4342 |
* |
| 4343 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 4344 |
* |
| 4345 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 4346 |
* initialized. |
| 4347 |
* |
| 4348 |
* @retval ::HSA_STATUS_ERROR_INVALID_EXECUTABLE The executable is invalid. |
| 4349 |
* |
| 4350 |
* @retval ::HSA_STATUS_ERROR_VARIABLE_UNDEFINED One or more variables are |
| 4351 |
* undefined in the executable. |
| 4352 |
* |
| 4353 |
* @retval ::HSA_STATUS_ERROR_FROZEN_EXECUTABLE @p executable is already frozen. |
| 4354 |
*/ |
| 4355 |
hsa_status_t HSA_API hsa_executable_freeze( |
| 4356 |
hsa_executable_t executable, |
| 4357 |
const char *options); |
| 4358 |
|
| 4359 |
/** |
| 4360 |
* @brief Executable attributes. |
| 4361 |
*/ |
| 4362 |
typedef enum { |
| 4363 |
/** |
| 4364 |
* Profile this executable is created for. The type of this attribute is |
| 4365 |
* ::hsa_profile_t. |
| 4366 |
*/ |
| 4367 |
HSA_EXECUTABLE_INFO_PROFILE = 1, |
| 4368 |
/** |
| 4369 |
* Executable state. The type of this attribute is ::hsa_executable_state_t. |
| 4370 |
*/ |
| 4371 |
HSA_EXECUTABLE_INFO_STATE = 2, |
| 4372 |
/** |
| 4373 |
* Default floating-point rounding mode specified when executable was created. |
| 4374 |
* The type of this attribute is ::hsa_default_float_rounding_mode_t. |
| 4375 |
*/ |
| 4376 |
HSA_EXECUTABLE_INFO_DEFAULT_FLOAT_ROUNDING_MODE = 3 |
| 4377 |
} hsa_executable_info_t; |
| 4378 |
|
| 4379 |
/** |
| 4380 |
* @brief Get the current value of an attribute for a given executable. |
| 4381 |
* |
| 4382 |
* @param[in] executable Executable. |
| 4383 |
* |
| 4384 |
* @param[in] attribute Attribute to query. |
| 4385 |
* |
| 4386 |
* @param[out] value Pointer to an application-allocated buffer where to store |
| 4387 |
* the value of the attribute. If the buffer passed by the application is not |
| 4388 |
* large enough to hold the value of @p attribute, the behavior is undefined. |
| 4389 |
* |
| 4390 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 4391 |
* |
| 4392 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 4393 |
* initialized. |
| 4394 |
* |
| 4395 |
* @retval ::HSA_STATUS_ERROR_INVALID_EXECUTABLE The executable is invalid. |
| 4396 |
* |
| 4397 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p attribute is an invalid |
| 4398 |
* executable attribute, or @p value is NULL. |
| 4399 |
*/ |
| 4400 |
hsa_status_t HSA_API hsa_executable_get_info( |
| 4401 |
hsa_executable_t executable, |
| 4402 |
hsa_executable_info_t attribute, |
| 4403 |
void *value); |
| 4404 |
|
| 4405 |
/** |
| 4406 |
* @brief Define an external global variable with program allocation. |
| 4407 |
* |
| 4408 |
* @details This function allows the application to provide the definition |
| 4409 |
* of a variable in the global segment memory with program allocation. The |
| 4410 |
* variable must be defined before loading a code object into an executable. |
| 4411 |
* In addition, code objects loaded must not define the variable. |
| 4412 |
* |
| 4413 |
* @param[in] executable Executable. Must not be in frozen state. |
| 4414 |
* |
| 4415 |
* @param[in] variable_name Name of the variable. The Programmer's Reference |
| 4416 |
* Manual describes the standard name mangling scheme. |
| 4417 |
* |
| 4418 |
* @param[in] address Address where the variable is defined. This address must |
| 4419 |
* be in global memory and can be read and written by any agent in the |
| 4420 |
* system. The application cannot deallocate the buffer pointed by @p address |
| 4421 |
* before @p executable is destroyed. |
| 4422 |
* |
| 4423 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 4424 |
* |
| 4425 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 4426 |
* initialized. |
| 4427 |
* |
| 4428 |
* @retval ::HSA_STATUS_ERROR_OUT_OF_RESOURCES The HSA runtime failed to |
| 4429 |
* allocate the required resources. |
| 4430 |
* |
| 4431 |
* @retval ::HSA_STATUS_ERROR_INVALID_EXECUTABLE The executable is invalid. |
| 4432 |
* |
| 4433 |
* @retval ::HSA_STATUS_ERROR_VARIABLE_ALREADY_DEFINED The variable is |
| 4434 |
* already defined. |
| 4435 |
* |
| 4436 |
* @retval ::HSA_STATUS_ERROR_INVALID_SYMBOL_NAME There is no variable with the |
| 4437 |
* @p variable_name. |
| 4438 |
* |
| 4439 |
* @retval ::HSA_STATUS_ERROR_FROZEN_EXECUTABLE @p executable is frozen. |
| 4440 |
* |
| 4441 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p variable_name is NULL. |
| 4442 |
*/ |
| 4443 |
hsa_status_t HSA_API hsa_executable_global_variable_define( |
| 4444 |
hsa_executable_t executable, |
| 4445 |
const char *variable_name, |
| 4446 |
void *address); |
| 4447 |
|
| 4448 |
/** |
| 4449 |
* @brief Define an external global variable with agent allocation. |
| 4450 |
* |
| 4451 |
* @details This function allows the application to provide the definition |
| 4452 |
* of a variable in the global segment memory with agent allocation. The |
| 4453 |
* variable must be defined before loading a code object into an executable. |
| 4454 |
* In addition, code objects loaded must not define the variable. |
| 4455 |
* |
| 4456 |
* @param[in] executable Executable. Must not be in frozen state. |
| 4457 |
* |
| 4458 |
* @param[in] agent Agent for which the variable is being defined. |
| 4459 |
* |
| 4460 |
* @param[in] variable_name Name of the variable. The Programmer's Reference |
| 4461 |
* Manual describes the standard name mangling scheme. |
| 4462 |
* |
| 4463 |
* @param[in] address Address where the variable is defined. This address must |
| 4464 |
* have been previously allocated using ::hsa_memory_allocate in a global region |
| 4465 |
* that is only visible to @p agent. The application cannot deallocate the |
| 4466 |
* buffer pointed by @p address before @p executable is destroyed. |
| 4467 |
* |
| 4468 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 4469 |
* |
| 4470 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 4471 |
* initialized. |
| 4472 |
* |
| 4473 |
* @retval ::HSA_STATUS_ERROR_OUT_OF_RESOURCES The HSA runtime failed to |
| 4474 |
* allocate the required resources. |
| 4475 |
* |
| 4476 |
* @retval ::HSA_STATUS_ERROR_INVALID_EXECUTABLE The executable is invalid. |
| 4477 |
* |
| 4478 |
* @retval ::HSA_STATUS_ERROR_INVALID_AGENT @p agent is invalid. |
| 4479 |
* |
| 4480 |
* @retval ::HSA_STATUS_ERROR_VARIABLE_ALREADY_DEFINED The variable is |
| 4481 |
* already defined. |
| 4482 |
* |
| 4483 |
* @retval ::HSA_STATUS_ERROR_INVALID_SYMBOL_NAME There is no variable with the |
| 4484 |
* @p variable_name. |
| 4485 |
* |
| 4486 |
* @retval ::HSA_STATUS_ERROR_FROZEN_EXECUTABLE @p executable is frozen. |
| 4487 |
* |
| 4488 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p variable_name is NULL. |
| 4489 |
*/ |
| 4490 |
hsa_status_t HSA_API hsa_executable_agent_global_variable_define( |
| 4491 |
hsa_executable_t executable, |
| 4492 |
hsa_agent_t agent, |
| 4493 |
const char *variable_name, |
| 4494 |
void *address); |
| 4495 |
|
| 4496 |
/** |
| 4497 |
* @brief Define an external readonly variable. |
| 4498 |
* |
| 4499 |
* @details This function allows the application to provide the definition |
| 4500 |
* of a variable in the readonly segment memory. The variable must be defined |
| 4501 |
* before loading a code object into an executable. In addition, code objects |
| 4502 |
* loaded must not define the variable. |
| 4503 |
* |
| 4504 |
* @param[in] executable Executable. Must not be in frozen state. |
| 4505 |
* |
| 4506 |
* @param[in] agent Agent for which the variable is being defined. |
| 4507 |
* |
| 4508 |
* @param[in] variable_name Name of the variable. The Programmer's Reference |
| 4509 |
* Manual describes the standard name mangling scheme. |
| 4510 |
* |
| 4511 |
* @param[in] address Address where the variable is defined. This address must |
| 4512 |
* have been previously allocated using ::hsa_memory_allocate in a readonly |
| 4513 |
* region associated with @p agent. The application cannot deallocate the buffer |
| 4514 |
* pointed by @p address before @p executable is destroyed. |
| 4515 |
* |
| 4516 |
* @param[in] address Address where the variable is defined. The buffer pointed |
| 4517 |
* by @p address is owned by the application, and cannot be deallocated before |
| 4518 |
* @p executable is destroyed. |
| 4519 |
* |
| 4520 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 4521 |
* |
| 4522 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 4523 |
* initialized. |
| 4524 |
* |
| 4525 |
* @retval ::HSA_STATUS_ERROR_OUT_OF_RESOURCES The HSA runtime failed to |
| 4526 |
* allocate the required resources. |
| 4527 |
* |
| 4528 |
* @retval ::HSA_STATUS_ERROR_INVALID_EXECUTABLE Executable is invalid. |
| 4529 |
* |
| 4530 |
* @retval ::HSA_STATUS_ERROR_INVALID_AGENT @p agent is invalid. |
| 4531 |
* |
| 4532 |
* @retval ::HSA_STATUS_ERROR_VARIABLE_ALREADY_DEFINED The variable is |
| 4533 |
* already defined. |
| 4534 |
* |
| 4535 |
* @retval ::HSA_STATUS_ERROR_INVALID_SYMBOL_NAME There is no variable with the |
| 4536 |
* @p variable_name. |
| 4537 |
* |
| 4538 |
* @retval ::HSA_STATUS_ERROR_FROZEN_EXECUTABLE @p executable is frozen. |
| 4539 |
* |
| 4540 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p variable_name is NULL. |
| 4541 |
*/ |
| 4542 |
hsa_status_t HSA_API hsa_executable_readonly_variable_define( |
| 4543 |
hsa_executable_t executable, |
| 4544 |
hsa_agent_t agent, |
| 4545 |
const char *variable_name, |
| 4546 |
void *address); |
| 4547 |
|
| 4548 |
/** |
| 4549 |
* @brief Validate an executable. Checks that all code objects have matching |
| 4550 |
* machine model, profile, and default floating-point rounding mode. Checks that |
| 4551 |
* all declarations have definitions. Checks declaration-definition |
| 4552 |
* compatibility (see the HSA Programming Reference Manual for compatibility |
| 4553 |
* rules). Invoking this function is equivalent to invoking |
| 4554 |
* ::hsa_executable_validate_alt with no options. |
| 4555 |
* |
| 4556 |
* @param[in] executable Executable. Must be in frozen state. |
| 4557 |
* |
| 4558 |
* @param[out] result Memory location where the HSA runtime stores the |
| 4559 |
* validation result. If the executable passes validation, the result is 0. |
| 4560 |
* |
| 4561 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 4562 |
* |
| 4563 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 4564 |
* initialized. |
| 4565 |
* |
| 4566 |
* @retval ::HSA_STATUS_ERROR_INVALID_EXECUTABLE @p executable is invalid. |
| 4567 |
* |
| 4568 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p result is NULL. |
| 4569 |
*/ |
| 4570 |
hsa_status_t HSA_API hsa_executable_validate( |
| 4571 |
hsa_executable_t executable, |
| 4572 |
uint32_t *result); |
| 4573 |
|
| 4574 |
/** |
| 4575 |
* @brief Validate an executable. Checks that all code objects have matching |
| 4576 |
* machine model, profile, and default floating-point rounding mode. Checks that |
| 4577 |
* all declarations have definitions. Checks declaration-definition |
| 4578 |
* compatibility (see the HSA Programming Reference Manual for compatibility |
| 4579 |
* rules). |
| 4580 |
* |
| 4581 |
* @param[in] executable Executable. Must be in frozen state. |
| 4582 |
* |
| 4583 |
* @param[in] options Standard and vendor-specific options. Unknown options are |
| 4584 |
* ignored. A standard option begins with the "-hsa_" prefix. Options beginning |
| 4585 |
* with the "-hsa_ext_<extension_name>_" prefix are reserved for extensions. A |
| 4586 |
* vendor-specific option begins with the "-<vendor_name>_" prefix. Must be a |
| 4587 |
* NUL-terminated string. May be NULL. |
| 4588 |
* |
| 4589 |
* @param[out] result Memory location where the HSA runtime stores the |
| 4590 |
* validation result. If the executable passes validation, the result is 0. |
| 4591 |
* |
| 4592 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 4593 |
* |
| 4594 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 4595 |
* initialized. |
| 4596 |
* |
| 4597 |
* @retval ::HSA_STATUS_ERROR_INVALID_EXECUTABLE @p executable is invalid. |
| 4598 |
* |
| 4599 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p result is NULL. |
| 4600 |
*/ |
| 4601 |
hsa_status_t HSA_API hsa_executable_validate_alt( |
| 4602 |
hsa_executable_t executable, |
| 4603 |
const char *options, |
| 4604 |
uint32_t *result); |
| 4605 |
|
| 4606 |
/** |
| 4607 |
* @brief Executable symbol handle. |
| 4608 |
* |
| 4609 |
* The lifetime of an executable object symbol matches that of the executable |
| 4610 |
* associated with it. An operation on a symbol whose associated executable has |
| 4611 |
* been destroyed results in undefined behavior. |
| 4612 |
*/ |
| 4613 |
typedef struct hsa_executable_symbol_s { |
| 4614 |
/** |
| 4615 |
* Opaque handle. Two handles reference the same object of the enclosing type |
| 4616 |
* if and only if they are equal. |
| 4617 |
*/ |
| 4618 |
uint64_t handle; |
| 4619 |
} hsa_executable_symbol_t; |
| 4620 |
|
| 4621 |
/** |
| 4622 |
* @deprecated Use ::hsa_executable_get_symbol_by_name instead. |
| 4623 |
* |
| 4624 |
* @brief Get the symbol handle for a given a symbol name. |
| 4625 |
* |
| 4626 |
* @param[in] executable Executable. |
| 4627 |
* |
| 4628 |
* @param[in] module_name Module name. Must be NULL if the symbol has |
| 4629 |
* program linkage. |
| 4630 |
* |
| 4631 |
* @param[in] symbol_name Symbol name. |
| 4632 |
* |
| 4633 |
* @param[in] agent Agent associated with the symbol. If the symbol is |
| 4634 |
* independent of any agent (for example, a variable with program |
| 4635 |
* allocation), this argument is ignored. |
| 4636 |
* |
| 4637 |
* @param[in] call_convention Call convention associated with the symbol. If the |
| 4638 |
* symbol does not correspond to an indirect function, this argument is ignored. |
| 4639 |
* |
| 4640 |
* @param[out] symbol Memory location where the HSA runtime stores the symbol |
| 4641 |
* handle. |
| 4642 |
* |
| 4643 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 4644 |
* |
| 4645 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 4646 |
* initialized. |
| 4647 |
* |
| 4648 |
* @retval ::HSA_STATUS_ERROR_INVALID_EXECUTABLE The executable is invalid. |
| 4649 |
* |
| 4650 |
* @retval ::HSA_STATUS_ERROR_INVALID_SYMBOL_NAME There is no symbol with a name |
| 4651 |
* that matches @p symbol_name. |
| 4652 |
* |
| 4653 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p symbol_name is NULL, or |
| 4654 |
* @p symbol is NULL. |
| 4655 |
*/ |
| 4656 |
hsa_status_t HSA_API HSA_DEPRECATED hsa_executable_get_symbol( |
| 4657 |
hsa_executable_t executable, |
| 4658 |
const char *module_name, |
| 4659 |
const char *symbol_name, |
| 4660 |
hsa_agent_t agent, |
| 4661 |
int32_t call_convention, |
| 4662 |
hsa_executable_symbol_t *symbol); |
| 4663 |
|
| 4664 |
/** |
| 4665 |
* @brief Retrieve the symbol handle corresponding to a given a symbol name. |
| 4666 |
* |
| 4667 |
* @param[in] executable Executable. |
| 4668 |
* |
| 4669 |
* @param[in] symbol_name Symbol name. Must be a NUL-terminated character |
| 4670 |
* array. The Programmer's Reference Manual describes the standard name mangling |
| 4671 |
* scheme. |
| 4672 |
* |
| 4673 |
* @param[in] agent Pointer to the agent for which the symbol with the given |
| 4674 |
* name is defined. If the symbol corresponding to the given name has program |
| 4675 |
* allocation, @p agent must be NULL. |
| 4676 |
* |
| 4677 |
* @param[out] symbol Memory location where the HSA runtime stores the symbol |
| 4678 |
* handle. Must not be NULL. |
| 4679 |
* |
| 4680 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 4681 |
* |
| 4682 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 4683 |
* initialized. |
| 4684 |
* |
| 4685 |
* @retval ::HSA_STATUS_ERROR_INVALID_EXECUTABLE The executable is invalid. |
| 4686 |
* |
| 4687 |
* @retval ::HSA_STATUS_ERROR_INVALID_SYMBOL_NAME There is no symbol with a name |
| 4688 |
* that matches @p symbol_name. |
| 4689 |
* |
| 4690 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p symbol_name is NULL, or @p |
| 4691 |
* symbol is NULL. |
| 4692 |
*/ |
| 4693 |
hsa_status_t HSA_API hsa_executable_get_symbol_by_name( |
| 4694 |
hsa_executable_t executable, |
| 4695 |
const char *symbol_name, |
| 4696 |
const hsa_agent_t *agent, |
| 4697 |
hsa_executable_symbol_t *symbol); |
| 4698 |
|
| 4699 |
/** |
| 4700 |
* @brief Symbol type. |
| 4701 |
*/ |
| 4702 |
typedef enum { |
| 4703 |
/** |
| 4704 |
* Variable. |
| 4705 |
*/ |
| 4706 |
HSA_SYMBOL_KIND_VARIABLE = 0, |
| 4707 |
/** |
| 4708 |
* Kernel. |
| 4709 |
*/ |
| 4710 |
HSA_SYMBOL_KIND_KERNEL = 1, |
| 4711 |
/** |
| 4712 |
* Indirect function. |
| 4713 |
*/ |
| 4714 |
HSA_SYMBOL_KIND_INDIRECT_FUNCTION = 2 |
| 4715 |
} hsa_symbol_kind_t; |
| 4716 |
|
| 4717 |
/** |
| 4718 |
* @brief Linkage type of a symbol. |
| 4719 |
*/ |
| 4720 |
typedef enum { |
| 4721 |
/** |
| 4722 |
* Module linkage. |
| 4723 |
*/ |
| 4724 |
HSA_SYMBOL_LINKAGE_MODULE = 0, |
| 4725 |
/** |
| 4726 |
* Program linkage. |
| 4727 |
*/ |
| 4728 |
HSA_SYMBOL_LINKAGE_PROGRAM = 1 |
| 4729 |
} hsa_symbol_linkage_t; |
| 4730 |
|
| 4731 |
/** |
| 4732 |
* @brief Allocation type of a variable. |
| 4733 |
*/ |
| 4734 |
typedef enum { |
| 4735 |
/** |
| 4736 |
* Agent allocation. |
| 4737 |
*/ |
| 4738 |
HSA_VARIABLE_ALLOCATION_AGENT = 0, |
| 4739 |
/** |
| 4740 |
* Program allocation. |
| 4741 |
*/ |
| 4742 |
HSA_VARIABLE_ALLOCATION_PROGRAM = 1 |
| 4743 |
} hsa_variable_allocation_t; |
| 4744 |
|
| 4745 |
/** |
| 4746 |
* @brief Memory segment associated with a variable. |
| 4747 |
*/ |
| 4748 |
typedef enum { |
| 4749 |
/** |
| 4750 |
* Global memory segment. |
| 4751 |
*/ |
| 4752 |
HSA_VARIABLE_SEGMENT_GLOBAL = 0, |
| 4753 |
/** |
| 4754 |
* Readonly memory segment. |
| 4755 |
*/ |
| 4756 |
HSA_VARIABLE_SEGMENT_READONLY = 1 |
| 4757 |
} hsa_variable_segment_t; |
| 4758 |
|
| 4759 |
/** |
| 4760 |
* @brief Executable symbol attributes. |
| 4761 |
*/ |
| 4762 |
typedef enum { |
| 4763 |
/** |
| 4764 |
* The kind of the symbol. The type of this attribute is ::hsa_symbol_kind_t. |
| 4765 |
*/ |
| 4766 |
HSA_EXECUTABLE_SYMBOL_INFO_TYPE = 0, |
| 4767 |
/** |
| 4768 |
* The length of the symbol name in bytes, not including the NUL terminator. |
| 4769 |
* The type of this attribute is uint32_t. |
| 4770 |
*/ |
| 4771 |
HSA_EXECUTABLE_SYMBOL_INFO_NAME_LENGTH = 1, |
| 4772 |
/** |
| 4773 |
* The name of the symbol. The type of this attribute is character array with |
| 4774 |
* the length equal to the value of ::HSA_EXECUTABLE_SYMBOL_INFO_NAME_LENGTH |
| 4775 |
* attribute. |
| 4776 |
*/ |
| 4777 |
HSA_EXECUTABLE_SYMBOL_INFO_NAME = 2, |
| 4778 |
/** |
| 4779 |
* @deprecated |
| 4780 |
* |
| 4781 |
* The length of the module name in bytes (not including the NUL terminator) |
| 4782 |
* to which this symbol belongs if this symbol has module linkage, otherwise 0 |
| 4783 |
* is returned. The type of this attribute is uint32_t. |
| 4784 |
*/ |
| 4785 |
HSA_EXECUTABLE_SYMBOL_INFO_MODULE_NAME_LENGTH = 3, |
| 4786 |
/** |
| 4787 |
* @deprecated |
| 4788 |
* |
| 4789 |
* The module name to which this symbol belongs if this symbol has module |
| 4790 |
* linkage, otherwise an empty string is returned. The type of this attribute |
| 4791 |
* is character array with the length equal to the value of |
| 4792 |
* ::HSA_EXECUTABLE_SYMBOL_INFO_MODULE_NAME_LENGTH attribute. |
| 4793 |
*/ |
| 4794 |
HSA_EXECUTABLE_SYMBOL_INFO_MODULE_NAME = 4, |
| 4795 |
/** |
| 4796 |
* @deprecated |
| 4797 |
* |
| 4798 |
* Agent associated with this symbol. If the symbol is a variable, the |
| 4799 |
* value of this attribute is only defined if |
| 4800 |
* ::HSA_EXECUTABLE_SYMBOL_INFO_VARIABLE_ALLOCATION is |
| 4801 |
* ::HSA_VARIABLE_ALLOCATION_AGENT. The type of this attribute is hsa_agent_t. |
| 4802 |
*/ |
| 4803 |
HSA_EXECUTABLE_SYMBOL_INFO_AGENT = 20, |
| 4804 |
/** |
| 4805 |
* The address of the variable. The value of this attribute is undefined if |
| 4806 |
* the symbol is not a variable. The type of this attribute is uint64_t. |
| 4807 |
* |
| 4808 |
* If executable's state is ::HSA_EXECUTABLE_STATE_UNFROZEN, then 0 is |
| 4809 |
* returned. |
| 4810 |
*/ |
| 4811 |
HSA_EXECUTABLE_SYMBOL_INFO_VARIABLE_ADDRESS = 21, |
| 4812 |
/** |
| 4813 |
* The linkage kind of the symbol. The type of this attribute is |
| 4814 |
* ::hsa_symbol_linkage_t. |
| 4815 |
*/ |
| 4816 |
HSA_EXECUTABLE_SYMBOL_INFO_LINKAGE = 5, |
| 4817 |
/** |
| 4818 |
* Indicates whether the symbol corresponds to a definition. The type of this |
| 4819 |
* attribute is bool. |
| 4820 |
*/ |
| 4821 |
HSA_EXECUTABLE_SYMBOL_INFO_IS_DEFINITION = 17, |
| 4822 |
/** |
| 4823 |
* @deprecated |
| 4824 |
* |
| 4825 |
* The allocation kind of the variable. The value of this attribute is |
| 4826 |
* undefined if the symbol is not a variable. The type of this attribute is |
| 4827 |
* ::hsa_variable_allocation_t. |
| 4828 |
*/ |
| 4829 |
HSA_EXECUTABLE_SYMBOL_INFO_VARIABLE_ALLOCATION = 6, |
| 4830 |
/** |
| 4831 |
* @deprecated |
| 4832 |
* |
| 4833 |
* The segment kind of the variable. The value of this attribute is undefined |
| 4834 |
* if the symbol is not a variable. The type of this attribute is |
| 4835 |
* ::hsa_variable_segment_t. |
| 4836 |
*/ |
| 4837 |
HSA_EXECUTABLE_SYMBOL_INFO_VARIABLE_SEGMENT = 7, |
| 4838 |
/** |
| 4839 |
* @deprecated |
| 4840 |
* |
| 4841 |
* Alignment of the symbol in memory. The value of this attribute is undefined |
| 4842 |
* if the symbol is not a variable. The type of this attribute is uint32_t. |
| 4843 |
* |
| 4844 |
* The current alignment of the variable in memory may be greater than the |
| 4845 |
* value specified in the source program variable declaration. |
| 4846 |
*/ |
| 4847 |
HSA_EXECUTABLE_SYMBOL_INFO_VARIABLE_ALIGNMENT = 8, |
| 4848 |
/** |
| 4849 |
* @deprecated |
| 4850 |
* |
| 4851 |
* Size of the variable. The value of this attribute is undefined if |
| 4852 |
* the symbol is not a variable. The type of this attribute is uint32_t. |
| 4853 |
* |
| 4854 |
* A value of 0 is returned if the variable is an external variable and has an |
| 4855 |
* unknown dimension. |
| 4856 |
*/ |
| 4857 |
HSA_EXECUTABLE_SYMBOL_INFO_VARIABLE_SIZE = 9, |
| 4858 |
/** |
| 4859 |
* @deprecated |
| 4860 |
* |
| 4861 |
* Indicates whether the variable is constant. The value of this attribute is |
| 4862 |
* undefined if the symbol is not a variable. The type of this attribute is |
| 4863 |
* bool. |
| 4864 |
*/ |
| 4865 |
HSA_EXECUTABLE_SYMBOL_INFO_VARIABLE_IS_CONST = 10, |
| 4866 |
/** |
| 4867 |
* Kernel object handle, used in the kernel dispatch packet. The value of this |
| 4868 |
* attribute is undefined if the symbol is not a kernel. The type of this |
| 4869 |
* attribute is uint64_t. |
| 4870 |
* |
| 4871 |
* If the state of the executable is ::HSA_EXECUTABLE_STATE_UNFROZEN, then 0 |
| 4872 |
* is returned. |
| 4873 |
*/ |
| 4874 |
HSA_EXECUTABLE_SYMBOL_INFO_KERNEL_OBJECT = 22, |
| 4875 |
/** |
| 4876 |
* Size of kernarg segment memory that is required to hold the values of the |
| 4877 |
* kernel arguments, in bytes. Must be a multiple of 16. The value of this |
| 4878 |
* attribute is undefined if the symbol is not a kernel. The type of this |
| 4879 |
* attribute is uint32_t. |
| 4880 |
*/ |
| 4881 |
HSA_EXECUTABLE_SYMBOL_INFO_KERNEL_KERNARG_SEGMENT_SIZE = 11, |
| 4882 |
/** |
| 4883 |
* Alignment (in bytes) of the buffer used to pass arguments to the kernel, |
| 4884 |
* which is the maximum of 16 and the maximum alignment of any of the kernel |
| 4885 |
* arguments. The value of this attribute is undefined if the symbol is not a |
| 4886 |
* kernel. The type of this attribute is uint32_t. |
| 4887 |
*/ |
| 4888 |
HSA_EXECUTABLE_SYMBOL_INFO_KERNEL_KERNARG_SEGMENT_ALIGNMENT = 12, |
| 4889 |
/** |
| 4890 |
* Size of static group segment memory required by the kernel (per |
| 4891 |
* work-group), in bytes. The value of this attribute is undefined |
| 4892 |
* if the symbol is not a kernel. The type of this attribute is uint32_t. |
| 4893 |
* |
| 4894 |
* The reported amount does not include any dynamically allocated group |
| 4895 |
* segment memory that may be requested by the application when a kernel is |
| 4896 |
* dispatched. |
| 4897 |
*/ |
| 4898 |
HSA_EXECUTABLE_SYMBOL_INFO_KERNEL_GROUP_SEGMENT_SIZE = 13, |
| 4899 |
/** |
| 4900 |
* Size of static private, spill, and arg segment memory required by |
| 4901 |
* this kernel (per work-item), in bytes. The value of this attribute is |
| 4902 |
* undefined if the symbol is not a kernel. The type of this attribute is |
| 4903 |
* uint32_t. |
| 4904 |
* |
| 4905 |
* If the value of ::HSA_EXECUTABLE_SYMBOL_INFO_KERNEL_DYNAMIC_CALLSTACK is |
| 4906 |
* true, the kernel may use more private memory than the reported value, and |
| 4907 |
* the application must add the dynamic call stack usage to @a |
| 4908 |
* private_segment_size when populating a kernel dispatch packet. |
| 4909 |
*/ |
| 4910 |
HSA_EXECUTABLE_SYMBOL_INFO_KERNEL_PRIVATE_SEGMENT_SIZE = 14, |
| 4911 |
/** |
| 4912 |
* Dynamic callstack flag. The value of this attribute is undefined if the |
| 4913 |
* symbol is not a kernel. The type of this attribute is bool. |
| 4914 |
* |
| 4915 |
* If this flag is set (the value is true), the kernel uses a dynamically |
| 4916 |
* sized call stack. This can happen if recursive calls, calls to indirect |
| 4917 |
* functions, or the HSAIL alloca instruction are present in the kernel. |
| 4918 |
*/ |
| 4919 |
HSA_EXECUTABLE_SYMBOL_INFO_KERNEL_DYNAMIC_CALLSTACK = 15, |
| 4920 |
/** |
| 4921 |
* @deprecated |
| 4922 |
* |
| 4923 |
* Call convention of the kernel. The value of this attribute is undefined if |
| 4924 |
* the symbol is not a kernel. The type of this attribute is uint32_t. |
| 4925 |
*/ |
| 4926 |
HSA_EXECUTABLE_SYMBOL_INFO_KERNEL_CALL_CONVENTION = 18, |
| 4927 |
/** |
| 4928 |
* Indirect function object handle. The value of this attribute is undefined |
| 4929 |
* if the symbol is not an indirect function, or the associated agent does |
| 4930 |
* not support the Full Profile. The type of this attribute depends on the |
| 4931 |
* machine model: the type is uint32_t for small machine model, and uint64_t |
| 4932 |
* for large model. |
| 4933 |
* |
| 4934 |
* If the state of the executable is ::HSA_EXECUTABLE_STATE_UNFROZEN, then 0 |
| 4935 |
* is returned. |
| 4936 |
*/ |
| 4937 |
HSA_EXECUTABLE_SYMBOL_INFO_INDIRECT_FUNCTION_OBJECT = 23, |
| 4938 |
/** |
| 4939 |
* @deprecated |
| 4940 |
* |
| 4941 |
* Call convention of the indirect function. The value of this attribute is |
| 4942 |
* undefined if the symbol is not an indirect function, or the associated |
| 4943 |
* agent does not support the Full Profile. The type of this attribute is |
| 4944 |
* uint32_t. |
| 4945 |
*/ |
| 4946 |
HSA_EXECUTABLE_SYMBOL_INFO_INDIRECT_FUNCTION_CALL_CONVENTION = 16 |
| 4947 |
} hsa_executable_symbol_info_t; |
| 4948 |
|
| 4949 |
/** |
| 4950 |
* @brief Get the current value of an attribute for a given executable symbol. |
| 4951 |
* |
| 4952 |
* @param[in] executable_symbol Executable symbol. |
| 4953 |
* |
| 4954 |
* @param[in] attribute Attribute to query. |
| 4955 |
* |
| 4956 |
* @param[out] value Pointer to an application-allocated buffer where to store |
| 4957 |
* the value of the attribute. If the buffer passed by the application is not |
| 4958 |
* large enough to hold the value of @p attribute, the behavior is undefined. |
| 4959 |
* |
| 4960 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 4961 |
* |
| 4962 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 4963 |
* initialized. |
| 4964 |
* |
| 4965 |
* @retval ::HSA_STATUS_ERROR_INVALID_EXECUTABLE_SYMBOL The executable symbol is |
| 4966 |
* invalid. |
| 4967 |
* |
| 4968 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p attribute is an invalid |
| 4969 |
* executable symbol attribute, or @p value is NULL. |
| 4970 |
*/ |
| 4971 |
hsa_status_t HSA_API hsa_executable_symbol_get_info( |
| 4972 |
hsa_executable_symbol_t executable_symbol, |
| 4973 |
hsa_executable_symbol_info_t attribute, |
| 4974 |
void *value); |
| 4975 |
|
| 4976 |
/** |
| 4977 |
* @deprecated |
| 4978 |
* |
| 4979 |
* @brief Iterate over the symbols in a executable, and invoke an |
| 4980 |
* application-defined callback on every iteration. |
| 4981 |
* |
| 4982 |
* @param[in] executable Executable. |
| 4983 |
* |
| 4984 |
* @param[in] callback Callback to be invoked once per executable symbol. The |
| 4985 |
* HSA runtime passes three arguments to the callback: the executable, a symbol, |
| 4986 |
* and the application data. If @p callback returns a status other than |
| 4987 |
* ::HSA_STATUS_SUCCESS for a particular iteration, the traversal stops and |
| 4988 |
* ::hsa_executable_iterate_symbols returns that status value. |
| 4989 |
* |
| 4990 |
* @param[in] data Application data that is passed to @p callback on every |
| 4991 |
* iteration. May be NULL. |
| 4992 |
* |
| 4993 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 4994 |
* |
| 4995 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 4996 |
* initialized. |
| 4997 |
* |
| 4998 |
* @retval ::HSA_STATUS_ERROR_INVALID_EXECUTABLE The executable is invalid. |
| 4999 |
* |
| 5000 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p callback is NULL. |
| 5001 |
*/ |
| 5002 |
hsa_status_t HSA_API HSA_DEPRECATED hsa_executable_iterate_symbols( |
| 5003 |
hsa_executable_t executable, |
| 5004 |
hsa_status_t (*callback)(hsa_executable_t exec, |
| 5005 |
hsa_executable_symbol_t symbol, |
| 5006 |
void *data), |
| 5007 |
void *data); |
| 5008 |
|
| 5009 |
/** |
| 5010 |
* @brief Iterate over the kernels, indirect functions, and agent allocation |
| 5011 |
* variables in an executable for a given agent, and invoke an application- |
| 5012 |
* defined callback on every iteration. |
| 5013 |
* |
| 5014 |
* @param[in] executable Executable. |
| 5015 |
* |
| 5016 |
* @param[in] agent Agent. |
| 5017 |
* |
| 5018 |
* @param[in] callback Callback to be invoked once per executable symbol. The |
| 5019 |
* HSA runtime passes three arguments to the callback: the executable, a symbol, |
| 5020 |
* and the application data. If @p callback returns a status other than |
| 5021 |
* ::HSA_STATUS_SUCCESS for a particular iteration, the traversal stops and |
| 5022 |
* ::hsa_executable_iterate_symbols returns that status value. |
| 5023 |
* |
| 5024 |
* @param[in] data Application data that is passed to @p callback on every |
| 5025 |
* iteration. May be NULL. |
| 5026 |
* |
| 5027 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 5028 |
* |
| 5029 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 5030 |
* initialized. |
| 5031 |
* |
| 5032 |
* @retval ::HSA_STATUS_ERROR_INVALID_EXECUTABLE The executable is invalid. |
| 5033 |
* |
| 5034 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p callback is NULL. |
| 5035 |
*/ |
| 5036 |
hsa_status_t HSA_API hsa_executable_iterate_agent_symbols( |
| 5037 |
hsa_executable_t executable, |
| 5038 |
hsa_agent_t agent, |
| 5039 |
hsa_status_t (*callback)(hsa_executable_t exec, |
| 5040 |
hsa_agent_t agent, |
| 5041 |
hsa_executable_symbol_t symbol, |
| 5042 |
void *data), |
| 5043 |
void *data); |
| 5044 |
|
| 5045 |
/** |
| 5046 |
* @brief Iterate over the program allocation variables in an executable, and |
| 5047 |
* invoke an application-defined callback on every iteration. |
| 5048 |
* |
| 5049 |
* @param[in] executable Executable. |
| 5050 |
* |
| 5051 |
* @param[in] callback Callback to be invoked once per executable symbol. The |
| 5052 |
* HSA runtime passes three arguments to the callback: the executable, a symbol, |
| 5053 |
* and the application data. If @p callback returns a status other than |
| 5054 |
* ::HSA_STATUS_SUCCESS for a particular iteration, the traversal stops and |
| 5055 |
* ::hsa_executable_iterate_symbols returns that status value. |
| 5056 |
* |
| 5057 |
* @param[in] data Application data that is passed to @p callback on every |
| 5058 |
* iteration. May be NULL. |
| 5059 |
* |
| 5060 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 5061 |
* |
| 5062 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 5063 |
* initialized. |
| 5064 |
* |
| 5065 |
* @retval ::HSA_STATUS_ERROR_INVALID_EXECUTABLE The executable is invalid. |
| 5066 |
* |
| 5067 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p callback is NULL. |
| 5068 |
*/ |
| 5069 |
hsa_status_t HSA_API hsa_executable_iterate_program_symbols( |
| 5070 |
hsa_executable_t executable, |
| 5071 |
hsa_status_t (*callback)(hsa_executable_t exec, |
| 5072 |
hsa_executable_symbol_t symbol, |
| 5073 |
void *data), |
| 5074 |
void *data); |
| 5075 |
|
| 5076 |
/** @} */ |
| 5077 |
|
| 5078 |
|
| 5079 |
/** \defgroup code-object Code Objects (deprecated). |
| 5080 |
* @{ |
| 5081 |
*/ |
| 5082 |
|
| 5083 |
/** |
| 5084 |
* @deprecated |
| 5085 |
* |
| 5086 |
* @brief Struct containing an opaque handle to a code object, which contains |
| 5087 |
* ISA for finalized kernels and indirect functions together with information |
| 5088 |
* about the global or readonly segment variables they reference. |
| 5089 |
*/ |
| 5090 |
typedef struct hsa_code_object_s { |
| 5091 |
/** |
| 5092 |
* Opaque handle. Two handles reference the same object of the enclosing type |
| 5093 |
* if and only if they are equal. |
| 5094 |
*/ |
| 5095 |
uint64_t handle; |
| 5096 |
} hsa_code_object_t; |
| 5097 |
|
| 5098 |
/** |
| 5099 |
* @deprecated |
| 5100 |
* |
| 5101 |
* @brief Application data handle that is passed to the serialization |
| 5102 |
* and deserialization functions. |
| 5103 |
*/ |
| 5104 |
typedef struct hsa_callback_data_s { |
| 5105 |
/** |
| 5106 |
* Opaque handle. |
| 5107 |
*/ |
| 5108 |
uint64_t handle; |
| 5109 |
} hsa_callback_data_t; |
| 5110 |
|
| 5111 |
/** |
| 5112 |
* @deprecated |
| 5113 |
* |
| 5114 |
* @brief Serialize a code object. Can be used for offline finalization, |
| 5115 |
* install-time finalization, disk code caching, etc. |
| 5116 |
* |
| 5117 |
* @param[in] code_object Code object. |
| 5118 |
* |
| 5119 |
* @param[in] alloc_callback Callback function for memory allocation. Must not |
| 5120 |
* be NULL. The HSA runtime passes three arguments to the callback: the |
| 5121 |
* allocation size, the application data, and a pointer to a memory location |
| 5122 |
* where the application stores the allocation result. The HSA runtime invokes |
| 5123 |
* @p alloc_callback once to allocate a buffer that contains the serialized |
| 5124 |
* version of @p code_object. If the callback returns a status code other than |
| 5125 |
* ::HSA_STATUS_SUCCESS, this function returns the same code. |
| 5126 |
* |
| 5127 |
* @param[in] callback_data Application data that is passed to @p |
| 5128 |
* alloc_callback. May be NULL. |
| 5129 |
* |
| 5130 |
* @param[in] options Standard and vendor-specific options. Unknown options are |
| 5131 |
* ignored. A standard option begins with the "-hsa_" prefix. Options beginning |
| 5132 |
* with the "-hsa_ext_<extension_name>_" prefix are reserved for extensions. A |
| 5133 |
* vendor-specific option begins with the "-<vendor_name>_" prefix. Must be a |
| 5134 |
* NUL-terminated string. May be NULL. |
| 5135 |
* |
| 5136 |
* @param[out] serialized_code_object Memory location where the HSA runtime |
| 5137 |
* stores a pointer to the serialized code object. Must not be NULL. |
| 5138 |
* |
| 5139 |
* @param[out] serialized_code_object_size Memory location where the HSA runtime |
| 5140 |
* stores the size (in bytes) of @p serialized_code_object. The returned value |
| 5141 |
* matches the allocation size passed by the HSA runtime to @p |
| 5142 |
* alloc_callback. Must not be NULL. |
| 5143 |
* |
| 5144 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 5145 |
* |
| 5146 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 5147 |
* initialized. |
| 5148 |
* |
| 5149 |
* @retval ::HSA_STATUS_ERROR_OUT_OF_RESOURCES The HSA runtime failed to |
| 5150 |
* allocate the required resources. |
| 5151 |
* |
| 5152 |
* @retval ::HSA_STATUS_ERROR_INVALID_CODE_OBJECT @p code_object is invalid. |
| 5153 |
* |
| 5154 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p alloc_callback, @p |
| 5155 |
* serialized_code_object, or @p serialized_code_object_size are NULL. |
| 5156 |
*/ |
| 5157 |
hsa_status_t HSA_API HSA_DEPRECATED hsa_code_object_serialize( |
| 5158 |
hsa_code_object_t code_object, |
| 5159 |
hsa_status_t (*alloc_callback)(size_t size, |
| 5160 |
hsa_callback_data_t data, |
| 5161 |
void **address), |
| 5162 |
hsa_callback_data_t callback_data, |
| 5163 |
const char *options, |
| 5164 |
void **serialized_code_object, |
| 5165 |
size_t *serialized_code_object_size); |
| 5166 |
|
| 5167 |
/** |
| 5168 |
* @deprecated |
| 5169 |
* |
| 5170 |
* @brief Deserialize a code object. |
| 5171 |
* |
| 5172 |
* @param[in] serialized_code_object A serialized code object. Must not be NULL. |
| 5173 |
* |
| 5174 |
* @param[in] serialized_code_object_size The size (in bytes) of @p |
| 5175 |
* serialized_code_object. Must not be 0. |
| 5176 |
* |
| 5177 |
* @param[in] options Standard and vendor-specific options. Unknown options are |
| 5178 |
* ignored. A standard option begins with the "-hsa_" prefix. Options beginning |
| 5179 |
* with the "-hsa_ext_<extension_name>_" prefix are reserved for extensions. A |
| 5180 |
* vendor-specific option begins with the "-<vendor_name>_" prefix. Must be a |
| 5181 |
* NUL-terminated string. May be NULL. |
| 5182 |
* |
| 5183 |
* @param[out] code_object Memory location where the HSA runtime stores the |
| 5184 |
* deserialized code object. |
| 5185 |
* |
| 5186 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 5187 |
* |
| 5188 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 5189 |
* initialized. |
| 5190 |
* |
| 5191 |
* @retval ::HSA_STATUS_ERROR_OUT_OF_RESOURCES The HSA runtime failed to |
| 5192 |
* allocate the required resources. |
| 5193 |
* |
| 5194 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p serialized_code_object, or @p |
| 5195 |
* code_object are NULL, or @p serialized_code_object_size is 0. |
| 5196 |
*/ |
| 5197 |
hsa_status_t HSA_API HSA_DEPRECATED hsa_code_object_deserialize( |
| 5198 |
void *serialized_code_object, |
| 5199 |
size_t serialized_code_object_size, |
| 5200 |
const char *options, |
| 5201 |
hsa_code_object_t *code_object); |
| 5202 |
|
| 5203 |
/** |
| 5204 |
* @deprecated |
| 5205 |
* |
| 5206 |
* @brief Destroy a code object. |
| 5207 |
* |
| 5208 |
* @details The lifetime of a code object must exceed that of any executable |
| 5209 |
* where it has been loaded. If an executable that loaded @p code_object has not |
| 5210 |
* been destroyed, the behavior is undefined. |
| 5211 |
* |
| 5212 |
* @param[in] code_object Code object. The handle becomes invalid after it has |
| 5213 |
* been destroyed. |
| 5214 |
* |
| 5215 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 5216 |
* |
| 5217 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 5218 |
* initialized. |
| 5219 |
* |
| 5220 |
* @retval ::HSA_STATUS_ERROR_INVALID_CODE_OBJECT @p code_object is invalid. |
| 5221 |
*/ |
| 5222 |
hsa_status_t HSA_API HSA_DEPRECATED hsa_code_object_destroy( |
| 5223 |
hsa_code_object_t code_object); |
| 5224 |
|
| 5225 |
/** |
| 5226 |
* @deprecated |
| 5227 |
* |
| 5228 |
* @brief Code object type. |
| 5229 |
*/ |
| 5230 |
typedef enum { |
| 5231 |
/** |
| 5232 |
* Produces code object that contains ISA for all kernels and indirect |
| 5233 |
* functions in HSA source. |
| 5234 |
*/ |
| 5235 |
HSA_CODE_OBJECT_TYPE_PROGRAM = 0 |
| 5236 |
} hsa_code_object_type_t; |
| 5237 |
|
| 5238 |
/** |
| 5239 |
* @deprecated |
| 5240 |
* |
| 5241 |
* @brief Code object attributes. |
| 5242 |
*/ |
| 5243 |
typedef enum { |
| 5244 |
/** |
| 5245 |
* The version of the code object. The type of this attribute is a |
| 5246 |
* NUL-terminated char[64]. The name must be at most 63 characters long (not |
| 5247 |
* including the NUL terminator) and all array elements not used for the name |
| 5248 |
* must be NUL. |
| 5249 |
*/ |
| 5250 |
HSA_CODE_OBJECT_INFO_VERSION = 0, |
| 5251 |
/** |
| 5252 |
* Type of code object. The type of this attribute is |
| 5253 |
* ::hsa_code_object_type_t. |
| 5254 |
*/ |
| 5255 |
HSA_CODE_OBJECT_INFO_TYPE = 1, |
| 5256 |
/** |
| 5257 |
* Instruction set architecture this code object is produced for. The type of |
| 5258 |
* this attribute is ::hsa_isa_t. |
| 5259 |
*/ |
| 5260 |
HSA_CODE_OBJECT_INFO_ISA = 2, |
| 5261 |
/** |
| 5262 |
* Machine model this code object is produced for. The type of this attribute |
| 5263 |
* is ::hsa_machine_model_t. |
| 5264 |
*/ |
| 5265 |
HSA_CODE_OBJECT_INFO_MACHINE_MODEL = 3, |
| 5266 |
/** |
| 5267 |
* Profile this code object is produced for. The type of this attribute is |
| 5268 |
* ::hsa_profile_t. |
| 5269 |
*/ |
| 5270 |
HSA_CODE_OBJECT_INFO_PROFILE = 4, |
| 5271 |
/** |
| 5272 |
* Default floating-point rounding mode used when the code object is |
| 5273 |
* produced. The type of this attribute is |
| 5274 |
* ::hsa_default_float_rounding_mode_t. |
| 5275 |
*/ |
| 5276 |
HSA_CODE_OBJECT_INFO_DEFAULT_FLOAT_ROUNDING_MODE = 5 |
| 5277 |
} hsa_code_object_info_t; |
| 5278 |
|
| 5279 |
/** |
| 5280 |
* @deprecated |
| 5281 |
* |
| 5282 |
* @brief Get the current value of an attribute for a given code object. |
| 5283 |
* |
| 5284 |
* @param[in] code_object Code object. |
| 5285 |
* |
| 5286 |
* @param[in] attribute Attribute to query. |
| 5287 |
* |
| 5288 |
* @param[out] value Pointer to an application-allocated buffer where to store |
| 5289 |
* the value of the attribute. If the buffer passed by the application is not |
| 5290 |
* large enough to hold the value of @p attribute, the behavior is undefined. |
| 5291 |
* |
| 5292 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 5293 |
* |
| 5294 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 5295 |
* initialized. |
| 5296 |
* |
| 5297 |
* @retval ::HSA_STATUS_ERROR_INVALID_CODE_OBJECT @p code_object is invalid. |
| 5298 |
* |
| 5299 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p attribute is an invalid |
| 5300 |
* code object attribute, or @p value is NULL. |
| 5301 |
*/ |
| 5302 |
hsa_status_t HSA_API HSA_DEPRECATED hsa_code_object_get_info( |
| 5303 |
hsa_code_object_t code_object, |
| 5304 |
hsa_code_object_info_t attribute, |
| 5305 |
void *value); |
| 5306 |
|
| 5307 |
/** |
| 5308 |
* @deprecated |
| 5309 |
* |
| 5310 |
* @brief Load code object into the executable. |
| 5311 |
* |
| 5312 |
* @details Every global or readonly variable that is external must be defined |
| 5313 |
* before loading the code object. An internal global or readonly variable is |
| 5314 |
* allocated once the code object, that is being loaded, references this |
| 5315 |
* variable and this variable is not allocated. |
| 5316 |
* |
| 5317 |
* Any module linkage declaration must have been defined either by a define |
| 5318 |
* variable or by loading a code object that has a symbol with module linkage |
| 5319 |
* definition. |
| 5320 |
* |
| 5321 |
* @param[in] executable Executable. |
| 5322 |
* |
| 5323 |
* @param[in] agent Agent to load code object for. The agent must support the |
| 5324 |
* default floating-point rounding mode used by @p code_object. |
| 5325 |
* |
| 5326 |
* @param[in] code_object Code object to load. The lifetime of the code object |
| 5327 |
* must exceed that of the executable: if @p code_object is destroyed before @p |
| 5328 |
* executable, the behavior is undefined. |
| 5329 |
* |
| 5330 |
* @param[in] options Standard and vendor-specific options. Unknown options are |
| 5331 |
* ignored. A standard option begins with the "-hsa_" prefix. Options beginning |
| 5332 |
* with the "-hsa_ext_<extension_name>_" prefix are reserved for extensions. A |
| 5333 |
* vendor-specific option begins with the "-<vendor_name>_" prefix. Must be a |
| 5334 |
* NUL-terminated string. May be NULL. |
| 5335 |
* |
| 5336 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 5337 |
* |
| 5338 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 5339 |
* initialized. |
| 5340 |
* |
| 5341 |
* @retval ::HSA_STATUS_ERROR_OUT_OF_RESOURCES The HSA runtime failed to |
| 5342 |
* allocate the required resources. |
| 5343 |
* |
| 5344 |
* @retval ::HSA_STATUS_ERROR_INVALID_EXECUTABLE The executable is invalid. |
| 5345 |
* |
| 5346 |
* @retval ::HSA_STATUS_ERROR_INVALID_AGENT The agent is invalid. |
| 5347 |
* |
| 5348 |
* @retval ::HSA_STATUS_ERROR_INVALID_CODE_OBJECT @p code_object is invalid. |
| 5349 |
* |
| 5350 |
* @retval ::HSA_STATUS_ERROR_INCOMPATIBLE_ARGUMENTS @p agent is not compatible |
| 5351 |
* with @p code_object (for example, @p agent does not support the default |
| 5352 |
* floating-point rounding mode specified by @p code_object), or @p code_object |
| 5353 |
* is not compatible with @p executable (for example, @p code_object and @p |
| 5354 |
* executable have different machine models or profiles). |
| 5355 |
* |
| 5356 |
* @retval ::HSA_STATUS_ERROR_FROZEN_EXECUTABLE @p executable is frozen. |
| 5357 |
*/ |
| 5358 |
hsa_status_t HSA_API HSA_DEPRECATED hsa_executable_load_code_object( |
| 5359 |
hsa_executable_t executable, |
| 5360 |
hsa_agent_t agent, |
| 5361 |
hsa_code_object_t code_object, |
| 5362 |
const char *options); |
| 5363 |
|
| 5364 |
/** |
| 5365 |
* @deprecated |
| 5366 |
* |
| 5367 |
* @brief Code object symbol handle. |
| 5368 |
* |
| 5369 |
* The lifetime of a code object symbol matches that of the code object |
| 5370 |
* associated with it. An operation on a symbol whose associated code object has |
| 5371 |
* been destroyed results in undefined behavior. |
| 5372 |
*/ |
| 5373 |
typedef struct hsa_code_symbol_s { |
| 5374 |
/** |
| 5375 |
* Opaque handle. Two handles reference the same object of the enclosing type |
| 5376 |
* if and only if they are equal. |
| 5377 |
*/ |
| 5378 |
uint64_t handle; |
| 5379 |
} hsa_code_symbol_t; |
| 5380 |
|
| 5381 |
/** |
| 5382 |
* @deprecated |
| 5383 |
* |
| 5384 |
* @brief Get the symbol handle within a code object for a given a symbol name. |
| 5385 |
* |
| 5386 |
* @param[in] code_object Code object. |
| 5387 |
* |
| 5388 |
* @param[in] symbol_name Symbol name. |
| 5389 |
* |
| 5390 |
* @param[out] symbol Memory location where the HSA runtime stores the symbol |
| 5391 |
* handle. |
| 5392 |
* |
| 5393 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 5394 |
* |
| 5395 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 5396 |
* initialized. |
| 5397 |
* |
| 5398 |
* @retval ::HSA_STATUS_ERROR_INVALID_CODE_OBJECT @p code_object is invalid. |
| 5399 |
* |
| 5400 |
* @retval ::HSA_STATUS_ERROR_INVALID_SYMBOL_NAME There is no symbol with a name |
| 5401 |
* that matches @p symbol_name. |
| 5402 |
* |
| 5403 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p symbol_name is NULL, or |
| 5404 |
* @p symbol is NULL. |
| 5405 |
*/ |
| 5406 |
hsa_status_t HSA_API HSA_DEPRECATED hsa_code_object_get_symbol( |
| 5407 |
hsa_code_object_t code_object, |
| 5408 |
const char *symbol_name, |
| 5409 |
hsa_code_symbol_t *symbol); |
| 5410 |
|
| 5411 |
/** |
| 5412 |
* @deprecated |
| 5413 |
* |
| 5414 |
* @brief Get the symbol handle within a code object for a given a symbol name. |
| 5415 |
* |
| 5416 |
* @param[in] code_object Code object. |
| 5417 |
* |
| 5418 |
* @param[in] module_name Module name. Must be NULL if the symbol has |
| 5419 |
* program linkage. |
| 5420 |
* |
| 5421 |
* @param[in] symbol_name Symbol name. |
| 5422 |
* |
| 5423 |
* @param[out] symbol Memory location where the HSA runtime stores the symbol |
| 5424 |
* handle. |
| 5425 |
* |
| 5426 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 5427 |
* |
| 5428 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 5429 |
* initialized. |
| 5430 |
* |
| 5431 |
* @retval ::HSA_STATUS_ERROR_INVALID_CODE_OBJECT @p code_object is invalid. |
| 5432 |
* |
| 5433 |
* @retval ::HSA_STATUS_ERROR_INVALID_SYMBOL_NAME There is no symbol with a name |
| 5434 |
* that matches @p symbol_name. |
| 5435 |
* |
| 5436 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p symbol_name is NULL, or |
| 5437 |
* @p symbol is NULL. |
| 5438 |
*/ |
| 5439 |
hsa_status_t HSA_API HSA_DEPRECATED hsa_code_object_get_symbol_from_name( |
| 5440 |
hsa_code_object_t code_object, |
| 5441 |
const char *module_name, |
| 5442 |
const char *symbol_name, |
| 5443 |
hsa_code_symbol_t *symbol); |
| 5444 |
|
| 5445 |
/** |
| 5446 |
* @deprecated |
| 5447 |
* |
| 5448 |
* @brief Code object symbol attributes. |
| 5449 |
*/ |
| 5450 |
typedef enum { |
| 5451 |
/** |
| 5452 |
* The type of the symbol. The type of this attribute is ::hsa_symbol_kind_t. |
| 5453 |
*/ |
| 5454 |
HSA_CODE_SYMBOL_INFO_TYPE = 0, |
| 5455 |
/** |
| 5456 |
* The length of the symbol name in bytes, not including the NUL terminator. |
| 5457 |
* The type of this attribute is uint32_t. |
| 5458 |
*/ |
| 5459 |
HSA_CODE_SYMBOL_INFO_NAME_LENGTH = 1, |
| 5460 |
/** |
| 5461 |
* The name of the symbol. The type of this attribute is character array with |
| 5462 |
* the length equal to the value of ::HSA_CODE_SYMBOL_INFO_NAME_LENGTH |
| 5463 |
* attribute. |
| 5464 |
*/ |
| 5465 |
HSA_CODE_SYMBOL_INFO_NAME = 2, |
| 5466 |
/** |
| 5467 |
* The length of the module name in bytes (not including the NUL terminator) |
| 5468 |
* to which this symbol belongs if this symbol has module linkage, otherwise 0 |
| 5469 |
* is returned. The type of this attribute is uint32_t. |
| 5470 |
*/ |
| 5471 |
HSA_CODE_SYMBOL_INFO_MODULE_NAME_LENGTH = 3, |
| 5472 |
/** |
| 5473 |
* The module name to which this symbol belongs if this symbol has module |
| 5474 |
* linkage, otherwise an empty string is returned. The type of this attribute |
| 5475 |
* is character array with the length equal to the value of |
| 5476 |
* ::HSA_CODE_SYMBOL_INFO_MODULE_NAME_LENGTH attribute. |
| 5477 |
*/ |
| 5478 |
HSA_CODE_SYMBOL_INFO_MODULE_NAME = 4, |
| 5479 |
/** |
| 5480 |
* The linkage kind of the symbol. The type of this attribute is |
| 5481 |
* ::hsa_symbol_linkage_t. |
| 5482 |
*/ |
| 5483 |
HSA_CODE_SYMBOL_INFO_LINKAGE = 5, |
| 5484 |
/** |
| 5485 |
* Indicates whether the symbol corresponds to a definition. The type of this |
| 5486 |
* attribute is bool. |
| 5487 |
*/ |
| 5488 |
HSA_CODE_SYMBOL_INFO_IS_DEFINITION = 17, |
| 5489 |
/** |
| 5490 |
* The allocation kind of the variable. The value of this attribute is |
| 5491 |
* undefined if the symbol is not a variable. The type of this attribute is |
| 5492 |
* ::hsa_variable_allocation_t. |
| 5493 |
*/ |
| 5494 |
HSA_CODE_SYMBOL_INFO_VARIABLE_ALLOCATION = 6, |
| 5495 |
/** |
| 5496 |
* The segment kind of the variable. The value of this attribute is |
| 5497 |
* undefined if the symbol is not a variable. The type of this attribute is |
| 5498 |
* ::hsa_variable_segment_t. |
| 5499 |
*/ |
| 5500 |
HSA_CODE_SYMBOL_INFO_VARIABLE_SEGMENT = 7, |
| 5501 |
/** |
| 5502 |
* Alignment of the symbol in memory. The value of this attribute is undefined |
| 5503 |
* if the symbol is not a variable. The type of this attribute is uint32_t. |
| 5504 |
* |
| 5505 |
* The current alignment of the variable in memory may be greater than the |
| 5506 |
* value specified in the source program variable declaration. |
| 5507 |
*/ |
| 5508 |
HSA_CODE_SYMBOL_INFO_VARIABLE_ALIGNMENT = 8, |
| 5509 |
/** |
| 5510 |
* Size of the variable. The value of this attribute is undefined if the |
| 5511 |
* symbol is not a variable. The type of this attribute is uint32_t. |
| 5512 |
* |
| 5513 |
* A size of 0 is returned if the variable is an external variable and has an |
| 5514 |
* unknown dimension. |
| 5515 |
*/ |
| 5516 |
HSA_CODE_SYMBOL_INFO_VARIABLE_SIZE = 9, |
| 5517 |
/** |
| 5518 |
* Indicates whether the variable is constant. The value of this attribute is |
| 5519 |
* undefined if the symbol is not a variable. The type of this attribute is |
| 5520 |
* bool. |
| 5521 |
*/ |
| 5522 |
HSA_CODE_SYMBOL_INFO_VARIABLE_IS_CONST = 10, |
| 5523 |
/** |
| 5524 |
* Size of kernarg segment memory that is required to hold the values of the |
| 5525 |
* kernel arguments, in bytes. Must be a multiple of 16. The value of this |
| 5526 |
* attribute is undefined if the symbol is not a kernel. The type of this |
| 5527 |
* attribute is uint32_t. |
| 5528 |
*/ |
| 5529 |
HSA_CODE_SYMBOL_INFO_KERNEL_KERNARG_SEGMENT_SIZE = 11, |
| 5530 |
/** |
| 5531 |
* Alignment (in bytes) of the buffer used to pass arguments to the kernel, |
| 5532 |
* which is the maximum of 16 and the maximum alignment of any of the kernel |
| 5533 |
* arguments. The value of this attribute is undefined if the symbol is not a |
| 5534 |
* kernel. The type of this attribute is uint32_t. |
| 5535 |
*/ |
| 5536 |
HSA_CODE_SYMBOL_INFO_KERNEL_KERNARG_SEGMENT_ALIGNMENT = 12, |
| 5537 |
/** |
| 5538 |
* Size of static group segment memory required by the kernel (per |
| 5539 |
* work-group), in bytes. The value of this attribute is undefined |
| 5540 |
* if the symbol is not a kernel. The type of this attribute is uint32_t. |
| 5541 |
* |
| 5542 |
* The reported amount does not include any dynamically allocated group |
| 5543 |
* segment memory that may be requested by the application when a kernel is |
| 5544 |
* dispatched. |
| 5545 |
*/ |
| 5546 |
HSA_CODE_SYMBOL_INFO_KERNEL_GROUP_SEGMENT_SIZE = 13, |
| 5547 |
/** |
| 5548 |
* Size of static private, spill, and arg segment memory required by |
| 5549 |
* this kernel (per work-item), in bytes. The value of this attribute is |
| 5550 |
* undefined if the symbol is not a kernel. The type of this attribute is |
| 5551 |
* uint32_t. |
| 5552 |
* |
| 5553 |
* If the value of ::HSA_CODE_SYMBOL_INFO_KERNEL_DYNAMIC_CALLSTACK is true, |
| 5554 |
* the kernel may use more private memory than the reported value, and the |
| 5555 |
* application must add the dynamic call stack usage to @a |
| 5556 |
* private_segment_size when populating a kernel dispatch packet. |
| 5557 |
*/ |
| 5558 |
HSA_CODE_SYMBOL_INFO_KERNEL_PRIVATE_SEGMENT_SIZE = 14, |
| 5559 |
/** |
| 5560 |
* Dynamic callstack flag. The value of this attribute is undefined if the |
| 5561 |
* symbol is not a kernel. The type of this attribute is bool. |
| 5562 |
* |
| 5563 |
* If this flag is set (the value is true), the kernel uses a dynamically |
| 5564 |
* sized call stack. This can happen if recursive calls, calls to indirect |
| 5565 |
* functions, or the HSAIL alloca instruction are present in the kernel. |
| 5566 |
*/ |
| 5567 |
HSA_CODE_SYMBOL_INFO_KERNEL_DYNAMIC_CALLSTACK = 15, |
| 5568 |
/** |
| 5569 |
* Call convention of the kernel. The value of this attribute is undefined if |
| 5570 |
* the symbol is not a kernel. The type of this attribute is uint32_t. |
| 5571 |
*/ |
| 5572 |
HSA_CODE_SYMBOL_INFO_KERNEL_CALL_CONVENTION = 18, |
| 5573 |
/** |
| 5574 |
* Call convention of the indirect function. The value of this attribute is |
| 5575 |
* undefined if the symbol is not an indirect function. The type of this |
| 5576 |
* attribute is uint32_t. |
| 5577 |
*/ |
| 5578 |
HSA_CODE_SYMBOL_INFO_INDIRECT_FUNCTION_CALL_CONVENTION = 16 |
| 5579 |
} hsa_code_symbol_info_t; |
| 5580 |
|
| 5581 |
/** |
| 5582 |
* @deprecated |
| 5583 |
* |
| 5584 |
* @brief Get the current value of an attribute for a given code symbol. |
| 5585 |
* |
| 5586 |
* @param[in] code_symbol Code symbol. |
| 5587 |
* |
| 5588 |
* @param[in] attribute Attribute to query. |
| 5589 |
* |
| 5590 |
* @param[out] value Pointer to an application-allocated buffer where to store |
| 5591 |
* the value of the attribute. If the buffer passed by the application is not |
| 5592 |
* large enough to hold the value of @p attribute, the behavior is undefined. |
| 5593 |
* |
| 5594 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 5595 |
* |
| 5596 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 5597 |
* initialized. |
| 5598 |
* |
| 5599 |
* @retval ::HSA_STATUS_ERROR_INVALID_CODE_SYMBOL The code symbol is invalid. |
| 5600 |
* |
| 5601 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p attribute is an invalid |
| 5602 |
* code symbol attribute, or @p value is NULL. |
| 5603 |
*/ |
| 5604 |
hsa_status_t HSA_API HSA_DEPRECATED hsa_code_symbol_get_info( |
| 5605 |
hsa_code_symbol_t code_symbol, |
| 5606 |
hsa_code_symbol_info_t attribute, |
| 5607 |
void *value); |
| 5608 |
|
| 5609 |
/** |
| 5610 |
* @deprecated |
| 5611 |
* |
| 5612 |
* @brief Iterate over the symbols in a code object, and invoke an |
| 5613 |
* application-defined callback on every iteration. |
| 5614 |
* |
| 5615 |
* @param[in] code_object Code object. |
| 5616 |
* |
| 5617 |
* @param[in] callback Callback to be invoked once per code object symbol. The |
| 5618 |
* HSA runtime passes three arguments to the callback: the code object, a |
| 5619 |
* symbol, and the application data. If @p callback returns a status other than |
| 5620 |
* ::HSA_STATUS_SUCCESS for a particular iteration, the traversal stops and |
| 5621 |
* ::hsa_code_object_iterate_symbols returns that status value. |
| 5622 |
* |
| 5623 |
* @param[in] data Application data that is passed to @p callback on every |
| 5624 |
* iteration. May be NULL. |
| 5625 |
* |
| 5626 |
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. |
| 5627 |
* |
| 5628 |
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been |
| 5629 |
* initialized. |
| 5630 |
* |
| 5631 |
* @retval ::HSA_STATUS_ERROR_INVALID_CODE_OBJECT @p code_object is invalid. |
| 5632 |
* |
| 5633 |
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p callback is NULL. |
| 5634 |
*/ |
| 5635 |
hsa_status_t HSA_API HSA_DEPRECATED hsa_code_object_iterate_symbols( |
| 5636 |
hsa_code_object_t code_object, |
| 5637 |
hsa_status_t (*callback)(hsa_code_object_t code_object, |
| 5638 |
hsa_code_symbol_t symbol, |
| 5639 |
void *data), |
| 5640 |
void *data); |
| 5641 |
|
| 5642 |
/** @} */ |
| 5643 |
|
| 5644 |
#ifdef __cplusplus |
| 5645 |
} // end extern "C" block |
| 5646 |
#endif |
| 5647 |
|
| 5648 |
#endif // header guard |