rocprofiler-sdk/hipfile/details/hipfile.h Source File

rocprofiler-sdk/hipfile/details/hipfile.h Source File#

ROCprofiler-SDK developer API: rocprofiler-sdk/hipfile/details/hipfile.h Source File
ROCprofiler-SDK developer API 1.3.5
ROCm Profiling API and tools
hipfile.h
Go to the documentation of this file.
1/* Copyright (c) Advanced Micro Devices, Inc. All rights reserved.
2 *
3 * SPDX-License-Identifier: MIT
4 */
5
6#pragma once
7
8// clang-format off
9
10#include <hip/hip_runtime_api.h>
11#include <stdbool.h>
12#include <stdint.h>
13#include <stdlib.h>
14#include <sys/types.h>
15
16/* Needed for struct sockaddr */
17#ifdef _WIN32
18#include <winsock2.h>
19#else
20#include <sys/socket.h>
21#endif
22
23#if defined(__GNUC__)
24#define HIPFILE_API __attribute__((visibility("default")))
25#else
26#define HIPFILE_API
27#endif
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33// ***********************************************************************
34// DOXYGEN SETUP
35// ***********************************************************************
36
37// Without the `file`/`defgroup` directives, Doxgyen will not emit
38// documentation for anything aside from structs in a C header.
39//
40// *ALL* Doxygen comment blocks should have an `ingroup` directive so they
41// group properly in the output.
42
43/**
44 * @file
45 *
46 * @mainpage hipFile API Reference
47 *
48 * @section contents Contents
49 * - @ref core
50 * - @ref error
51 * - @ref driver
52 * - @ref rdma
53 * - @ref file
54 * - @ref batch
55 * - @ref async
56 */
57
58/*!
59 * @defgroup core Core Functionality
60 *
61 * @defgroup error Errors and Error Handling
62 *
63 * @defgroup driver GPU IO Driver API
64 *
65 * @defgroup rdma Userspace RDMA API
66 *
67 * @defgroup file File Handle API
68 *
69 * @defgroup batch Batch API
70 *
71 * @defgroup async Async API
72 *
73 * @defgroup sync Synchronous I/O API
74 */
75
76// ***********************************************************************
77// LIBRARY VERSION NUMBERS
78// ***********************************************************************
79
80/*!
81 * @brief hipFile major version number
82 * @ingroup core
83 */
84#define HIPFILE_VERSION_MAJOR 0
85/*!
86 * @brief hipFile minor version number
87 * @ingroup core
88 */
89#define HIPFILE_VERSION_MINOR 3
90/*!
91 * @brief hipFile patch version number
92 * @ingroup core
93 */
94#define HIPFILE_VERSION_PATCH 0
95
96// ***********************************************************************
97// PLATFORM-INDEPENDENT TYPES
98// ***********************************************************************
99
100/*!
101 * @brief Platform-independent offset type
102 * @ingroup sync
103 */
104#ifdef _WIN32
105typedef __int64 hoff_t;
106#else
107typedef off_t hoff_t;
108#endif
109
110/* Handle ssize_t on Windows (does not need Doxygen) */
111#ifdef _WIN32
112#include <BaseTsd.h>
113typedef SSIZE_T ssize_t;
114#endif
115
116// ***********************************************************************
117// ERROR HANDLING
118// ***********************************************************************
119
120/*!
121 * @brief The base value for hipFile error codes
122 * @ingroup error
123 */
124#define HIPFILE_BASE_ERR 5000
125
126/* clang-format off */
127/*!
128 * @brief hipFile function return codes
129 * @ingroup error
130 *
131 * An error code of -1 indicates a that a C or POSIX error has occurred and
132 * errno is likely to have been set.
133 *
134 * @note HIPFILE_BASE_ERR + 21 and 32 are intentionally omitted.
135 */
136typedef enum hipFileOpError {
137 hipFileSuccess = 0, //!< hipFile operation completed successfully
138 hipFileDriverNotInitialized = HIPFILE_BASE_ERR + 1, //!< GPU IO driver is not loaded
139 hipFileDriverInvalidProps = HIPFILE_BASE_ERR + 2, //!< Invalid GPU IO driver property provided
140 hipFileDriverUnsupportedLimit = HIPFILE_BASE_ERR + 3, //!< GPU IO Driver property value is unsupported
141 hipFileDriverVersionMismatch = HIPFILE_BASE_ERR + 4, //!< hipFile version does not match GPU IO driver version
142 hipFileDriverVersionReadError = HIPFILE_BASE_ERR + 5, //!< Unable to read the GPU IO driver version
143 hipFileDriverClosing = HIPFILE_BASE_ERR + 6, //!< GPU IO driver is closing and not accepting new requests
144 hipFilePlatformNotSupported = HIPFILE_BASE_ERR + 7, //!< hipFile is not supported on the current platform
145 hipFileIONotSupported = HIPFILE_BASE_ERR + 8, //!< hipFile is not supported on the selected file
146 hipFileDeviceNotSupported = HIPFILE_BASE_ERR + 9, //!< The selected GPU does not support hipFile
147 hipFileDriverError = HIPFILE_BASE_ERR + 10, //!< GPU IO driver error
148 hipFileHipDriverError = HIPFILE_BASE_ERR + 11, //!< GPU driver error: Inspect the hipError_t value for additional information
149 hipFileHipPointerInvalid = HIPFILE_BASE_ERR + 12, //!< Invalid GPU pointer
150 hipFileHipMemoryTypeInvalid = HIPFILE_BASE_ERR + 13, //!< Memory type backing pointer is incompatible with hipFile
151 hipFileHipPointerRangeError = HIPFILE_BASE_ERR + 14, //!< Pointer range exceeds allocated memory region
152 hipFileHipContextMismatch = HIPFILE_BASE_ERR + 15, //!< GPU driver context mismatch
153 hipFileInvalidMappingSize = HIPFILE_BASE_ERR + 16, //!< Accessing memory beyond pinned memory buffer
154 hipFileInvalidMappingRange = HIPFILE_BASE_ERR + 17, //!< Accessing memory beyond mapped memory region
155 hipFileInvalidFileType = HIPFILE_BASE_ERR + 18, //!< Unsupported file type
156 hipFileInvalidFileOpenFlag = HIPFILE_BASE_ERR + 19, //!< Unsupported file open flags
157 hipFileDIONotSet = HIPFILE_BASE_ERR + 20, //!< O_DIRECT flag not set
158 /* Value 5021 intentionally unused */
159 hipFileInvalidValue = HIPFILE_BASE_ERR + 22, //!< One or more arguments have an invalid value
160 hipFileMemoryAlreadyRegistered = HIPFILE_BASE_ERR + 23, //!< Device pointer is already registered
161 hipFileMemoryNotRegistered = HIPFILE_BASE_ERR + 24, //!< Device pointer is not registered
162 hipFilePermissionDenied = HIPFILE_BASE_ERR + 25, //!< Permission error on device or file access
163 hipFileDriverAlreadyOpen = HIPFILE_BASE_ERR + 26, //!< GPU IO driver is already open
164 hipFileHandleNotRegistered = HIPFILE_BASE_ERR + 27, //!< File handle for GPU IO is not registered
165 hipFileHandleAlreadyRegistered = HIPFILE_BASE_ERR + 28, //!< File handle for GPU IO is already registered
166 hipFileDeviceNotFound = HIPFILE_BASE_ERR + 29, //!< Selected device not found
167 hipFileInternalError = HIPFILE_BASE_ERR + 30, //!< Internal GPU IO library error
168 hipFileGetNewFDFailed = HIPFILE_BASE_ERR + 31, //!< Unable to obtain a new file descriptor
169 /* Value 5032 intentionally unused */
170 hipFileDriverSetupError = HIPFILE_BASE_ERR + 33, //!< GPU IO Driver initialization error
171 hipFileIODisabled = HIPFILE_BASE_ERR + 34, //!< GPU IO config file prohibits GPU IO on specified file
172 hipFileBatchSubmitFailed = HIPFILE_BASE_ERR + 35, //!< Failed to submit request for batch operation
173 hipFileGPUMemoryPinningFailed = HIPFILE_BASE_ERR + 36, //!< Failed to allocated pinned device memory
174 hipFileBatchFull = HIPFILE_BASE_ERR + 37, //!< Batch operation queue is full
175 hipFileAsyncNotSupported = HIPFILE_BASE_ERR + 38, //!< hipFile async IO is not supported
176 hipFileIOMaxError = HIPFILE_BASE_ERR + 39, //!< Internal flag to mark largest hipFile error code
178/* clang-format on */
179// clang-format off
180
181/*!
182 * @brief Return a descriptive string for a hipFile error
183 * @ingroup error
184 *
185 * @param [in] status Return code provided by hipFile
186 *
187 * @return Description of the error encountered
188 */
189HIPFILE_API
191
192// Ignoring return values from hipFile APIs is discouraged.
193// In C++17 and C23 and up, we can make that emit a warning.
194#if (defined(__cplusplus) && __cplusplus >= 201703L) || __STDC_VERSION__ >= 202311L
195#define __HIPFILE_NODISCARD [[nodiscard]]
196#else
197#define __HIPFILE_NODISCARD
198#endif
199
200/*!
201 * @brief Error status returned from hipFile API calls
202 * @ingroup error
203 *
204 * @note This struct has the `[[nodiscard]]` attribute in C++ >= 17 and
205 * C >= 23 so unhandled return values will generate warnings
206 */
207typedef struct __HIPFILE_NODISCARD hipFileError {
208 hipFileOpError_t err; //!< Errors related to hipFile or the GPU IO driver
209 hipError_t hip_drv_err; //!< Errors related to the GPU driver
211
212/*!
213 * @brief Determine if an error code is a hipFile error
214 * @ingroup error
215 * @hideinitializer
216 *
217 * Signature
218 * @code
219 * bool IS_HIPFILE_ERR(hipFileOpError err)
220 * @endcode
221 *
222 * @return true/false
223 */
224#define IS_HIPFILE_ERR(hip_op_err) (abs(hip_op_err) > HIPFILE_BASE_ERR)
225
226/*!
227 * @brief Get an error string for a hipFile error
228 * @ingroup error
229 * @hideinitializer
230 *
231 * Signature
232 * @code
233 * const char *HIPFILE_ERRSTR(hipFileOpError err)
234 * @endcode
235 *
236 * @return A string description of a hipFile error
237 */
238#define HIPFILE_ERRSTR(hip_op_err) hipFileGetOpErrorString((hipFileOpError_t)abs(hip_op_err))
239
240/*!
241 * @brief Determine if an error is a hipFile driver error
242 * @ingroup error
243 * @hideinitializer
244 *
245 * Signature
246 * @code
247 * bool IS_HIP_DRV_ERR(hipFileError_t err)
248 * @endcode
249 *
250 * @return true/false
251 */
252#ifndef IS_HIP_DRV_ERR
253#define IS_HIP_DRV_ERR(hip_err) (hip_err.err == hipFileHipDriverError)
254#endif
255
256/*!
257 * @brief Get the driver error from a hipFileError_t
258 * @ingroup error
259 * @hideinitializer
260 *
261 * Signature
262 * @code
263 * hipError_t HIP_DRV_ERR(hipFileError_t err)
264 * @endcode
265 *
266 * @return The hipError_t component of err
267 */
268#ifndef HIP_DRV_ERR
269#define HIP_DRV_ERR(hip_err) (hip_err.hip_drv_err)
270#endif
271
272// ***********************************************************************
273// GPU IO DRIVER API
274// ***********************************************************************
275
276/*
277 * Most of the enums in this defgroup indicate that their intended
278 * use is as flags, which is impossible if the consecutive values in
279 * cufile.h are used. Note the flag fields in hipFileDriverProps_t.nvfs.
280 * The documentation in cufile.h is also incomplete and many of the
281 * structs/enums are poorly documented, if at all. It may require some
282 * experimentation to figure out how the fields are supposed to work.
283 *
284 * The ideal solution is probably going to involve replacing the
285 * enums with named collections of #defined bitwise flags.
286 */
287
288/*!
289 * @brief Filesystems/storage protocols supported by GPU IO on this system
290 * @ingroup driver
291 *
292 * @note Value 10 is reserved for YRCloudFile
293 */
294typedef enum hipFileDriverStatusFlags {
295 hipFileLustreSupported = 0, //!< Lustre is supported
296 hipFileWekaFSSupported = 1, //!< Weka is supported
297 hipFileNFSSupported = 2, //!< NFS is supported
298 hipFileGPFSSupported = 3, //!< GPFS/IBM Storage Scale is supported
299 hipFileNVMeSupported = 4, //!< Local NVMe is supported
300 hipFileNVMeoFSupported = 5, //!< NVMeoF is supported
301 hipFileSCSISupported = 6, //!< SCSI is supported
302 hipFileScaleFluxCSDSupported = 7, //!< ScaleFlux CSD is supported
303 hipFileNVMeshSupported = 8, //!< NVMesh is supported
304 hipFileBeeGFSSupported = 9, //!< BeeGFS is supported
305 /* 10 is reserved for YRCloudFile */
306 hipFileNVMeP2PSupported = 11, //!< NVMeP2P is supported
307 hipFileScatefsSupported = 12, //!< ScateFS is supported
309
310/*!
311 * @brief Control flags for passing to the GPU IO driver
312 * @ingroup driver
313 */
314typedef enum hipFileDriverControlFlags {
315 hipFileUsePollMode = 0, //!< Enable polling for IO completion
316 hipFileAllowCompatMode = 1, //!< Allow GPU IO to fall back to POSIX IO
318
319/*!
320 * @brief GPU IO Transport & Features supported by the system
321 * @ingroup driver
322 */
323typedef enum hipFileFeatureFlags {
324 hipFileDynRoutingSupported = 0, //!< RDMA dynamic routing is supported
325 hipFileBatchIOSupported = 1, //!< Batch operations are supported
326 hipFileStreamsSupported = 2, //!< Streams are supported
327 hipFileParallelIOSupported = 3, //!< Parallel IO is supported
329
330/*!
331 * @brief GPU IO configuration
332 * @ingroup driver
333 */
334typedef struct hipFileDriverProps {
335 /*!
336 * @brief GPU IO Driver Configuration
337 */
338 struct {
339 unsigned major_version; //!< Major version of the GPU IO driver
340 unsigned minor_version; //!< Minor version of the GPU IO driver
341
342 uint64_t poll_thresh_size; //!< Maximum IO size (in KiB) for which polling is used when poll mode is
343 //!< enabled
344 uint64_t max_direct_io_size; //!< Maximum IO size (in KiB) used by the GPU IO driver
345
346 unsigned driver_status_flags; //!< Bitfield that maps to hipFileDriverStatusFlags_t
347 unsigned driver_control_flags; //!< Bitfield that maps to hipFileDriverControlFlags_t
348 } nvfs;
349
350 unsigned feature_flags; //!< Bitfield that maps to hipFileFeatureFlags_t
351
352 uint64_t max_device_cache_size; //!< Maximum amount of GPU memory (in KiB) that can be used for bounce
353 //!< buffers
354 uint64_t per_buffer_cache_size; //!< Amount of GPU memory (in KiB) allocated for each bounce buffer
355 uint64_t max_device_pinned_mem_size; //!< Maximum amount of GPU memory (in KiB) that can be pinned
356
357 unsigned max_batch_io_count; //!< Maximum number of batch operations that can be submitted at once
358 unsigned max_batch_io_timeout_msecs; //!< Timeout (in msec) for a batch operation to complete
360
361// ***********************************************************************
362// RDMA API
363// ***********************************************************************
364
365/*!
366 * @brief Userspace RDMA configuration
367 * @ingroup rdma
368 */
369typedef struct hipFileRDMAInfo {
370 int version; //!< Version of the RDMA API to use
371 int desc_len; //!< Length of the description string
372 const char *desc_str; //!< Describes the configuration of the RDMA operation
374
375/*!
376 * @defgroup rdma_flags RDMA Characteristic Flags
377 * @ingroup rdma
378 *
379 * @brief Bitwise flags for RDMA characteristics
380 * @{
381 */
382
383/// Flag for if the RDMA operation is registered
384#define HIPFILE_RDMA_REGISTER 1
385
386/// Flag for if the RDMA operation has relaxed ordering
387#define HIPFILE_RDMA_RELAXED_ORDERING (1 << 1)
388/*! @} */
389
390// ***********************************************************************
391// FILE HANDLE API
392// ***********************************************************************
393
394/*!
395 * @brief IO operations for RDMA filesystems
396 * @ingroup file
397 */
398typedef struct hipFileFSOps {
399 /*!
400 * Type of remote FS used. If NULL, use fstat to discover.
401 */
402 const char *(*fs_type)(void *handle);
403 /*!
404 * Get a list of host RDMA addresses. If NULL, use any address.
405 */
406 int (*getRDMADeviceList)(void *handle, struct sockaddr **hostaddrs);
407 /*!
408 * Get the assigned priority of a RDMA device. If -1, there is no preference.
409 */
410 int (*getRDMADevicePriority)(void *handle, char *, size_t, hoff_t, struct sockaddr *hostaddr);
411 /*!
412 * Read from the remote filesystem. If NULL, use the Linux VFS.
413 */
414 ssize_t (*read)(void *handle, char *, size_t, hoff_t, hipFileRDMAInfo_t *);
415 /*!
416 * Write to the remote filesystem. If NULL, use the Linux VFS.
417 */
418 ssize_t (*write)(void *handle, const char *, size_t, hoff_t, hipFileRDMAInfo_t *);
420
421/*!
422 * @brief Type of file handle being used
423 * @ingroup file
424 */
425typedef enum hipFileFileHandleType {
426 hipFileHandleTypeOpaqueFD = 1, //!< POSIX file descriptor
427 hipFileHandleTypeOpaqueWin32 = 2, //!< Win32 HANDLE file handle
428 hipFileHandleTypeUserspaceFS = 3, //!< Userspace RDMA filesystem
430
431/*!
432 * @brief Top-level structure for performing GPU IO
433 * @ingroup file
434 *
435 * hipFileHandleTypeOpaqueFD -> handle.fd non-negative, fs_ops ignored
436 * hipFileHandleTypeOpaqueWin32 -> handle.hFile non-NULL, fs_ops ignored
437 * hipFileHandleTypeUserspaceFS -> handle.fd non-negative, fs_ops non-NULL
438 */
439typedef struct hipFileDescr {
440 hipFileFileHandleType_t type; //!< Type of file handle being used
441 union {
442 int fd; //!< POSIX file descriptor
443 void *hFile; //!< Win32 HANDLE file handle
444 } handle; //!< Union containing the OS-specific file handle
445 const hipFileFSOps_t *fs_ops; //!< Userspace RDMA filesystem operations
447
448/*!
449 * @brief Opaque file handle used by the GPU IO driver/library
450 * @ingroup file
451 */
452typedef void *hipFileHandle_t;
453
454/*!
455 * @brief Registers an open file for GPU IO
456 * @ingroup file
457 *
458 * @note If the library has not already been initialized, the first call to
459 * `hipFileHandleRegister()` will initialize the library and increment
460 * the reference count.
461 *
462 * @param [out] fh \hipfile_handle_param
463 * @param [in] descr Parameters for opening the file
464 *
465 * @return \hipfile_error_return
466 */
467HIPFILE_API
469
470/*!
471 * @brief Deregisters a file from GPU IO
472 * @ingroup file
473 *
474 * @param [in] fh \hipfile_handle_param
475 */
476HIPFILE_API
478
479/*!
480 * @brief Registers a GPU memory region to be used with GPU IO
481 * @ingroup file
482 *
483 * The memory region should be allocated by the user before being passed to the API call
484 *
485 * @note If the library has not already been initialized, the first call to
486 * `hipFileBufRegister()` will initialize the library and increment
487 * the reference count.
488 *
489 * @param [in] buffer_base \buffer_base_param
490 * @param [in] length Size of the allocated buffer in bytes
491 * @param [in] flags Control flags for this buffer
492 *
493 * @return \hipfile_error_return
494 */
495HIPFILE_API
496hipFileError_t hipFileBufRegister(const void *buffer_base, size_t length, int flags);
497
498/*!
499 * @brief Deregisters a GPU memory region from being used with GPU IO
500 * @ingroup file
501 *
502 * @param [in] buffer_base \buffer_base_param
503 *
504 * @return \hipfile_error_return
505 */
506HIPFILE_API
507hipFileError_t hipFileBufDeregister(const void *buffer_base);
508
509/*!
510 * @brief Synchronously read data from a file into a GPU buffer
511 * @ingroup sync
512 *
513 * @param [in] fh \hipfile_handle_param
514 * @param [in] buffer_base \buffer_base_param
515 * @param [in] size Number of bytes that should be read
516 * @param [in] file_offset Offset into the file that should be read from
517 * @param [in] buffer_offset Offset of the GPU buffer that that the data should be written to
518 *
519 * \max_io_size_note
520 *
521 * @return if >= 0: Number of bytes read
522 * @return if -1: System error (check `errno` for the specific error)
523 * @return else: Negative value of the related hipFileOpError_t
524 */
525HIPFILE_API
526ssize_t hipFileRead(hipFileHandle_t fh, void *buffer_base, size_t size, hoff_t file_offset,
527 hoff_t buffer_offset);
528
529/*!
530 * @brief Synchronously write data from a GPU buffer to a file
531 * @ingroup sync
532 *
533 * @param [in] fh \hipfile_handle_param
534 * @param [in] buffer_base \buffer_base_param
535 * @param [in] size Number of bytes that should be written
536 * @param [in] file_offset Offset into the file that should be written to
537 * @param [in] buffer_offset Offset of the GPU buffer that the data should be read from
538 *
539 * \max_io_size_note
540 *
541 * @return if >= 0: Number of bytes written
542 * @return if -1: System error (check `errno` for the specific error)
543 * @return else: Negative value of the related hipFileOpError_t
544 */
545HIPFILE_API
546ssize_t hipFileWrite(hipFileHandle_t fh, const void *buffer_base, size_t size, hoff_t file_offset,
547 hoff_t buffer_offset);
548
549// ***********************************************************************
550// GPU IO DRIVER API
551// ***********************************************************************
552
553/*!
554 * @brief Initialize the GPU IO driver for this process
555 * @ingroup driver
556 *
557 * Each call to `hipFileDriverOpen()` increments the library's reference
558 * count. If a call to `hipFileDriverOpen()` results in the reference count
559 * transitioning from zero to one, the library's state will be initialized.
560 *
561 * Calling `hipFileDriverOpen()` is optional. The first call to
562 * `hipFileBufRegister()` or `hipFileHandleRegister()` will trigger
563 * library initialization and increment the library's reference count.
564 *
565 * @return \hipfile_error_return
566 */
567HIPFILE_API
569
570/*!
571 * @brief Close the GPU IO driver for this process
572 * @ingroup driver
573 *
574 * Each call to `hipFileDriverClose()` decrements the library's reference
575 * count. If a call to `hipFileDriverClose()` results in the reference count
576 * transitioning from one to zero, the library's state will be destroyed.
577 *
578 * Explicitly closing the library is not required; the library's state will be
579 * destroyed automatically at program exit.
580 *
581 * @return \hipfile_error_return
582 */
583HIPFILE_API
585
586/*!
587 * @brief Obtain the current reference count for the library
588 * @ingroup driver
589 *
590 * @see hipFileDriverOpen()
591 * @see hipFileDriverClose()
592 *
593 * @return The library's reference count
594 */
595HIPFILE_API
596int64_t hipFileUseCount(void);
597
598/*!
599 * @brief Get a list of GPU IO driver properties
600 * @ingroup driver
601 *
602 * \warn_not_implemented
603 *
604 * @param [out] props See `hipFileDriverProps_t` for what properties are reported
605 *
606 * @return \hipfile_error_return
607 */
608HIPFILE_API
610
611/*!
612 * @brief Enable/disable polling mode for GPU IO
613 * @ingroup driver
614 *
615 * \warn_not_implemented
616 *
617 * @param [in] poll `true` to enable polling, `false` to disable
618 * @param [in] poll_threshold_size Maximum IO size (in KiB) for which polling is
619 * used when enabled
620 *
621 * @return \hipfile_error_return
622 */
623HIPFILE_API
624hipFileError_t hipFileDriverSetPollMode(bool poll, size_t poll_threshold_size);
625
626/*!
627 * @brief Set the maximum IO chunk size
628 * @ingroup driver
629 *
630 * \warn_not_implemented
631 *
632 * @param [in] max_direct_io_size Maximum IO chunk size (in KiB) for each IO request
633 *
634 * @return \hipfile_error_return
635 */
636HIPFILE_API
638
639/*!
640 * @brief Set the maximum amount of GPU memory that can be used for bounce buffers
641 * @ingroup driver
642 *
643 * \warn_not_implemented
644 *
645 * @param [in] max_cache_size Maximum GPU memory (in KiB) that can be reserved for bounce buffers
646 *
647 * @return \hipfile_error_return
648 */
649HIPFILE_API
651
652/*!
653 * @brief Set the maximum amount of GPU memory that can be pinned
654 * @ingroup driver
655 *
656 * \warn_not_implemented
657 *
658 * @param [in] max_pinned_size Maximum GPU memory (in KiB) that can be pinned
659 *
660 * @return \hipfile_error_return
661 */
662HIPFILE_API
664
665// ***********************************************************************
666// BATCH API
667// ***********************************************************************
668
669/*!
670 * @brief The direction of data movement in a batch IO request
671 * @ingroup batch
672 */
673typedef enum hipFileOpcode {
674 hipFileBatchRead = 0, //!< Read batch IO operation
675 hipFileBatchWrite = 1, //!< Write batch IO operation
677
678/*!
679 * @brief The status of a batch IO operation
680 * @ingroup batch
681 */
682typedef enum hipFileStatus {
683 hipFileWaiting = 1 << 0, //!< Batch IO operation pending acceptance
684 hipFilePending = 1 << 1, //!< Batch IO operation accepted and queued
685 hipFileInvalid = 1 << 2, //!< Batch IO operation was rejected for being invalid or could not be queued
686 hipFileCanceled = 1 << 3, //!< Batch IO operation was canceled
687 hipFileComplete = 1 << 4, //!< Batch IO operation completed
688 hipFileTimeout = 1 << 5, //!< Batch IO operation timed out
689 hipFileFailed = 1 << 6, //!< Batch IO operation failed
691
692/*!
693 * @brief Mode of a batch IO operation
694 * @ingroup batch
695 */
696typedef enum hipFileBatchMode {
697 hipFileBatch = 1, //!< Normal batch IO operation
699
700/*!
701 * @brief Input parameters for a batch IO request
702 * @ingroup batch
703 */
704typedef struct hipFileIOParams {
705 hipFileBatchMode_t mode; //!< Mode of the batch IO request
706 union {
707 struct {
708 void *devPtr_base; //!< Base address of the GPU buffer where data should be read/written
709 int64_t file_offset; //!< Offset into the file that should be read/written
710 int64_t devPtr_offset; //!< Offset of the GPU buffer that should be read/written
711 size_t size; //!< Number of bytes to read or write
712 } batch; //!< Parameters for the read/write batch request
713 } u; //!< Wrapping union for batch IO parameters
714 hipFileHandle_t fh; //!< Registered hipFile handle for the target file
715 hipFileOpcode_t opcode; //!< Direction data is moving for the batch request
716 void *cookie; //!< Optionally used to track IO operations (e.g. self-reference pointer)
718
719/*!
720 * @brief Status of a batch IO operation
721 * @ingroup batch
722 */
723typedef struct hipFileIOEvents {
724 void *cookie; //!< Optionally used to track IO operations (e.g. pointer to corresponding hipFileIOParams)
725 hipFileStatus_t status; //!< Status of the batch IO operation
726 size_t ret; //!< Number of bytes transferred or POSIX error code if negative
728
729/*!
730 * @brief Opaque batch operations handle
731 * @ingroup batch
732 */
734
735/*!
736 * @brief Prepare the system to perform a batch IO operation
737 * @ingroup batch
738 *
739 * @param [out] batch_idp \batch_handle_param
740 * @param [in] max_nr Maximum number of requests that can be submitted to this batch handle
741 *
742 * @return \hipfile_error_return
743 */
744HIPFILE_API
746
747/*!
748 * @brief Enqueue a batch of IO requests for the GPU to complete asynchronously
749 * @ingroup batch
750 *
751 * @param [in] batch_idp \batch_handle_param
752 * @param [in] nr Number of batch IO requests to submit
753 * @param [in] iocbp An array of `nr` batch IO requests to submit to the GPU.
754 * Data will be read into or written from the buffer specified in
755 * each request.
756 * @param [in] flags Control Flags for the batch IO. Currently unused.
757 *
758 * @return \hipfile_error_return
759 */
760HIPFILE_API
762 unsigned flags);
763
764/*!
765 * @brief Poll for the status of completed batch IO operations
766 * @ingroup batch
767 *
768 * \warn_not_implemented
769 *
770 * @param [in] batch_idp \batch_handle_param
771 * @param [in] min_nr Minimum number of batch operation statuses that should be returned.
772 * If `timeout` is exceeded, fewer statuses may be returned.
773 * @param [in,out] nr Maximum number of batch operation statuses that can be returned.
774 * This is parameter is modified to return the number of statuses returned in `iocbp`.
775 *
776 * @param [out] iocbp An array containing up to `nr` statuses from the overall batch operation
777 * @param [in] timeout Maximum amount of time this function should poll for status updates
778 *
779 * @return \hipfile_error_return
780 */
781HIPFILE_API
782hipFileError_t hipFileBatchIOGetStatus(hipFileBatchHandle_t batch_idp, unsigned min_nr, unsigned *nr,
783 hipFileIOEvents_t *iocbp, struct timespec *timeout);
784
785/*!
786 * @brief Cancels all pending batch IO operations
787 * @ingroup batch
788 *
789 * \warn_not_implemented
790 *
791 * @param [in] batch_idp \batch_handle_param
792 *
793 * @return \hipfile_error_return
794 */
795HIPFILE_API
797
798/*!
799 * @brief Destroys the batch IO handle and frees the associated resources
800 * @ingroup batch
801 *
802 * \warn_not_implemented_void
803 *
804 * @param [in] batch_idp \batch_handle_param
805 */
806HIPFILE_API
808
809// ***********************************************************************
810// ASYNC API
811// ***********************************************************************
812
813/*!
814 * @defgroup stream_flags Stream registration flags
815 * @ingroup async
816 *
817 * @brief Flags to configure async GPU IO behaviour at stream registration
818 * @{
819 */
820
821/// Buffer offset is fixed at time of submission
822#define HIPFILE_STREAM_FIXED_BUF_OFFSET 1
823
824/// File offset is fixed at time of submission
825#define HIPFILE_STREAM_FIXED_FILE_OFFSET (1 << 1)
826
827/// File size is fixed at time of submission
828#define HIPFILE_STREAM_FIXED_FILE_SIZE (1 << 2)
829
830/// Offsets and size are 4k aligned
831#define HIPFILE_STREAM_PAGE_ALIGNED_INPUTS (1 << 3)
832
833/// Mask for selecting flag bits
834#define HIPFILE_STREAM_FLAGS_MASK 0xf
835/*! @} */
836
837/*!
838 * @brief Perform an asynchronous read from a stream
839 * @ingroup async
840 *
841 * @param [in] fh \hipfile_handle_param
842 * @param [in] buffer_base \buffer_base_param
843 * @param [in] size_p Number of bytes that should be read
844 * @param [in] file_offset_p Offset into the file that should be read from
845 * @param [in] buffer_offset_p Offset of the GPU buffer that that the data should be written to
846 * @param [out] bytes_read_p Number of bytes read
847 * @param [in] stream \hipstream_param. \hipstream_if_null.
848 *
849 * \max_io_size_note
850 *
851 * @return \hipfile_error_return
852 */
853HIPFILE_API
854hipFileError_t hipFileReadAsync(hipFileHandle_t fh, void *buffer_base, size_t *size_p, hoff_t *file_offset_p,
855 hoff_t *buffer_offset_p, ssize_t *bytes_read_p, hipStream_t stream);
856
857/*!
858 * @brief Perform an asynchronous write to a stream
859 * @ingroup async
860 *
861 * @param [in] fh \hipfile_handle_param
862 * @param [in] buffer_base \buffer_base_param
863 * @param [in] size_p Number of bytes that should be written
864 * @param [in] file_offset_p Offset into the file that should be written to
865 * @param [in] buffer_offset_p Offset of the GPU buffer that that the data should be read from
866 * @param [out] bytes_written_p Number of bytes written
867 * @param [in] stream \hipstream_param. \hipstream_if_null.
868 *
869 * \max_io_size_note
870 *
871 * @return \hipfile_error_return
872 */
873HIPFILE_API
874hipFileError_t hipFileWriteAsync(hipFileHandle_t fh, void *buffer_base, size_t *size_p, hoff_t *file_offset_p,
875 hoff_t *buffer_offset_p, ssize_t *bytes_written_p, hipStream_t stream);
876
877/*!
878 * @brief Register a stream to be used by for asynchronous GPU IO
879 * @ingroup async
880 *
881 * @param [in] stream \hipstream_param
882 * @param [in] flags Flags that can optimize stream processing if parameters
883 * are known/are aligned at time of request submission
884 *
885 * @return \hipfile_error_return
886 */
887HIPFILE_API
888hipFileError_t hipFileStreamRegister(hipStream_t stream, unsigned flags);
889
890/*!
891 * @brief Deregister a stream and free the associated resources
892 * @ingroup async
893 *
894 * @param [in] stream \hipstream_param
895 *
896 * @return \hipfile_error_return
897 */
898HIPFILE_API
900
901// ***********************************************************************
902// CORE API
903// ***********************************************************************
904
905/*!
906 * @brief Get the version of the hipFile library
907 * @ingroup core
908 *
909 * @param [out] major The major version
910 * @param [out] minor The minor version
911 * @param [out] patch The patch version
912 *
913 * @note Parameters can be set to NULL to ignore that part of the version
914 *
915 * @return \hipfile_error_return
916 */
917HIPFILE_API
918hipFileError_t hipFileGetVersion(unsigned *major, unsigned *minor, unsigned *patch);
919
920// ***********************************************************************
921// PROPERTIES API
922// ***********************************************************************
923
924/*!
925 * @brief size_t configuration parameters
926 * @ingroup core
927 */
931 hipFileParamExecutionMaxIOThreads, //!< Max number of IO threads
932 hipFileParamExecutionMinIOThresholdSizeKB, //!< Min IO threshold (KiB)
933 hipFileParamExecutionMaxRequestParallelism, //!< Max request parallelism
934 hipFileParamPropertiesMaxDirectIOSizeKB, //!< Max direct IO size (KiB)
935 hipFileParamPropertiesMaxDeviceCacheSizeKB, //!< Max device cache size (KiB)
936 hipFileParamPropertiesPerBufferCacheSizeKB, //!< Max buffer cache size (KiB)
937 hipFileParamPropertiesMaxDevicePinnedMemSizeKB, //!< Max device pinned memory size (KiB)
939 hipFileParamPollthresholdSizeKB, //!< Poll threshold size (KiB)
940 hipFileParamPropertiesBatchIOTimeoutMs, //!< Batch IO timeout (ms)
942
943/*!
944 * @brief Boolean configuration parameters
945 * @ingroup core
946 */
949 hipFileParamPropertiesAllowCompatMode, //!< Allow compatibility mode
950 hipFileParamForceCompatMode, //!< Force compatibility mode
951 hipFileParamFsMiscApiCheckAggressive, //!< Use aggressive checks in API calls
952 hipFileParamExecutionParallelIO, //!< Allow parallel IO execution
953 hipFileParamProfileNvtx, //!< Use NVTX profiler
954 hipFileParamPropertiesAllowSystemMemory, //!< Allow system memory use
955 hipFileParamUsePcip2pdma, //!< Use P2P DMA
956 hipFileParamPreferIOUring, //!< Prefer io_uring
957 hipFileParamForceOdirectMode, //!< Force O_DIRECT mode
958 hipFileParamSkipTopologyDetection, //!< Skip topology detection
959 hipFileParamStreamMemopsBypass, //!< Bypass stream memory operations
961
962/*!
963 * @brief String configuration parameters
964 * @ingroup core
965 */
971
972/*!
973 * @brief Get the value of a size_t configuration parameter
974 * @ingroup core
975 *
976 * \warn_not_implemented
977 *
978 * @param param The configuration parameter
979 * @param value The location to store the value of the configuration parameter
980 *
981 * @return \hipfile_error_return
982 *
983 * @note If the driver is open, the value returned is the value currently in use by the driver.
984 * @note If the driver is closed, the value returned is the value that was last set by hipFileSetParameter*.
985 */
986HIPFILE_API
988
989/*!
990 * @brief Get the value of a Boolean configuration parameter
991 * @ingroup core
992 *
993 * \warn_not_implemented
994 *
995 * @param param The configuration parameter
996 * @param value The location to store the value of the configuration parameter
997 *
998 * @return \hipfile_error_return
999 *
1000 * @note If the driver is open, the value returned is the value currently in use by the driver.
1001 * @note If the driver is closed, the value returned is the value that was last set by hipFileSetParameter*.
1002 */
1003HIPFILE_API
1005
1006/*!
1007 * @brief Get the value of a string configuration parameter
1008 * @ingroup core
1009 *
1010 * \warn_not_implemented
1011 *
1012 * @param param The configuration parameter
1013 * @param desc_str The location to store the value of the configuration parameter
1014 * @param len The length of the desc_str parameter
1015 *
1016 * @return \hipfile_error_return
1017 *
1018 * @note If the driver is open, the value returned is the value currently in use by the driver.
1019 * @note If the driver is closed, the value returned is the value that was last set by hipFileSetParameter*.
1020 */
1021HIPFILE_API
1023
1024/*!
1025 * @brief Set the value of a size_t configuration parameter
1026 * @ingroup core
1027 *
1028 * \warn_not_implemented
1029 *
1030 * @param param The configuration parameter
1031 * @param value The value of the configuration parameter
1032 *
1033 * @return \hipfile_error_return
1034 *
1035 * @note Configuration parameter values may only be set when the driver is closed. Values are applied when the
1036 * driver is opened.
1037 */
1038HIPFILE_API
1040
1041/*!
1042 * @brief Set the value of a Boolean configuration parameter
1043 * @ingroup core
1044 *
1045 * \warn_not_implemented
1046 *
1047 * @param param The configuration parameter
1048 * @param value The value of the configuration parameter
1049 *
1050 * @return \hipfile_error_return
1051 *
1052 * @note Configuration parameter values may only be set when the driver is closed. Values are applied when the
1053 * driver is opened.
1054 */
1055HIPFILE_API
1057
1058/*!
1059 * @brief Set the value of a string configuration parameter
1060 * @ingroup core
1061 *
1062 * \warn_not_implemented
1063 *
1064 * @param param The configuration parameter
1065 * @param desc_str The value of the configuration parameter
1066 *
1067 * @return \hipfile_error_return
1068 *
1069 * @note Configuration parameter values may only be set when the driver is closed. Values are applied when the
1070 * driver is opened.
1071 */
1072HIPFILE_API
1074
1075// Not a part of the public API
1076#undef __HIPFILE_NODISCARD
1077
1078#ifdef __cplusplus
1079}
1080#endif
1081
1082// clang-format on
hipFileError_t hipFileWriteAsync(hipFileHandle_t fh, void *buffer_base, unsigned long *size_p, hoff_t *file_offset_p, hoff_t *buffer_offset_p, ssize_t *bytes_written_p, hipStream_t stream)
Perform an asynchronous write to a stream.
hipFileError_t hipFileStreamRegister(hipStream_t stream, unsigned flags)
Register a stream to be used by for asynchronous GPU IO.
hipFileError_t hipFileStreamDeregister(hipStream_t stream)
Deregister a stream and free the associated resources.
hipFileError_t hipFileReadAsync(hipFileHandle_t fh, void *buffer_base, unsigned long *size_p, hoff_t *file_offset_p, hoff_t *buffer_offset_p, ssize_t *bytes_read_p, hipStream_t stream)
Perform an asynchronous read from a stream.
hipFileStatus_t status
Status of the batch IO operation.
Definition hipfile.h:725
hipFileOpcode_t opcode
Direction data is moving for the batch request.
Definition hipfile.h:715
void * cookie
Optionally used to track IO operations (e.g. self-reference pointer)
Definition hipfile.h:716
unsigned long ret
Number of bytes transferred or POSIX error code if negative.
Definition hipfile.h:726
hipFileHandle_t fh
Registered hipFile handle for the target file.
Definition hipfile.h:714
void * cookie
Optionally used to track IO operations (e.g. pointer to corresponding hipFileIOParams)
Definition hipfile.h:724
hipFileBatchMode_t mode
Mode of the batch IO request.
Definition hipfile.h:705
hipFileOpcode_t
The direction of data movement in a batch IO request.
Definition hipfile.h:673
void * hipFileBatchHandle_t
Opaque batch operations handle.
Definition hipfile.h:733
hipFileStatus_t
The status of a batch IO operation.
Definition hipfile.h:682
hipFileError_t hipFileBatchIOCancel(hipFileBatchHandle_t batch_idp)
Cancels all pending batch IO operations.
hipFileError_t hipFileBatchIOGetStatus(hipFileBatchHandle_t batch_idp, unsigned min_nr, unsigned *nr, hipFileIOEvents_t *iocbp, struct timespec *timeout)
Poll for the status of completed batch IO operations.
hipFileError_t hipFileBatchIOSetUp(hipFileBatchHandle_t *batch_idp, unsigned max_nr)
Prepare the system to perform a batch IO operation.
void hipFileBatchIODestroy(hipFileBatchHandle_t batch_idp)
Destroys the batch IO handle and frees the associated resources.
hipFileError_t hipFileBatchIOSubmit(hipFileBatchHandle_t batch_idp, unsigned nr, hipFileIOParams_t *iocbp, unsigned flags)
Enqueue a batch of IO requests for the GPU to complete asynchronously.
hipFileBatchMode_t
Mode of a batch IO operation.
Definition hipfile.h:696
@ hipFileBatchRead
Read batch IO operation.
Definition hipfile.h:674
@ hipFileBatchWrite
Write batch IO operation.
Definition hipfile.h:675
@ hipFileTimeout
Batch IO operation timed out.
Definition hipfile.h:688
@ hipFilePending
Batch IO operation accepted and queued.
Definition hipfile.h:684
@ hipFileFailed
Batch IO operation failed.
Definition hipfile.h:689
@ hipFileInvalid
Batch IO operation was rejected for being invalid or could not be queued.
Definition hipfile.h:685
@ hipFileCanceled
Batch IO operation was canceled.
Definition hipfile.h:686
@ hipFileWaiting
Batch IO operation pending acceptance.
Definition hipfile.h:683
@ hipFileComplete
Batch IO operation completed.
Definition hipfile.h:687
@ hipFileBatch
Normal batch IO operation.
Definition hipfile.h:697
Status of a batch IO operation.
Definition hipfile.h:723
Input parameters for a batch IO request.
Definition hipfile.h:704
hipFileError_t hipFileGetParameterString(hipFileStringConfigParameter_t param, char *desc_str, int len)
Get the value of a string configuration parameter.
hipFileStringConfigParameter_t
String configuration parameters.
Definition hipfile.h:966
hipFileError_t hipFileGetParameterBool(hipFileBoolConfigParameter_t param, bool *value)
Get the value of a Boolean configuration parameter.
hipFileBoolConfigParameter_t
Boolean configuration parameters.
Definition hipfile.h:947
hipFileError_t hipFileSetParameterSizeT(hipFileSizeTConfigParameter_t param, unsigned long value)
Set the value of a size_t configuration parameter.
hipFileSizeTConfigParameter_t
size_t configuration parameters
Definition hipfile.h:928
hipFileError_t hipFileSetParameterString(hipFileStringConfigParameter_t param, const char *desc_str)
Set the value of a string configuration parameter.
hipFileError_t hipFileSetParameterBool(hipFileBoolConfigParameter_t param, bool value)
Set the value of a Boolean configuration parameter.
hipFileError_t hipFileGetParameterSizeT(hipFileSizeTConfigParameter_t param, unsigned long *value)
Get the value of a size_t configuration parameter.
hipFileError_t hipFileGetVersion(unsigned *major, unsigned *minor, unsigned *patch)
Get the version of the hipFile library.
@ hipFileParamLoggingLevel
Logging level.
Definition hipfile.h:967
@ hipFileParamEnvLogfilePath
Logfile path.
Definition hipfile.h:968
@ hipFileParamLogDir
Logfile directory.
Definition hipfile.h:969
@ hipFileParamSkipTopologyDetection
Skip topology detection.
Definition hipfile.h:958
@ hipFileParamUsePcip2pdma
Use P2P DMA.
Definition hipfile.h:955
@ hipFileParamForceOdirectMode
Force O_DIRECT mode.
Definition hipfile.h:957
@ hipFileParamForceCompatMode
Force compatibility mode.
Definition hipfile.h:950
@ hipFileParamFsMiscApiCheckAggressive
Use aggressive checks in API calls.
Definition hipfile.h:951
@ hipFileParamExecutionParallelIO
Allow parallel IO execution.
Definition hipfile.h:952
@ hipFileParamPreferIOUring
Prefer io_uring.
Definition hipfile.h:956
@ hipFileParamPropertiesAllowSystemMemory
Allow system memory use.
Definition hipfile.h:954
@ hipFileParamProfileNvtx
Use NVTX profiler.
Definition hipfile.h:953
@ hipFileParamStreamMemopsBypass
Bypass stream memory operations.
Definition hipfile.h:959
@ hipFileParamPropertiesUsePollMode
Use poll mode.
Definition hipfile.h:948
@ hipFileParamPropertiesAllowCompatMode
Allow compatibility mode.
Definition hipfile.h:949
@ hipFileParamPropertiesMaxDeviceCacheSizeKB
Max device cache size (KiB)
Definition hipfile.h:935
@ hipFileParamExecutionMaxRequestParallelism
Max request parallelism.
Definition hipfile.h:933
@ hipFileParamPropertiesMaxDirectIOSizeKB
Max direct IO size (KiB)
Definition hipfile.h:934
@ hipFileParamExecutionMinIOThresholdSizeKB
Min IO threshold (KiB)
Definition hipfile.h:932
@ hipFileParamPropertiesMaxDevicePinnedMemSizeKB
Max device pinned memory size (KiB)
Definition hipfile.h:937
@ hipFileParamExecutionMaxIOThreads
Max number of IO threads.
Definition hipfile.h:931
@ hipFileParamExecutionMaxIOQueueDepth
Max IO queue depth.
Definition hipfile.h:930
@ hipFileParamPropertiesIOBatchsize
IO batch size.
Definition hipfile.h:938
@ hipFileParamPollthresholdSizeKB
Poll threshold size (KiB)
Definition hipfile.h:939
@ hipFileParamPropertiesPerBufferCacheSizeKB
Max buffer cache size (KiB)
Definition hipfile.h:936
@ hipFileParamProfileStats
Statistics.
Definition hipfile.h:929
@ hipFileParamPropertiesBatchIOTimeoutMs
Batch IO timeout (ms)
Definition hipfile.h:940
uint64_t max_device_cache_size
Maximum amount of GPU memory (in KiB) that can be used for bounce buffers.
Definition hipfile.h:352
uint64_t per_buffer_cache_size
Amount of GPU memory (in KiB) allocated for each bounce buffer.
Definition hipfile.h:354
unsigned feature_flags
Bitfield that maps to hipFileFeatureFlags_t.
Definition hipfile.h:350
uint64_t max_device_pinned_mem_size
Maximum amount of GPU memory (in KiB) that can be pinned.
Definition hipfile.h:355
unsigned max_batch_io_count
Maximum number of batch operations that can be submitted at once.
Definition hipfile.h:357
unsigned max_batch_io_timeout_msecs
Timeout (in msec) for a batch operation to complete.
Definition hipfile.h:358
hipFileError_t hipFileDriverGetProperties(hipFileDriverProps_t *props)
Get a list of GPU IO driver properties.
hipFileError_t hipFileDriverSetPollMode(bool poll, unsigned long poll_threshold_size)
Enable/disable polling mode for GPU IO.
hipFileError_t hipFileDriverOpen(void)
Initialize the GPU IO driver for this process.
int64_t hipFileUseCount(void)
Obtain the current reference count for the library.
hipFileDriverStatusFlags_t
Filesystems/storage protocols supported by GPU IO on this system.
Definition hipfile.h:294
hipFileDriverControlFlags_t
Control flags for passing to the GPU IO driver.
Definition hipfile.h:314
hipFileError_t hipFileDriverClose(void)
Close the GPU IO driver for this process.
hipFileFeatureFlags_t
GPU IO Transport & Features supported by the system.
Definition hipfile.h:323
hipFileError_t hipFileDriverSetMaxDirectIOSize(unsigned long max_direct_io_size)
Set the maximum IO chunk size.
hipFileError_t hipFileDriverSetMaxCacheSize(unsigned long max_cache_size)
Set the maximum amount of GPU memory that can be used for bounce buffers.
hipFileError_t hipFileDriverSetMaxPinnedMemSize(unsigned long max_pinned_size)
Set the maximum amount of GPU memory that can be pinned.
@ hipFileScatefsSupported
ScateFS is supported.
Definition hipfile.h:307
@ hipFileNVMeSupported
Local NVMe is supported.
Definition hipfile.h:299
@ hipFileNVMeshSupported
NVMesh is supported.
Definition hipfile.h:303
@ hipFileGPFSSupported
GPFS/IBM Storage Scale is supported.
Definition hipfile.h:298
@ hipFileScaleFluxCSDSupported
ScaleFlux CSD is supported.
Definition hipfile.h:302
@ hipFileNFSSupported
NFS is supported.
Definition hipfile.h:297
@ hipFileLustreSupported
Lustre is supported.
Definition hipfile.h:295
@ hipFileNVMeoFSupported
NVMeoF is supported.
Definition hipfile.h:300
@ hipFileWekaFSSupported
Weka is supported.
Definition hipfile.h:296
@ hipFileSCSISupported
SCSI is supported.
Definition hipfile.h:301
@ hipFileBeeGFSSupported
BeeGFS is supported.
Definition hipfile.h:304
@ hipFileNVMeP2PSupported
NVMeP2P is supported.
Definition hipfile.h:306
@ hipFileUsePollMode
Enable polling for IO completion.
Definition hipfile.h:315
@ hipFileAllowCompatMode
Allow GPU IO to fall back to POSIX IO.
Definition hipfile.h:316
@ hipFileBatchIOSupported
Batch operations are supported.
Definition hipfile.h:325
@ hipFileParallelIOSupported
Parallel IO is supported.
Definition hipfile.h:327
@ hipFileDynRoutingSupported
RDMA dynamic routing is supported.
Definition hipfile.h:324
@ hipFileStreamsSupported
Streams are supported.
Definition hipfile.h:326
GPU IO configuration.
Definition hipfile.h:334
hipFileOpError_t err
Errors related to hipFile or the GPU IO driver.
Definition hipfile.h:208
hipError_t hip_drv_err
Errors related to the GPU driver.
Definition hipfile.h:209
#define HIPFILE_BASE_ERR
The base value for hipFile error codes.
Definition hipfile.h:124
const char * hipFileGetOpErrorString(hipFileOpError_t status)
Return a descriptive string for a hipFile error.
hipFileOpError_t
hipFile function return codes
Definition hipfile.h:136
@ hipFileMemoryAlreadyRegistered
Device pointer is already registered.
Definition hipfile.h:160
@ hipFileDriverInvalidProps
Invalid GPU IO driver property provided.
Definition hipfile.h:139
@ hipFileMemoryNotRegistered
Device pointer is not registered.
Definition hipfile.h:161
@ hipFileIOMaxError
Internal flag to mark largest hipFile error code.
Definition hipfile.h:176
@ hipFilePlatformNotSupported
hipFile is not supported on the current platform
Definition hipfile.h:144
@ hipFileInternalError
Internal GPU IO library error.
Definition hipfile.h:167
@ hipFileInvalidMappingSize
Accessing memory beyond pinned memory buffer.
Definition hipfile.h:153
@ hipFileDriverAlreadyOpen
GPU IO driver is already open.
Definition hipfile.h:163
@ hipFileHandleAlreadyRegistered
File handle for GPU IO is already registered.
Definition hipfile.h:165
@ hipFileDriverVersionMismatch
hipFile version does not match GPU IO driver version
Definition hipfile.h:141
@ hipFileGPUMemoryPinningFailed
Failed to allocated pinned device memory.
Definition hipfile.h:173
@ hipFileInvalidValue
One or more arguments have an invalid value.
Definition hipfile.h:159
@ hipFileDriverSetupError
GPU IO Driver initialization error.
Definition hipfile.h:170
@ hipFileHandleNotRegistered
File handle for GPU IO is not registered.
Definition hipfile.h:164
@ hipFileInvalidFileType
Unsupported file type.
Definition hipfile.h:155
@ hipFileIONotSupported
hipFile is not supported on the selected file
Definition hipfile.h:145
@ hipFileHipPointerRangeError
Pointer range exceeds allocated memory region.
Definition hipfile.h:151
@ hipFileHipDriverError
GPU driver error: Inspect the hipError_t value for additional information.
Definition hipfile.h:148
@ hipFileInvalidFileOpenFlag
Unsupported file open flags.
Definition hipfile.h:156
@ hipFileDriverUnsupportedLimit
GPU IO Driver property value is unsupported.
Definition hipfile.h:140
@ hipFilePermissionDenied
Permission error on device or file access.
Definition hipfile.h:162
@ hipFileDriverClosing
GPU IO driver is closing and not accepting new requests.
Definition hipfile.h:143
@ hipFileDeviceNotSupported
The selected GPU does not support hipFile.
Definition hipfile.h:146
@ hipFileHipPointerInvalid
Invalid GPU pointer.
Definition hipfile.h:149
@ hipFileDIONotSet
O_DIRECT flag not set.
Definition hipfile.h:157
@ hipFileGetNewFDFailed
Unable to obtain a new file descriptor.
Definition hipfile.h:168
@ hipFileInvalidMappingRange
Accessing memory beyond mapped memory region.
Definition hipfile.h:154
@ hipFileDriverNotInitialized
GPU IO driver is not loaded.
Definition hipfile.h:138
@ hipFileDeviceNotFound
Selected device not found.
Definition hipfile.h:166
@ hipFileHipContextMismatch
GPU driver context mismatch.
Definition hipfile.h:152
@ hipFileDriverError
GPU IO driver error.
Definition hipfile.h:147
@ hipFileSuccess
hipFile operation completed successfully
Definition hipfile.h:137
@ hipFileAsyncNotSupported
hipFile async IO is not supported
Definition hipfile.h:175
@ hipFileBatchSubmitFailed
Failed to submit request for batch operation.
Definition hipfile.h:172
@ hipFileHipMemoryTypeInvalid
Memory type backing pointer is incompatible with hipFile.
Definition hipfile.h:150
@ hipFileBatchFull
Batch operation queue is full.
Definition hipfile.h:174
@ hipFileIODisabled
GPU IO config file prohibits GPU IO on specified file.
Definition hipfile.h:171
@ hipFileDriverVersionReadError
Unable to read the GPU IO driver version.
Definition hipfile.h:142
Error status returned from hipFile API calls.
Definition hipfile.h:207
hipFileFileHandleType_t type
Type of file handle being used.
Definition hipfile.h:440
const hipFileFSOps_t * fs_ops
Userspace RDMA filesystem operations.
Definition hipfile.h:445
hipFileError_t hipFileBufDeregister(const void *buffer_base)
Deregisters a GPU memory region from being used with GPU IO.
void hipFileHandleDeregister(hipFileHandle_t fh)
Deregisters a file from GPU IO.
hipFileError_t hipFileBufRegister(const void *buffer_base, unsigned long length, int flags)
Registers a GPU memory region to be used with GPU IO.
void * hipFileHandle_t
Opaque file handle used by the GPU IO driver/library.
Definition hipfile.h:452
hipFileFileHandleType_t
Type of file handle being used.
Definition hipfile.h:425
hipFileError_t hipFileHandleRegister(hipFileHandle_t *fh, hipFileDescr_t *descr)
Registers an open file for GPU IO.
@ hipFileHandleTypeUserspaceFS
Userspace RDMA filesystem.
Definition hipfile.h:428
@ hipFileHandleTypeOpaqueWin32
Win32 HANDLE file handle.
Definition hipfile.h:427
@ hipFileHandleTypeOpaqueFD
POSIX file descriptor.
Definition hipfile.h:426
Top-level structure for performing GPU IO.
Definition hipfile.h:439
int version
Version of the RDMA API to use.
Definition hipfile.h:370
int desc_len
Length of the description string.
Definition hipfile.h:371
const char * desc_str
Describes the configuration of the RDMA operation.
Definition hipfile.h:372
Userspace RDMA configuration.
Definition hipfile.h:369
off_t hoff_t
Platform-independent offset type.
Definition hipfile.h:107
ssize_t hipFileRead(hipFileHandle_t fh, void *buffer_base, unsigned long size, hoff_t file_offset, hoff_t buffer_offset)
Synchronously read data from a file into a GPU buffer.
ssize_t hipFileWrite(hipFileHandle_t fh, const void *buffer_base, unsigned long size, hoff_t file_offset, hoff_t buffer_offset)
Synchronously write data from a GPU buffer to a file.
IO operations for RDMA filesystems.
Definition hipfile.h:398