Found while reviewing KhronosGroup/SPIRV-Tools#6009.
Surprisingly, using the half type does not generate SPIR-V modules that declare the Float16 capability. We have some tests that are checking that the right capability is declared, for example:
|
; CHECK-SPIRV-DAG: {{[0-9]+}} Capability Float16 |
However, this is unfortunately matching Capability Float16Buffer, so it is not actually checking for Capability Float16. If I change this check instead to:
; CHECK-SPIRV: Capability {{Float16 *$}}
Then the test starts to fail.
Recommended actions:
- Change all tests to check for
Float16 at the end of the line, similar to the check above.
- Are there any other capabilities that are the prefix of another capability that may be affected similarly?
- Figure out why Float16Buffer is being declared and not Float16. Possibly something is going wrong here?
|
SPIRVCapVec getRequiredCapability() const override { |
|
SPIRVCapVec CV; |
|
if (isTypeFloat(16)) { |
|
CV.push_back(CapabilityFloat16Buffer); |
|
auto Extensions = getModule()->getSourceExtension(); |
|
if (std::any_of(Extensions.begin(), Extensions.end(), |
|
[](const std::string &I) { return I == "cl_khr_fp16"; })) |
|
CV.push_back(CapabilityFloat16); |
|
} else if (isTypeFloat(64)) |
|
CV.push_back(CapabilityFloat64); |
|
return CV; |
Found while reviewing KhronosGroup/SPIRV-Tools#6009.
Surprisingly, using the
halftype does not generate SPIR-V modules that declare the Float16 capability. We have some tests that are checking that the right capability is declared, for example:SPIRV-LLVM-Translator/test/half_extension.ll
Line 17 in 4eea290
However, this is unfortunately matching
Capability Float16Buffer, so it is not actually checking forCapability Float16. If I change this check instead to:Then the test starts to fail.
Recommended actions:
Float16at the end of the line, similar to the check above.SPIRV-LLVM-Translator/lib/SPIRV/libSPIRV/SPIRVType.h
Lines 214 to 224 in 4eea290