Skip to content

Remove rocFile#95

Merged
derobins merged 48 commits into
developfrom
derobins/i_could_be_playing_stardew_valley
Nov 26, 2025
Merged

Remove rocFile#95
derobins merged 48 commits into
developfrom
derobins/i_could_be_playing_stardew_valley

Conversation

@derobins
Copy link
Copy Markdown
Collaborator

Completely removes all traces of rocFile

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
Copilot AI review requested due to automatic review settings November 26, 2025 15:55
Copy link
Copy Markdown
Contributor

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 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.

Comment thread CHANGELOG.md Outdated
Comment on lines +196 to 199
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));
}
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Comment on lines +219 to +220
hipFileHandleDeregister(fh);
hipFileHandleDeregister(fh);
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Comment on lines +246 to +248
hipFileHandleDeregister(fh);
}
ASSERT_EQ(rocFileHandleDeregister(fh), ROCFILE_SUCCESS);
hipFileHandleDeregister(fh);
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator

@kurtmcmillan kurtmcmillan left a comment

Choose a reason for hiding this comment

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

Should probably wait for at least another reviewer.

@derobins
Copy link
Copy Markdown
Collaborator Author

Should probably wait for at least another reviewer.

I think @jordan-turbofish and @riley-dixon should also sign off. This is a big change.

Copy link
Copy Markdown
Collaborator

@riley-dixon riley-dixon left a comment

Choose a reason for hiding this comment

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

I'm impressed that you were able to do this so quickly.

Batch and CI changes look good.

Comment on lines 72 to 84

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;
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why remove the error handling here and changing this to return void?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

Comment on lines +208 to +212
if (result == -hipFileDriverNotInitialized) {
// Match cuFile behaviour
errno = EINVAL;
result = -1;
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this really what happens? This goes against their own documentation that return -1 means a POSIX error.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

After talking with @jordan-turbofish this is in fact what happens.

@derobins derobins merged commit d537b0a into develop Nov 26, 2025
33 checks passed
@derobins derobins deleted the derobins/i_could_be_playing_stardew_valley branch November 26, 2025 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants