KhronosGroup / KhronosGroup/SPIRV-Cross

MSL: Add support for op OpCompositeInsert in OpSpecConstantOp?

Open
#1,736 2 comments 0 reactions 0 assignees View on GitHub
CTS
Dominant language
GLSL
Stars
2.5k
Forks
713
Avg merge
2d 18h
Merged PRs (30d)
16

Description

Several Vulkan CTS tests use op `OpCompositeInsert` in `OpSpecConstantOp`, which is not currently supported in SPIRV-Cross. Consequently, these tests fail in MoltenVK.

I've had a look, but it is not at all clear to me how a modified constant composite can be created in MSL via SPIRV-Cross. The corresponding instruction for the **_non_**-constant`OpCompositeInsert` op relies on emitting statements to crate a temp var copy of the composite, and then modifying part of it, which won't be possible with a constant value.

For a constant expression, it would seem we will have to construct the new composite on the fly, with the appropriate element modified as the composite is being created, but unfortunately, the internal plumbing for that is beyond my understanding of SPIRV-Cross innards.

[edit]: Adding CTS tests affected:

dEQP-VK.spirv_assembly.instruction.compute.opspecconstantop.vector_related
dEQP-VK.spirv_assembly.instruction.graphics.opspecconstantop.vector_related_vert
dEQP-VK.spirv_assembly.instruction.graphics.opspecconstantop.vector_related_tessc
dEQP-VK.spirv_assembly.instruction.graphics.opspecconstantop.vector_related_tesse
dEQP-VK.spirv_assembly.instruction.graphics.opspecconstantop.vector_related_frag

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with SPIRV-Cross's existing handling of non-constant OpCompositeInsert and the OpSpecConstantOp path for MSL generation. Use the listed Vulkan CTS vector-related tests to reproduce the failures and trace how constant composites are constructed. Done means those affected tests pass with OpCompositeInsert supported in OpSpecConstantOp.

Written by the indexing model from the issue text.

Assessment

Domain
compilers, computer-graphics
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.