Open cdavis5e opened 4 years ago
Not sure I understand why you want this to be a VkPI limitation. You have the constant value when the pipeline is created, and this is where you are generating MSL. What's stopping you from just putting the value of the constant into the MSL source?
What's stopping you from just putting the value of the constant into the MSL source?
Thanks for identifying that possibility.
Exploring possible...but likely heroic...design options for this:
printf
kind of substitution tags which the implementation then invokes with the specialized values?Other considerations:
- How significant are the use-case requirements for this (vis-a-vis need for heroics)?
Well, it turns out, there are tests in the CTS which do this. Many of the subgroup tests, for example. If we want MoltenVK to be a certified implementation of VkPS, we're going to have to implement this. And when gfx-rs gets subgroup support, they'll have to support it, too.
Implementation detects the requirement, and resubmits SPIRV to SPIRV-Cross with the specialized value as part of the SPIRV-Cross API?
Is there a reason we won't be able to use the existing fallback paths (https://github.com/KhronosGroup/SPIRV-Cross/blob/5845e009ea25991264d1b848bea7e6d37469bdba/spirv_msl.cpp#L5593-L5609) that avoids emitting function constants? It looks like we could do either of these fallbacks:
Hello, I was wondering if there is not a way to bypass this limit in 2023? This is very annoying for bindless texturing: it is required to specialize the hardware limit to access the full hardware potential.
In MSL, it is not possible to specify an array size using a variable in the
constant
address space. Because Metal function constants are variables in this space, this means that the size of an array cannot be a function constant. This is particularly surprising, given that several other things, including binding numbers of resources, can be function constants, which one would not expect given that arrays cannot be sized with function constants.This means that, on Portability implementations over Metal, we won't be able to support shaders that use Specialization Constants to size arrays.