Remove rocFile#95
Conversation
This still builds separate rocFile and hipFile libraries, but the rocFile code has been moved to the hipFile source tree. rocfile/include/* --> hipfile/include/ rocfile/src/* --> hipfile/src/amd_detail/ rocfile/test/* --> hipfile/test/amd_detail/ The hipfile directory has been left as-is, though it may be renamed in the future (libhipfile?). If we add command-line tools or other code to this repo, it'll be handy to have the library code separated into its own directory.
Replaces a lot of HIP platform string comparisons with a variable that gets set early and cleans up a few other things.
We only build hipFile now. All former rocFile code is now built with hipFile. The rocFile API is still exposed at this time.
Everything moved to the hipFile namespace
Relocated to a `legacy` subdirectory under `test`
These tests ensured that the rocFile API stayed compatible with the hipFile API. With the retirement of the rocFile API, these tests are no longer necessary.
Move the hipfile-cufile.cpp file to a new nvidia_detail directory and rename it to cufile-api-compat.cpp to make its purpose more obvious. Also added some explanatory text to the test file. Also removed the useless main.cpp file that was a leftover placeholder from when we first set up the testing.
Moved to hipfile/test/common
* Includes rocfile.h in hipfile.h * Replace rocfile.h with hipfile.h * Move hoff_t from shared/hipfile-types.h to hipfile.h * Remove hipfile-types.h
There was a problem hiding this comment.
Pull request overview
This PR completely removes the rocFile library and consolidates all functionality directly into hipFile. The changes eliminate the intermediate rocFile layer that was previously used on AMD platforms, moving its implementation directly into hipFile's AMD backend. This simplification reduces code duplication and maintenance overhead while maintaining the same public API surface.
Key Changes:
- Removed all rocFile-specific files, directories, and build configuration
- Moved rocFile implementation directly into hipFile's AMD backend
- Updated test infrastructure to reflect the consolidated architecture
- Simplified build system by eliminating rocFile dependencies
Reviewed changes
Copilot reviewed 92 out of 99 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
rocfile/ (multiple files) |
Deleted entire rocFile library directory including source, tests, and headers |
shared/hipfile-types.h |
Removed shared type definitions, moved into hipfile.h |
hipfile/src/amd_detail/hipfile.cpp |
Replaced rocFile delegation with direct implementation of all hipFile APIs |
hipfile/src/amd_detail/hipfile-rocfile.* |
Removed conversion layer between hipFile and rocFile types |
hipfile/test/amd_detail/ (multiple files) |
Updated test files to use hipFile namespaces and types instead of rocFile |
CMakeLists.txt (multiple) |
Updated build configuration to remove rocFile targets and dependencies |
| Documentation files | Updated references from "hipFile/rocFile" to "hipFile" |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| TEST_F(HipFileHandle, deregister_handle_doesnt_throw_if_not_registered) | ||
| { | ||
| ASSERT_EQ(rocFileHandleDeregister(reinterpret_cast<rocFileHandle_t>(0xdeadbeef)), | ||
| RocFileOpError(rocFileHandleNotRegistered)); | ||
| hipFileHandleDeregister(reinterpret_cast<hipFileHandle_t>(0xdeadbeef)); | ||
| } |
There was a problem hiding this comment.
The updated behavior of hipFileHandleDeregister to not throw exceptions for unregistered handles should be verified with an assertion. Currently, the test only calls the function without verifying the expected no-throw behavior.
| hipFileHandleDeregister(fh); | ||
| hipFileHandleDeregister(fh); |
There was a problem hiding this comment.
The second call to hipFileHandleDeregister should verify that it doesn't throw or produce an error when called on an already-deregistered handle, consistent with the new no-throw behavior.
| hipFileHandleDeregister(fh); | ||
| } | ||
| ASSERT_EQ(rocFileHandleDeregister(fh), ROCFILE_SUCCESS); | ||
| hipFileHandleDeregister(fh); |
There was a problem hiding this comment.
The behavior change where hipFileHandleDeregister no longer returns an error when operations are outstanding should be verified with assertions to ensure this new behavior is intentional and tested.
kurtmcmillan
left a comment
There was a problem hiding this comment.
Should probably wait for at least another reviewer.
I think @jordan-turbofish and @riley-dixon should also sign off. This is a big change. |
riley-dixon
left a comment
There was a problem hiding this comment.
I'm impressed that you were able to do this so quickly.
Batch and CI changes look good.
|
|
||
| hipFileError_t | ||
| rocFileHandleDeregister(hipFileHandle_t fh) | ||
| void | ||
| hipFileHandleDeregister(hipFileHandle_t fh) | ||
| try { | ||
| if (fh == nullptr) { | ||
| return {hipFileInvalidValue, hipSuccess}; | ||
| return; | ||
| } | ||
|
|
||
| Context<DriverState>::get()->deregisterFile(fh); | ||
| return {hipFileSuccess, hipSuccess}; | ||
| } | ||
| catch (const DriverNotInitialized &) { | ||
| return {hipFileDriverNotInitialized, hipSuccess}; | ||
| } | ||
| catch (const FileOperationsOutstanding &) { | ||
| return {hipFileInternalError, hipSuccess}; | ||
| } | ||
| catch (const FileNotRegistered &) { | ||
| return {hipFileHandleNotRegistered, hipSuccess}; | ||
| return; | ||
| } | ||
| catch (...) { | ||
| return handle_exception(); | ||
| return; | ||
| } |
There was a problem hiding this comment.
Why remove the error handling here and changing this to return void?
There was a problem hiding this comment.
Okay, I understand the reasoning now.
I'm going to (unsuccessfully) argue that we should keep our error handling somewhere, despite needing this particular target for compatibility reasons.
| if (result == -hipFileDriverNotInitialized) { | ||
| // Match cuFile behaviour | ||
| errno = EINVAL; | ||
| result = -1; | ||
| } |
There was a problem hiding this comment.
Is this really what happens? This goes against their own documentation that return -1 means a POSIX error.
There was a problem hiding this comment.
After talking with @jordan-turbofish this is in fact what happens.
Completely removes all traces of rocFile