20
20
"TOSA-0.80+MI+8k" ,
21
21
"TOSA-0.80+BI+u55" ,
22
22
]
23
- test_valid_1_00_strings = [
24
- "TOSA-1.00.0+INT+FP+fft" ,
25
- "TOSA-1.00.0+FP+bf16+fft" ,
26
- "TOSA-1.00.0+INT+int4+cf" ,
27
- "TOSA-1.00.0+FP+cf+bf16+8k" ,
28
- "TOSA-1.00.0+FP+INT+bf16+fft+int4+cf" ,
29
- "TOSA-1.00.0+FP+INT+fft+int4+cf+8k" ,
23
+ test_valid_1_0_strings = [
24
+ "TOSA-1.0.0+INT+FP+fft" ,
25
+ "TOSA-1.0.0+FP+bf16+fft" ,
26
+ "TOSA-1.0.0+INT+int4+cf" ,
27
+ "TOSA-1.0.0+FP+cf+bf16+8k" ,
28
+ "TOSA-1.0.0+FP+INT+bf16+fft+int4+cf" ,
29
+ "TOSA-1.0.0+FP+INT+fft+int4+cf+8k" ,
30
+ "TOSA-1.0+INT+FP+fft" ,
31
+ "TOSA-1.0+FP+bf16+fft" ,
32
+ "TOSA-1.0+INT+int4+cf" ,
33
+ "TOSA-1.0+FP+cf+bf16+8k" ,
34
+ "TOSA-1.0+FP+INT+bf16+fft+int4+cf" ,
35
+ "TOSA-1.0+FP+INT+fft+int4+cf+8k" ,
30
36
]
31
37
32
- test_valid_1_00_extensions = {
38
+ test_valid_1_0_extensions = {
33
39
"INT" : ["int16" , "int4" , "var" , "cf" ],
34
40
"FP" : ["bf16" , "fp8e4m3" , "fp8e5m2" , "fft" , "var" , "cf" ],
35
41
}
40
46
"TOSA-0.80+8k" ,
41
47
"TOSA-0.80+BI+MI" ,
42
48
"TOSA-0.80+BI+U55" ,
43
- "TOSA-1.00 .0+fft" ,
44
- "TOSA-1.00 .0+fp+bf16+fft" ,
45
- "TOSA-1.00 .0+INT+INT4+cf" ,
46
- "TOSA-1.00 .0+BI" ,
47
- "TOSA-1.00 .0+FP+FP+INT" ,
48
- "TOSA-1.00 .0+FP+CF+bf16" ,
49
- "TOSA-1.00 .0+BF16+fft+int4+cf+INT" ,
49
+ "TOSA-1.0 .0+fft" ,
50
+ "TOSA-1.0 .0+fp+bf16+fft" ,
51
+ "TOSA-1.0 .0+INT+INT4+cf" ,
52
+ "TOSA-1.0 .0+BI" ,
53
+ "TOSA-1.0 .0+FP+FP+INT" ,
54
+ "TOSA-1.0 .0+FP+CF+bf16" ,
55
+ "TOSA-1.0 .0+BF16+fft+int4+cf+INT" ,
50
56
]
51
57
52
58
test_compile_specs = [
53
59
([CompileSpec ("tosa_version" , "TOSA-0.80+BI" .encode ())],),
54
60
([CompileSpec ("tosa_version" , "TOSA-0.80+BI+u55" .encode ())],),
55
- ([CompileSpec ("tosa_version" , "TOSA-1.00 .0+INT" .encode ())],),
61
+ ([CompileSpec ("tosa_version" , "TOSA-1.0 .0+INT" .encode ())],),
56
62
]
57
63
58
64
test_compile_specs_no_version = [
@@ -70,8 +76,8 @@ def test_version_string_0_80(self, version_string: str):
70
76
assert isinstance (tosa_spec , Tosa_0_80 )
71
77
assert tosa_spec .profile in ["BI" , "MI" ]
72
78
73
- @parameterized .expand (test_valid_1_00_strings ) # type: ignore[misc]
74
- def test_version_string_1_00 (self , version_string : str ):
79
+ @parameterized .expand (test_valid_1_0_strings ) # type: ignore[misc]
80
+ def test_version_string_1_0 (self , version_string : str ):
75
81
tosa_spec = TosaSpecification .create_from_string (version_string )
76
82
assert isinstance (tosa_spec , Tosa_1_00 )
77
83
assert [profile in ["INT" , "FP" ] for profile in tosa_spec .profiles ].count (
@@ -80,7 +86,7 @@ def test_version_string_1_00(self, version_string: str):
80
86
81
87
for profile in tosa_spec .profiles :
82
88
assert [
83
- e in test_valid_1_00_extensions [profile ] for e in tosa_spec .extensions
89
+ e in test_valid_1_0_extensions [profile ] for e in tosa_spec .extensions
84
90
]
85
91
86
92
@parameterized .expand (test_invalid_strings ) # type: ignore[misc]
@@ -103,3 +109,15 @@ def test_create_from_invalid_compilespec(self, compile_specs: list[CompileSpec])
103
109
tosa_spec = TosaSpecification .create_from_compilespecs (compile_specs )
104
110
105
111
assert tosa_spec is None
112
+
113
+ @parameterized .expand (test_valid_0_80_strings )
114
+ def test_correct_string_representation_0_80 (self , version_string : str ):
115
+ tosa_spec = TosaSpecification .create_from_string (version_string )
116
+ assert isinstance (tosa_spec , Tosa_0_80 )
117
+ assert f"{ tosa_spec } " == version_string
118
+
119
+ @parameterized .expand (test_valid_1_0_strings )
120
+ def test_correct_string_representation_1_0 (self , version_string : str ):
121
+ tosa_spec = TosaSpecification .create_from_string (version_string )
122
+ assert isinstance (tosa_spec , Tosa_1_00 )
123
+ assert f"{ tosa_spec } " == version_string
0 commit comments