[all-commits] [llvm/llvm-project] bcfd6d: [mlir][spirv] Enable validation of global vars tes...

Igor Wodiany via All-commits all-commits at lists.llvm.org
Mon Oct 27 02:28:11 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bcfd6da5dbb3c6bb0c598de7f9bbbae4c42f6ba9
      https://github.com/llvm/llvm-project/commit/bcfd6da5dbb3c6bb0c598de7f9bbbae4c42f6ba9
  Author: Igor Wodiany <igor.wodiany at imgtec.com>
  Date:   2025-10-27 (Mon, 27 Oct 2025)

  Changed paths:
    M mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
    M mlir/test/Dialect/SPIRV/IR/structure-ops.mlir
    M mlir/test/Target/SPIRV/global-variable.mlir

  Log Message:
  -----------
  [mlir][spirv] Enable validation of global vars tests (#164974)

Currently the target test will fail with:

```
error: line 12: Initializer type must match the data type
  %var2 = OpVariable %_ptr_Uniform_float Uniform %var1
```

When passed:

```mlir
spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader], []> {
  spirv.GlobalVariable @var1 : !spirv.ptr<f32, Uniform>
  spirv.GlobalVariable @var2 initializer(@var1) bind(1, 0) : !spirv.ptr<f32, Uniform>
}
```

The problem is that we try to initialize `f32` pointer with `f32`
pointer, but the validator fails because it expects `var1` to be `f32`,
not a pointer to `f32`. `spirv.GlobalVariable` only allows pointer type,
so in the current design we cannot initialize one `spirv.GlobalVariable`
with another.

So, for now we disallow initialization of one global variable with
another. In the future we may want to re-work global variables if we
want to support that.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list