Skip to content

Conversation

@jzadnik
Copy link
Contributor

@jzadnik jzadnik commented Jul 10, 2025

This PR:

  • Adds validation support for the SPV_INTEL_function_variants extension
  • Augments the linker to be able to produce multitarget modules described in the extension spec. Details of how it works are documented in fnvar.h.

NOTE: This PR requires #6210 for the tests to pass because inline assembly is used to test conditional extensions.

The values to pass to OpSpecConstantArchitectureINTEL and OpSpecConstantTargetINTEL can be determined from targets registry.

Copy link
Collaborator

@s-perron s-perron left a comment

Choose a reason for hiding this comment

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

I've reviewed the spirv-opt changes. I'm actually surprized you do not need more changes. You add tests to spirv-opt. Mainly for the remove duplicates pass.

@s-perron s-perron requested a review from alan-baker July 11, 2025 18:41
Copy link
Collaborator

@s-perron s-perron left a comment

Choose a reason for hiding this comment

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

I looked at some of the generic files. I believe you need a lot more testing. The way the extension was defined is that it created parallel opcode, but shifted the operands by 1. This means that every place that looks at the capabilities, extensions, ect. must make sure the operand indices are shift by one. I'm not sure that have been thoroughly checked or tests.

@s-perron s-perron requested a review from dneto0 July 11, 2025 18:53
@jzadnik
Copy link
Contributor Author

jzadnik commented Jul 16, 2025

Thanks to the review. I fixed the issues you pointed out and added more tests.

The way I identified where the index should be shifted by one is that I searched for OpCapability/Extension/EntryPoint in the source. A more thorough check can be done, though I haven't found a systematic way to do it.

Could you also check the other PR I made (see this PR's description)? It's used to test conditional extensions and should be merged before this PR, otherwise the tests won't pass.

I'll be on vacation for the next three weeks, if more changes are required, I'll address them after that.

Copy link
Contributor

@alan-baker alan-baker left a comment

Choose a reason for hiding this comment

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

Validator changes are good.

@s-perron s-perron self-requested a review July 25, 2025 20:44
Copy link
Collaborator

@s-perron s-perron left a comment

Choose a reason for hiding this comment

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

The changes to the optimizer look good. I still need to look at the code in the linker.

@s-perron
Copy link
Collaborator

The FunctionVariants.FAddAsm test seems to be failing. That is a linker test. Can you get that test fixed, and then someone will look at the linker code. Thanks.

Copy link
Collaborator

@dneto0 dneto0 left a comment

Choose a reason for hiding this comment

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

Partial review of the linking material.

I'm up to about line 200 in link/fnvar.cpp but have read the other parts of the linker changes.

@jzadnik
Copy link
Contributor Author

jzadnik commented Aug 11, 2025

I rebased this PR onto the latest main which has the inline assembly patch merged. This should fix the FunctionVariants.FAddAsm (all tests pass on my machine).

@jzadnik jzadnik force-pushed the fnvar3 branch 2 times, most recently from 5dd7f3b to 05333ad Compare August 12, 2025 11:13
@dneto0
Copy link
Collaborator

dneto0 commented Aug 12, 2025

Also, thanks for your patience.

Between the three reviewers so far I think we've approved all parts of this MR.

@dneto0 dneto0 merged commit bf98dd7 into KhronosGroup:main Aug 12, 2025
25 of 26 checks passed
@jzadnik
Copy link
Contributor Author

jzadnik commented Aug 13, 2025

Thanks for the thorough review!

@jzadnik jzadnik deleted the fnvar3 branch August 13, 2025 09:07
@dneto0
Copy link
Collaborator

dneto0 commented Aug 15, 2025

This broke GN builds in downstream projects.
I'm looking into it.

E.g. vulkan-deps into dawn. https://dawn-review.googlesource.com/c/dawn/+/257354

(Not blaming anyone: GN is niche, and sometimes hard to get right)

dneto0 added a commit that referenced this pull request Aug 15, 2025
PR #6211 added new source files but did not update BUILD.gn
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.

5 participants