From 717074a2f8f66ab3a233cea36d08256300271710 Mon Sep 17 00:00:00 2001 From: dzaima Date: Fri, 3 Mar 2023 18:53:18 +0200 Subject: [PATCH] =?UTF-8?q?fast=20transpose=20on=20shape=20n=E2=80=BF2=20?= =?UTF-8?q?=F0=9D=95=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/builtins/sfns.c | 26 +++++++++++++++++++++++++- src/opt/mm_buddy.c | 4 ++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/builtins/sfns.c b/src/builtins/sfns.c index d112202b..3ef6223b 100644 --- a/src/builtins/sfns.c +++ b/src/builtins/sfns.c @@ -1296,7 +1296,7 @@ B transp_c1(B t, B x) { r = (Arr*) rp.c; } else { #ifndef __BMI2__ - if (xe==el_bit) { x = taga(cpyI8Arr(x)); xsh=SH(x); xe=el_i8; } + if (xe==el_bit) { x = taga(cpyI8Arr(x)); xsh=SH(x); xe=el_i8; toBit=true; } void* rp = m_tyarrp(&r,elWidth(xe),ia,el2t(xe)); #else void* rp = m_tyarrlbp(&r,elWidthLogBits(xe),ia,el2t(xe)); @@ -1318,6 +1318,30 @@ B transp_c1(B t, B x) { case el_f64: { u64* x0=xp; u64* x1=x0+w; for (usz i=0; isz) { printf("Bad used range: "N64u".."N64u", allocation size "N64u"\n", start, end, sz); exit(1); } + if (end+64>sz) { printf("Bad used range: "N64u".."N64u", allocation size "N64u"\n", start, end, sz); __builtin_trap(); } } void tailVerifyReinit(void* ptr, u64 filled, u64 end) { - if(filled>end || filled<=8) { printf("Bad reinit arguments: "N64u".."N64u"\n", filled, end); exit(1); } + if(filled>end || filled<=8) { printf("Bad reinit arguments: "N64u".."N64u"\n", filled, end); __builtin_trap(); } verifyEnd(ptr, mm_size(ptr), filled, end); tailVerifyInit(ptr, filled, end, mm_size(ptr)); }