Skip to content

Conversation

@jandres742
Copy link
Contributor

No description provided.

jandres742 referenced this pull request Mar 10, 2023
Update to

oneapi-src/unified-runtime@6fb8e26

Tag: weekly-2023-02-24

Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
@jandres742 jandres742 temporarily deployed to aws March 10, 2023 01:45 — with GitHub Actions Inactive
@jandres742 jandres742 temporarily deployed to aws March 10, 2023 02:41 — with GitHub Actions Inactive
@jandres742 jandres742 marked this pull request as ready for review March 10, 2023 03:11
@jandres742 jandres742 requested a review from a team as a code owner March 10, 2023 03:11
@jandres742 jandres742 requested a review from bso-intel March 10, 2023 03:11
@jandres742
Copy link
Contributor Author

this addresses a warning from #8315 and adds the stub.

@smaslov-intel : please review.

}

ur_result_t UR_APICALL urGetLastResult(
ur_platform_handle_t Platform, ///< [in] handle of the platform instance
Copy link
Contributor

Choose a reason for hiding this comment

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

why is there the Platform argument in UR unlike in PI?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@smaslov-intel : Git blame points at
oneapi-src/unified-runtime#84

From @pbalcer

This makes it possible to have a simple passthrough implementation for this method in the loader. Otherwise we'd have to have a copy of the last error in the loader itself.

Copy link
Contributor

Choose a reason for hiding this comment

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

This interface was meant to be per-plugin (and not per-platform). And it's implementation is such now too:

ur_result_t zerPluginGetLastError(char **message) {

@pbalcer, @jandres742 : I am not against make it per-platform, but then more changes are needed than just these.

Copy link
Contributor

@pbalcer pbalcer Mar 10, 2023

Choose a reason for hiding this comment

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

There's no adapter/plugin entity in UR's API. The platform is the closest analog. If it's too burdensome to use this API in its current form, we can remove the platform argument, and use e.g., a thread-local variable that stores the last used adapter instance so that we know where to redirect the call. But that's an extra tls access and write in every call (which might be fine, just something to consider).

Copy link
Contributor

Choose a reason for hiding this comment

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

With PI we are registering the specific plugin's entries at the beginning with piPluginInit, so SYCL RT was talking directly to the specific plugin and there the the error-message was a TLS:

thread_local char ErrorMessage[MaxMessageSize];

Now, if you really need to re-direct to the needed plugin from the UR loader, then it makes sense to add the platform argument (I assume you keep a map of platforms to adapters). But let's not fork the second set of interfaces and re-do the current ones (add platform to PI)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pbalcer : even if we leave the platform argument, this needs to be tls (in the adapter instead of the loader), since multiple threads could be calling different UR calls in the same platform, each with a different error code.

From your comment in the PR, the idea of using the platform is to have a way of knowing which adapter the PI runtime is calling. W/o the platform, either we can have only 1 adapter used at a time, or as you mention, to track last adapter used by the thread.

@smaslov-intel : to which other changes are you referring to?

Copy link
Contributor

Choose a reason for hiding this comment

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

@smaslov-intel : to which other changes are you referring to?

This PR adds urGetLastResult: https://github.com/intel/llvm/pull/8602/files#diff-d293a76e913cc9b50844ba191619e7c43bbff7c3fdd673e36dcb4c980f4b0589R406

But there is already zerPluginGetLastError:

ur_result_t zerPluginGetLastError(char **message) {

The 2 need to converge

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see @smaslov-intel . Ok, fixing that that.

@jandres742
Copy link
Contributor Author

New version of this API being implemented in #10349. Closing.

@jandres742 jandres742 closed this Jul 26, 2023
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