Skip to content

[HIPIFY][8.0][FILE][feature][Linux] Initial support of cuFile to hipFile hipification#2174

Merged
emankov merged 6 commits intoROCm:amd-developfrom
derobins:hipFile
Feb 2, 2026
Merged

[HIPIFY][8.0][FILE][feature][Linux] Initial support of cuFile to hipFile hipification#2174
emankov merged 6 commits intoROCm:amd-developfrom
derobins:hipFile

Conversation

@derobins
Copy link
Contributor

@derobins derobins commented Nov 13, 2025

AIROCFILE-7
AIROCFILE-15

Adds types and API calls from ROCm/hipFile:

  • hipfile/include/hipfile.h

@derobins derobins marked this pull request as draft November 13, 2025 21:00
{"CUFILE_ERRSTR", {CUDA_129, CUDA_0, CUDA_0}},
{"CUDA_DRV_ERR", {CUDA_129, CUDA_0, CUDA_0}},
{"IS_CUDA_ERR", {CUDA_129, CUDA_0, CUDA_0}},
};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We just used version placeholders, so this will probably need some fixing.

@emankov emankov added the feature Feature request or implementation label Nov 14, 2025
@emankov emankov changed the title Update HIPIFY to handle hipFile and rocFile [HIPIFY][FILE][feature] Initial support of cuFile to hipFile and rocFile hipification Nov 14, 2025
@emankov emankov changed the title [HIPIFY][FILE][feature] Initial support of cuFile to hipFile and rocFile hipification [HIPIFY][FILE][8.0][feature] Initial support of cuFile to hipFile and rocFile hipification Nov 14, 2025
@emankov emankov added HIP-8.0 Related to ROCm HIP 8.0 release FILE FILE-related partial Partial fix or implementation Linux Linux-related labels Nov 14, 2025
@emankov emankov changed the title [HIPIFY][FILE][8.0][feature] Initial support of cuFile to hipFile and rocFile hipification [HIPIFY][8.0][FILE][feature][Linux] Initial support of cuFile to hipFile and rocFile hipification Nov 14, 2025
Comment on lines +129 to +137
const string sHIPFILE = "cuFile_API_supported_by_HIP";
const string sHIPFILE_md = sHIPFILE + md_ext;
const string sHIPFILE_csv = sHIPFILE + csv_ext;
const string sHIPFILE_and_ROC_md = sHIPFILE + sandROC + md_ext;
const string sHIPFILE_and_ROC_csv = sHIPFILE + sandROC + csv_ext;
const string sROCFILE = "cuFile_API_supported_by_ROC";
const string sROCFILE_md = sROCFILE + md_ext;
const string sROCFILE_csv = sROCFILE + csv_ext;
const string sCUFILE = "cuFile";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const string sHIPFILE = "cuFile_API_supported_by_HIP";
const string sHIPFILE_md = sHIPFILE + md_ext;
const string sHIPFILE_csv = sHIPFILE + csv_ext;
const string sHIPFILE_and_ROC_md = sHIPFILE + sandROC + md_ext;
const string sHIPFILE_and_ROC_csv = sHIPFILE + sandROC + csv_ext;
const string sROCFILE = "cuFile_API_supported_by_ROC";
const string sROCFILE_md = sROCFILE + md_ext;
const string sROCFILE_csv = sROCFILE + csv_ext;
const string sCUFILE = "cuFile";
const string sHIPFILE = "cuFile_API_supported_by_HIP";

Could we keep same format as before?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is the format different? I think I just copied one of the other libraries that has both hip and roc flavors (perhaps hipSolver/rocSover) because we have both hipFile and rocFile and would like to support both.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the request was to keep the existing formatting.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is the format different? I think I just copied one of the other libraries that has both hip and roc flavors (perhaps hipSolver/rocSover) because we have both hipFile and rocFile and would like to support both.

