-
Notifications
You must be signed in to change notification settings - Fork 130
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
expose header parameters in clCompileProgram #286
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this is a nice addition!
I think this isn't quite backward compatible though, even with the default arguments. To see why, imagine a case that called compile()
and passed a notification function pointer (and possibly some user data) before. This will not work after these changes because the order of the function arguments has changed.
We have several options:
- Break compatibility. Not ideal, but the odds of this change affecting a significant amont of code is probably low, and if any code breaks the error message and steps to fix it should be clear
- Move the header arguments to the end of the argument list. This will retain compatibility, although if we did this then the order of arguments will not match
clCompileProgram
. - Keep the current function as-is and add an overload that supports headers. Note, the overload will need to have some non-default arguments for overload resolution to work.
I think my order of preference is (3), then (2), and then (1), though I'm open to alternatives. What do you think?
PS: It would be great to have some unit tests for these changes!
You are right of course about compatibility. Not sure what inhibited my thinking when I wrote that. Due to the limitation of the non default argument needing to come first and me wanting to preserve argument order, this leads to the requirement to provide options, which is ok I guess. No need to break compatibility. While I was at it, I also wrote an overload addressing #285 Honestly, I have no clue how to write unit tests for something like this. Questions:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I think this is moving in the right direction, just a few minor things to fix.
I also think it'd be really good to have some tests to ensure this is doing what we want it to do. Is this something you could look into adding? If not, could you please file an issue so we don't lose track of it? Thanks again!
I fully agree, that tests would be nice. I looked into it and could not figure it out (sorry). Consequently, I wrote an issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this looks really great.
I had a look at adding some tests for this feature and it's going to be complex, since compiling the program also queries the build log. I'm fine with just the tracker issue for now.
I left a PR on your repo with some tests - please take a look: Richardk2n#1 I do wonder if we should re-think passing the options as a |
add a few compile program tests
In my opinion using |
Merging as discussed in the April 9th teleconference - thanks! |
I use this to include dynamically generated headers.
Exposing this should offer more flexibility without breaking existing code due to the defaults.