Skip to content
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

Proposal for UR new warnings mechanism #1330

Open
fabiomestre opened this issue Feb 9, 2024 · 1 comment
Open

Proposal for UR new warnings mechanism #1330

fabiomestre opened this issue Feb 9, 2024 · 1 comment
Assignees
Labels
specification Changes or additions to the specification

Comments

@fabiomestre
Copy link
Contributor

fabiomestre commented Feb 9, 2024

The warning mechanism that currently exists in Unified Runtime is ambiguous and not very intuitive.

This is the current state (for adapters that use this functionality):

  • The entrypoint that wants to send a warning sets an error message for urAdapterGetLastError and returns UR_RESULT_ERROR_ADAPTER_SPECIFIC
  • The call to urAdapterGetLastError returns UR_RESULT_SUCCESS to signal that it is a warning.
  • If it is an actual error, The call to urAdapterGetLastErrorreturns UR_RESULT_ERROR_ADAPTER_SPECIFIC instead.

This is not intuitive because urAdapterGetLastError is the only entrypoint that can return an error code in a success state. In addition, setting UR_RESULT_SUCCESS to signal a warning doesn't make much sense.

After some internal discussion, we think that the following changes could improve the current workflow:

  • Create a new loader entrypoint that accepts a callback function. This callback function will be called everytime a UR adapter emits a warning.
  • The application would be able to opt out of warnings by simply not setting the callback function.
  • At runtime, we can provide an environment variable to allow the user to enable/disable warnings.
  • urAdapterGetLastError should be simplified to always return UR_RESULT_SUCCESS unless something is wrong with its parameters. This would make it behave in a way that is more in line with other UR entrypoints.

Risks:

  • This would require some changes on the way that SYCL Runtime handles warnings and adapter specific errors from UR.

Related issue: #762

@fabiomestre fabiomestre added the specification Changes or additions to the specification label Feb 9, 2024
@fabiomestre fabiomestre changed the title Proposal for UR warnings mechanism Proposal for UR new warnings mechanism Feb 9, 2024
@fabiomestre fabiomestre added the needs-discussion This needs further discussion label Feb 12, 2024
@fabiomestre
Copy link
Contributor Author

This was discussed on the WG meeting of 14/02/2024. There was no objections to this approach. So we will go ahead with adding the new entrypoint to the specification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
specification Changes or additions to the specification
Projects
None yet
Development

No branches or pull requests

2 participants