1 // RUN: mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics %s | FileCheck %s
3 // Combine modules without the same symbols
6 // CHECK-NEXT: spirv.module Logical GLSL450 {
7 // CHECK-NEXT: spirv.SpecConstant @m1_sc
8 // CHECK-NEXT: spirv.GlobalVariable @m1_gv bind(1, 0)
9 // CHECK-NEXT: spirv.func @no_op
10 // CHECK-NEXT: spirv.Return
12 // CHECK-NEXT: spirv.EntryPoint "GLCompute" @no_op
13 // CHECK-NEXT: spirv.ExecutionMode @no_op "LocalSize", 32, 1, 1
15 // CHECK-NEXT: spirv.SpecConstant @m2_sc
16 // CHECK-NEXT: spirv.GlobalVariable @m2_gv bind(0, 1)
17 // CHECK-NEXT: spirv.func @variable_init_spec_constant
18 // CHECK-NEXT: spirv.mlir.referenceof @m2_sc
19 // CHECK-NEXT: spirv.Variable init
20 // CHECK-NEXT: spirv.Return
26 spirv.module Logical GLSL450 {
27 spirv.SpecConstant @m1_sc = 42.42 : f32
28 spirv.GlobalVariable @m1_gv bind(1, 0): !spirv.ptr<f32, Input>
29 spirv.func @no_op() -> () "None" {
32 spirv.EntryPoint "GLCompute" @no_op
33 spirv.ExecutionMode @no_op "LocalSize", 32, 1, 1
36 spirv.module Logical GLSL450 {
37 spirv.SpecConstant @m2_sc = 42 : i32
38 spirv.GlobalVariable @m2_gv bind(0, 1): !spirv.ptr<f32, Input>
39 spirv.func @variable_init_spec_constant() -> () "None" {
40 %0 = spirv.mlir.referenceof @m2_sc : i32
41 %1 = spirv.Variable init(%0) : !spirv.ptr<i32, Function>
50 spirv.module Physical64 GLSL450 {
53 // expected-error @+1 {{input modules differ in addressing model, memory model, and/or VCE triple}}
54 spirv.module Logical GLSL450 {
61 spirv.module Logical Simple {
64 // expected-error @+1 {{input modules differ in addressing model, memory model, and/or VCE triple}}
65 spirv.module Logical GLSL450 {
72 spirv.module Logical GLSL450 {
75 // expected-error @+1 {{input modules differ in addressing model, memory model, and/or VCE triple}}
76 spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader], [SPV_KHR_storage_buffer_storage_class]> {
82 // No spir-v modules to combine.
84 func.func @foo(%arg0: i32) -> i32 {