Skip to content

Instantly share code, notes, and snippets.

Avatar

Matti Picus mattip

  • Quansight Labs
View GitHub Profile
View gist:368e8379cd2467121b88a5fc5b2991e2
# HG changeset patch
# Branch py3.7
# Node ID d1fa7b5d94536a005568f422643b45c8c36a7d7c
# Parent cfc38b565a4eff52cf4f41e3987432e9b26fa14b
# Parent c08e635a58d4aea3dd374be09ff94ea5293b37c7
merge default into py3.7
diff -r cfc38b565a4e -r d1fa7b5d9453 pypy/doc/whatsnew-head.rst
--- a/pypy/doc/whatsnew-head.rst Thu Jul 15 16:33:54 2021 +0200
+++ b/pypy/doc/whatsnew-head.rst Mon Jul 26 13:11:15 2021 +0300
@mattip
mattip / info.md
Last active Aug 3, 2021
Converting hg repo to git, with notes for each node which branch it came from
View info.md

Cloning the hg repo as a git repo

the tools

Get this repo https://github.com/mnauw/git-remote-hg which is a fork of the original and supports modern git/hg. Copy git-hg-helper and git-remote-hg to ~/bin and make them executable with chmod +x ~/bin/git*

clone the repo as both hg and git

git clone hg::https://foss.heptapod.net/pypy/cffi cffi-git

@mattip
mattip / gist:e7834c9c93b38d05f177a4d4e334a829
Created Jul 17, 2021
C/Assembler of the call to PyUFunc_GenericFunctionInternal
View gist:e7834c9c93b38d05f177a4d4e334a829
This C function
typedef struct {
PyObject *in;
PyObject *out;
} ufunc_full_args;
static int
PyUFunc_GenericFunctionInternal(PyUFuncObject *ufunc, PyArrayObject **op,
ufunc_full_args full_args, PyObject *type_tup, PyObject *extobj,
View gist:51af5d994f5f4de58dc7097b9dd0d590
diff --git a/numpy/core/src/umath/ufunc_object.c b/numpy/core/src/umath/ufunc_object.c
index 1b47e74ac..c65e481e3 100644
--- a/numpy/core/src/umath/ufunc_object.c
+++ b/numpy/core/src/umath/ufunc_object.c
@@ -4489,6 +4489,13 @@ replace_with_wrapped_result_and_return(PyUFuncObject *ufunc,
{
PyObject *retobj[NPY_MAXARGS];
PyObject *wraparr[NPY_MAXARGS];
+ if (full_args.in == NULL) {
+ if (PyErr_Occurred() == NULL) {
@mattip
mattip / test.py
Last active May 18, 2021
Comparison of jit summary before and after py3.7-cpyext-unroll-a-bit 1f4c96de61ee
View test.py
BEFORE AFTER
[4e2f663bd9fe8] {jit-summary [4e2d5889878b8] {jit-summary
Tracing: 86 0.100334 Tracing: 78 0.113238
Backend: 74 0.031218 Backend: 66 0.032329
TOTAL: 1.515222 TOTAL: 1.509000
ops: 124400 ops: 123038
heapcached ops: 78660 heapcached ops: 79768
recorded ops: 39196 recorded ops: 40168
calls: 6160 calls: 5844
guards: 9656 guards: 10059
@mattip
mattip / gist:bbf95deb2e09dec66aa13cb5f32eef07
Created May 12, 2021
Quiet warnings in ufunc_object.c
View gist:bbf95deb2e09dec66aa13cb5f32eef07
--- a/numpy/core/src/umath/ufunc_object.c
+++ b/numpy/core/src/umath/ufunc_object.c
@@ -1263,8 +1263,8 @@ iterator_loop(PyUFuncObject *ufunc,
void *innerloopdata,
npy_uint32 *op_flags)
{
- npy_intp i, nin = ufunc->nin, nout = ufunc->nout;
- npy_intp nop = nin + nout;
+ int i, nin = ufunc->nin, nout = ufunc->nout;
+ int nop = nin + nout;
View gist:5c7ddf15511d429c5c303d4f4ac06b3e
# Running this set of tests fails. The JIT log is https://www.dropbox.com/s/3utbtgz1ke03i5p/jit.log?dl=0
d:\pypy_stuff\numpy>..\pypy3.7-v7.3.5rc2-win64\pypy3.exe runtests.py -t numpy\core\tests\test_multiarray.py -- -k TestStats
Building, see build.log...
Build OK
NumPy version 1.21.0.dev0+1494.g7311af823
NumPy relaxed strides checking option: True
NumPy CPU features: SSE SSE2 SSE3 SSSE3* SSE41* POPCNT* SSE42* AVX* F16C* FMA3* AVX2* AVX512F? AVX512CD? AVX512_SKX? AVX512_CLX? AVX512_CNL? AVX512_ICL?
.......F............... [100%]
====================================================== FAILURES =======================================================
@mattip
mattip / gist:be49649c3ac89ae15e1df19b76efe595
Created May 6, 2021
7.3.5 rc2 failures on numpy for win64
View gist:be49649c3ac89ae15e1df19b76efe595
FAILED numpy\core\tests\test_longdouble.py::test_longdouble_from_int[179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137216]
FAILED numpy\core\tests\test_multiarray.py::TestStats::test_empty - AssertionError
FAILED numpy\core\tests\test_multiarray.py::TestStats::test_var_where - AssertionError:
FAILED numpy\core\tests\test_numeric.py::TestNonarrayArgs::test_std - AssertionError
FAILED numpy\core\tests\test_numeric.py::TestNonarrayArgs::test_var - AssertionError
FAILED numpy\core\tests\test_numeric.py::TestClip::test_clip_property - hypothesis.errors.Flaky: Inconsistent data ge...
FAILED numpy\core\tests\test_scalar_ctors.py::TestFromString::test_floating_overflow - AssertionError:
FAILED numpy\core\tests\test_scalarmath.py::TestConversion::test_int_from_infin
@mattip
mattip / test file
Created Apr 11, 2021
testing pickle/unpickle of masked record array
View test file
import numpy as np
import numpy.ma as ma
from numpy.ma.mrecords import (
MaskedRecords, mrecarray, fromarrays, fromtextfile, fromrecords,
addfield
)
import pickle
def test_pickling():
ilist = [1, 2, 3, 4, 5]
View gist:6055de08fb0cf47b08cb1aafb2bcf223
$ python -m pytest test/test_ops.py -k _add_
========================================================================== test session starts ===========================================================================
platform linux -- Python 3.9.2, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rootdir: /home/matti/quansight/pytorch, configfile: pytest.ini
plugins: hypothesis-6.6.0
collected 12668 items / 12479 deselected / 189 selected
test/test_ops.py F.............................FFFFFFFssssssssssssssssssssssssssssssssssssss..................................F........FF..FF..ssssssssssssssss... [ 76%]
.....FF..FF....s.....F..ssssssssss.s.....F.. [100%]