-
Notifications
You must be signed in to change notification settings - Fork 114
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
clLinkProgram return value when link fails #798
base: main
Are you sure you want to change the base?
Conversation
I'm sorry if that's impatient, but it's been almost 4 months and no one even commented. Can it be because I made this as a draft? I didn't think that could be a problem because there is another draft... Though now that I look, that one also seems abandoned. It seems pulls are actively being worked upon right now. If no one is getting notifications of this because it's a draft, I'll turn this into a proper PR in about a day... |
Hi @SunSerega, apologies that no one got to this. Using draft is okay. Yes, I see the problem you're describing. The last three sentences in the existing spec are pretty confusing. Logically they say:
But "otherwise" is a confusing word because it's not immediately clear what situations weren't covered by the previous two sentences. Based on the error codes I think it's clear that it means all the listed situations except for the ones resulting in Both You list different behaviour for existing implementations, on a first reading of your proposed wording changes it's not clear to me whether you restrict that, but if you do that would only be possible in a new specification version. |
The difference with I put the most effort into not changing the current behavior of |
Yes, probably. But it can also be treated as a bug in some implementations, caused by misinterpreted spec because my changes restrict only nonsensical behavior (not returning program object on But that would only be feasible if fixing it wouldn't be too hard. In this sense, the biggest concern is NVidia's implementation, because it didn't return the program object in any of my tests, so they may not have any ready code for this. Can you please ping someone who makes the default OpenCL layer for CUDA? |
Well, I guess it's not directly said. Instead:
So, returning NULL if inputs for But, while not ambiguous, I guess it can be made more direct. For instance:
|
This is a tricky issue! I created #1075 for discussion. Maybe we can decide what we want to clarify first, then we can figure out what we need to change in the spec? |
18ee252
to
5b0521e
Compare
The last paragraph of clLinkProgram sais:
But I see the contradiction in it because the application cannot query the linker status of the NULL program object.
It was probably meant that
NULL program object
is returned only iferrcode_ret
is neitherCL_SUCCESS
norCL_LINK_PROGRAM_FAILURE
. And such behavior can be implied by the text above this paragraph, but...I tested what is returned when the linking begins but fails with this program:
On 3 different PCs, each with 1 platform of a different vendor:
clLinkProgram
behaves either way, depending on which devices I add to the context.(program objects returned by
clLinkProgram
and passed topfn_notify
(when it was not NULL) were equal to each other in all tested cases)That is all to say, I think the current description of
clLinkProgram
is not strict/clear enough.This pull is a draft because it is only an example of how the description of
clLinkProgram
can be improved, and I can see some problems with these changes:These changes cannot be applied to OpenCL3.0 specs, because they invalidate some implementations - like one by NVidia on my PC. I guess this kind of change should go to OpenCL3.1 or something... Though I'm not sure where it would be appropriate to suggest that.
I made sure not to change the meaning of the spec section (except for what is returned when the link fails), but I'm unsure about some things. For instance:
This seems to imply that
clLinkProgram
can return a non-zero program object even whenpfn_notify
is not NULL. But this program object would not be usable beforepfn_notify
is called, and would be redundant after.English is not my native language, so while I have checked my changes with Grammarly, there are probably some not obvious to me issues with my changes.