Skip to content

Conversation

YixingZhang007
Copy link
Contributor

@YixingZhang007 YixingZhang007 commented Sep 11, 2025

This PR resolves the current failure in the integer-casts.ll SPIR-V test during CI runs in llvm-project.
The failure occurs because the SPIR-V instruction OpQuantizeToF16 requires the Capability::Shader. However, the function in integer-casts.ll is written as a kernel function and executed in a kernel environment. Therefore, Capability::Kernel is emitted instead of Capability::Shader. To fix this, we remove the QuantizeToF16 test frominteger-casts.ll in this PR.

@YixingZhang007 YixingZhang007 marked this pull request as draft September 11, 2025 14:20
@llvmbot
Copy link
Member

llvmbot commented Sep 11, 2025

@llvm/pr-subscribers-backend-spir-v

Author: None (YixingZhang007)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/158086.diff

1 Files Affected:

  • (modified) llvm/test/CodeGen/SPIRV/instructions/integer-casts.ll (-3)
diff --git a/llvm/test/CodeGen/SPIRV/instructions/integer-casts.ll b/llvm/test/CodeGen/SPIRV/instructions/integer-casts.ll
index 6a4b4f593bf3b..667c8adfdba4b 100644
--- a/llvm/test/CodeGen/SPIRV/instructions/integer-casts.ll
+++ b/llvm/test/CodeGen/SPIRV/instructions/integer-casts.ll
@@ -258,7 +258,6 @@ define <4 x i32>  @u16tou32v4(<4 x i16> %a) {
 ; CHECK: %[[#]] = OpUConvert [[U32]] %[[#]]
 ; CHECK: %[[#]] = OpSConvert [[U32]] %[[#]]
 ; CHECK: %[[#]] = OpFConvert [[F16]] %[[#]]
-; CHECK: %[[#]] = OpQuantizeToF16 [[F32]] %[[#]]
 ; CHECK: %[[#]] = OpSatConvertSToU [[U64]] %[[#]]
 ; CHECK: %[[#]] = OpSatConvertUToS [[U64]] %[[#]]
 ; CHECK: %[[#]] = OpConvertPtrToU [[U64]] [[Arg1]]
@@ -281,7 +280,6 @@ define dso_local spir_kernel void @test_wrappers(ptr addrspace(4) %arg, i64 %arg
   %r5 = call spir_func i32 @__spirv_UConvert(i64 1)
   %r6 = call spir_func i32 @__spirv_SConvert(i64 1)
   %r7 = call spir_func half @__spirv_FConvert(float 0.000000e+00)
-  %r8 = call spir_func float @__spirv_QuantizeToF16(float 0.000000e+00)
   %r9 = call spir_func i64 @__spirv_SatConvertSToU(i64 1)
   %r10 = call spir_func i64 @__spirv_SatConvertUToS(i64 1)
   %r11 = call spir_func i64 @__spirv_ConvertPtrToU(ptr addrspace(4) %arg)
@@ -305,7 +303,6 @@ declare dso_local spir_func float @__spirv_ConvertUToF(i32)
 declare dso_local spir_func i32 @__spirv_UConvert(i64)
 declare dso_local spir_func i32 @__spirv_SConvert(i64)
 declare dso_local spir_func half @__spirv_FConvert(float)
-declare dso_local spir_func float @__spirv_QuantizeToF16(float)
 declare dso_local spir_func i64 @__spirv_SatConvertSToU(i64)
 declare dso_local spir_func i64 @__spirv_SatConvertUToS(i64)
 declare dso_local spir_func i64 @__spirv_ConvertPtrToU(ptr addrspace(4))

@YixingZhang007
Copy link
Contributor Author

After this change, we no longer have test coverage for QuantizeToF16, since there is not yet sufficient support for running it in a Shader environment. Tests for QuantizeToF16 will be added once Shader support for this feature is implemented.

@YixingZhang007 YixingZhang007 force-pushed the solve_integer_cast_test_failure branch from 7a3ffff to a5046dc Compare September 12, 2025 16:10
@YixingZhang007 YixingZhang007 marked this pull request as ready for review September 12, 2025 21:17
@YixingZhang007 YixingZhang007 force-pushed the solve_integer_cast_test_failure branch from ce5642c to ae9c07a Compare September 15, 2025 13:16
Copy link
Contributor

@maarquitos14 maarquitos14 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Can we spin off the OpQuantizeToF16 test to a new test and mark as xfail/unsupported, so we don't reduce test coverage?

@YixingZhang007
Copy link
Contributor Author

LGTM. Can we spin off the OpQuantizeToF16 test to a new test and mark as xfail/unsupported, so we don't reduce test coverage?

Thanks for the suggestion! I have added the test for OpQuantizeToF16 in quantizeto16.ll and marked it as XFAIL.

@maarquitos14 maarquitos14 merged commit ab645f1 into llvm:main Sep 30, 2025
10 checks passed
mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Oct 3, 2025
This PR resolves the current failure in the `integer-casts.ll` SPIR-V
test during CI runs in `llvm-project`.
The failure occurs because the SPIR-V instruction `OpQuantizeToF16`
requires the `Capability::Shader`. However, the function in
`integer-casts.ll` is written as a kernel function and executed in a
kernel environment. Therefore, `Capability::Kernel` is emitted instead
of `Capability::Shader`. To fix this, we remove the `QuantizeToF16` test
from`integer-casts.ll` in this PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants