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
Allow for partial linking #1144
Comments
I can have a look at allowing partially linked modules, when given the corresponding linker option. |
pierremoreau
added a commit
to pierremoreau/SPIRV-Tools
that referenced
this issue
Feb 13, 2018
pierremoreau
added a commit
to pierremoreau/SPIRV-Tools
that referenced
this issue
Feb 13, 2018
Sorry for the wait. #1297 should allow you to do what you want. Please have a try and tell me if some things are not working as expected. |
Yes, that is exactly what I wanted and works like a charm. Thank you very much |
pierremoreau
added a commit
to pierremoreau/SPIRV-Tools
that referenced
this issue
Feb 18, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem:
The linker currently expects all functions imported by one of the modules linked together to be exported by another module, otherwise it fails. This works well for linking together a final binary module, but does not allow for linking partially-linked modules, which have still unresolved import linkages.
Use-case:
I have an OpenCL compiler, that uses the SPIRV-Tools to read SPIR-V input, link SPIR-V modules if necessary, and convert it into an internal representation. In the device-side standard-library (which is linked into the kernel code) I also define some additional intrinsic functions to access special hardware components (like mutex, semaphores, etc.). These functions are then replaced by my compiler with the corresponding hardware-instructions and therefore not defined in any SPIR-V module. This works fine with a single SPIR-V module, since imported functions are accepted by SPIRV-Tools, but not when linking modules, since the linker does not allow for any functions to remain imported. See also here for a discussion on this.
Solution:
Allow the linker to create "partially linked" modules by not throwing errors when there is no exported symbol matching an imported one, instead it should leave the imported symbol as such. Since this behaviour may not always be intended, it should be added as optional feature, e.g. as a new flag to
spvtools::LinkerOptions
.The text was updated successfully, but these errors were encountered: