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

Validator disallows Float16 capability even when the necessary extension is present #1375

Closed
ehsannas opened this issue Mar 5, 2018 · 5 comments
Assignees

Comments

@ehsannas
Copy link
Contributor

ehsannas commented Mar 5, 2018

I am trying to validate a SPIR-V file that includes usages of 16-bit float.

The validator complains that:

Capability Float16 is not allowed by Vulkan 1.0 specification (or requires extension)

However, my SPIR-V contains OpExtension "SPV_AMD_gpu_shader_half_float" which is the extension that enables this capability. Attached is the SPIR-V source.

float16.txt

@atgoo
Copy link

atgoo commented Mar 5, 2018

The validator simply ignores this extension since it's not in the grammar, so there are no rules for it.

I could hardcode this particular case somewhere, but I think it's more of a question for @dneto0.

@ehsannas
Copy link
Contributor Author

ehsannas commented Mar 5, 2018

It turns out that specifying the "SPV_AMD_gpu_shader_half_float" extension does not necessarily mean Float16 capability should be enabled. Nothing needs to be done. Sorry for the confusion.

@ehsannas ehsannas closed this as completed Mar 5, 2018
@ehsannas ehsannas reopened this Mar 5, 2018
@ehsannas
Copy link
Contributor Author

ehsannas commented Mar 5, 2018

Ok, so there is still some work that needs to be done.

If Float16 capability is not specified, you will get this error:

Using a 16-bit floating point type requires the Float16 or Float16Buffer capability, or an extension that explicitly enables 16-bit floating point.

But we should not get this validation error if the "SPV_AMD_gpu_shader_half_float" extension is specified.

@ehsannas
Copy link
Contributor Author

ehsannas commented Mar 5, 2018

conclusion of my talk with @dneto0 was that we should tell the validator about this extension and the fact that it enables 16bit floats by adding it to the Features in the validation state.

@oscarbg
Copy link

oscarbg commented Mar 6, 2018

just let me join the discussion and say that it is strange as with SPIRV-tools from Vulkan SDK 1.0.68 all works OK (EDIT: I mean SPIR-V code with Float16 cap+ SPV_AMD_.. ext):

spirv-val --version
SPIRV-Tools v2018.1-dev v2018.0-6-g9e19fc0

spirv-val doesn't catch any issues with the generated SPIR-V with Float16 cap+ SPV_AMD_.. ext:
spirv-as test.spv.txt -o test.spv
I run spirv-dis just to check spirv-as has mantained Float16 and SPV_AMD_.. ext:
spirv-dis test.spv -o testdis.spv.txt
spirv-val test.spv
no errors and also
spirv-opt test.spv -O -o test2.spv
optimzes spir-v correctly seeing textual form:
spirv-dis test2.spv -o test2dis.spv.txt
I attach all generated files in case helpful:

tests.zip

atgoo pushed a commit to atgoo/SPIRV-Tools that referenced this issue Mar 6, 2018
Fixes KhronosGroup#1375

Hardcoded float16 feature enabling if extension
SPV_AMD_gpu_shader_half_float is present.
@dneto0 dneto0 closed this as completed in 03b8a3f Mar 7, 2018
jaebaek pushed a commit to jaebaek/SPIRV-Tools that referenced this issue Mar 8, 2018
Fixes KhronosGroup#1375

Hardcoded float16 feature enabling if extension
SPV_AMD_gpu_shader_half_float is present.
jaebaek pushed a commit to jaebaek/SPIRV-Tools that referenced this issue Mar 8, 2018
Fixes KhronosGroup#1375

Hardcoded float16 feature enabling if extension
SPV_AMD_gpu_shader_half_float is present.
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

No branches or pull requests

3 participants