From d581afd8736e50afb6028e33e38865f503085236 Mon Sep 17 00:00:00 2001 From: Ignacio Sica Date: Tue, 11 Feb 2025 21:11:14 -0300 Subject: [PATCH 1/2] skipdata capstone (#9026) --- tinygrad/helpers.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tinygrad/helpers.py b/tinygrad/helpers.py index c920c54684e18..57e4b3b71d514 100644 --- a/tinygrad/helpers.py +++ b/tinygrad/helpers.py @@ -277,6 +277,7 @@ def capstone_flatdump(lib: bytes): case 'x86_64' | 'AMD64': cs = capstone.Cs(capstone.CS_ARCH_X86, capstone.CS_MODE_64) case 'aarch64' | 'arm64': cs = capstone.Cs(capstone.CS_ARCH_ARM64, capstone.CS_MODE_ARM) case machine: raise NotImplementedError(f"Capstone disassembly isn't supported for {machine}") + cs.skipdata = True for instr in cs.disasm(lib, 0): print(f"{instr.address:#08x}: {instr.mnemonic}\t{instr.op_str}") sys.stdout.flush() From 0c97c108146e167d7a1d2ce1476852ff483dbee4 Mon Sep 17 00:00:00 2001 From: Josh Moore Date: Wed, 12 Feb 2025 01:49:18 -0500 Subject: [PATCH 2/2] TestOps: silence pytorch std()/var() degrees of freedom warnings (#9034) --- test/test_ops.py | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/test/test_ops.py b/test/test_ops.py index 759b739119064..03b89dadc740c 100644 --- a/test/test_ops.py +++ b/test/test_ops.py @@ -2,13 +2,13 @@ import numpy as np from typing import List, Callable import torch +import warnings from tinygrad.helpers import getenv, IMAGE, DEBUG, CI, Context, TRANSCENDENTAL from tinygrad import Tensor, Device, dtypes from tinygrad.tensor import _to_np_dtype from tinygrad.device import is_dtype_supported if CI: - import warnings warnings.filterwarnings("ignore", message="Non-empty compiler output encountered") FORWARD_ONLY = getenv("FORWARD_ONLY", 0) @@ -1275,18 +1275,22 @@ def test_var_axis(self): helper_test_op([(15, 25, 35)], lambda x: x.var(2, correction=0)) helper_test_op([(15, 25, 35)], lambda x: x.var([1, 2], correction=0)) def test_var_zero_in_axis(self): - helper_test_op([(1,0,3,0,5)], lambda x: x.var(axis=(1,3))) - helper_test_op([(1,0,3,0,5)], lambda x: x.var(axis=(1,3), correction=0)) - helper_test_op([(1,0,3,0,5)], lambda x: x.var(axis=(1,3), correction=5)) + with warnings.catch_warnings(): + warnings.filterwarnings("ignore", message="var\\(\\): degrees of freedom is <= 0") + helper_test_op([(1,0,3,0,5)], lambda x: x.var(axis=(1,3))) + helper_test_op([(1,0,3,0,5)], lambda x: x.var(axis=(1,3), correction=0)) + helper_test_op([(1,0,3,0,5)], lambda x: x.var(axis=(1,3), correction=5)) def test_var_one_in_axis(self): + with warnings.catch_warnings(): + warnings.filterwarnings("ignore", message="var\\(\\): degrees of freedom is <= 0") + helper_test_op([(1,2,3,1,5)], lambda x: x.var(axis=(0,3))) + helper_test_op([(1,2,3,1,5)], lambda x: x.var(axis=(0,3), correction=5)) + # TODO: fix backward + helper_test_op([(1,2,3,1,5)], lambda x: x.var(axis=(0,4), correction=5), forward_only=True) helper_test_op([(1,)], lambda x: x.var(axis=(0,), correction=0)) - helper_test_op([(1,2,3,1,5)], lambda x: x.var(axis=(0,3))) helper_test_op([(1,2,3,1,5)], lambda x: x.var(axis=(0,3), correction=0)) - helper_test_op([(1,2,3,1,5)], lambda x: x.var(axis=(0,3), correction=5)) helper_test_op([(1,2,3,1,5)], lambda x: x.var(axis=(0,4))) helper_test_op([(1,2,3,1,5)], lambda x: x.var(axis=(0,4), correction=0)) - # TODO: fix backward - helper_test_op([(1,2,3,1,5)], lambda x: x.var(axis=(0,4), correction=5), forward_only=True) def test_var_keepdim(self): helper_test_op([(15, 25, 35)], lambda x: x.var(keepdim=True)) helper_test_op([(15, 25, 35)], lambda x: x.var(0, keepdim=True, correction=0)) @@ -1303,18 +1307,22 @@ def test_std_axis(self): helper_test_op([(15, 25, 35)], lambda x: x.std(2, correction=0)) helper_test_op([(15, 25, 35)], lambda x: x.std([1, 2], correction=0)) def test_std_zero_in_axis(self): - helper_test_op([(1,0,3,0,5)], lambda x: x.std(axis=(1,3))) - helper_test_op([(1,0,3,0,5)], lambda x: x.std(axis=(1,3), correction=0)) - helper_test_op([(1,0,3,0,5)], lambda x: x.std(axis=(1,3), correction=5)) + with warnings.catch_warnings(): + warnings.filterwarnings("ignore", message="std\\(\\): degrees of freedom is <= 0") + helper_test_op([(1,0,3,0,5)], lambda x: x.std(axis=(1,3))) + helper_test_op([(1,0,3,0,5)], lambda x: x.std(axis=(1,3), correction=0)) + helper_test_op([(1,0,3,0,5)], lambda x: x.std(axis=(1,3), correction=5)) def test_std_one_in_axis(self): + with warnings.catch_warnings(): + warnings.filterwarnings("ignore", message="std\\(\\): degrees of freedom is <= 0") + helper_test_op([(1,2,3,1,5)], lambda x: x.std(axis=(0,3))) + helper_test_op([(1,2,3,1,5)], lambda x: x.std(axis=(0,3), correction=5)) + helper_test_op([(1,2,3,1,5)], lambda x: x.std(axis=(0,4), correction=5)) # TODO: fix backward helper_test_op([(1,)], lambda x: x.std(axis=(0,), correction=0), forward_only=True) - helper_test_op([(1,2,3,1,5)], lambda x: x.std(axis=(0,3))) helper_test_op([(1,2,3,1,5)], lambda x: x.std(axis=(0,3), correction=0), forward_only=True) - helper_test_op([(1,2,3,1,5)], lambda x: x.std(axis=(0,3), correction=5)) helper_test_op([(1,2,3,1,5)], lambda x: x.std(axis=(0,4))) helper_test_op([(1,2,3,1,5)], lambda x: x.std(axis=(0,4), correction=0)) - helper_test_op([(1,2,3,1,5)], lambda x: x.std(axis=(0,4), correction=5)) def test_std_keepdim(self): helper_test_op([(15, 25, 35)], lambda x: x.std(keepdim=True)) helper_test_op([(15, 25, 35)], lambda x: x.std(0, keepdim=True, correction=0))