brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.2 KiB · 9a1f49b Raw
76 lines · plain
1// REQUIRES: target=x86{{.*}}2 3// RUN: mlir-opt -transform-interpreter -split-input-file %s --verify-diagnostics4 5// Check that processor features, like AVX, are appropriated derived and queryable.6 7// expected-remark @+2 {{attr associated to ["features", "+avx"] = unit}}8// expected-remark @below {{attr associated to ["features", "avx"] = true}}9module attributes { llvm.target = #llvm.target<triple = "x86_64-unknown-linux",10                                               chip = "skylake">,11                    test.dl_spec = #dlti.dl_spec<index = 32> } {12  func.func private @f()13}14 15module attributes {transform.with_named_sequence} {16  transform.named_sequence @__transform_main(%arg: !transform.any_op) {17    %funcs = transform.structured.match ops{["func.func"]} in %arg : (!transform.any_op) -> !transform.any_op18    %module = transform.get_parent_op %funcs : (!transform.any_op) -> !transform.any_op19    %mod = transform.apply_registered_pass "llvm-target-to-target-features" to %module : (!transform.any_op) -> !transform.any_op20    %plus_avx = transform.dlti.query ["features", "+avx"] at %mod : (!transform.any_op) -> !transform.any_param21    transform.debug.emit_param_as_remark %plus_avx, "attr associated to [\"features\", \"+avx\"] =" at %mod : !transform.any_param, !transform.any_op22    %avx = transform.dlti.query ["features", "avx"] at %mod : (!transform.any_op) -> !transform.any_param23    transform.debug.emit_param_as_remark %avx, "attr associated to [\"features\", \"avx\"] =" at %mod : !transform.any_param, !transform.any_op24    transform.yield25  }26}27 28// -----29 30// Check that newer processor features, like AMX, are appropriated derived and queryable.31 32// expected-remark @+2 {{attr associated to ["features", "+amx-bf16"] = unit}}33// expected-remark @below {{attr associated to ["features", "amx-bf16"] = true}}34module attributes { llvm.target = #llvm.target<triple = "x86_64-unknown-linux",35                                               chip = "sapphirerapids">,36                    test.dl_spec = #dlti.dl_spec<index = 32> } {37  func.func private @f()38}39 40module attributes {transform.with_named_sequence} {41  transform.named_sequence @__transform_main(%arg: !transform.any_op) {42    %funcs = transform.structured.match ops{["func.func"]} in %arg : (!transform.any_op) -> !transform.any_op43    %module = transform.get_parent_op %funcs : (!transform.any_op) -> !transform.any_op44    %mod = transform.apply_registered_pass "llvm-target-to-target-features" to %module : (!transform.any_op) -> !transform.any_op45    %plus_avx = transform.dlti.query ["features", "+amx-bf16"] at %mod : (!transform.any_op) -> !transform.any_param46    transform.debug.emit_param_as_remark %plus_avx, "attr associated to [\"features\", \"+amx-bf16\"] =" at %mod : !transform.any_param, !transform.any_op47    %avx = transform.dlti.query ["features", "amx-bf16"] at %mod : (!transform.any_op) -> !transform.any_param48    transform.debug.emit_param_as_remark %avx, "attr associated to [\"features\", \"amx-bf16\"] =" at %mod : !transform.any_param, !transform.any_op49    transform.yield50  }51}52 53// -----54 55// Check that features that a processor does not have, AMX in this case,56// aren't derived and hence that querying for them will fail.57 58// expected-error @+2 {{target op of failed DLTI query}}59// expected-note @below {{key "+amx-bf16" has no DLTI-mapping per attr: #llvm.target_features}}60module attributes { llvm.target = #llvm.target<triple = "x86_64-unknown-linux",61                                               chip = "skylake">,62                    test.dl_spec = #dlti.dl_spec<index = 32> } {63  func.func private @f()64}65 66module attributes {transform.with_named_sequence} {67  transform.named_sequence @__transform_main(%arg: !transform.any_op) {68    %funcs = transform.structured.match ops{["func.func"]} in %arg : (!transform.any_op) -> !transform.any_op69    %module = transform.get_parent_op %funcs : (!transform.any_op) -> !transform.any_op70    %mod = transform.apply_registered_pass "llvm-target-to-target-features" to %module : (!transform.any_op) -> !transform.any_op71    // expected-error @below {{'transform.dlti.query' op failed to apply}}72    %param = transform.dlti.query ["features", "+amx-bf16"] at %mod : (!transform.any_op) -> !transform.any_param73    transform.yield74  }75}76