/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-hip/checkouts/ROCR-Runtime/src/inc/hsa_ext_amd.h Source File

/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-hip/checkouts/ROCR-Runtime/src/inc/hsa_ext_amd.h Source File#

HIP Runtime API Reference: /home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-hip/checkouts/ROCR-Runtime/src/inc/hsa_ext_amd.h Source File
hsa_ext_amd.h
Go to the documentation of this file.
1 //
3 // The University of Illinois/NCSA
4 // Open Source License (NCSA)
5 //
6 // Copyright (c) 2014-2020, Advanced Micro Devices, Inc. All rights reserved.
7 //
8 // Developed by:
9 //
10 // AMD Research and AMD HSA Software Development
11 //
12 // Advanced Micro Devices, Inc.
13 //
14 // www.amd.com
15 //
16 // Permission is hereby granted, free of charge, to any person obtaining a copy
17 // of this software and associated documentation files (the "Software"), to
18 // deal with the Software without restriction, including without limitation
19 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
20 // and/or sell copies of the Software, and to permit persons to whom the
21 // Software is furnished to do so, subject to the following conditions:
22 //
23 // - Redistributions of source code must retain the above copyright notice,
24 // this list of conditions and the following disclaimers.
25 // - Redistributions in binary form must reproduce the above copyright
26 // notice, this list of conditions and the following disclaimers in
27 // the documentation and/or other materials provided with the distribution.
28 // - Neither the names of Advanced Micro Devices, Inc,
29 // nor the names of its contributors may be used to endorse or promote
30 // products derived from this Software without specific prior written
31 // permission.
32 //
33 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
34 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
35 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
36 // THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
37 // OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
38 // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
39 // DEALINGS WITH THE SOFTWARE.
40 //
42 
43 // HSA AMD extension.
44 
45 #ifndef HSA_RUNTIME_EXT_AMD_H_
46 #define HSA_RUNTIME_EXT_AMD_H_
47 
48 #include "hsa.h"
49 #include "hsa_ext_image.h"
50 
51 /*
52  * - 1.0 - initial version
53  * - 1.1 - dmabuf export
54  * - 1.2 - hsa_amd_memory_async_copy_on_engine
55  * - 1.3 - HSA_AMD_MEMORY_POOL_GLOBAL_FLAG_EXTENDED_SCOPE_FINE_GRAINED pool
56  * - 1.4 - Virtual Memory API
57  */
58 #define HSA_AMD_INTERFACE_VERSION_MAJOR 1
59 #define HSA_AMD_INTERFACE_VERSION_MINOR 4
60 
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64 
73 static __inline__ __attribute__((always_inline)) bool hsa_flag_isset64(uint8_t* value,
74  uint32_t bit) {
75  unsigned int index = bit / 8;
76  unsigned int subBit = bit % 8;
77  return ((uint8_t*)value)[index] & (1 << subBit);
78 }
79 
83 typedef uint32_t hsa_signal_condition32_t;
84 
88 typedef enum {
96 
100 typedef uint8_t hsa_amd_packet_type8_t;
101 
105 typedef struct hsa_amd_packet_header_s {
110  uint16_t header;
111 
116 
120  uint8_t reserved;
122 
128 typedef struct hsa_amd_barrier_value_packet_s {
133 
137  uint32_t reserved0;
138 
144  hsa_signal_t signal;
145 
149  hsa_signal_value_t value;
150 
154  hsa_signal_value_t mask;
155 
160 
164  uint32_t reserved1;
165 
169  uint64_t reserved2;
170 
174  uint64_t reserved3;
175 
180  hsa_signal_t completion_signal;
182 
190 enum {
195 
200 
205 
212 
219 
224 };
225 
229 typedef enum {
234  /* IOMMU V1 support is not relevant to user applications, so not reporting it */
240 
244 typedef enum hsa_amd_agent_info_s {
431  HSA_AMD_AGENT_INFO_AQL_EXTENSIONS = 0xA115 /* Not implemented yet */
433 
437 typedef enum hsa_amd_agent_memory_properties_s {
440 
444 typedef enum hsa_amd_sdma_engine_id {
460  HSA_AMD_SDMA_ENGINE_15 = 0x8000
462 
463 typedef struct hsa_amd_hdp_flush_s {
467 
471 typedef enum hsa_amd_region_info_s {
492 
496 typedef enum hsa_amd_coherency_type_s {
506 
524 hsa_status_t HSA_API hsa_amd_coherency_get_type(hsa_agent_t agent,
526 
545 hsa_status_t HSA_API hsa_amd_coherency_set_type(hsa_agent_t agent,
547 
554 typedef struct hsa_amd_profiling_dispatch_time_s {
558  uint64_t start;
562  uint64_t end;
564 
571 typedef struct hsa_amd_profiling_async_copy_time_s {
575  uint64_t start;
579  uint64_t end;
581 
598 hsa_status_t HSA_API
599  hsa_amd_profiling_set_profiler_enabled(hsa_queue_t* queue, int enable);
600 
621 hsa_status_t HSA_API
623 
652  hsa_agent_t agent, hsa_signal_t signal,
654 
677  hsa_signal_t signal, hsa_amd_profiling_async_copy_time_t* time);
678 
700 hsa_status_t HSA_API
702  uint64_t agent_tick,
703  uint64_t* system_tick);
704 
708 typedef enum {
723 
759 hsa_status_t HSA_API hsa_amd_signal_create(hsa_signal_value_t initial_value, uint32_t num_consumers,
760  const hsa_agent_t* consumers, uint64_t attributes,
761  hsa_signal_t* signal);
762 
791 hsa_status_t hsa_amd_signal_value_pointer(hsa_signal_t signal,
792  volatile hsa_signal_value_t** value_ptr);
793 
818 typedef bool (*hsa_amd_signal_handler)(hsa_signal_value_t value, void* arg);
819 
861 hsa_status_t HSA_API
862  hsa_amd_signal_async_handler(hsa_signal_t signal,
863  hsa_signal_condition_t cond,
864  hsa_signal_value_t value,
865  hsa_amd_signal_handler handler, void* arg);
866 
891 hsa_status_t HSA_API
892  hsa_amd_async_function(void (*callback)(void* arg), void* arg);
893 
903 uint32_t HSA_API
904  hsa_amd_signal_wait_any(uint32_t signal_count, hsa_signal_t* signals,
905  hsa_signal_condition_t* conds,
906  hsa_signal_value_t* values, uint64_t timeout_hint,
907  hsa_wait_state_t wait_hint,
908  hsa_signal_value_t* satisfying_value);
909 
931 hsa_status_t HSA_API hsa_amd_image_get_info_max_dim(hsa_agent_t agent,
932  hsa_agent_info_t attribute,
933  void* value);
934 
968 hsa_status_t HSA_API hsa_amd_queue_cu_set_mask(const hsa_queue_t* queue,
969  uint32_t num_cu_mask_count,
970  const uint32_t* cu_mask);
971 
996 hsa_status_t HSA_API hsa_amd_queue_cu_get_mask(const hsa_queue_t* queue, uint32_t num_cu_mask_count,
997  uint32_t* cu_mask);
998 
1002 typedef enum {
1022 
1044 typedef struct hsa_amd_memory_pool_s {
1048  uint64_t handle;
1050 
1051 typedef enum hsa_amd_memory_pool_global_flag_s {
1068 
1074 
1076 
1077 typedef enum hsa_amd_memory_pool_location_s {
1087 
1091 typedef enum {
1164 
1169 typedef enum hsa_amd_memory_pool_flag_s {
1180 
1182 
1197 hsa_status_t HSA_API
1199  hsa_amd_memory_pool_info_t attribute,
1200  void* value);
1201 
1236  hsa_agent_t agent,
1237  hsa_status_t (*callback)(hsa_amd_memory_pool_t memory_pool, void* data),
1238  void* data);
1239 
1276 hsa_status_t HSA_API
1278  uint32_t flags, void** ptr);
1279 
1293 hsa_status_t HSA_API hsa_amd_memory_pool_free(void* ptr);
1294 
1353 hsa_status_t HSA_API
1354  hsa_amd_memory_async_copy(void* dst, hsa_agent_t dst_agent, const void* src,
1355  hsa_agent_t src_agent, size_t size,
1356  uint32_t num_dep_signals,
1357  const hsa_signal_t* dep_signals,
1358  hsa_signal_t completion_signal);
1359 
1386 hsa_status_t HSA_API
1387  hsa_amd_memory_async_copy_on_engine(void* dst, hsa_agent_t dst_agent, const void* src,
1388  hsa_agent_t src_agent, size_t size,
1389  uint32_t num_dep_signals,
1390  const hsa_signal_t* dep_signals,
1391  hsa_signal_t completion_signal,
1392  hsa_amd_sdma_engine_id_t engine_id,
1393  bool force_copy_on_sdma);
1411 hsa_status_t HSA_API
1412  hsa_amd_memory_copy_engine_status(hsa_agent_t dst_agent, hsa_agent_t src_agent,
1413  uint32_t *engine_ids_mask);
1414 
1415 /*
1416 [Provisional API]
1417 Pitched memory descriptor.
1418 All elements must be 4 byte aligned. Pitch and slice are in bytes.
1419 */
1420 typedef struct hsa_pitched_ptr_s {
1421  void* base;
1422  size_t pitch;
1423  size_t slice;
1425 
1426 /*
1427 [Provisional API]
1428 Copy direction flag.
1429 */
1430 typedef enum {
1434  hsaDeviceToDevice = 3
1436 
1437 /*
1438 [Provisional API]
1439 SDMA 3D memory copy API. The same requirements must be met by src and dst as in
1440 hsa_amd_memory_async_copy.
1441 Both src and dst must be directly accessible to the copy_agent during the copy, src and dst rects
1442 must not overlap.
1443 CPU agents are not supported. API requires SDMA and will return an error if SDMA is not available.
1444 Offsets and range carry x in bytes, y and z in rows and layers.
1445 */
1446 hsa_status_t HSA_API hsa_amd_memory_async_copy_rect(
1447  const hsa_pitched_ptr_t* dst, const hsa_dim3_t* dst_offset, const hsa_pitched_ptr_t* src,
1448  const hsa_dim3_t* src_offset, const hsa_dim3_t* range, hsa_agent_t copy_agent,
1449  hsa_amd_copy_direction_t dir, uint32_t num_dep_signals, const hsa_signal_t* dep_signals,
1450  hsa_signal_t completion_signal);
1451 
1455 typedef enum {
1472 
1476 typedef enum {
1481 
1486 
1491 
1496 
1501 
1503 
1508 typedef struct hsa_amd_memory_pool_link_info_s {
1512  uint32_t min_latency;
1513 
1517  uint32_t max_latency;
1518 
1522  uint32_t min_bandwidth;
1523 
1527  uint32_t max_bandwidth;
1528 
1533 
1538 
1543 
1548 
1552  uint32_t numa_distance;
1554 
1558 typedef enum {
1580 
1589 
1597 
1599 
1618  hsa_agent_t agent, hsa_amd_memory_pool_t memory_pool,
1619  hsa_amd_agent_memory_pool_info_t attribute, void* value);
1620 
1658 hsa_status_t HSA_API
1659  hsa_amd_agents_allow_access(uint32_t num_agents, const hsa_agent_t* agents,
1660  const uint32_t* flags, const void* ptr);
1661 
1689 hsa_status_t HSA_API
1691  hsa_amd_memory_pool_t dst_memory_pool,
1692  bool* result);
1693 
1730 hsa_status_t HSA_API hsa_amd_memory_migrate(const void* ptr,
1731  hsa_amd_memory_pool_t memory_pool,
1732  uint32_t flags);
1733 
1768 hsa_status_t HSA_API hsa_amd_memory_lock(void* host_ptr, size_t size,
1769  hsa_agent_t* agents, int num_agent,
1770  void** agent_ptr);
1771 
1817 hsa_status_t HSA_API hsa_amd_memory_lock_to_pool(void* host_ptr, size_t size, hsa_agent_t* agents,
1818  int num_agent, hsa_amd_memory_pool_t pool,
1819  uint32_t flags, void** agent_ptr);
1820 
1837 hsa_status_t HSA_API hsa_amd_memory_unlock(void* host_ptr);
1838 
1861 hsa_status_t HSA_API
1862  hsa_amd_memory_fill(void* ptr, uint32_t value, size_t count);
1863 
1900 hsa_status_t HSA_API hsa_amd_interop_map_buffer(uint32_t num_agents,
1901  hsa_agent_t* agents,
1902  int interop_handle,
1903  uint32_t flags,
1904  size_t* size,
1905  void** ptr,
1906  size_t* metadata_size,
1907  const void** metadata);
1908 
1913 hsa_status_t HSA_API hsa_amd_interop_unmap_buffer(void* ptr);
1914 
1920 typedef struct hsa_amd_image_descriptor_s {
1921  /*
1922  Version number of the descriptor
1923  */
1924  uint32_t version;
1925 
1926  /*
1927  Vendor and device PCI IDs for the format as VENDOR_ID<<16|DEVICE_ID.
1928  */
1929  uint32_t deviceID;
1930 
1931  /*
1932  Start of vendor specific data.
1933  */
1934  uint32_t data[1];
1936 
1962 hsa_status_t HSA_API hsa_amd_image_create(
1963  hsa_agent_t agent,
1964  const hsa_ext_image_descriptor_t *image_descriptor,
1965  const hsa_amd_image_descriptor_t *image_layout,
1966  const void *image_data,
1967  hsa_access_permission_t access_permission,
1968  hsa_ext_image_t *image
1969 );
1970 
1974 typedef enum {
1975  /*
1976  Memory is not known to the HSA driver. Unallocated or unlocked system memory.
1977  */
1979  /*
1980  Memory was allocated with an HSA memory allocator.
1981  */
1983  /*
1984  System memory which has been locked for use with an HSA agent.
1985 
1986  Memory of this type is normal malloc'd memory and is always accessible to
1987  the CPU. Pointer info queries may not include CPU agents in the accessible
1988  agents list as the CPU has implicit access.
1989  */
1991  /*
1992  Memory originated in a graphics component and is shared with ROCr.
1993  */
1995  /*
1996  Memory has been shared with the local process via ROCr IPC APIs.
1997  */
2000 
2005 typedef struct hsa_amd_pointer_info_s {
2006  /*
2007  Size in bytes of this structure. Used for version control within a major ROCr
2008  revision. Set to sizeof(hsa_amd_pointer_t) prior to calling
2009  hsa_amd_pointer_info. If the runtime supports an older version of pointer
2010  info then size will be smaller on return. Members starting after the return
2011  value of size will not be updated by hsa_amd_pointer_info.
2012  */
2013  uint32_t size;
2014  /*
2015  The type of allocation referenced.
2016  */
2018  /*
2019  Base address at which non-host agents may access the allocation. This field is
2020  not meaningful if the type of the allocation is HSA_EXT_POINTER_TYPE_UNKNOWN.
2021  */
2023  /*
2024  Base address at which the host agent may access the allocation. This field is
2025  not meaningful if the type of the allocation is HSA_EXT_POINTER_TYPE_UNKNOWN.
2026  */
2028  /*
2029  Size of the allocation. This field is not meaningful if the type of the allocation
2030  is HSA_EXT_POINTER_TYPE_UNKNOWN.
2031  */
2032  size_t sizeInBytes;
2033  /*
2034  Application provided value. This field is not meaningful if the type of the
2035  allocation is HSA_EXT_POINTER_TYPE_UNKNOWN.
2036  */
2037  void* userData;
2038  /*
2039  Reports an agent which "owns" (ie has preferred access to) the pool in which the
2040  allocation was
2041  made. When multiple agents share equal access to a pool (ex: multiple CPU agents, or multi-die
2042  GPU boards) any such agent may be returned. This field is not meaningful if
2043  the type of the allocation is HSA_EXT_POINTER_TYPE_UNKNOWN or if this agent is not available in
2044  this process, for e.g if this agent is masked using ROCR_VISIBLE_DEVICES.
2045  */
2046  hsa_agent_t agentOwner;
2047  /*
2048  Contains a bitfield of hsa_amd_memory_pool_global_flag_t values.
2049  Reports the effective global flags bitmask for the allocation. This field is not
2050  meaningful if the type of the allocation is HSA_EXT_POINTER_TYPE_UNKNOWN.
2051  */
2052  uint32_t global_flags;
2054 
2090 hsa_status_t HSA_API hsa_amd_pointer_info(const void* ptr,
2091  hsa_amd_pointer_info_t* info,
2092  void* (*alloc)(size_t),
2093  uint32_t* num_agents_accessible,
2094  hsa_agent_t** accessible);
2095 
2114 hsa_status_t HSA_API hsa_amd_pointer_info_set_userdata(const void* ptr,
2115  void* userdata);
2116 
2121 typedef struct hsa_amd_ipc_memory_s {
2122  uint32_t handle[8];
2124 
2155 hsa_status_t HSA_API hsa_amd_ipc_memory_create(void* ptr, size_t len,
2156  hsa_amd_ipc_memory_t* handle);
2157 
2189 hsa_status_t HSA_API hsa_amd_ipc_memory_attach(
2190  const hsa_amd_ipc_memory_t* handle, size_t len,
2191  uint32_t num_agents,
2192  const hsa_agent_t* mapping_agents,
2193  void** mapped_ptr);
2194 
2210 hsa_status_t HSA_API hsa_amd_ipc_memory_detach(void* mapped_ptr);
2211 
2216 
2241 hsa_status_t HSA_API hsa_amd_ipc_signal_create(hsa_signal_t signal, hsa_amd_ipc_signal_t* handle);
2242 
2263 hsa_status_t HSA_API hsa_amd_ipc_signal_attach(const hsa_amd_ipc_signal_t* handle,
2264  hsa_signal_t* signal);
2265 
2269 typedef enum hsa_amd_event_type_s {
2270  /*
2271  AMD GPU memory fault.
2272  */
2274  /*
2275  AMD GPU HW Exception.
2276  */
2279 
2283 typedef enum {
2284  // Page not present or supervisor privilege.
2286  // Write access to a read-only page.
2288  // Execute access to a page marked NX.
2290  // GPU attempted access to a host only page.
2292  // DRAM ECC failure.
2294  // Can't determine the exact fault address.
2296  // SRAM ECC failure (ie registers, no fault address).
2298  // GPU reset following unspecified hang.
2299  HSA_AMD_MEMORY_FAULT_HANG = 1U << 31
2301 
2305 typedef struct hsa_amd_gpu_memory_fault_info_s {
2306  /*
2307  The agent where the memory fault occurred.
2308  */
2309  hsa_agent_t agent;
2310  /*
2311  Virtual address accessed.
2312  */
2314  /*
2315  Bit field encoding the memory access failure reasons. There could be multiple bits set
2316  for one fault. Bits are defined in hsa_amd_memory_fault_reason_t.
2317  */
2320 
2324 typedef enum {
2325  // Unused for now
2328 
2332 typedef enum {
2333  // GPU Hang
2335  // SRAM ECC
2338 
2342 typedef struct hsa_amd_gpu_hw_exception_info_s {
2343  /*
2344  The agent where the HW exception occurred.
2345  */
2346  hsa_agent_t agent;
2350 
2354 typedef struct hsa_amd_event_s {
2355  /*
2356  The event type.
2357  */
2359  union {
2360  /*
2361  The memory fault info, only valid when @p event_type is HSA_AMD_GPU_MEMORY_FAULT_EVENT.
2362  */
2364  /*
2365  The memory fault info, only valid when @p event_type is HSA_AMD_GPU_HW_EXCEPTION_EVENT.
2366  */
2368  };
2369 } hsa_amd_event_t;
2370 
2371 typedef hsa_status_t (*hsa_amd_system_event_callback_t)(const hsa_amd_event_t* event, void* data);
2372 
2389  void* data);
2390 
2394 typedef enum hsa_amd_queue_priority_s {
2395  /*
2396  Below normal/high priority compute and all graphics
2397  */
2399  /*
2400  Above low priority compute, below high priority compute and all graphics
2401  */
2403  /*
2404  Above low/normal priority compute and all graphics
2405  */
2408 
2425 hsa_status_t HSA_API hsa_amd_queue_set_priority(hsa_queue_t* queue,
2426  hsa_amd_queue_priority_t priority);
2427 
2431 typedef void (*hsa_amd_deallocation_callback_t)(void* ptr, void* user_data);
2432 
2465 hsa_status_t HSA_API hsa_amd_register_deallocation_callback(void* ptr,
2467  void* user_data);
2468 
2485 hsa_status_t HSA_API hsa_amd_deregister_deallocation_callback(void* ptr,
2487 
2488 typedef enum hsa_amd_svm_model_s {
2510 
2511 typedef enum hsa_amd_svm_attribute_s {
2512  // Memory model attribute.
2513  // Type of this attribute is hsa_amd_svm_model_t.
2515  // Marks the range read only. This allows multiple physical copies to be
2516  // placed local to each accessing device.
2517  // Type of this attribute is bool.
2519  // Automatic migrations should attempt to keep the memory within the xgmi hive
2520  // containing accessible agents.
2521  // Type of this attribute is bool.
2523  // Page granularity to migrate at once. Page granularity is specified as
2524  // log2(page_count).
2525  // Type of this attribute is uint64_t.
2527  // Physical location to prefer when automatic migration occurs.
2528  // Set to the null agent handle (handle == 0) to indicate there
2529  // is no preferred location.
2530  // Type of this attribute is hsa_agent_t.
2532  // This attribute can not be used in ::hsa_amd_svm_attributes_set (see
2533  // ::hsa_amd_svm_prefetch_async).
2534  // Queries the physical location of most recent prefetch command.
2535  // If the prefetch location has not been set or is not uniform across the
2536  // address range then returned hsa_agent_t::handle will be 0.
2537  // Querying this attribute will return the destination agent of the most
2538  // recent ::hsa_amd_svm_prefetch_async targeting the address range. If
2539  // multiple async prefetches have been issued targeting the region and the
2540  // most recently issued prefetch has completed then the query will return
2541  // the location of the most recently completed prefetch.
2542  // Type of this attribute is hsa_agent_t.
2544  // Optimizes with the anticipation that the majority of operations to the
2545  // range will be read operations.
2546  // Type of this attribute is bool.
2548  // Allows the execution on GPU.
2549  // Type of this attribute is bool.
2551  // This attribute can not be used in ::hsa_amd_svm_attributes_get.
2552  // Enables an agent for access to the range. Access may incur a page fault
2553  // and associated memory migration. Either this or
2554  // HSA_AMD_SVM_ATTRIB_AGENT_ACCESSIBLE_IN_PLACE is required prior to SVM
2555  // access if HSA_AMD_SYSTEM_INFO_SVM_ACCESSIBLE_BY_DEFAULT is false.
2556  // Type of this attribute is hsa_agent_t.
2558  // This attribute can not be used in ::hsa_amd_svm_attributes_get.
2559  // Enables an agent for access to the range without page faults. Access
2560  // will not incur a page fault and will not cause access based migration.
2561  // and associated memory migration. Either this or
2562  // HSA_AMD_SVM_ATTRIB_AGENT_ACCESSIBLE is required prior to SVM access if
2563  // HSA_AMD_SYSTEM_INFO_SVM_ACCESSIBLE_BY_DEFAULT is false.
2564  // Type of this attribute is hsa_agent_t.
2566  // This attribute can not be used in ::hsa_amd_svm_attributes_get.
2567  // Denies an agent access to the memory range. Access will cause a terminal
2568  // segfault.
2569  // Type of this attribute is hsa_agent_t.
2571  // This attribute can not be used in ::hsa_amd_svm_attributes_set.
2572  // Returns the access attribute associated with the agent.
2573  // The agent to query must be set in the attribute value field.
2574  // The attribute enum will be replaced with the agent's current access
2575  // attribute for the address range.
2576  // TODO: Clarify KFD return value for non-uniform access attribute.
2577  // Type of this attribute is hsa_agent_t.
2580 
2581 // List type for hsa_amd_svm_attributes_set/get.
2582 typedef struct hsa_amd_svm_attribute_pair_s {
2583  // hsa_amd_svm_attribute_t value.
2584  uint64_t attribute;
2585  // Attribute value. Bit values should be interpreted according to the type
2586  // given in the associated attribute description.
2587  uint64_t value;
2589 
2609 hsa_status_t hsa_amd_svm_attributes_set(void* ptr, size_t size,
2610  hsa_amd_svm_attribute_pair_t* attribute_list,
2611  size_t attribute_count);
2612 
2631 hsa_status_t hsa_amd_svm_attributes_get(void* ptr, size_t size,
2632  hsa_amd_svm_attribute_pair_t* attribute_list,
2633  size_t attribute_count);
2634 
2659 hsa_status_t hsa_amd_svm_prefetch_async(void* ptr, size_t size, hsa_agent_t agent,
2660  uint32_t num_dep_signals, const hsa_signal_t* dep_signals,
2661  hsa_signal_t completion_signal);
2662 
2671 hsa_status_t hsa_amd_spm_acquire(hsa_agent_t preferred_agent);
2672 
2682 hsa_status_t hsa_amd_spm_release(hsa_agent_t preferred_agent);
2683 
2712 hsa_status_t hsa_amd_spm_set_dest_buffer(hsa_agent_t preferred_agent, size_t size_in_bytes,
2713  uint32_t* timeout, uint32_t* size_copied, void* dest,
2714  bool* is_data_loss);
2760 hsa_status_t hsa_amd_portable_export_dmabuf(const void* ptr, size_t size, int* dmabuf,
2761  uint64_t* offset);
2762 
2784 hsa_status_t hsa_amd_portable_close_dmabuf(int dmabuf);
2785 
2807 hsa_status_t hsa_amd_vmem_address_reserve(void** va, size_t size, uint64_t address,
2808  uint64_t flags);
2809 
2826 hsa_status_t hsa_amd_vmem_address_free(void* va, size_t size);
2827 
2831 typedef struct hsa_amd_vmem_alloc_handle_s {
2836  uint64_t handle;
2838 
2839 typedef enum {
2843 
2869 hsa_status_t hsa_amd_vmem_handle_create(hsa_amd_memory_pool_t pool, size_t size,
2870  hsa_amd_memory_type_t type, uint64_t flags,
2871  hsa_amd_vmem_alloc_handle_t* memory_handle);
2872 
2883 
2907 hsa_status_t hsa_amd_vmem_map(void* va, size_t size, size_t in_offset,
2908  hsa_amd_vmem_alloc_handle_t memory_handle, uint64_t flags);
2909 
2926 hsa_status_t hsa_amd_vmem_unmap(void* va, size_t size);
2927 
2928 typedef struct hsa_amd_memory_access_desc_s {
2929  hsa_access_permission_t permissions;
2930  hsa_agent_t agent_handle;
2932 
2958 hsa_status_t hsa_amd_vmem_set_access(void* va, size_t size,
2959  const hsa_amd_memory_access_desc_t* desc,
2960  size_t desc_cnt);
2961 
2980 hsa_status_t hsa_amd_vmem_get_access(void* va, hsa_access_permission_t* perms,
2981  hsa_agent_t agent_handle);
2982 
3003 hsa_status_t hsa_amd_vmem_export_shareable_handle(int* dmabuf_fd,
3005  uint64_t flags);
3023 hsa_status_t hsa_amd_vmem_import_shareable_handle(int dmabuf_fd,
3024  hsa_amd_vmem_alloc_handle_t* handle);
3025 
3041  void* addr);
3042 
3043 /*
3044 * @brief Returns the current allocation properties of a handle
3045 *
3046 * Returns the allocation properties of an existing handle
3047 *
3048 * @param[in] memory_handle memory handle to be queried
3049 * @param[out] pool memory pool that owns this handle
3050 * @param[out] memory type
3051 
3052 * @retval ::HSA_STATUS_SUCCESS
3053 *
3054 * @retval ::HSA_STATUS_ERROR_INVALID_ALLOCATION Invalid memory_handle
3055 */
3058  hsa_amd_memory_type_t* type);
3059 
3085 hsa_status_t HSA_API hsa_amd_agent_set_async_scratch_limit(hsa_agent_t agent, size_t threshold);
3086 
3087 #ifdef __cplusplus
3088 } // end extern "C" block
3089 #endif
3090 
3091 #endif // header guard
uint8_t hsa_amd_packet_type8_t
A fixed-size type used to represent hsa_amd_packet_type_t constants.
Definition: hsa_ext_amd.h:100
unsigned int subBit
Definition: hsa_ext_amd.h:76
hsa_amd_packet_type_t
AMD vendor specific packet type.
Definition: hsa_ext_amd.h:88
static __inline__ uint32_t bit
Definition: hsa_ext_amd.h:74
uint32_t hsa_signal_condition32_t
A fixed-size type used to represent ::hsa_signal_condition_t constants.
Definition: hsa_ext_amd.h:83
@ HSA_AMD_PACKET_TYPE_BARRIER_VALUE
Definition: hsa_ext_amd.h:94
hsa_status_t HSA_API hsa_amd_memory_migrate(const void *ptr, hsa_amd_memory_pool_t memory_pool, uint32_t flags)
Relocate a buffer to a new memory pool.
hsa_amd_iommu_version_t
IOMMU version supported.
Definition: hsa_ext_amd.h:229
@ HSA_IOMMU_SUPPORT_NONE
Definition: hsa_ext_amd.h:233
@ HSA_IOMMU_SUPPORT_V2
Definition: hsa_ext_amd.h:238
hsa_status_t HSA_API hsa_amd_register_system_event_handler(hsa_amd_system_event_callback_t callback, void *data)
Register AMD GPU event handler.
hsa_status_t HSA_API hsa_amd_agent_memory_pool_get_info(hsa_agent_t agent, hsa_amd_memory_pool_t memory_pool, hsa_amd_agent_memory_pool_info_t attribute, void *value)
Get the current value of an attribute of the relationship between an agent and a memory pool.
hsa_status_t HSA_API hsa_amd_register_deallocation_callback(void *ptr, hsa_amd_deallocation_callback_t callback, void *user_data)
Registers a deallocation notifier monitoring for release of agent accessible address ptr....
hsa_status_t hsa_amd_vmem_retain_alloc_handle(hsa_amd_vmem_alloc_handle_t *memory_handle, void *addr)
Returns memory handle for mapped memory.
hsa_status_t HSA_API hsa_amd_queue_set_priority(hsa_queue_t *queue, hsa_amd_queue_priority_t priority)
Modifies the dispatch and wavefront scheduling prioirty for a given compute queue....
hsa_status_t HSA_API hsa_amd_ipc_memory_attach(const hsa_amd_ipc_memory_t *handle, size_t len, uint32_t num_agents, const hsa_agent_t *mapping_agents, void **mapped_ptr)
Imports shared memory into the local process and makes it accessible by the given agents....
hsa_status_t HSA_API hsa_amd_interop_map_buffer(uint32_t num_agents, hsa_agent_t *agents, int interop_handle, uint32_t flags, size_t *size, void **ptr, size_t *metadata_size, const void **metadata)
Maps an interop object into the HSA flat address space and establishes memory residency....
hsa_status_t HSA_API hsa_amd_memory_async_copy(void *dst, hsa_agent_t dst_agent, const void *src, hsa_agent_t src_agent, size_t size, uint32_t num_dep_signals, const hsa_signal_t *dep_signals, hsa_signal_t completion_signal)
Asynchronously copy a block of memory from the location pointed to by src on the src_agent to the mem...
hsa_status_t hsa_amd_spm_acquire(hsa_agent_t preferred_agent)
Acquire Stream Performance Monitor on an agent.
hsa_amd_svm_model_t
Definition: hsa_ext_amd.h:2488
@ HSA_AMD_SVM_GLOBAL_FLAG_COARSE_GRAINED
Definition: hsa_ext_amd.h:2498
@ HSA_AMD_SVM_GLOBAL_FLAG_FINE_GRAINED
Definition: hsa_ext_amd.h:2493
@ HSA_AMD_SVM_GLOBAL_FLAG_INDETERMINATE
Definition: hsa_ext_amd.h:2508
hsa_status_t HSA_API hsa_amd_image_get_info_max_dim(hsa_agent_t agent, hsa_agent_info_t attribute, void *value)
Query image limits.
hsa_amd_memory_type_t
Definition: hsa_ext_amd.h:2839
@ MEMORY_TYPE_PINNED
Definition: hsa_ext_amd.h:2841
@ MEMORY_TYPE_NONE
Definition: hsa_ext_amd.h:2840
hsa_status_t HSA_API hsa_amd_signal_create(hsa_signal_value_t initial_value, uint32_t num_consumers, const hsa_agent_t *consumers, uint64_t attributes, hsa_signal_t *signal)
Create a signal with specific attributes.
hsa_amd_region_info_t
Region attributes.
Definition: hsa_ext_amd.h:471
@ HSA_AMD_REGION_INFO_BUS_WIDTH
Definition: hsa_ext_amd.h:485
@ HSA_AMD_REGION_INFO_HOST_ACCESSIBLE
Definition: hsa_ext_amd.h:476
@ HSA_AMD_REGION_INFO_MAX_CLOCK_FREQUENCY
Definition: hsa_ext_amd.h:490
@ HSA_AMD_REGION_INFO_BASE
Definition: hsa_ext_amd.h:480
hsa_status_t hsa_amd_vmem_get_access(void *va, hsa_access_permission_t *perms, hsa_agent_t agent_handle)
Get current access permissions for memory mapping.
hsa_status_t HSA_API hsa_amd_agent_set_async_scratch_limit(hsa_agent_t agent, size_t threshold)
Set the asynchronous scratch limit threshold on all the queues for this agent. Dispatches that are en...
hsa_status_t HSA_API hsa_amd_queue_cu_set_mask(const hsa_queue_t *queue, uint32_t num_cu_mask_count, const uint32_t *cu_mask)
Set a queue's CU affinity mask.
hsa_status_t hsa_amd_vmem_map(void *va, size_t size, size_t in_offset, hsa_amd_vmem_alloc_handle_t memory_handle, uint64_t flags)
Map a virtual memory handle.
hsa_amd_ipc_memory_t hsa_amd_ipc_signal_t
256-bit process independent identifier for a ROCr IPC signal.
Definition: hsa_ext_amd.h:2215
@ HSA_STATUS_ERROR_INVALID_MEMORY_POOL
Definition: hsa_ext_amd.h:194
@ HSA_STATUS_CU_MASK_REDUCED
Definition: hsa_ext_amd.h:218
@ HSA_STATUS_ERROR_ILLEGAL_INSTRUCTION
Definition: hsa_ext_amd.h:204
@ HSA_STATUS_ERROR_MEMORY_FAULT
Definition: hsa_ext_amd.h:211
@ HSA_STATUS_ERROR_OUT_OF_REGISTERS
Definition: hsa_ext_amd.h:223
@ HSA_STATUS_ERROR_MEMORY_APERTURE_VIOLATION
Definition: hsa_ext_amd.h:199
hsa_status_t hsa_amd_vmem_handle_create(hsa_amd_memory_pool_t pool, size_t size, hsa_amd_memory_type_t type, uint64_t flags, hsa_amd_vmem_alloc_handle_t *memory_handle)
Create a virtual memory handle.
hsa_status_t hsa_amd_svm_attributes_get(void *ptr, size_t size, hsa_amd_svm_attribute_pair_t *attribute_list, size_t attribute_count)
Gets SVM memory attributes.
hsa_status_t HSA_API hsa_amd_memory_unlock(void *host_ptr)
Unpin the host pointer previously pinned via hsa_amd_memory_lock or hsa_amd_memory_lock_to_pool.
hsa_amd_memory_fault_reason_t
Flags denoting the cause of a memory fault.
Definition: hsa_ext_amd.h:2283
@ HSA_AMD_MEMORY_FAULT_DRAMECC
Definition: hsa_ext_amd.h:2293
@ HSA_AMD_MEMORY_FAULT_HANG
Definition: hsa_ext_amd.h:2299
@ HSA_AMD_MEMORY_FAULT_PAGE_NOT_PRESENT
Definition: hsa_ext_amd.h:2285
@ HSA_AMD_MEMORY_FAULT_SRAMECC
Definition: hsa_ext_amd.h:2297
@ HSA_AMD_MEMORY_FAULT_NX
Definition: hsa_ext_amd.h:2289
@ HSA_AMD_MEMORY_FAULT_IMPRECISE
Definition: hsa_ext_amd.h:2295
@ HSA_AMD_MEMORY_FAULT_HOST_ONLY
Definition: hsa_ext_amd.h:2291
@ HSA_AMD_MEMORY_FAULT_READ_ONLY
Definition: hsa_ext_amd.h:2287
hsa_status_t HSA_API hsa_amd_memory_lock_to_pool(void *host_ptr, size_t size, hsa_agent_t *agents, int num_agent, hsa_amd_memory_pool_t pool, uint32_t flags, void **agent_ptr)
Pin a host pointer allocated by C/C++ or OS allocator (i.e. ordinary system DRAM) and return a new po...
hsa_status_t hsa_amd_spm_release(hsa_agent_t preferred_agent)
Release Stream Performance Monitor on an agent.
hsa_status_t HSA_API hsa_amd_queue_cu_get_mask(const hsa_queue_t *queue, uint32_t num_cu_mask_count, uint32_t *cu_mask)
Retrieve a queue's CU affinity mask.
hsa_status_t HSA_API hsa_amd_pointer_info(const void *ptr, hsa_amd_pointer_info_t *info, void *(*alloc)(size_t), uint32_t *num_agents_accessible, hsa_agent_t **accessible)
Retrieves information about the allocation referenced by the given pointer. Optionally returns the nu...
hsa_status_t HSA_API hsa_amd_pointer_info_set_userdata(const void *ptr, void *userdata)
Associates an arbitrary pointer with an allocation known to ROCr. The pointer can be fetched by hsa_a...
hsa_status_t hsa_amd_spm_set_dest_buffer(hsa_agent_t preferred_agent, size_t size_in_bytes, uint32_t *timeout, uint32_t *size_copied, void *dest, bool *is_data_loss)
Set up the current destination user mode buffer for stream performance counter data....
hsa_status_t HSA_API hsa_amd_deregister_deallocation_callback(void *ptr, hsa_amd_deallocation_callback_t callback)
Removes a deallocation notifier previously registered with hsa_amd_register_deallocation_callback....
hsa_status_t hsa_amd_vmem_set_access(void *va, size_t size, const hsa_amd_memory_access_desc_t *desc, size_t desc_cnt)
Make a memory mapping accessible.
hsa_status_t HSA_API hsa_amd_memory_pool_allocate(hsa_amd_memory_pool_t memory_pool, size_t size, uint32_t flags, void **ptr)
Allocate a block of memory (or buffer) in the specified pool.
hsa_status_t HSA_API hsa_amd_coherency_set_type(hsa_agent_t agent, hsa_amd_coherency_type_t type)
Set the coherency type of the fine grain region of an agent. Deprecated. This is supported on KV plat...
hsa_status_t hsa_amd_vmem_import_shareable_handle(int dmabuf_fd, hsa_amd_vmem_alloc_handle_t *handle)
Import a shareable handle.
hsa_amd_signal_attribute_t
Signal attribute flags.
Definition: hsa_ext_amd.h:708
@ HSA_AMD_SIGNAL_AMD_GPU_ONLY
Definition: hsa_ext_amd.h:713
@ HSA_AMD_SIGNAL_IPC
Definition: hsa_ext_amd.h:721
hsa_status_t HSA_API hsa_amd_signal_async_handler(hsa_signal_t signal, hsa_signal_condition_t cond, hsa_signal_value_t value, hsa_amd_signal_handler handler, void *arg)
Register asynchronous signal handler function.
hsa_status_t hsa_amd_vmem_address_free(void *va, size_t size)
Free a reserved address range.
hsa_status_t HSA_API hsa_amd_agent_iterate_memory_pools(hsa_agent_t agent, hsa_status_t(*callback)(hsa_amd_memory_pool_t memory_pool, void *data), void *data)
Iterate over the memory pools associated with a given agent, and invoke an application-defined callba...
hsa_amd_svm_attribute_t
Definition: hsa_ext_amd.h:2511
@ HSA_AMD_SVM_ATTRIB_READ_ONLY
Definition: hsa_ext_amd.h:2518
@ HSA_AMD_SVM_ATTRIB_AGENT_ACCESSIBLE
Definition: hsa_ext_amd.h:2557
@ HSA_AMD_SVM_ATTRIB_AGENT_NO_ACCESS
Definition: hsa_ext_amd.h:2570
@ HSA_AMD_SVM_ATTRIB_PREFETCH_LOCATION
Definition: hsa_ext_amd.h:2543
@ HSA_AMD_SVM_ATTRIB_MIGRATION_GRANULARITY
Definition: hsa_ext_amd.h:2526
@ HSA_AMD_SVM_ATTRIB_HIVE_LOCAL
Definition: hsa_ext_amd.h:2522
@ HSA_AMD_SVM_ATTRIB_GPU_EXEC
Definition: hsa_ext_amd.h:2550
@ HSA_AMD_SVM_ATTRIB_PREFERRED_LOCATION
Definition: hsa_ext_amd.h:2531
@ HSA_AMD_SVM_ATTRIB_READ_MOSTLY
Definition: hsa_ext_amd.h:2547
@ HSA_AMD_SVM_ATTRIB_AGENT_ACCESSIBLE_IN_PLACE
Definition: hsa_ext_amd.h:2565
@ HSA_AMD_SVM_ATTRIB_ACCESS_QUERY
Definition: hsa_ext_amd.h:2578
@ HSA_AMD_SVM_ATTRIB_GLOBAL_FLAG
Definition: hsa_ext_amd.h:2514
hsa_status_t HSA_API hsa_amd_async_function(void(*callback)(void *arg), void *arg)
Call a function asynchronously.
uint32_t HSA_API hsa_amd_signal_wait_any(uint32_t signal_count, hsa_signal_t *signals, hsa_signal_condition_t *conds, hsa_signal_value_t *values, uint64_t timeout_hint, hsa_wait_state_t wait_hint, hsa_signal_value_t *satisfying_value)
Wait for any signal-condition pair to be satisfied.
hsa_amd_memory_pool_global_flag_t
Definition: hsa_ext_amd.h:1051
@ HSA_AMD_MEMORY_POOL_GLOBAL_FLAG_EXTENDED_SCOPE_FINE_GRAINED
Definition: hsa_ext_amd.h:1073
@ HSA_AMD_MEMORY_POOL_GLOBAL_FLAG_KERNARG_INIT
Definition: hsa_ext_amd.h:1057
@ HSA_AMD_MEMORY_POOL_GLOBAL_FLAG_FINE_GRAINED
Definition: hsa_ext_amd.h:1063
@ HSA_AMD_MEMORY_POOL_GLOBAL_FLAG_COARSE_GRAINED
Definition: hsa_ext_amd.h:1067
hsa_amd_agent_info_t
Agent attributes.
Definition: hsa_ext_amd.h:244
@ HSA_AMD_AGENT_INFO_MEMORY_PROPERTIES
Definition: hsa_ext_amd.h:425
@ HSA_AMD_AGENT_INFO_NUM_XCC
Definition: hsa_ext_amd.h:409
@ HSA_AMD_AGENT_INFO_COOPERATIVE_QUEUES
Definition: hsa_ext_amd.h:328
@ HSA_AMD_AGENT_INFO_DRIVER_UID
Definition: hsa_ext_amd.h:414
@ HSA_AMD_AGENT_INFO_MEMORY_MAX_FREQUENCY
Definition: hsa_ext_amd.h:286
@ HSA_AMD_AGENT_INFO_MEMORY_WIDTH
Definition: hsa_ext_amd.h:282
@ HSA_AMD_AGENT_INFO_ASIC_FAMILY_ID
Definition: hsa_ext_amd.h:376
@ HSA_AMD_AGENT_INFO_IOMMU_SUPPORT
Definition: hsa_ext_amd.h:404
@ HSA_AMD_AGENT_INFO_MEMORY_AVAIL
Definition: hsa_ext_amd.h:365
@ HSA_AMD_AGENT_INFO_TIMESTAMP_FREQUENCY
Definition: hsa_ext_amd.h:371
@ HSA_AMD_AGENT_INFO_ASIC_REVISION
Definition: hsa_ext_amd.h:346
@ HSA_AMD_AGENT_INFO_AQL_EXTENSIONS
Definition: hsa_ext_amd.h:431
@ HSA_AMD_AGENT_INFO_COMPUTE_UNIT_COUNT
Definition: hsa_ext_amd.h:257
@ HSA_AMD_AGENT_INFO_NUM_SIMDS_PER_CU
Definition: hsa_ext_amd.h:301
@ HSA_AMD_AGENT_INFO_SDMA_UCODE_VERSION
Definition: hsa_ext_amd.h:386
@ HSA_AMD_AGENT_INFO_UUID
Definition: hsa_ext_amd.h:338
@ HSA_AMD_AGENT_INFO_SVM_DIRECT_HOST_ACCESS
Definition: hsa_ext_amd.h:352
@ HSA_AMD_AGENT_INFO_MAX_WAVES_PER_CU
Definition: hsa_ext_amd.h:296
@ HSA_AMD_AGENT_INFO_COOPERATIVE_COMPUTE_UNIT_COUNT
Definition: hsa_ext_amd.h:359
@ HSA_AMD_AGENT_INFO_NUM_SDMA_ENG
Definition: hsa_ext_amd.h:394
@ HSA_AMD_AGENT_INFO_NEAREST_CPU
Definition: hsa_ext_amd.h:419
@ HSA_AMD_AGENT_INFO_BDFID
Definition: hsa_ext_amd.h:277
@ HSA_AMD_AGENT_INFO_CHIP_ID
Definition: hsa_ext_amd.h:248
@ HSA_AMD_AGENT_INFO_NUM_SHADER_ENGINES
Definition: hsa_ext_amd.h:306
@ HSA_AMD_AGENT_INFO_DRIVER_NODE_ID
Definition: hsa_ext_amd.h:266
@ HSA_AMD_AGENT_INFO_HDP_FLUSH
Definition: hsa_ext_amd.h:317
@ HSA_AMD_AGENT_INFO_DOMAIN
Definition: hsa_ext_amd.h:323
@ HSA_AMD_AGENT_INFO_NUM_SDMA_XGMI_ENG
Definition: hsa_ext_amd.h:399
@ HSA_AMD_AGENT_INFO_MAX_ADDRESS_WATCH_POINTS
Definition: hsa_ext_amd.h:272
@ HSA_AMD_AGENT_INFO_MAX_CLOCK_FREQUENCY
Definition: hsa_ext_amd.h:262
@ HSA_AMD_AGENT_INFO_PRODUCT_NAME
Definition: hsa_ext_amd.h:291
@ HSA_AMD_AGENT_INFO_CACHELINE_SIZE
Definition: hsa_ext_amd.h:252
@ HSA_AMD_AGENT_INFO_NUM_SHADER_ARRAYS_PER_SE
Definition: hsa_ext_amd.h:311
@ HSA_AMD_AGENT_INFO_UCODE_VERSION
Definition: hsa_ext_amd.h:381
hsa_status_t HSA_API hsa_amd_profiling_set_profiler_enabled(hsa_queue_t *queue, int enable)
Enable or disable profiling capability of a queue.
hsa_status_t HSA_API hsa_amd_profiling_async_copy_enable(bool enable)
Enable or disable asynchronous memory copy profiling.
hsa_status_t HSA_API hsa_amd_image_create(hsa_agent_t agent, const hsa_ext_image_descriptor_t *image_descriptor, const hsa_amd_image_descriptor_t *image_layout, const void *image_data, hsa_access_permission_t access_permission, hsa_ext_image_t *image)
Creates an image from an opaque vendor specific image format. Does not modify data at image_data....
hsa_amd_memory_pool_info_t
Memory pool features.
Definition: hsa_ext_amd.h:1091
@ HSA_AMD_MEMORY_POOL_INFO_RUNTIME_ALLOC_ALIGNMENT
Definition: hsa_ext_amd.h:1137
@ HSA_AMD_MEMORY_POOL_INFO_RUNTIME_ALLOC_GRANULE
Definition: hsa_ext_amd.h:1130
@ HSA_AMD_MEMORY_POOL_INFO_SEGMENT
Definition: hsa_ext_amd.h:1096
@ HSA_AMD_MEMORY_POOL_INFO_SIZE
Definition: hsa_ext_amd.h:1109
@ HSA_AMD_MEMORY_POOL_INFO_RUNTIME_ALLOC_REC_GRANULE
Definition: hsa_ext_amd.h:1162
@ HSA_AMD_MEMORY_POOL_INFO_GLOBAL_FLAGS
Definition: hsa_ext_amd.h:1105
@ HSA_AMD_MEMORY_POOL_INFO_RUNTIME_ALLOC_ALLOWED
Definition: hsa_ext_amd.h:1117
@ HSA_AMD_MEMORY_POOL_INFO_ALLOC_MAX_SIZE
Definition: hsa_ext_amd.h:1149
@ HSA_AMD_MEMORY_POOL_INFO_LOCATION
Definition: hsa_ext_amd.h:1154
@ HSA_AMD_MEMORY_POOL_INFO_ACCESSIBLE_BY_ALL
Definition: hsa_ext_amd.h:1144
hsa_status_t HSA_API hsa_amd_ipc_signal_create(hsa_signal_t signal, hsa_amd_ipc_signal_t *handle)
Obtains an interprocess sharing handle for a signal. The handle is valid while the signal it referenc...
hsa_status_t HSA_API hsa_amd_memory_async_copy_rect(const hsa_pitched_ptr_t *dst, const hsa_dim3_t *dst_offset, const hsa_pitched_ptr_t *src, const hsa_dim3_t *src_offset, const hsa_dim3_t *range, hsa_agent_t copy_agent, hsa_amd_copy_direction_t dir, uint32_t num_dep_signals, const hsa_signal_t *dep_signals, hsa_signal_t completion_signal)
hsa_amd_coherency_type_t
Coherency attributes of fine grain region.
Definition: hsa_ext_amd.h:496
@ HSA_AMD_COHERENCY_TYPE_NONCOHERENT
Definition: hsa_ext_amd.h:504
@ HSA_AMD_COHERENCY_TYPE_COHERENT
Definition: hsa_ext_amd.h:500
hsa_status_t HSA_API hsa_amd_memory_pool_can_migrate(hsa_amd_memory_pool_t src_memory_pool, hsa_amd_memory_pool_t dst_memory_pool, bool *result)
Query if buffers currently located in some memory pool can be relocated to a destination memory pool.
hsa_status_t HSA_API hsa_amd_interop_unmap_buffer(void *ptr)
Removes a previously mapped interop object from HSA's flat address space. Ends lifetime for the mappi...
hsa_amd_memory_pool_access_t
Type of accesses to a memory pool from a given agent.
Definition: hsa_ext_amd.h:1455
@ HSA_AMD_MEMORY_POOL_ACCESS_DISALLOWED_BY_DEFAULT
Definition: hsa_ext_amd.h:1470
@ HSA_AMD_MEMORY_POOL_ACCESS_ALLOWED_BY_DEFAULT
Definition: hsa_ext_amd.h:1464
@ HSA_AMD_MEMORY_POOL_ACCESS_NEVER_ALLOWED
Definition: hsa_ext_amd.h:1459
hsa_status_t HSA_API hsa_amd_memory_pool_get_info(hsa_amd_memory_pool_t memory_pool, hsa_amd_memory_pool_info_t attribute, void *value)
Get the current value of an attribute of a memory pool.
hsa_status_t hsa_amd_portable_export_dmabuf(const void *ptr, size_t size, int *dmabuf, uint64_t *offset)
Obtains an OS specific, vendor neutral, handle to a memory allocation.
hsa_status_t HSA_API hsa_amd_ipc_memory_detach(void *mapped_ptr)
Decrements the reference count for the shared memory mapping and releases access to shared memory imp...
hsa_status_t hsa_amd_vmem_export_shareable_handle(int *dmabuf_fd, hsa_amd_vmem_alloc_handle_t handle, uint64_t flags)
Get an exportable shareable handle.
hsa_status_t hsa_amd_vmem_get_alloc_properties_from_handle(hsa_amd_vmem_alloc_handle_t memory_handle, hsa_amd_memory_pool_t *pool, hsa_amd_memory_type_t *type)
hsa_amd_hw_exception_reset_type_t
Flags denoting the type of a HW exception.
Definition: hsa_ext_amd.h:2324
@ HSA_AMD_HW_EXCEPTION_RESET_TYPE_OTHER
Definition: hsa_ext_amd.h:2326
hsa_amd_segment_t
Memory segments associated with a memory pool.
Definition: hsa_ext_amd.h:1002
@ HSA_AMD_SEGMENT_GROUP
Definition: hsa_ext_amd.h:1020
@ HSA_AMD_SEGMENT_GLOBAL
Definition: hsa_ext_amd.h:1006
@ HSA_AMD_SEGMENT_READONLY
Definition: hsa_ext_amd.h:1011
@ HSA_AMD_SEGMENT_PRIVATE
Definition: hsa_ext_amd.h:1015
hsa_status_t hsa_amd_vmem_address_reserve(void **va, size_t size, uint64_t address, uint64_t flags)
Allocate a reserved address range.
hsa_amd_sdma_engine_id_t
SDMA engine IDs unique by single set bit position.
Definition: hsa_ext_amd.h:444
@ HSA_AMD_SDMA_ENGINE_13
Definition: hsa_ext_amd.h:458
@ HSA_AMD_SDMA_ENGINE_9
Definition: hsa_ext_amd.h:454
@ HSA_AMD_SDMA_ENGINE_2
Definition: hsa_ext_amd.h:447
@ HSA_AMD_SDMA_ENGINE_6
Definition: hsa_ext_amd.h:451
@ HSA_AMD_SDMA_ENGINE_4
Definition: hsa_ext_amd.h:449
@ HSA_AMD_SDMA_ENGINE_7
Definition: hsa_ext_amd.h:452
@ HSA_AMD_SDMA_ENGINE_11
Definition: hsa_ext_amd.h:456
@ HSA_AMD_SDMA_ENGINE_8
Definition: hsa_ext_amd.h:453
@ HSA_AMD_SDMA_ENGINE_12
Definition: hsa_ext_amd.h:457
@ HSA_AMD_SDMA_ENGINE_10
Definition: hsa_ext_amd.h:455
@ HSA_AMD_SDMA_ENGINE_1
Definition: hsa_ext_amd.h:446
@ HSA_AMD_SDMA_ENGINE_0
Definition: hsa_ext_amd.h:445
@ HSA_AMD_SDMA_ENGINE_5
Definition: hsa_ext_amd.h:450
@ HSA_AMD_SDMA_ENGINE_3
Definition: hsa_ext_amd.h:448
@ HSA_AMD_SDMA_ENGINE_14
Definition: hsa_ext_amd.h:459
@ HSA_AMD_SDMA_ENGINE_15
Definition: hsa_ext_amd.h:460
hsa_status_t HSA_API hsa_amd_profiling_get_async_copy_time(hsa_signal_t signal, hsa_amd_profiling_async_copy_time_t *time)
Retrieve asynchronous copy timestamps.
hsa_status_t HSA_API hsa_amd_agents_allow_access(uint32_t num_agents, const hsa_agent_t *agents, const uint32_t *flags, const void *ptr)
Enable direct access to a buffer from a given set of agents.
hsa_status_t hsa_amd_vmem_unmap(void *va, size_t size)
Unmap a virtual memory handle.
hsa_status_t HSA_API hsa_amd_memory_copy_engine_status(hsa_agent_t dst_agent, hsa_agent_t src_agent, uint32_t *engine_ids_mask)
Reports the availability of SDMA copy engines.
hsa_amd_memory_pool_flag_t
Memory pool flag used to specify allocation directives.
Definition: hsa_ext_amd.h:1169
@ HSA_AMD_MEMORY_POOL_PCIE_FLAG
Definition: hsa_ext_amd.h:1179
@ HSA_AMD_MEMORY_POOL_STANDARD_FLAG
Definition: hsa_ext_amd.h:1173
void(* hsa_amd_deallocation_callback_t)(void *ptr, void *user_data)
Deallocation notifier function type.
Definition: hsa_ext_amd.h:2431
hsa_status_t HSA_API hsa_amd_memory_async_copy_on_engine(void *dst, hsa_agent_t dst_agent, const void *src, hsa_agent_t src_agent, size_t size, uint32_t num_dep_signals, const hsa_signal_t *dep_signals, hsa_signal_t completion_signal, hsa_amd_sdma_engine_id_t engine_id, bool force_copy_on_sdma)
Asynchronously copy a block of memory from the location pointed to by src on the src_agent to the mem...
hsa_amd_agent_memory_properties_t
Agent memory properties attributes.
Definition: hsa_ext_amd.h:437
@ HSA_AMD_MEMORY_PROPERTY_AGENT_IS_APU
Definition: hsa_ext_amd.h:438
hsa_amd_pointer_type_t
Denotes the type of memory in a pointer info query.
Definition: hsa_ext_amd.h:1974
@ HSA_EXT_POINTER_TYPE_IPC
Definition: hsa_ext_amd.h:1998
@ HSA_EXT_POINTER_TYPE_HSA
Definition: hsa_ext_amd.h:1982
@ HSA_EXT_POINTER_TYPE_LOCKED
Definition: hsa_ext_amd.h:1990
@ HSA_EXT_POINTER_TYPE_UNKNOWN
Definition: hsa_ext_amd.h:1978
@ HSA_EXT_POINTER_TYPE_GRAPHICS
Definition: hsa_ext_amd.h:1994
hsa_amd_event_type_t
GPU system event type.
Definition: hsa_ext_amd.h:2269
@ HSA_AMD_GPU_MEMORY_FAULT_EVENT
Definition: hsa_ext_amd.h:2273
@ HSA_AMD_GPU_HW_EXCEPTION_EVENT
Definition: hsa_ext_amd.h:2277
hsa_status_t HSA_API hsa_amd_memory_fill(void *ptr, uint32_t value, size_t count)
Sets the first count of uint32_t of the block of memory pointed by ptr to the specified value.
hsa_status_t HSA_API hsa_amd_profiling_get_dispatch_time(hsa_agent_t agent, hsa_signal_t signal, hsa_amd_profiling_dispatch_time_t *time)
Retrieve packet processing time stamps.
hsa_amd_agent_memory_pool_info_t
Properties of the relationship between an agent a memory pool.
Definition: hsa_ext_amd.h:1558
@ HSA_AMD_AGENT_MEMORY_POOL_INFO_ACCESS
Definition: hsa_ext_amd.h:1579
@ HSA_AMD_AGENT_MEMORY_POOL_INFO_LINK_INFO
Definition: hsa_ext_amd.h:1596
@ HSA_AMD_AGENT_MEMORY_POOL_INFO_NUM_LINK_HOPS
Definition: hsa_ext_amd.h:1588
hsa_status_t hsa_amd_portable_close_dmabuf(int dmabuf)
Closes an OS specific, vendor neutral, handle to a memory allocation.
hsa_amd_memory_pool_location_t
Definition: hsa_ext_amd.h:1077
@ HSA_AMD_MEMORY_POOL_LOCATION_CPU
Definition: hsa_ext_amd.h:1081
@ HSA_AMD_MEMORY_POOL_LOCATION_GPU
Definition: hsa_ext_amd.h:1085
hsa_status_t hsa_amd_svm_attributes_set(void *ptr, size_t size, hsa_amd_svm_attribute_pair_t *attribute_list, size_t attribute_count)
Sets SVM memory attributes.
hsa_amd_queue_priority_t
Per-queue dispatch and wavefront scheduling priority.
Definition: hsa_ext_amd.h:2394
@ HSA_AMD_QUEUE_PRIORITY_LOW
Definition: hsa_ext_amd.h:2398
@ HSA_AMD_QUEUE_PRIORITY_HIGH
Definition: hsa_ext_amd.h:2406
@ HSA_AMD_QUEUE_PRIORITY_NORMAL
Definition: hsa_ext_amd.h:2402
bool(* hsa_amd_signal_handler)(hsa_signal_value_t value, void *arg)
Asyncronous signal handler function type.
Definition: hsa_ext_amd.h:818
hsa_status_t HSA_API hsa_amd_memory_pool_free(void *ptr)
Deallocate a block of memory previously allocated using hsa_amd_memory_pool_allocate.
hsa_amd_copy_direction_t
Definition: hsa_ext_amd.h:1430
@ hsaHostToHost
Definition: hsa_ext_amd.h:1431
@ hsaDeviceToDevice
Definition: hsa_ext_amd.h:1434
@ hsaHostToDevice
Definition: hsa_ext_amd.h:1432
@ hsaDeviceToHost
Definition: hsa_ext_amd.h:1433
hsa_status_t HSA_API hsa_amd_coherency_get_type(hsa_agent_t agent, hsa_amd_coherency_type_t *type)
Get the coherency type of the fine grain region of an agent.
hsa_amd_hw_exception_reset_cause_t
Flags denoting the cause of a HW exception.
Definition: hsa_ext_amd.h:2332
@ HSA_AMD_HW_EXCEPTION_CAUSE_GPU_HANG
Definition: hsa_ext_amd.h:2334
@ HSA_AMD_HW_EXCEPTION_CAUSE_ECC
Definition: hsa_ext_amd.h:2336
hsa_status_t HSA_API hsa_amd_memory_lock(void *host_ptr, size_t size, hsa_agent_t *agents, int num_agent, void **agent_ptr)
Pin a host pointer allocated by C/C++ or OS allocator (i.e. ordinary system DRAM) and return a new po...
hsa_status_t hsa_amd_svm_prefetch_async(void *ptr, size_t size, hsa_agent_t agent, uint32_t num_dep_signals, const hsa_signal_t *dep_signals, hsa_signal_t completion_signal)
Asynchronously migrates memory to an agent.
hsa_status_t HSA_API hsa_amd_ipc_memory_create(void *ptr, size_t len, hsa_amd_ipc_memory_t *handle)
Prepares an allocation for interprocess sharing and creates a handle of type hsa_amd_ipc_memory_t uni...
hsa_status_t(* hsa_amd_system_event_callback_t)(const hsa_amd_event_t *event, void *data)
Definition: hsa_ext_amd.h:2371
hsa_status_t HSA_API hsa_amd_profiling_convert_tick_to_system_domain(hsa_agent_t agent, uint64_t agent_tick, uint64_t *system_tick)
Computes the frequency ratio and offset between the agent clock and HSA system clock and converts the...
hsa_status_t hsa_amd_vmem_handle_release(hsa_amd_vmem_alloc_handle_t memory_handle)
Release a virtual memory handle.
hsa_amd_link_info_type_t
Properties of the relationship between an agent a memory pool.
Definition: hsa_ext_amd.h:1476
@ HSA_AMD_LINK_INFO_TYPE_XGMI
Definition: hsa_ext_amd.h:1500
@ HSA_AMD_LINK_INFO_TYPE_INFINBAND
Definition: hsa_ext_amd.h:1495
@ HSA_AMD_LINK_INFO_TYPE_PCIE
Definition: hsa_ext_amd.h:1490
@ HSA_AMD_LINK_INFO_TYPE_QPI
Definition: hsa_ext_amd.h:1485
@ HSA_AMD_LINK_INFO_TYPE_HYPERTRANSPORT
Definition: hsa_ext_amd.h:1480
hsa_status_t HSA_API hsa_amd_ipc_signal_attach(const hsa_amd_ipc_signal_t *handle, hsa_signal_t *signal)
Imports an IPC capable signal into the local process. If an IPC signal handle is attached multiple ti...
hsa_status_t hsa_amd_signal_value_pointer(hsa_signal_t signal, volatile hsa_signal_value_t **value_ptr)
Returns a pointer to the value of a signal.
AMD barrier value packet. Halts packet processing and waits for (signal_value & ::mask) ::cond ::valu...
Definition: hsa_ext_amd.h:128
hsa_amd_vendor_packet_header_t header
Definition: hsa_ext_amd.h:132
uint32_t reserved1
Definition: hsa_ext_amd.h:164
hsa_signal_value_t mask
Definition: hsa_ext_amd.h:154
uint64_t reserved2
Definition: hsa_ext_amd.h:169
hsa_signal_value_t value
Definition: hsa_ext_amd.h:149
hsa_signal_condition32_t cond
Definition: hsa_ext_amd.h:159
hsa_signal_t completion_signal
Definition: hsa_ext_amd.h:180
uint64_t reserved3
Definition: hsa_ext_amd.h:174
hsa_signal_t signal
Definition: hsa_ext_amd.h:144
uint32_t reserved0
Definition: hsa_ext_amd.h:137
AMD GPU event data passed to event handler.
Definition: hsa_ext_amd.h:2354
hsa_amd_event_type_t event_type
Definition: hsa_ext_amd.h:2358
hsa_amd_gpu_hw_exception_info_t hw_exception
Definition: hsa_ext_amd.h:2367
hsa_amd_gpu_memory_fault_info_t memory_fault
Definition: hsa_ext_amd.h:2363
AMD GPU HW Exception event data.
Definition: hsa_ext_amd.h:2342
hsa_agent_t agent
Definition: hsa_ext_amd.h:2346
hsa_amd_hw_exception_reset_type_t reset_type
Definition: hsa_ext_amd.h:2347
hsa_amd_hw_exception_reset_cause_t reset_cause
Definition: hsa_ext_amd.h:2348
AMD GPU memory fault event data.
Definition: hsa_ext_amd.h:2305
uint32_t fault_reason_mask
Definition: hsa_ext_amd.h:2318
hsa_agent_t agent
Definition: hsa_ext_amd.h:2309
uint64_t virtual_address
Definition: hsa_ext_amd.h:2313
Definition: hsa_ext_amd.h:463
uint32_t * HDP_MEM_FLUSH_CNTL
Definition: hsa_ext_amd.h:464
uint32_t * HDP_REG_FLUSH_CNTL
Definition: hsa_ext_amd.h:465
Encodes an opaque vendor specific image format. The length of data depends on the underlying format....
Definition: hsa_ext_amd.h:1920
uint32_t deviceID
Definition: hsa_ext_amd.h:1929
uint32_t version
Definition: hsa_ext_amd.h:1924
256-bit process independent identifier for a ROCr shared memory allocation.
Definition: hsa_ext_amd.h:2121
Definition: hsa_ext_amd.h:2928
hsa_access_permission_t permissions
Definition: hsa_ext_amd.h:2929
hsa_agent_t agent_handle
Definition: hsa_ext_amd.h:2930
A memory pool encapsulates physical storage on an agent along with a memory access model.
Definition: hsa_ext_amd.h:1044
uint64_t handle
Definition: hsa_ext_amd.h:1048
Describes a memory allocation known to ROCr. Within a ROCr major version this structure can only grow...
Definition: hsa_ext_amd.h:2005
void * userData
Definition: hsa_ext_amd.h:2037
uint32_t size
Definition: hsa_ext_amd.h:2013
void * agentBaseAddress
Definition: hsa_ext_amd.h:2022
hsa_agent_t agentOwner
Definition: hsa_ext_amd.h:2046
uint32_t global_flags
Definition: hsa_ext_amd.h:2052
hsa_amd_pointer_type_t type
Definition: hsa_ext_amd.h:2017
void * hostBaseAddress
Definition: hsa_ext_amd.h:2027
size_t sizeInBytes
Definition: hsa_ext_amd.h:2032
Structure containing profiling async copy time information.
Definition: hsa_ext_amd.h:571
uint64_t end
Definition: hsa_ext_amd.h:579
uint64_t start
Definition: hsa_ext_amd.h:575
Structure containing profiling dispatch time information.
Definition: hsa_ext_amd.h:554
uint64_t end
Definition: hsa_ext_amd.h:562
uint64_t start
Definition: hsa_ext_amd.h:558
Definition: hsa_ext_amd.h:2582
uint64_t value
Definition: hsa_ext_amd.h:2587
uint64_t attribute
Definition: hsa_ext_amd.h:2584
AMD vendor specific AQL packet header.
Definition: hsa_ext_amd.h:105
hsa_amd_packet_type8_t AmdFormat
Definition: hsa_ext_amd.h:115
uint16_t header
Definition: hsa_ext_amd.h:110
uint8_t reserved
Definition: hsa_ext_amd.h:120
Struct containing an opaque handle to a memory allocation handle.
Definition: hsa_ext_amd.h:2831
uint64_t handle
Definition: hsa_ext_amd.h:2836
Definition: hsa_ext_amd.h:1420
size_t slice
Definition: hsa_ext_amd.h:1423
void * base
Definition: hsa_ext_amd.h:1421
size_t pitch
Definition: hsa_ext_amd.h:1422