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

Support SPIR-V deferred linking option #6500

Merged
merged 10 commits into from
Mar 5, 2025

Conversation

cheneym2
Copy link
Collaborator

The new option "SkipDownstreamLinking" will defer final downstream IR linking to the user application. This option only has an effect if there are modules that were precompiled to the target IR using precompileForTarget().

Until now, the default behavior for SPIR-V was to use deferred linking, and the default behavior for DXIL was to use immediate/internal linking in Slang.

This change only affects the SPIR-V behavior such that both deferred and non-deferred linking is supported based on the new option.

To support the non-deferred option, Slang will internally call into SPIRV-Tools-link to reconstitute a complete SPIR-V shader program when necessary (due to modules having been precompiled to target IR). Otherwise, if SkipDownstreamLinking is enabled, the shader returned by e.g. getTargetCode() or getEntryPointCode() may have import linkage to the SPIR-V embedded in the constituent modules.

Closes #4994

The new option "SkipDownstreamLinking" will defer final downstream IR
linking to the user application. This option only has an effect if
there are modules that were precompiled to the target IR using
precompileForTarget().

Until now, the default behavior for SPIR-V was to use deferred linking, and
the default behavior for DXIL was to use immediate/internal linking in Slang.

This change only affects the SPIR-V behavior such that both deferred and
non-deferred linking is supported based on the new option.

To support the non-deferred option, Slang will internally call into
SPIRV-Tools-link to reconstitute a complete SPIR-V shader program when
necessary (due to modules having been precompiled to target IR).
Otherwise, if SkipDownstreamLinking is enabled, the shader returned by
e.g. getTargetCode() or getEntryPointCode() may have import linkage to
the SPIR-V embedded in the constituent modules.

Closes shader-slang#4994
@cheneym2 cheneym2 added the pr: non-breaking PRs without breaking changes label Feb 28, 2025
@cheneym2
Copy link
Collaborator Author

/format

@slangbot
Copy link
Contributor

🌈 Formatted, please merge the changes from this PR

cheneym2 added a commit to cheneym2/slang that referenced this pull request Feb 28, 2025
@cheneym2
Copy link
Collaborator Author

/format

@slangbot
Copy link
Contributor

🌈 Formatted, please merge the changes from this PR

cheneym2 added a commit to cheneym2/slang that referenced this pull request Feb 28, 2025
@cheneym2 cheneym2 marked this pull request as ready for review February 28, 2025 21:10
@cheneym2 cheneym2 requested a review from a team as a code owner February 28, 2025 21:10
@cheneym2 cheneym2 force-pushed the cheneym2/spvlink2 branch from c9e1b25 to 1f9543a Compare March 1, 2025 04:04
@cheneym2
Copy link
Collaborator Author

cheneym2 commented Mar 1, 2025

/format

@slangbot
Copy link
Contributor

slangbot commented Mar 1, 2025

🌈 Formatted, please merge the changes from this PR

cheneym2 added a commit to cheneym2/slang that referenced this pull request Mar 1, 2025
@cheneym2 cheneym2 force-pushed the cheneym2/spvlink2 branch from d2bee20 to d49b82f Compare March 1, 2025 17:06
@cheneym2
Copy link
Collaborator Author

cheneym2 commented Mar 1, 2025

/format

@slangbot
Copy link
Contributor

slangbot commented Mar 1, 2025

🌈 Formatted, please merge the changes from this PR

@cheneym2 cheneym2 enabled auto-merge (squash) March 1, 2025 18:02
@cheneym2 cheneym2 merged commit 0634684 into shader-slang:master Mar 5, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: non-breaking PRs without breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SPIR-V linkage support modules with precompiled blobs
3 participants