Skip to content

hipfile/fastpath: Ensure (buffer_address + buffer_offset) is aligned#175

Open
kurtmcmillan wants to merge 12 commits intodevelopfrom
kumcmill/fix-fastpath-mem-align-check
Open

hipfile/fastpath: Ensure (buffer_address + buffer_offset) is aligned#175
kurtmcmillan wants to merge 12 commits intodevelopfrom
kumcmill/fix-fastpath-mem-align-check

Conversation

@kurtmcmillan
Copy link
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings January 27, 2026 23:05
Copy link
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 fixes alignment validation in the fastpath implementation by ensuring that the combined buffer_address + buffer_offset is properly aligned, rather than checking only buffer_offset in isolation.

Changes:

  • Updated alignment checks to validate buffer_address + buffer_offset instead of just buffer_offset
  • Added comprehensive test coverage including a new TestDefaults test and ScoreRejectsBufferAddressPlusBufferOffsetIsUnaligned test
  • Expanded parameterized test cases with additional edge cases and conditional compilation guards

Reviewed changes

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

File Description
src/amd_detail/backend/fastpath.cpp Modified alignment validation logic to check combined buffer address and offset
test/amd_detail/fastpath.cpp Added new tests, updated default test values for proper alignment, and added EXPECT_CALL for getBuffer() across all tests

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

@kurtmcmillan kurtmcmillan force-pushed the kumcmill/fix-fastpath-mem-align-check branch from 1250c5b to 288426a Compare January 28, 2026 18:57
@kurtmcmillan kurtmcmillan requested a review from Copilot January 28, 2026 19:01
Copy link
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

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


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

@kurtmcmillan kurtmcmillan force-pushed the kumcmill/fix-fastpath-mem-align-check branch from 288426a to 2904af6 Compare January 28, 2026 20:38
@kurtmcmillan kurtmcmillan requested a review from Copilot January 28, 2026 20:38
Copy link
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

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


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

@kurtmcmillan kurtmcmillan force-pushed the kumcmill/fix-fastpath-mem-align-check branch from 2904af6 to 3b23b45 Compare January 28, 2026 20:53
@kurtmcmillan kurtmcmillan requested a review from Copilot January 28, 2026 20:55
Copy link
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

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


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

@kurtmcmillan kurtmcmillan marked this pull request as ready for review January 28, 2026 21:26
- Ensure DEFAULT_MEM_ALIGN and DEFAULT_OFFSET_ALIGN are powers of 2 (> 1)
- Ensure DEFAULT_BUFFER_ADDR is DEFAULT_MEM_ALIGN aligned
- Ensure DEFAULT_BUFFER_OFFSET is DEFAULT_MEM_ALIGN aligned
- Ensure DEFAULT_FILE_OFFSET is DEFAULT_OFFSET_ALIGN aligned
- Ensure DEFAULT_IO_SIZE is DEFAULT_OFFSET_ALIGN aligned
FastpathAlignedIoSizesParam should only be instantiated with size_t values.
-DEFAULT_OFFSET_ALIGN became 4294966784 in the test.
FastpathUnalignedIoSizesParam should only be instantiated with size_t values.
(-DEFAULT_OFFSET_ALIGN + 1) became 4294966785 in the test.
Cast DEFAULT_OFFSET_ALIGN to hoff_t before negating to ensure the test is
instantiated with the expected value.

    -DEFAULT_OFFSET_ALIGN -> 4294966784

    -static_cast<hoff_t>(DEFAULT_OFFSET_ALIGN) -> -512
…Param

Cast DEFAULT_OFFSET_ALIGN to hoff_t before negating to ensure the test is
instantiated with the expected value.

    -DEFAULT_OFFSET_ALIGN -> 4294966784

    -static_cast<hoff_t>(DEFAULT_OFFSET_ALIGN) -> -512
…fsetsParam

We should be passing in a file offset value not a buffer offset value.
…Param

Cast DEFAULT_OFFSET_ALIGN to hoff_t before negating to ensure the test is
instantiated with the expected value.

    -DEFAULT_MEM_ALIGN -> 4294967292

    -static_cast<hoff_t>(DEFAULT_MEM_ALIGN) -> -4
…tsParam

Cast DEFAULT_OFFSET_ALIGN to hoff_t before negating to ensure the test is
instantiated with the expected value.

    -DEFAULT_MEM_ALIGN -> 4294967292

    -static_cast<hoff_t>(DEFAULT_MEM_ALIGN) -> -4
Removes alignment check duplication.
@kurtmcmillan kurtmcmillan force-pushed the kumcmill/fix-fastpath-mem-align-check branch from 3b23b45 to af88d42 Compare February 2, 2026 22:18
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.

4 participants