1// RUN: mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics %s | FileCheck %s 2 3// Combine modules without the same symbols 4 5// CHECK: module { 6// CHECK-NEXT: spv.module Logical GLSL450 { 7// CHECK-NEXT: spv.SpecConstant @m1_sc 8// CHECK-NEXT: spv.GlobalVariable @m1_gv bind(1, 0) 9// CHECK-NEXT: spv.func @no_op 10// CHECK-NEXT: spv.Return 11// CHECK-NEXT: } 12// CHECK-NEXT: spv.EntryPoint "GLCompute" @no_op 13// CHECK-NEXT: spv.ExecutionMode @no_op "LocalSize", 32, 1, 1 14 15// CHECK-NEXT: spv.SpecConstant @m2_sc 16// CHECK-NEXT: spv.GlobalVariable @m2_gv bind(0, 1) 17// CHECK-NEXT: spv.func @variable_init_spec_constant 18// CHECK-NEXT: spv.mlir.referenceof @m2_sc 19// CHECK-NEXT: spv.Variable init 20// CHECK-NEXT: spv.Return 21// CHECK-NEXT: } 22// CHECK-NEXT: } 23// CHECK-NEXT: } 24 25module { 26spv.module Logical GLSL450 { 27 spv.SpecConstant @m1_sc = 42.42 : f32 28 spv.GlobalVariable @m1_gv bind(1, 0): !spv.ptr<f32, Input> 29 spv.func @no_op() -> () "None" { 30 spv.Return 31 } 32 spv.EntryPoint "GLCompute" @no_op 33 spv.ExecutionMode @no_op "LocalSize", 32, 1, 1 34} 35 36spv.module Logical GLSL450 { 37 spv.SpecConstant @m2_sc = 42 : i32 38 spv.GlobalVariable @m2_gv bind(0, 1): !spv.ptr<f32, Input> 39 spv.func @variable_init_spec_constant() -> () "None" { 40 %0 = spv.mlir.referenceof @m2_sc : i32 41 %1 = spv.Variable init(%0) : !spv.ptr<i32, Function> 42 spv.Return 43 } 44} 45} 46 47// ----- 48 49module { 50spv.module Physical64 GLSL450 { 51} 52 53// expected-error @+1 {{input modules differ in addressing model, memory model, and/or VCE triple}} 54spv.module Logical GLSL450 { 55} 56} 57 58// ----- 59 60module { 61spv.module Logical Simple { 62} 63 64// expected-error @+1 {{input modules differ in addressing model, memory model, and/or VCE triple}} 65spv.module Logical GLSL450 { 66} 67} 68 69// ----- 70 71module { 72spv.module Logical GLSL450 { 73} 74 75// expected-error @+1 {{input modules differ in addressing model, memory model, and/or VCE triple}} 76spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], [SPV_KHR_storage_buffer_storage_class]> { 77} 78} 79 80