[llvm] [SPIR-V] Fix image query and sampler type (PR #190767)
Arseniy Obolenskiy via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 13 11:57:47 PDT 2026
================
@@ -1,11 +1,12 @@
; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
+; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
; CHECK-SPIRV-DAG: %[[#RetID:]] = OpImageSampleExplicitLod %[[#RetType:]] %[[#]] %[[#]] Lod %[[#]]
; CHECK-SPIRV-DAG: %[[#RetType]] = OpTypeVector %[[#]] 4
; CHECK-SPIRV: %[[#]] = OpCompositeExtract %[[#]] %[[#RetID]] 0
-define spir_kernel void @sample_kernel(target("spirv.Image", void, 1, 1, 0, 0, 0, 0, 0) %input, i32 %imageSampler, ptr addrspace(1) %xOffsets, ptr addrspace(1) %yOffsets, ptr addrspace(1) %results) {
+define spir_kernel void @sample_kernel(target("spirv.Image", void, 1, 1, 0, 0, 0, 0, 0) %input, target("spirv.Sampler") %imageSampler, ptr addrspace(1) %xOffsets, ptr addrspace(1) %yOffsets, ptr addrspace(1) %results) {
----------------
aobolensk wrote:
That seems legit, because:
> A variable of sampler_t type declared in the program source must be initialized with a 32-bit unsigned integer constant
https://registry.khronos.org/OpenCL/sdk/3.0/docs/man/html/samplers.html
https://github.com/llvm/llvm-project/pull/190767
More information about the llvm-commits
mailing list