CharlesCNorton commited on
Commit ·
d7c41b6
1
Parent(s): ae83247
Increase float16 randomized test coverage
Browse filesRaise sample sizes for float16 arithmetic, conversion, unary, and pow tests.
eval.py
CHANGED
|
@@ -2616,8 +2616,8 @@ def test_float16_arithmetic(ctx: EvalContext) -> List[TestResult]:
|
|
| 2616 |
results = []
|
| 2617 |
|
| 2618 |
rng = random.Random(0xF00D)
|
| 2619 |
-
light_pairs = build_float16_pairs(rng,
|
| 2620 |
-
heavy_pairs = build_float16_pairs(rng,
|
| 2621 |
|
| 2622 |
# Addition - randomized evaluation
|
| 2623 |
if f"float16.add.exp_a_all_ones.weight" in ctx.tensors:
|
|
@@ -2756,7 +2756,7 @@ def test_float16_conversion(ctx: EvalContext) -> List[TestResult]:
|
|
| 2756 |
0x0400, 0x0001, 0x03FF, 0x3555, 0x3E00,
|
| 2757 |
]
|
| 2758 |
test_bits = list(edge_vals)
|
| 2759 |
-
while len(test_bits) <
|
| 2760 |
v = rng.getrandbits(16)
|
| 2761 |
if float16_is_nan_bits(v):
|
| 2762 |
continue
|
|
@@ -2796,7 +2796,7 @@ def test_float16_conversion(ctx: EvalContext) -> List[TestResult]:
|
|
| 2796 |
|
| 2797 |
edge_ints = [0, 1, -1, 2, -2, 100, -100, 32767, -32768]
|
| 2798 |
test_vals = list(edge_ints)
|
| 2799 |
-
while len(test_vals) <
|
| 2800 |
test_vals.append(rng.randint(-32768, 32767))
|
| 2801 |
|
| 2802 |
for val in test_vals:
|
|
@@ -2825,7 +2825,7 @@ def test_float16_unary(ctx: EvalContext) -> List[TestResult]:
|
|
| 2825 |
results: List[TestResult] = []
|
| 2826 |
|
| 2827 |
rng = random.Random(1337)
|
| 2828 |
-
values = build_float16_values(rng,
|
| 2829 |
|
| 2830 |
ops = [
|
| 2831 |
("float16.sqrt", "sqrt"),
|
|
@@ -2990,7 +2990,7 @@ def test_float16_pow(ctx: EvalContext) -> List[TestResult]:
|
|
| 2990 |
return results
|
| 2991 |
|
| 2992 |
rng = random.Random(1337)
|
| 2993 |
-
pairs = build_float16_pairs(rng,
|
| 2994 |
mul_prefix = "float16.pow.mul"
|
| 2995 |
mul_gates = sorted([g for g in ctx.gates if g.startswith(mul_prefix + ".")])
|
| 2996 |
|
|
|
|
| 2616 |
results = []
|
| 2617 |
|
| 2618 |
rng = random.Random(0xF00D)
|
| 2619 |
+
light_pairs = build_float16_pairs(rng, 2048)
|
| 2620 |
+
heavy_pairs = build_float16_pairs(rng, 1024)
|
| 2621 |
|
| 2622 |
# Addition - randomized evaluation
|
| 2623 |
if f"float16.add.exp_a_all_ones.weight" in ctx.tensors:
|
|
|
|
| 2756 |
0x0400, 0x0001, 0x03FF, 0x3555, 0x3E00,
|
| 2757 |
]
|
| 2758 |
test_bits = list(edge_vals)
|
| 2759 |
+
while len(test_bits) < 1024:
|
| 2760 |
v = rng.getrandbits(16)
|
| 2761 |
if float16_is_nan_bits(v):
|
| 2762 |
continue
|
|
|
|
| 2796 |
|
| 2797 |
edge_ints = [0, 1, -1, 2, -2, 100, -100, 32767, -32768]
|
| 2798 |
test_vals = list(edge_ints)
|
| 2799 |
+
while len(test_vals) < 1024:
|
| 2800 |
test_vals.append(rng.randint(-32768, 32767))
|
| 2801 |
|
| 2802 |
for val in test_vals:
|
|
|
|
| 2825 |
results: List[TestResult] = []
|
| 2826 |
|
| 2827 |
rng = random.Random(1337)
|
| 2828 |
+
values = build_float16_values(rng, 1024)
|
| 2829 |
|
| 2830 |
ops = [
|
| 2831 |
("float16.sqrt", "sqrt"),
|
|
|
|
| 2990 |
return results
|
| 2991 |
|
| 2992 |
rng = random.Random(1337)
|
| 2993 |
+
pairs = build_float16_pairs(rng, 512)
|
| 2994 |
mul_prefix = "float16.pow.mul"
|
| 2995 |
mul_gates = sorted([g for g in ctx.gates if g.startswith(mul_prefix + ".")])
|
| 2996 |
|