brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.9 KiB · 506b81e Raw
71 lines · plain
1// RUN: mlir-opt %s -split-input-file -verify-diagnostics2 3// Test invalid target architecture (sm_100 instead of sm_100a)4gpu.module @invalid_arch_sm_100 [#nvvm.target<chip = "sm_100">] {5  func.func @convert_rs(%src : vector<4xf32>, %rbits : i32) {6    // expected-error@+1 {{'nvvm.convert.f32x4.to.f8x4' op is not supported on sm_100}}7    %res = nvvm.convert.f32x4.to.f8x4 %src, %rbits : vector<4xf32> -> vector<4xi8> (f8E4M3FN)8    return9  }10}11 12// -----13 14// Test invalid destination types for f8x4 (should only accept f8E4M3FN, f8E5M2)15llvm.func @invalid_dst_type_f8x4_e3m4(%src : vector<4xf32>, %rbits : i32) -> vector<4xi8> {16  // expected-error@+1 {{Only 'f8E4M3FN' and 'f8E5M2' types are supported for conversions from f32x4 to f8x4.}}17  %res = nvvm.convert.f32x4.to.f8x4 %src, %rbits : vector<4xf32> -> vector<4xi8> (f8E3M4)18  llvm.return %res : vector<4xi8>19}20 21// -----22 23llvm.func @invalid_dst_type_f8x4_e8m0(%src : vector<4xf32>, %rbits : i32) -> vector<4xi8> {24  // expected-error@+1 {{Only 'f8E4M3FN' and 'f8E5M2' types are supported for conversions from f32x4 to f8x4.}}25  %res = nvvm.convert.f32x4.to.f8x4 %src, %rbits : vector<4xf32> -> vector<4xi8> (f8E8M0FNU)26  llvm.return %res : vector<4xi8>27}28 29// -----30 31// Test invalid destination types for f6x4 (should only accept f6E2M3FN, f6E3M2FN)32llvm.func @invalid_dst_type_f6x4_f8(%src : vector<4xf32>, %rbits : i32) -> vector<4xi8> {33  // expected-error@+1 {{Only 'f6E2M3FN' and 'f6E3M2FN' types are supported for conversions from f32x4 to f6x4.}}34  %res = nvvm.convert.f32x4.to.f6x4 %src, %rbits : vector<4xf32> -> vector<4xi8> (f8E4M3FN)35  llvm.return %res : vector<4xi8>36}37 38// -----39 40// Test invalid destination type for f4x4 (should only accept f4E2M1FN)41llvm.func @invalid_dst_type_f4x4_f6(%src : vector<4xf32>, %rbits : i32) -> i16 {42  // expected-error@+1 {{Only 'f4E2M1FN' type is supported for conversions from f32x4 to f4x4.}}43  %res = nvvm.convert.f32x4.to.f4x4 %src, %rbits : vector<4xf32> -> i16 (f6E2M3FN)44  llvm.return %res : i1645}46 47// -----48 49// Test invalid rounding modes for non-stochastic ops50llvm.func @convert_float_to_tf32_rs_not_supported(%src : f32) -> i32 {51  // expected-error @below {{Only {rn,rz,rna} rounding modes supported for ConvertFloatToTF32Op.}}52  %res = nvvm.convert.float.to.tf32 %src {rnd = #nvvm.fp_rnd_mode<rs>}53  llvm.return %res : i3254}55 56// -----57 58llvm.func @convert_f32x2_to_f8x2_rs_not_supported(%a : f32, %b : f32) {59  // expected-error @below {{Only RN rounding mode is supported for conversions from f32x2 to 'f8E4M3FN' and 'f8E5M2' types}}60  %res = nvvm.convert.f32x2.to.f8x2 %a, %b {rnd = #nvvm.fp_rnd_mode<rs>, sat = #nvvm.sat_mode<satfinite>} : i16 (f8E4M3FN)61  llvm.return62}63 64// -----65 66llvm.func @convert_bf16x2_to_f8x2_rs_not_supported(%src : vector<2xbf16>) {67  // expected-error @below {{Only RZ and RP rounding modes are supported for conversions from bf16x2 to f8x2.}}68  %res = nvvm.convert.bf16x2.to.f8x2 %src {rnd = #nvvm.fp_rnd_mode<rs>} : vector<2xbf16> -> i16 (f8E8M0FNU)69  llvm.return70}71