Skip to content

Commit b3e91bf

Browse files
committed
Update DLTI tests
1 parent 36c3ba4 commit b3e91bf

File tree

1 file changed

+30
-4
lines changed

1 file changed

+30
-4
lines changed

mlir/test/Target/LLVMIR/target-to-target-features-dlti-query.mlir

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// REQUIRES: target=x86{{.*}}
22

3-
// RUN: mlir-opt -transform-interpreter -split-input-file %s | FileCheck %s
3+
// RUN: mlir-opt -transform-interpreter -split-input-file %s --verify-diagnostics
44

55
// Check that processor features, like AVX, are appropriated derived and queryable.
66

@@ -25,13 +25,39 @@ module attributes {transform.with_named_sequence} {
2525
}
2626
}
2727

28+
29+
// -----
30+
31+
// Check that newer processor features, like AMX, are appropriated derived and queryable.
32+
33+
// expected-remark @+2 {{attr associated to ["features", "+amx-bf16"] = unit}}
34+
// expected-remark @below {{attr associated to ["features", "amx-bf16"] = true}}
35+
module attributes { llvm.target = #llvm.target<triple = "x86_64-unknown-linux",
36+
chip = "sapphirerapids">,
37+
test.dl_spec = #dlti.dl_spec<index = 32> } {
38+
func.func private @f()
39+
}
40+
41+
module attributes {transform.with_named_sequence} {
42+
transform.named_sequence @__transform_main(%arg: !transform.any_op) {
43+
%funcs = transform.structured.match ops{["func.func"]} in %arg : (!transform.any_op) -> !transform.any_op
44+
%module = transform.get_parent_op %funcs : (!transform.any_op) -> !transform.any_op
45+
%mod = transform.apply_registered_pass "llvm-target-to-target-features" to %module : (!transform.any_op) -> !transform.any_op
46+
%plus_avx = transform.dlti.query ["features", "+amx-bf16"] at %mod : (!transform.any_op) -> !transform.any_param
47+
transform.debug.emit_param_as_remark %plus_avx, "attr associated to [\"features\", \"+amx-bf16\"] =" at %mod : !transform.any_param, !transform.any_op
48+
%avx = transform.dlti.query ["features", "amx-bf16"] at %mod : (!transform.any_op) -> !transform.any_param
49+
transform.debug.emit_param_as_remark %avx, "attr associated to [\"features\", \"amx-bf16\"] =" at %mod : !transform.any_param, !transform.any_op
50+
transform.yield
51+
}
52+
}
53+
2854
// -----
2955

30-
// Check that features that a processor does not have, AVX512f in this case,
56+
// Check that features that a processor does not have, AMX in this case,
3157
// aren't derived and hence that querying for them will fail.
3258

3359
// expected-error @+2 {{target op of failed DLTI query}}
34-
// expected-note @below {{key "+avx512f" has no DLTI-mapping per attr: #llvm.target_features<[}}
60+
// expected-note @below {{key "+amx-bf16" has no DLTI-mapping per attr: #llvm.target_features}}
3561
module attributes { llvm.target = #llvm.target<triple = "x86_64-unknown-linux",
3662
chip = "skylake">,
3763
test.dl_spec = #dlti.dl_spec<index = 32> } {
@@ -44,7 +70,7 @@ module attributes {transform.with_named_sequence} {
4470
%module = transform.get_parent_op %funcs : (!transform.any_op) -> !transform.any_op
4571
%mod = transform.apply_registered_pass "llvm-target-to-target-features" to %module : (!transform.any_op) -> !transform.any_op
4672
// expected-error @below {{'transform.dlti.query' op failed to apply}}
47-
%param = transform.dlti.query ["features", "+avx512f"] at %mod : (!transform.any_op) -> !transform.any_param
73+
%param = transform.dlti.query ["features", "+amx-bf16"] at %mod : (!transform.any_op) -> !transform.any_param
4874
transform.yield
4975
}
5076
}

0 commit comments

Comments
 (0)