Suggested change
const string sHIPFILE = "cuFile_API_supported_by_HIP";
const string sHIPFILE_md = sHIPFILE + md_ext;
const string sHIPFILE_csv = sHIPFILE + csv_ext;
const string sHIPFILE_and_ROC_md = sHIPFILE + sandROC + md_ext;
const string sHIPFILE_and_ROC_csv = sHIPFILE + sandROC + csv_ext;
const string sROCFILE = "cuFile_API_supported_by_ROC";
const string sROCFILE_md = sROCFILE + md_ext;
const string sROCFILE_csv = sROCFILE + csv_ext;
const string sCUFILE = "cuFile";
const string sHIPFILE = "cuFile_API_supported_by_HIP";

I meant to use existing format.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this all okay now?

@emankov
Copy link
Collaborator

emankov commented Nov 14, 2025

@derobins, could you please let us know the first CUDA version in which gds-nvidia-fs (with cuFile in it) appeared in the CUDA Toolkit Linux distribution?

@derobins
Copy link
Contributor Author

derobins commented Nov 14, 2025

@derobins, could you please let us know the first CUDA version in which gds-nvidia-fs (with cuFile in it) appeared in the CUDA Toolkit Linux distribution?

It looks like cuFile was released with CUDA 11.4.0. I don't see a cuFile section in the 11.3.x docs. It's confusing, though - 11.3 and 11.2 mention the library and header file in the list of things that are included, but there's no API documentation. Maybe the answer is 11.2?

https://docs.nvidia.com/cuda/archive/11.4.0/cufile-api/index.html

We'll have to grab header files from the various CUDA releases to see how the API has evolved and when new API calls were introduced.

@emankov
Copy link
Collaborator

emankov commented Nov 14, 2025

@derobins, I'll detect the former versions in the fs releases a bit later.

@derobins derobins force-pushed the hipFile branch 2 times, most recently from 84a81c0 to 5d5cd1d Compare November 27, 2025 08:28
@derobins derobins changed the title [HIPIFY][8.0][FILE][feature][Linux] Initial support of cuFile to hipFile and rocFile hipification [HIPIFY][8.0][FILE][feature][Linux] Initial support of cuFile to hipFile hipification Nov 27, 2025
};

const std::map<llvm::StringRef, hipAPIChangedVersions> HIP_FILE_FUNCTION_CHANGED_VER_MAP {
{"hipFileHandleRegister", {HIP_0}},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{HIP_8000, HIP_0, HIP_0, HIP_8000}},,
or
{HIP_7000, HIP_0, HIP_0}},,
if hipFile were really shipped with HIP 7.0.0

Copy link
Contributor Author

@derobins derobins Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HIP_8000 is probably the right value, but the enum stops at HIP_7020 and I don't see any HIPIFY branches that look like they are prep for ROCm 8.0.

@derobins derobins marked this pull request as ready for review January 28, 2026 17:39
@emankov emankov requested a review from SyamaAmd January 29, 2026 13:04
@gaoikawa gaoikawa requested a review from Copilot January 29, 2026 18:23
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds initial support for hipifying NVIDIA's cuFile API to AMD's hipFile API. This enables automatic conversion of GPU Direct Storage code from CUDA to HIP, allowing applications that use cuFile for fast data transfers between storage and GPU memory to be ported to ROCm.

Changes:

  • Adds new API_FILE enum type to categorize cuFile/hipFile API calls in the hipification system
  • Implements comprehensive type and function mappings between cuFile and hipFile APIs (129 types, 36 functions)
  • Integrates cuFile support into the documentation generation system

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/Statistics.h Adds API_FILE enum value for cuFile API categorization
src/Statistics.cpp Updates API name and type arrays with "cuFile API" and adds API_FILE to ROC translation logic
src/HipifyAction.h Adds insertedFILEHeader flag to track hipfile.h header insertion
src/HipifyAction.cpp Implements header insertion logic for API_FILE in the Exclude function
src/CUDA2HIP_FILE_API_types.cpp New file defining 129 type mappings from cuFile to hipFile with CUDA 12.9+ and HIP 7.0+ version information
src/CUDA2HIP_FILE_API_functions.cpp New file defining 36 function mappings from cuFile to hipFile with version tracking
src/CUDA2HIP_Doc.cpp Adds HIPFILE documentation class and integrates it into the documentation generation pipeline
src/CUDA2HIP.h Declares extern maps for cuFile type and function mappings, plus version tracking maps
src/CUDA2HIP.cpp Registers cuFile maps in the unified rename and version tracking systems, adds cufile.h to hipfile.h include mapping

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

