KhronosGroup / KhronosGroup/SPIRV-Registry

Clarification: DenormFlushToZero sign preservation

Open
#430 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
149
Forks
99
Avg merge
4d 21h
Merged PRs (30d)
2

Description

[SPV_KHR_float_controls](https://github.khronos.org/SPIRV-Registry/extensions/KHR/SPV_KHR_float_controls.html) does not specify if denorms that are flushed to zero preserve their sign bit or always flush to positive zero.

There is a discussion on the LLVM forums about how to map LLVM's float modes correctly to SPIRV:
https://discourse.llvm.org/t/rfc-hlsl-spirv-denormal-handling-executionmode-emission-in-clang-dxc/91143/3

We're currently intending to use sign-preserving flush-to-zero in the compiler to map to DenormFlushToZero. If a backend instead uses positive zero, this could cause subtle behavior differences when code is constant-evaluated in the frontend vs the backend.

Contributor guide

No contributing guide indexed for this repository

Research direction

Read the SPV_KHR_float_controls specification and the linked LLVM forum discussion first, focusing on DenormFlushToZero and sign handling for flushed denorms. Determine the intended behavior and update the specification so the sign-preservation rule is explicit and consistent with the compiler mapping concerns described in the issue.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.