1// RUN: mlir-opt -split-input-file -verify-diagnostics %s 2 3// expected-error@below {{attribute 'dlti.unknown' not supported by dialect}} 4"test.unknown_op"() { dlti.unknown } : () -> () 5 6// ----- 7 8// expected-error@below {{'dlti.dl_spec' is expected to be a #dlti.dl_spec attribute}} 9"test.unknown_op"() { dlti.dl_spec = 42 } : () -> () 10 11// ----- 12 13// expected-error@below {{invalid kind of attribute specified}} 14"test.unknown_op"() { dlti.dl_spec = #dlti.dl_spec<[]> } : () -> () 15 16// ----- 17 18// expected-error@below {{expected a type or a quoted string}} 19"test.unknown_op"() { test.unknown_attr = #dlti.dl_entry<42, 42> } : () -> () 20 21// ----- 22 23// expected-error@below {{repeated layout entry key: test.id}} 24"test.unknown_op"() { test.unknown_attr = #dlti.dl_spec< 25 #dlti.dl_entry<"test.id", 42>, 26 #dlti.dl_entry<"test.id", 43> 27>} : () -> () 28 29// ----- 30 31// expected-error@below {{repeated layout entry key: 'i32'}} 32"test.unknown_op"() { test.unknown_attr = #dlti.dl_spec< 33 #dlti.dl_entry<i32, 42>, 34 #dlti.dl_entry<i32, 42> 35>} : () -> () 36 37// ----- 38 39// expected-error@below {{unknown attrribute type: unknown}} 40"test.unknown_op"() { test.unknown_attr = #dlti.unknown } : () -> () 41 42// ----- 43 44// expected-error@below {{unknown data layout entry name: dlti.unknown_id}} 45"test.op_with_data_layout"() ({ 46}) { dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<"dlti.unknown_id", 42>> } : () -> () 47 48// ----- 49 50// expected-error@below {{'dlti.endianness' data layout entry is expected to be either 'big' or 'little'}} 51"test.op_with_data_layout"() ({ 52}) { dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<"dlti.endianness", "some">> } : () -> () 53 54// ----- 55 56// Mismatching entries don't combine. 57"test.op_with_data_layout"() ({ 58 // expected-error@below {{data layout does not combine with layouts of enclosing ops}} 59 // expected-note@above {{enclosing op with data layout}} 60 "test.op_with_data_layout"() { dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<"unknown.unknown", 32>> } : () -> () 61 "test.maybe_terminator_op"() : () -> () 62}) { dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<"unknown.unknown", 33>> } : () -> () 63 64// ----- 65 66// Layout not supported some built-in types. 67// expected-error@below {{unexpected data layout for a built-in type}} 68"test.op_with_data_layout"() { dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<tensor<f32>, 32>> } : () -> () 69 70// ----- 71 72// expected-error@below {{data layout specified for a type that does not support it}} 73"test.op_with_data_layout"() { dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<!test.test_type, 32>> } : () -> () 74 75// ----- 76 77// Mismatching entries are checked on module ops as well. 78module attributes { dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<"unknown.unknown", 33>>} { 79 // expected-error@below {{data layout does not combine with layouts of enclosing ops}} 80 // expected-note@above {{enclosing op with data layout}} 81 module attributes { dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<"unknown.unknown", 32>>} { 82 } 83} 84 85// ----- 86 87// Mismatching entries are checked on a combination of modules and other ops. 88module attributes { dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<"unknown.unknown", 33>>} { 89 // expected-error@below {{data layout does not combine with layouts of enclosing ops}} 90 // expected-note@above {{enclosing op with data layout}} 91 "test.op_with_data_layout"() { dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<"unknown.unknown", 32>>} : () -> () 92} 93