extern const std::map<llvm::StringRef, hipCounter> CUDA_TENSOR_FUNCTION_MAP;
// Maps the names of cuFile API types to the corresponding HIP types
extern const std::map<llvm::StringRef, hipCounter> CUDA_FILE_TYPE_NAME_MAP;
// Maps the names of cuFile API functions to the corresponding HIP types
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment incorrectly states "to the corresponding HIP types" but this is the CUDA_FILE_FUNCTION_MAP which maps to HIP functions. The comment should read "Maps the names of cuFile API functions to the corresponding HIP functions" to be consistent with other function map comments in this file (e.g., lines 86-87, 90-91).

Suggested change
// Maps the names of cuFile API functions to the corresponding HIP types
// Maps the names of cuFile API functions to the corresponding HIP functions

Copilot uses AI. Check for mistakes.
{"CUfileFileHandleType", {CUDA_129, CUDA_0, CUDA_0}},
{"CUfileDrvProps_t", {CUDA_129, CUDA_0, CUDA_0}},
{"cufileRDMAInfo_t", {CUDA_129, CUDA_0, CUDA_0}},
{"cufileFSOps_t", {CUDA_129, CUDA_0, CUDA_0}},
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The key name 'cufileFSOps_t' (lowercase 'u') in CUDA_FILE_TYPE_NAME_VER_MAP does not match the key 'CUfileFSOps_t' (uppercase 'U') used in CUDA_FILE_TYPE_NAME_MAP at line 12. This inconsistency will cause the version mapping to fail for this type. The key should be 'CUfileFSOps_t' to match the main mapping.

Suggested change
{"cufileFSOps_t", {CUDA_129, CUDA_0, CUDA_0}},
{"CUfileFSOps_t", {CUDA_129, CUDA_0, CUDA_0}},

Copilot uses AI. Check for mistakes.
{"CUfileIOParams_t", {CUDA_129, CUDA_0, CUDA_0}},
{"CUfileIOEvents_t", {CUDA_129, CUDA_0, CUDA_0}},
{"CUfileBatchHandle_t", {CUDA_129, CUDA_0, CUDA_0}},
{"CUfileBatchMode_t", {CUDA_129, CUDA_0, CUDA_0}},
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mapping for 'CUfileOpcode_t' and 'CUfileStatus_t' are missing from CUDA_FILE_TYPE_NAME_VER_MAP. These types are present in CUDA_FILE_TYPE_NAME_MAP (lines 17-18) and HIP_FILE_TYPE_NAME_VER_MAP (lines 284-285), but absent here. Add version entries for both types with CUDA_129 as the appeared version.

Suggested change
{"CUfileBatchMode_t", {CUDA_129, CUDA_0, CUDA_0}},
{"CUfileBatchMode_t", {CUDA_129, CUDA_0, CUDA_0}},
{"CUfileOpcode_t", {CUDA_129, CUDA_0, CUDA_0}},
{"CUfileStatus_t", {CUDA_129, CUDA_0, CUDA_0}},

Copilot uses AI. Check for mistakes.
{"CU_FILE_SCALEFLUX_CSD_SUPPORTED", {"hipFileScaleFluxCSDSupported", "", CONV_NUMERIC_LITERAL, API_FILE, 1, FULL}},
{"CU_FILE_NVMESH_SUPPORTED", {"hipFileNVMeshSupported", "", CONV_NUMERIC_LITERAL, API_FILE, 1, FULL}},
{"CU_FILE_BEEGFS_SUPPORTED", {"hipFileBEEGFSSupported", "", CONV_NUMERIC_LITERAL, API_FILE, 1, FULL}},
{"CU_FILE_NVME_P2P_SUPPORTED", {"hipFileNVMeP2PSsupported", "", CONV_NUMERIC_LITERAL, API_FILE, 1, FULL}},
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hipified name 'hipFileNVMeP2PSsupported' has inconsistent capitalization with a double 'S' - 'P2PSsupported' instead of 'P2PSupported'. This breaks the naming convention where 'Supported' should start with a capital 'S'. This should be 'hipFileNVMeP2PSupported' to match the pattern used for all other 'Supported' suffixes in this file.

