Skip to content

[DeviceMSAN] Fix urEnqueueUSMMemcpy2D return UR_RESULT_ERROR_UNSUPPORTED_FEATURE after enabling MSAN #19286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: sycl
Choose a base branch
from

Conversation

AllanZyne
Copy link
Contributor

@AllanZyne AllanZyne commented Jul 3, 2025

urEnqueueUSMMemcpy2D return UR_RESULT_ERROR_UNSUPPORTED_FEATURE after enabling msan layer due to most adapters haven't implementing urEnqueueUSMFill2D.

I added a quick fallback implementation in msan layer just for urEnqueueUSMMemcpy2D.

@AllanZyne AllanZyne requested a review from a team as a code owner July 3, 2025 08:37
@kbenzie
Copy link
Contributor

kbenzie commented Jul 3, 2025

Would it not make more sense to implement the fallback in the adapter?

@AllanZyne
Copy link
Contributor Author

Would it not make more sense to implement the fallback in the adapter?

Okay

@kbenzie
Copy link
Contributor

kbenzie commented Jul 3, 2025

No adapters actually implement urEnqueueUSMFill2D as we have urEnqueueUSMMemcpy2D instead. I'm wondering if urEnqueueUSMFill2D should actually be removed instead of implementing a fallback?

I just realised they do different things.

@AllanZyne AllanZyne requested review from a team as code owners July 4, 2025 02:32
@AllanZyne
Copy link
Contributor Author

Hi @intel/unified-runtime-reviewers-level-zero @intel/unified-runtime-reviewers-opencl, please review, thanks!

@AllanZyne
Copy link
Contributor Author

Would it not make more sense to implement the fallback in the adapter?

Sorry, I'm not familiar with the codes in adapter, especially fixing their conformance tests.
This patch is mainly for fixing a bug exposed by msan.
Thanks!

@AllanZyne AllanZyne requested review from a team and Copilot and removed request for a team July 4, 2025 07:53
@AllanZyne AllanZyne changed the title [DeviceMSAN] Fix Fill2D UR_RESULT_ERROR_UNSUPPORTED_FEATURE [DeviceMSAN] Fix UR_RESULT_ERROR_UNSUPPORTED_FEATURE after enabling MSAN Jul 4, 2025
Copy link
Contributor

@Copilot 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 adds a fallback path for USMFill2D when the underlying call returns UR_RESULT_ERROR_UNSUPPORTED_FEATURE and updates 2D memcpy logic to use the new fallback and simplify wait-list handling.

  • Introduce urEnqueueUSMFill2DFallback to slice a 2D fill into multiple 1D fills on unsupported backends
  • Update urEnqueueUSMMemcpy2D to invoke the new fallback and remove manual wait-event vector management
  • Minor loop/styling adjustments in event release logic

Comment on lines +64 to +65
if (Result == UR_RESULT_SUCCESS ||
Result != UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
Copy link
Preview

Copilot AI Jul 4, 2025

Choose a reason for hiding this comment

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

The condition if (Result == UR_RESULT_SUCCESS || Result != UR_RESULT_ERROR_UNSUPPORTED_FEATURE) is redundant. You can simplify it to if (Result != UR_RESULT_ERROR_UNSUPPORTED_FEATURE) return Result; for clarity.

Suggested change
if (Result == UR_RESULT_SUCCESS ||
Result != UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
if (Result != UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {

Copilot uses AI. Check for mistakes.

@AllanZyne AllanZyne changed the title [DeviceMSAN] Fix UR_RESULT_ERROR_UNSUPPORTED_FEATURE after enabling MSAN [DeviceMSAN] Fix urEnqueueUSMMemcpy2D return UR_RESULT_ERROR_UNSUPPORTED_FEATURE after enabling MSAN Jul 4, 2025
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