Skip to content

[SPIR-V] pow hitting assert on half and float types for Vulkan target #7702

Closed

Description

@kmpeng

https://godbolt.org/z/58rf9n114

Discovered while running the offload-test-suite. This constant-folding case:

// RUN: %dxc -spirv -fspv-target-env=vulkan1.3 -enable-16bit-types -Gis -HV 202x -T cs_6_5 %s

StructuredBuffer<half4> X : register(t0);
StructuredBuffer<half4> Y : register(t1);

RWStructuredBuffer<half4> Out : register(u2);

[numthreads(1,1,1)]
void main() {
  Out[3] = pow(half4(2, 4, 1.5, 8), half4(3, 0.5, 2, 0.33333333));
}

is producing this error:

# .---command stderr------------
# | Internal compiler error: LLVM Assert
# `-----------------------------
# error: command failed with exit status: 0xe0000001
Error: assert((!HasStatus(inst) || Status(inst) != SSAPropagator::kNotInteresting) && "Unsettled value")
File:
/home/kaitlinpeng/DirectXShaderCompiler/external/SPIRV-Tools/source/opt/propagator.cpp(265)
Func:   operator()
Illegal instruction (core dumped)

The same error occurs when using float, though seems like that one only hits the assert when the -Gis flag is enabled.

Activity

  1. added
    bug
    needs-triage
    on Aug 15, 2025
  2. s-perron commented on Aug 19, 2025

    @s-perron
    Collaborator
  3. changed the title [-][SPIR-V] `pow` hitting assert on half types for Vulkan target[/-] [+][SPIR-V] `pow` hitting assert on half and float types for Vulkan target[/+] on Aug 20, 2025
  4. s-perron commented on Aug 21, 2025

    @s-perron
    Collaborator

    This look like a duplicate of another issue I assigned to you.

  5. bogner commented on Aug 25, 2025

    @bogner
    Collaborator

    FWIW this assert doesn't appear to trigger prior to #7693, so this is likely an issue with nan, inf, or signed zeros.

  6. s-perron commented on Aug 26, 2025

    @s-perron
    Collaborator

    I think that adding the capabilities is stopping the instruction folder from folding the instruction. It then goes through a different path in the constant propagation pass, and exposing the bug. There are two issues to fix:

    • We should not hit the assert then not folding.
    • We should be folding the instruction.
  7. luciechoi commented on Sep 3, 2025

    @luciechoi
    Collaborator

    The assertion error should be fixed by KhronosGroup/SPIRV-Tools#6287

    Created a separate issue for tracking -Gis folding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugspirv

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions