spirv: Add SignedZeroInfNanPreserve logic
This commit is contained in:
parent
8d470c2e63
commit
b9f7bf4472
|
@ -124,6 +124,12 @@ void SetupDenormControl(const Profile& profile, const IR::Program& program, Emit
|
||||||
}
|
}
|
||||||
ctx.AddExtension("SPV_KHR_float_controls");
|
ctx.AddExtension("SPV_KHR_float_controls");
|
||||||
|
|
||||||
|
if (info.uses_fp16 && profile.support_fp16_signed_zero_nan_preserve) {
|
||||||
|
ctx.AddExecutionMode(main_func, spv::ExecutionMode::SignedZeroInfNanPreserve);
|
||||||
|
}
|
||||||
|
if (profile.support_fp32_signed_zero_nan_preserve) {
|
||||||
|
ctx.AddExecutionMode(main_func, spv::ExecutionMode::SignedZeroInfNanPreserve);
|
||||||
|
}
|
||||||
if (info.uses_fp32_denorms_flush && info.uses_fp32_denorms_preserve) {
|
if (info.uses_fp32_denorms_flush && info.uses_fp32_denorms_preserve) {
|
||||||
// LOG_ERROR(HW_GPU, "Fp32 denorm flush and preserve on the same shader");
|
// LOG_ERROR(HW_GPU, "Fp32 denorm flush and preserve on the same shader");
|
||||||
} else if (info.uses_fp32_denorms_flush) {
|
} else if (info.uses_fp32_denorms_flush) {
|
||||||
|
|
|
@ -15,6 +15,8 @@ struct Profile {
|
||||||
bool support_fp32_denorm_preserve{};
|
bool support_fp32_denorm_preserve{};
|
||||||
bool support_fp16_denorm_flush{};
|
bool support_fp16_denorm_flush{};
|
||||||
bool support_fp32_denorm_flush{};
|
bool support_fp32_denorm_flush{};
|
||||||
|
bool support_fp16_signed_zero_nan_preserve{};
|
||||||
|
bool support_fp32_signed_zero_nan_preserve{};
|
||||||
|
|
||||||
// FClamp is broken and OpFMax + OpFMin should be used instead
|
// FClamp is broken and OpFMax + OpFMin should be used instead
|
||||||
bool has_broken_spirv_clamp{};
|
bool has_broken_spirv_clamp{};
|
||||||
|
|
|
@ -193,6 +193,10 @@ ComputePipeline PipelineCache::CreateComputePipeline(ShaderInfo* shader_info) {
|
||||||
.support_fp32_denorm_preserve = float_control.shaderDenormPreserveFloat32 != VK_FALSE,
|
.support_fp32_denorm_preserve = float_control.shaderDenormPreserveFloat32 != VK_FALSE,
|
||||||
.support_fp16_denorm_flush = float_control.shaderDenormFlushToZeroFloat16 != VK_FALSE,
|
.support_fp16_denorm_flush = float_control.shaderDenormFlushToZeroFloat16 != VK_FALSE,
|
||||||
.support_fp32_denorm_flush = float_control.shaderDenormFlushToZeroFloat32 != VK_FALSE,
|
.support_fp32_denorm_flush = float_control.shaderDenormFlushToZeroFloat32 != VK_FALSE,
|
||||||
|
.support_fp16_signed_zero_nan_preserve =
|
||||||
|
float_control.shaderSignedZeroInfNanPreserveFloat16 != VK_FALSE,
|
||||||
|
.support_fp32_signed_zero_nan_preserve =
|
||||||
|
float_control.shaderSignedZeroInfNanPreserveFloat32 != VK_FALSE,
|
||||||
.has_broken_spirv_clamp = true, // TODO: is_intel
|
.has_broken_spirv_clamp = true, // TODO: is_intel
|
||||||
};
|
};
|
||||||
const auto [info, code]{Shader::RecompileSPIRV(profile, env, qmd.program_start)};
|
const auto [info, code]{Shader::RecompileSPIRV(profile, env, qmd.program_start)};
|
||||||
|
|
Reference in New Issue