From 2c7143459f0003d918975d683542d66588325a78 Mon Sep 17 00:00:00 2001 From: Jerome Robert Date: Thu, 31 Dec 2015 13:32:53 +0000 Subject: [PATCH 1/2] Let make MAX_STACK_ALLOC=0 do what expected It's no longer required to modify Makefile.rule to disable stack allocation. It's now possible to run: make MAX_STACK_ALLOC=0 --- Makefile.rule | 7 ++++--- Makefile.system | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Makefile.rule b/Makefile.rule index 0d7c45ead..4a6e4e9f1 100644 --- a/Makefile.rule +++ b/Makefile.rule @@ -163,10 +163,11 @@ COMMON_PROF = -pg # Build Debug version # DEBUG = 1 -# Improve GEMV and GER for small matrices by stack allocation. -# For details, https://github.com/xianyi/OpenBLAS/pull/482 +# Set maximum stack allocation. +# The default value is 2048. 0 disable stack allocation a may reduce GER and GEMV +# performance. For details, https://github.com/xianyi/OpenBLAS/pull/482 # - MAX_STACK_ALLOC=2048 +# MAX_STACK_ALLOC = 0 # Add a prefix or suffix to all exported symbol names in the shared library. # Avoid conflicts with other BLAS libraries, especially when using diff --git a/Makefile.system b/Makefile.system index 9de9232ad..b3e83e2dd 100644 --- a/Makefile.system +++ b/Makefile.system @@ -328,7 +328,8 @@ ifdef SANITY_CHECK CCOMMON_OPT += -DSANITY_CHECK -DREFNAME=$(*F)f$(BU) endif -ifdef MAX_STACK_ALLOC +MAX_STACK_ALLOC ?= 2048 +ifneq ($(MAX_STACK_ALLOC), 0) CCOMMON_OPT += -DMAX_STACK_ALLOC=$(MAX_STACK_ALLOC) endif From f9890a6452b2807200ea4b0ee2b2874e189fcbba Mon Sep 17 00:00:00 2001 From: Jerome Robert Date: Thu, 31 Dec 2015 13:36:22 +0000 Subject: [PATCH 2/2] Fix compilation when MAX_STACK_ALLOC is not set Close #722 --- interface/gemv.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/interface/gemv.c b/interface/gemv.c index 97c68bf2d..206390ed9 100644 --- a/interface/gemv.c +++ b/interface/gemv.c @@ -270,10 +270,11 @@ void CNAME(enum CBLAS_ORDER order, } #endif -// stack overflow check -assert(stack_check==3.14159265358979323846); #ifdef MAX_STACK_ALLOC + // stack overflow check + assert(stack_check==3.14159265358979323846); + if(!stack_alloc_size){ blas_memory_free(buffer); }