This page contains proposed changes for a future release of ROCm. Read the latest Linux release of ROCm documentation for your production environments.

/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 {
1184 
1186 
1201 hsa_status_t HSA_API
1203  hsa_amd_memory_pool_info_t attribute,
1204  void* value);
1205 
1240  hsa_agent_t agent,
1241  hsa_status_t (*callback)(hsa_amd_memory_pool_t memory_pool, void* data),
1242  void* data);
1243 
1280 hsa_status_t HSA_API
1282  uint32_t flags, void** ptr);
1283 
1297 hsa_status_t HSA_API hsa_amd_memory_pool_free(void* ptr);
1298 
1357 hsa_status_t HSA_API
1358  hsa_amd_memory_async_copy(void* dst, hsa_agent_t dst_agent, const void* src,
1359  hsa_agent_t src_agent, size_t size,
1360  uint32_t num_dep_signals,
1361  const hsa_signal_t* dep_signals,
1362  hsa_signal_t completion_signal);
1363 
1390 hsa_status_t HSA_API
1391  hsa_amd_memory_async_copy_on_engine(void* dst, hsa_agent_t dst_agent, const void* src,
1392  hsa_agent_t src_agent, size_t size,
1393  uint32_t num_dep_signals,
1394  const hsa_signal_t* dep_signals,
1395  hsa_signal_t completion_signal,
1396  hsa_amd_sdma_engine_id_t engine_id,
1397  bool force_copy_on_sdma);
1415 hsa_status_t HSA_API
1416  hsa_amd_memory_copy_engine_status(hsa_agent_t dst_agent, hsa_agent_t src_agent,
1417  uint32_t *engine_ids_mask);
1418 
1419 /*
1420 [Provisional API]
1421 Pitched memory descriptor.
1422 All elements must be 4 byte aligned. Pitch and slice are in bytes.
1423 */
1424 typedef struct hsa_pitched_ptr_s {
1425  void* base;
1426  size_t pitch;
1427  size_t slice;
1429 
1430 /*
1431 [Provisional API]
1432 Copy direction flag.
1433 */
1434 typedef enum {
1438  hsaDeviceToDevice = 3
1440 
1441 /*
1442 [Provisional API]
1443 SDMA 3D memory copy API. The same requirements must be met by src and dst as in
1444 hsa_amd_memory_async_copy.
1445 Both src and dst must be directly accessible to the copy_agent during the copy, src and dst rects
1446 must not overlap.
1447 CPU agents are not supported. API requires SDMA and will return an error if SDMA is not available.
1448 Offsets and range carry x in bytes, y and z in rows and layers.
1449 */
1450 hsa_status_t HSA_API hsa_amd_memory_async_copy_rect(
1451  const hsa_pitched_ptr_t* dst, const hsa_dim3_t* dst_offset, const hsa_pitched_ptr_t* src,
1452  const hsa_dim3_t* src_offset, const hsa_dim3_t* range, hsa_agent_t copy_agent,
1453  hsa_amd_copy_direction_t dir, uint32_t num_dep_signals, const hsa_signal_t* dep_signals,
1454  hsa_signal_t completion_signal);
1455 
1459 typedef enum {
1476 
1480 typedef enum {
1485 
1490 
1495 
1500 
1505 
1507 
1512 typedef struct hsa_amd_memory_pool_link_info_s {
1516  uint32_t min_latency;
1517 
1521  uint32_t max_latency;
1522 
1526  uint32_t min_bandwidth;
1527 
1531  uint32_t max_bandwidth;
1532 
1537 
1542 
1547 
1552 
1556  uint32_t numa_distance;
1558 
1562 typedef enum {
1584 
1593 
1601 
1603 
1622  hsa_agent_t agent, hsa_amd_memory_pool_t memory_pool,
1623  hsa_amd_agent_memory_pool_info_t attribute, void* value);
1624 
1662 hsa_status_t HSA_API
1663  hsa_amd_agents_allow_access(uint32_t num_agents, const hsa_agent_t* agents,
1664  const uint32_t* flags, const void* ptr);
1665 
1693 hsa_status_t HSA_API
1695  hsa_amd_memory_pool_t dst_memory_pool,
1696  bool* result);
1697 
1734 hsa_status_t HSA_API hsa_amd_memory_migrate(const void* ptr,
1735  hsa_amd_memory_pool_t memory_pool,
1736  uint32_t flags);
1737 
1772 hsa_status_t HSA_API hsa_amd_memory_lock(void* host_ptr, size_t size,
1773  hsa_agent_t* agents, int num_agent,
1774  void** agent_ptr);
1775 
1821 hsa_status_t HSA_API hsa_amd_memory_lock_to_pool(void* host_ptr, size_t size, hsa_agent_t* agents,
1822  int num_agent, hsa_amd_memory_pool_t pool,
1823  uint32_t flags, void** agent_ptr);
1824 
1841 hsa_status_t HSA_API hsa_amd_memory_unlock(void* host_ptr);
1842 
1865 hsa_status_t HSA_API
1866  hsa_amd_memory_fill(void* ptr, uint32_t value, size_t count);
1867 
1904 hsa_status_t HSA_API hsa_amd_interop_map_buffer(uint32_t num_agents,
1905  hsa_agent_t* agents,
1906  int interop_handle,
1907  uint32_t flags,
1908  size_t* size,
1909  void** ptr,
1910  size_t* metadata_size,
1911  const void** metadata);
1912 
1917 hsa_status_t HSA_API hsa_amd_interop_unmap_buffer(void* ptr);
1918 
1924 typedef struct hsa_amd_image_descriptor_s {
1925  /*
1926  Version number of the descriptor
1927  */
1928  uint32_t version;
1929 
1930  /*
1931  Vendor and device PCI IDs for the format as VENDOR_ID<<16|DEVICE_ID.
1932  */
1933  uint32_t deviceID;
1934 
1935  /*
1936  Start of vendor specific data.
1937  */
1938  uint32_t data[1];
1940 
1966 hsa_status_t HSA_API hsa_amd_image_create(
1967  hsa_agent_t agent,
1968  const hsa_ext_image_descriptor_t *image_descriptor,
1969  const hsa_amd_image_descriptor_t *image_layout,
1970  const void *image_data,
1971  hsa_access_permission_t access_permission,
1972  hsa_ext_image_t *image
1973 );
1974 
1978 typedef enum {
1979  /*
1980  Memory is not known to the HSA driver. Unallocated or unlocked system memory.
1981  */
1983  /*
1984  Memory was allocated with an HSA memory allocator.
1985  */
1987  /*
1988  System memory which has been locked for use with an HSA agent.
1989 
1990  Memory of this type is normal malloc'd memory and is always accessible to
1991  the CPU. Pointer info queries may not include CPU agents in the accessible
1992  agents list as the CPU has implicit access.
1993  */
1995  /*
1996  Memory originated in a graphics component and is shared with ROCr.
1997  */
1999  /*
2000  Memory has been shared with the local process via ROCr IPC APIs.
2001  */
2004 
2009 typedef struct hsa_amd_pointer_info_s {
2010  /*
2011  Size in bytes of this structure. Used for version control within a major ROCr
2012  revision. Set to sizeof(hsa_amd_pointer_t) prior to calling
2013  hsa_amd_pointer_info. If the runtime supports an older version of pointer
2014  info then size will be smaller on return. Members starting after the return
2015  value of size will not be updated by hsa_amd_pointer_info.
2016  */
2017  uint32_t size;
2018  /*
2019  The type of allocation referenced.
2020  */
2022  /*
2023  Base address at which non-host agents may access the allocation. This field is
2024  not meaningful if the type of the allocation is HSA_EXT_POINTER_TYPE_UNKNOWN.
2025  */
2027  /*
2028  Base address at which the host agent may access the allocation. This field is
2029  not meaningful if the type of the allocation is HSA_EXT_POINTER_TYPE_UNKNOWN.
2030  */
2032  /*
2033  Size of the allocation. This field is not meaningful if the type of the allocation
2034  is HSA_EXT_POINTER_TYPE_UNKNOWN.
2035  */
2036  size_t sizeInBytes;
2037  /*
2038  Application provided value. This field is not meaningful if the type of the
2039  allocation is HSA_EXT_POINTER_TYPE_UNKNOWN.
2040  */
2041  void* userData;
2042  /*
2043  Reports an agent which "owns" (ie has preferred access to) the pool in which the
2044  allocation was
2045  made. When multiple agents share equal access to a pool (ex: multiple CPU agents, or multi-die
2046  GPU boards) any such agent may be returned. This field is not meaningful if
2047  the type of the allocation is HSA_EXT_POINTER_TYPE_UNKNOWN or if this agent is not available in
2048  this process, for e.g if this agent is masked using ROCR_VISIBLE_DEVICES.
2049  */
2050  hsa_agent_t agentOwner;
2051  /*
2052  Contains a bitfield of hsa_amd_memory_pool_global_flag_t values.
2053  Reports the effective global flags bitmask for the allocation. This field is not
2054  meaningful if the type of the allocation is HSA_EXT_POINTER_TYPE_UNKNOWN.
2055  */
2056  uint32_t global_flags;
2058 
2094 hsa_status_t HSA_API hsa_amd_pointer_info(const void* ptr,
2095  hsa_amd_pointer_info_t* info,
2096  void* (*alloc)(size_t),
2097  uint32_t* num_agents_accessible,
2098  hsa_agent_t** accessible);
2099 
2118 hsa_status_t HSA_API hsa_amd_pointer_info_set_userdata(const void* ptr,
2119  void* userdata);
2120 
2125 typedef struct hsa_amd_ipc_memory_s {
2126  uint32_t handle[8];
2128 
2159 hsa_status_t HSA_API hsa_amd_ipc_memory_create(void* ptr, size_t len,
2160  hsa_amd_ipc_memory_t* handle);
2161 
2193 hsa_status_t HSA_API hsa_amd_ipc_memory_attach(
2194  const hsa_amd_ipc_memory_t* handle, size_t len,
2195  uint32_t num_agents,
2196  const hsa_agent_t* mapping_agents,
2197  void** mapped_ptr);
2198 
2214 hsa_status_t HSA_API hsa_amd_ipc_memory_detach(void* mapped_ptr);
2215 
2220 
2245 hsa_status_t HSA_API hsa_amd_ipc_signal_create(hsa_signal_t signal, hsa_amd_ipc_signal_t* handle);
2246 
2267 hsa_status_t HSA_API hsa_amd_ipc_signal_attach(const hsa_amd_ipc_signal_t* handle,
2268  hsa_signal_t* signal);
2269 
2273 typedef enum hsa_amd_event_type_s {
2274  /*
2275  AMD GPU memory fault.
2276  */
2278  /*
2279  AMD GPU HW Exception.
2280  */
2283 
2287 typedef enum {
2288  // Page not present or supervisor privilege.
2290  // Write access to a read-only page.
2292  // Execute access to a page marked NX.
2294  // GPU attempted access to a host only page.
2296  // DRAM ECC failure.
2298  // Can't determine the exact fault address.
2300  // SRAM ECC failure (ie registers, no fault address).
2302  // GPU reset following unspecified hang.
2303  HSA_AMD_MEMORY_FAULT_HANG = 1U << 31
2305 
2309 typedef struct hsa_amd_gpu_memory_fault_info_s {
2310  /*
2311  The agent where the memory fault occurred.
2312  */
2313  hsa_agent_t agent;
2314  /*
2315  Virtual address accessed.
2316  */
2318  /*
2319  Bit field encoding the memory access failure reasons. There could be multiple bits set
2320  for one fault. Bits are defined in hsa_amd_memory_fault_reason_t.
2321  */
2324 
2328 typedef enum {
2329  // Unused for now
2332 
2336 typedef enum {
2337  // GPU Hang
2339  // SRAM ECC
2342 
2346 typedef struct hsa_amd_gpu_hw_exception_info_s {
2347  /*
2348  The agent where the HW exception occurred.
2349  */
2350  hsa_agent_t agent;
2354 
2358 typedef struct hsa_amd_event_s {
2359  /*
2360  The event type.
2361  */
2363  union {
2364  /*
2365  The memory fault info, only valid when @p event_type is HSA_AMD_GPU_MEMORY_FAULT_EVENT.
2366  */
2368  /*
2369  The memory fault info, only valid when @p event_type is HSA_AMD_GPU_HW_EXCEPTION_EVENT.
2370  */
2372  };
2373 } hsa_amd_event_t;
2374 
2375 typedef hsa_status_t (*hsa_amd_system_event_callback_t)(const hsa_amd_event_t* event, void* data);
2376 
2393  void* data);
2394 
2398 typedef enum hsa_amd_queue_priority_s {
2399  /*
2400  Below normal/high priority compute and all graphics
2401  */
2403  /*
2404  Above low priority compute, below high priority compute and all graphics
2405  */
2407  /*
2408  Above low/normal priority compute and all graphics
2409  */
2412 
2429 hsa_status_t HSA_API hsa_amd_queue_set_priority(hsa_queue_t* queue,
2430  hsa_amd_queue_priority_t priority);
2431 
2435 typedef void (*hsa_amd_deallocation_callback_t)(void* ptr, void* user_data);
2436 
2469 hsa_status_t HSA_API hsa_amd_register_deallocation_callback(void* ptr,
2471  void* user_data);
2472 
2489 hsa_status_t HSA_API hsa_amd_deregister_deallocation_callback(void* ptr,
2491 
2492 typedef enum hsa_amd_svm_model_s {
2514 
2515 typedef enum hsa_amd_svm_attribute_s {
2516  // Memory model attribute.
2517  // Type of this attribute is hsa_amd_svm_model_t.
2519  // Marks the range read only. This allows multiple physical copies to be
2520  // placed local to each accessing device.
2521  // Type of this attribute is bool.
2523  // Automatic migrations should attempt to keep the memory within the xgmi hive
2524  // containing accessible agents.
2525  // Type of this attribute is bool.
2527  // Page granularity to migrate at once. Page granularity is specified as
2528  // log2(page_count).
2529  // Type of this attribute is uint64_t.
2531  // Physical location to prefer when automatic migration occurs.
2532  // Set to the null agent handle (handle == 0) to indicate there
2533  // is no preferred location.
2534  // Type of this attribute is hsa_agent_t.
2536  // This attribute can not be used in ::hsa_amd_svm_attributes_set (see
2537  // ::hsa_amd_svm_prefetch_async).
2538  // Queries the physical location of most recent prefetch command.
2539  // If the prefetch location has not been set or is not uniform across the
2540  // address range then returned hsa_agent_t::handle will be 0.
2541  // Querying this attribute will return the destination agent of the most
2542  // recent ::hsa_amd_svm_prefetch_async targeting the address range. If
2543  // multiple async prefetches have been issued targeting the region and the
2544  // most recently issued prefetch has completed then the query will return
2545  // the location of the most recently completed prefetch.
2546  // Type of this attribute is hsa_agent_t.
2548  // Optimizes with the anticipation that the majority of operations to the
2549  // range will be read operations.
2550  // Type of this attribute is bool.
2552  // Allows the execution on GPU.
2553  // Type of this attribute is bool.
2555  // This attribute can not be used in ::hsa_amd_svm_attributes_get.
2556  // Enables an agent for access to the range. Access may incur a page fault
2557  // and associated memory migration. Either this or
2558  // HSA_AMD_SVM_ATTRIB_AGENT_ACCESSIBLE_IN_PLACE is required prior to SVM
2559  // access if HSA_AMD_SYSTEM_INFO_SVM_ACCESSIBLE_BY_DEFAULT is false.
2560  // Type of this attribute is hsa_agent_t.
2562  // This attribute can not be used in ::hsa_amd_svm_attributes_get.
2563  // Enables an agent for access to the range without page faults. Access
2564  // will not incur a page fault and will not cause access based migration.
2565  // and associated memory migration. Either this or
2566  // HSA_AMD_SVM_ATTRIB_AGENT_ACCESSIBLE is required prior to SVM access if
2567  // HSA_AMD_SYSTEM_INFO_SVM_ACCESSIBLE_BY_DEFAULT is false.
2568  // Type of this attribute is hsa_agent_t.
2570  // This attribute can not be used in ::hsa_amd_svm_attributes_get.
2571  // Denies an agent access to the memory range. Access will cause a terminal
2572  // segfault.
2573  // Type of this attribute is hsa_agent_t.
2575  // This attribute can not be used in ::hsa_amd_svm_attributes_set.
2576  // Returns the access attribute associated with the agent.
2577  // The agent to query must be set in the attribute value field.
2578  // The attribute enum will be replaced with the agent's current access
2579  // attribute for the address range.
2580  // TODO: Clarify KFD return value for non-uniform access attribute.
2581  // Type of this attribute is hsa_agent_t.
2584 
2585 // List type for hsa_amd_svm_attributes_set/get.
2586 typedef struct hsa_amd_svm_attribute_pair_s {
2587  // hsa_amd_svm_attribute_t value.
2588  uint64_t attribute;
2589  // Attribute value. Bit values should be interpreted according to the type
2590  // given in the associated attribute description.
2591  uint64_t value;
2593 
2613 hsa_status_t hsa_amd_svm_attributes_set(void* ptr, size_t size,
2614  hsa_amd_svm_attribute_pair_t* attribute_list,
2615  size_t attribute_count);
2616 
2635 hsa_status_t hsa_amd_svm_attributes_get(void* ptr, size_t size,
2636  hsa_amd_svm_attribute_pair_t* attribute_list,
2637  size_t attribute_count);
2638 
2663 hsa_status_t hsa_amd_svm_prefetch_async(void* ptr, size_t size, hsa_agent_t agent,
2664  uint32_t num_dep_signals, const hsa_signal_t* dep_signals,
2665  hsa_signal_t completion_signal);
2666 
2675 hsa_status_t hsa_amd_spm_acquire(hsa_agent_t preferred_agent);
2676 
2686 hsa_status_t hsa_amd_spm_release(hsa_agent_t preferred_agent);
2687 
2716 hsa_status_t hsa_amd_spm_set_dest_buffer(hsa_agent_t preferred_agent, size_t size_in_bytes,
2717  uint32_t* timeout, uint32_t* size_copied, void* dest,
2718  bool* is_data_loss);
2764 hsa_status_t hsa_amd_portable_export_dmabuf(const void* ptr, size_t size, int* dmabuf,
2765  uint64_t* offset);
2766 
2788 hsa_status_t hsa_amd_portable_close_dmabuf(int dmabuf);
2789 
2811 hsa_status_t hsa_amd_vmem_address_reserve(void** va, size_t size, uint64_t address,
2812  uint64_t flags);
2813 
2830 hsa_status_t hsa_amd_vmem_address_free(void* va, size_t size);
2831 
2835 typedef struct hsa_amd_vmem_alloc_handle_s {
2840  uint64_t handle;
2842 
2843 typedef enum {
2847 
2873 hsa_status_t hsa_amd_vmem_handle_create(hsa_amd_memory_pool_t pool, size_t size,
2874  hsa_amd_memory_type_t type, uint64_t flags,
2875  hsa_amd_vmem_alloc_handle_t* memory_handle);
2876 
2887 
2911 hsa_status_t hsa_amd_vmem_map(void* va, size_t size, size_t in_offset,
2912  hsa_amd_vmem_alloc_handle_t memory_handle, uint64_t flags);
2913 
2930 hsa_status_t hsa_amd_vmem_unmap(void* va, size_t size);
2931 
2932 typedef struct hsa_amd_memory_access_desc_s {
2933  hsa_access_permission_t permissions;
2934  hsa_agent_t agent_handle;
2936 
2962 hsa_status_t hsa_amd_vmem_set_access(void* va, size_t size,
2963  const hsa_amd_memory_access_desc_t* desc,
2964  size_t desc_cnt);
2965 
2984 hsa_status_t hsa_amd_vmem_get_access(void* va, hsa_access_permission_t* perms,
2985  hsa_agent_t agent_handle);
2986 
3007 hsa_status_t hsa_amd_vmem_export_shareable_handle(int* dmabuf_fd,
3009  uint64_t flags);
3027 hsa_status_t hsa_amd_vmem_import_shareable_handle(int dmabuf_fd,
3028  hsa_amd_vmem_alloc_handle_t* handle);
3029 
3045  void* addr);
3046 
3047 /*
3048 * @brief Returns the current allocation properties of a handle
3049 *
3050 * Returns the allocation properties of an existing handle
3051 *
3052 * @param[in] memory_handle memory handle to be queried
3053 * @param[out] pool memory pool that owns this handle
3054 * @param[out] memory type
3055 
3056 * @retval ::HSA_STATUS_SUCCESS
3057 *
3058 * @retval ::HSA_STATUS_ERROR_INVALID_ALLOCATION Invalid memory_handle
3059 */
3062  hsa_amd_memory_type_t* type);
3063 
3089 hsa_status_t HSA_API hsa_amd_agent_set_async_scratch_limit(hsa_agent_t agent, size_t threshold);
3090 
3091 #ifdef __cplusplus
3092 } // end extern "C" block
3093 #endif
3094 
3095 #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:2492
@ HSA_AMD_SVM_GLOBAL_FLAG_COARSE_GRAINED
Definition: hsa_ext_amd.h:2502
@ HSA_AMD_SVM_GLOBAL_FLAG_FINE_GRAINED
Definition: hsa_ext_amd.h:2497
@ HSA_AMD_SVM_GLOBAL_FLAG_INDETERMINATE
Definition: hsa_ext_amd.h:2512
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:2843
@ MEMORY_TYPE_PINNED
Definition: hsa_ext_amd.h:2845
@ MEMORY_TYPE_NONE
Definition: hsa_ext_amd.h:2844
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:2219
@ 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:2287
@ HSA_AMD_MEMORY_FAULT_DRAMECC
Definition: hsa_ext_amd.h:2297
@ HSA_AMD_MEMORY_FAULT_HANG
Definition: hsa_ext_amd.h:2303
@ HSA_AMD_MEMORY_FAULT_PAGE_NOT_PRESENT
Definition: hsa_ext_amd.h:2289
@ HSA_AMD_MEMORY_FAULT_SRAMECC
Definition: hsa_ext_amd.h:2301
@ HSA_AMD_MEMORY_FAULT_NX
Definition: hsa_ext_amd.h:2293
@ HSA_AMD_MEMORY_FAULT_IMPRECISE
Definition: hsa_ext_amd.h:2299
@ HSA_AMD_MEMORY_FAULT_HOST_ONLY
Definition: hsa_ext_amd.h:2295
@ HSA_AMD_MEMORY_FAULT_READ_ONLY
Definition: hsa_ext_amd.h:2291
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:2515
@ HSA_AMD_SVM_ATTRIB_READ_ONLY
Definition: hsa_ext_amd.h:2522
@ HSA_AMD_SVM_ATTRIB_AGENT_ACCESSIBLE
Definition: hsa_ext_amd.h:2561
@ HSA_AMD_SVM_ATTRIB_AGENT_NO_ACCESS
Definition: hsa_ext_amd.h:2574
@ HSA_AMD_SVM_ATTRIB_PREFETCH_LOCATION
Definition: hsa_ext_amd.h:2547
@ HSA_AMD_SVM_ATTRIB_MIGRATION_GRANULARITY
Definition: hsa_ext_amd.h:2530
@ HSA_AMD_SVM_ATTRIB_HIVE_LOCAL
Definition: hsa_ext_amd.h:2526
@ HSA_AMD_SVM_ATTRIB_GPU_EXEC
Definition: hsa_ext_amd.h:2554
@ HSA_AMD_SVM_ATTRIB_PREFERRED_LOCATION
Definition: hsa_ext_amd.h:2535
@ HSA_AMD_SVM_ATTRIB_READ_MOSTLY
Definition: hsa_ext_amd.h:2551
@ HSA_AMD_SVM_ATTRIB_AGENT_ACCESSIBLE_IN_PLACE
Definition: hsa_ext_amd.h:2569
@ HSA_AMD_SVM_ATTRIB_ACCESS_QUERY
Definition: hsa_ext_amd.h:2582
@ HSA_AMD_SVM_ATTRIB_GLOBAL_FLAG
Definition: hsa_ext_amd.h:2518
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:1459
@ HSA_AMD_MEMORY_POOL_ACCESS_DISALLOWED_BY_DEFAULT
Definition: hsa_ext_amd.h:1474
@ HSA_AMD_MEMORY_POOL_ACCESS_ALLOWED_BY_DEFAULT
Definition: hsa_ext_amd.h:1468
@ HSA_AMD_MEMORY_POOL_ACCESS_NEVER_ALLOWED
Definition: hsa_ext_amd.h:1463
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:2328
@ HSA_AMD_HW_EXCEPTION_RESET_TYPE_OTHER
Definition: hsa_ext_amd.h:2330
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
@ HSA_AMD_MEMORY_POOL_CONTIGUOUS_FLAG
Definition: hsa_ext_amd.h:1183
void(* hsa_amd_deallocation_callback_t)(void *ptr, void *user_data)
Deallocation notifier function type.
Definition: hsa_ext_amd.h:2435
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:1978
@ HSA_EXT_POINTER_TYPE_IPC
Definition: hsa_ext_amd.h:2002
@ HSA_EXT_POINTER_TYPE_HSA
Definition: hsa_ext_amd.h:1986
@ HSA_EXT_POINTER_TYPE_LOCKED
Definition: hsa_ext_amd.h:1994
@ HSA_EXT_POINTER_TYPE_UNKNOWN
Definition: hsa_ext_amd.h:1982
@ HSA_EXT_POINTER_TYPE_GRAPHICS
Definition: hsa_ext_amd.h:1998
hsa_amd_event_type_t
GPU system event type.
Definition: hsa_ext_amd.h:2273
@ HSA_AMD_GPU_MEMORY_FAULT_EVENT
Definition: hsa_ext_amd.h:2277
@ HSA_AMD_GPU_HW_EXCEPTION_EVENT
Definition: hsa_ext_amd.h:2281
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:1562
@ HSA_AMD_AGENT_MEMORY_POOL_INFO_ACCESS
Definition: hsa_ext_amd.h:1583
@ HSA_AMD_AGENT_MEMORY_POOL_INFO_LINK_INFO
Definition: hsa_ext_amd.h:1600
@ HSA_AMD_AGENT_MEMORY_POOL_INFO_NUM_LINK_HOPS
Definition: hsa_ext_amd.h:1592
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:2398
@ HSA_AMD_QUEUE_PRIORITY_LOW
Definition: hsa_ext_amd.h:2402
@ HSA_AMD_QUEUE_PRIORITY_HIGH
Definition: hsa_ext_amd.h:2410
@ HSA_AMD_QUEUE_PRIORITY_NORMAL
Definition: hsa_ext_amd.h:2406
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:1434
@ hsaHostToHost
Definition: hsa_ext_amd.h:1435
@ hsaDeviceToDevice
Definition: hsa_ext_amd.h:1438
@ hsaHostToDevice
Definition: hsa_ext_amd.h:1436
@ hsaDeviceToHost
Definition: hsa_ext_amd.h:1437
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:2336
@ HSA_AMD_HW_EXCEPTION_CAUSE_GPU_HANG
Definition: hsa_ext_amd.h:2338
@ HSA_AMD_HW_EXCEPTION_CAUSE_ECC
Definition: hsa_ext_amd.h:2340
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:2375
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:1480
@ HSA_AMD_LINK_INFO_TYPE_XGMI
Definition: hsa_ext_amd.h:1504
@ HSA_AMD_LINK_INFO_TYPE_INFINBAND
Definition: hsa_ext_amd.h:1499
@ HSA_AMD_LINK_INFO_TYPE_PCIE
Definition: hsa_ext_amd.h:1494
@ HSA_AMD_LINK_INFO_TYPE_QPI
Definition: hsa_ext_amd.h:1489
@ HSA_AMD_LINK_INFO_TYPE_HYPERTRANSPORT
Definition: hsa_ext_amd.h:1484
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:2358
hsa_amd_event_type_t event_type
Definition: hsa_ext_amd.h:2362
hsa_amd_gpu_hw_exception_info_t hw_exception
Definition: hsa_ext_amd.h:2371
hsa_amd_gpu_memory_fault_info_t memory_fault
Definition: hsa_ext_amd.h:2367
AMD GPU HW Exception event data.
Definition: hsa_ext_amd.h:2346
hsa_agent_t agent
Definition: hsa_ext_amd.h:2350
hsa_amd_hw_exception_reset_type_t reset_type
Definition: hsa_ext_amd.h:2351
hsa_amd_hw_exception_reset_cause_t reset_cause
Definition: hsa_ext_amd.h:2352
AMD GPU memory fault event data.
Definition: hsa_ext_amd.h:2309
uint32_t fault_reason_mask
Definition: hsa_ext_amd.h:2322
hsa_agent_t agent
Definition: hsa_ext_amd.h:2313
uint64_t virtual_address
Definition: hsa_ext_amd.h:2317
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:1924
uint32_t deviceID
Definition: hsa_ext_amd.h:1933
uint32_t version
Definition: hsa_ext_amd.h:1928
256-bit process independent identifier for a ROCr shared memory allocation.
Definition: hsa_ext_amd.h:2125
Definition: hsa_ext_amd.h:2932
hsa_access_permission_t permissions
Definition: hsa_ext_amd.h:2933
hsa_agent_t agent_handle
Definition: hsa_ext_amd.h:2934
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:2009
void * userData
Definition: hsa_ext_amd.h:2041
uint32_t size
Definition: hsa_ext_amd.h:2017
void * agentBaseAddress
Definition: hsa_ext_amd.h:2026
hsa_agent_t agentOwner
Definition: hsa_ext_amd.h:2050
uint32_t global_flags
Definition: hsa_ext_amd.h:2056
hsa_amd_pointer_type_t type
Definition: hsa_ext_amd.h:2021
void * hostBaseAddress
Definition: hsa_ext_amd.h:2031
size_t sizeInBytes
Definition: hsa_ext_amd.h:2036
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:2586
uint64_t value
Definition: hsa_ext_amd.h:2591
uint64_t attribute
Definition: hsa_ext_amd.h:2588
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:2835
uint64_t handle
Definition: hsa_ext_amd.h:2840
Definition: hsa_ext_amd.h:1424
size_t slice
Definition: hsa_ext_amd.h:1427
void * base
Definition: hsa_ext_amd.h:1425
size_t pitch
Definition: hsa_ext_amd.h:1426