Suggested change
{"CU_FILE_NVME_P2P_SUPPORTED", {"hipFileNVMeP2PSsupported", "", CONV_NUMERIC_LITERAL, API_FILE, 1, FULL}},
{"CU_FILE_NVME_P2P_SUPPORTED", {"hipFileNVMeP2PSupported", "", CONV_NUMERIC_LITERAL, API_FILE, 1, FULL}},

Copilot uses AI. Check for mistakes.
{"hipFileScaleFluxCSDSupported", {HIP_7000, HIP_0, HIP_0}},
{"hipFileNVMeshSupported", {HIP_7000, HIP_0, HIP_0}},
{"hipFileBEEGFSSupported", {HIP_7000, HIP_0, HIP_0}},
{"hipFileNVMeP2PSsupported", {HIP_7000, HIP_0, HIP_0}},
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hipified name 'hipFileNVMeP2PSsupported' has inconsistent capitalization with a double 'S'. This entry should use 'hipFileNVMeP2PSupported' to be consistent with the corrected naming convention.

Suggested change
{"hipFileNVMeP2PSsupported", {HIP_7000, HIP_0, HIP_0}},
{"hipFileNVMeP2PSupported", {HIP_7000, HIP_0, HIP_0}},

Copilot uses AI. Check for mistakes.
{"cuFileSetParameterString", {CUDA_0}},
};

const std::map<llvm::StringRef, hipAPIChangedVersions> HIP_FILE_FUNCTION_CHANGED_VER_MAP {
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function 'hipFileOpStatusError' is missing from HIP_FILE_FUNCTION_CHANGED_VER_MAP. This function is present in CUDA_FILE_FUNCTION_MAP (line 5), HIP_FILE_FUNCTION_VER_MAP (line 40), and CUDA_FILE_FUNCTION_CHANGED_VER_MAP (line 107). Add an entry with HIP_7000 to maintain consistency across all version maps.

Suggested change
const std::map<llvm::StringRef, hipAPIChangedVersions> HIP_FILE_FUNCTION_CHANGED_VER_MAP {
const std::map<llvm::StringRef, hipAPIChangedVersions> HIP_FILE_FUNCTION_CHANGED_VER_MAP {
{"hipFileOpStatusError", {HIP_7000}},

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,396 @@
#include "CUDA2HIP.h"
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is missing the standard copyright header that is present in all other similar source files in the codebase. Add an MIT license copyright header with "Copyright (c) 2025 - present Advanced Micro Devices, Inc. All rights reserved." at the beginning of the file, consistent with the pattern used in files like CUDA2HIP_TENSOR_API_types.cpp.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,175 @@
#include "CUDA2HIP.h"
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is missing the standard copyright header that is present in all other similar source files in the codebase. Add an MIT license copyright header with "Copyright (c) 2025 - present Advanced Micro Devices, Inc. All rights reserved." at the beginning of the file, consistent with the pattern used in other API function files.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

@emankov emankov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, tests, versioning, and documentation changes will come in separate changes.

Do not upstream

@emankov emankov merged commit 64a0181 into ROCm:amd-develop Feb 2, 2026
11 checks passed
emankov added a commit to emankov/HIPIFY that referenced this pull request Feb 5, 2026
… `CU_FILE_CUDA_ERR`

+ Updated the regenerated `hipify-perl` and `File` `CUDA2HIP` docs accordingly
emankov added a commit that referenced this pull request Feb 5, 2026
[HIPIFY][FILE][#2174][#2362][fix] Fix typo: `CUDA_DRV_ERR` -> `CU_FILE_CUDA_ERR`
emankov pushed a commit that referenced this pull request Feb 6, 2026
emankov added a commit that referenced this pull request Feb 6, 2026
…var-typo

[HIPIFY][FILE][#2174][#2362][fix] Fix typo: `cuFule_version` -> `cuFile_version`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Feature request or implementation FILE FILE-related HIP-8.0 Related to ROCm HIP 8.0 release Linux Linux-related partial Partial fix or implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants