[Python-bugs-list] [ python-Bugs-435026 ] SGI cores on 1.0 / 0

noreply@sourceforge.net noreply@sourceforge.net
Fri, 22 Jun 2001 17:48:17 -0700


Bugs item #435026, was opened at 2001-06-20 23:18
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=435026&group_id=5470

Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Drew Whitehouse (drw900)
Assigned to: Nobody/Anonymous (nobody)
Summary: SGI cores on 1.0 / 0

Initial Comment:
python21 cores evaluating 1.0 / 0 on SGI.
MIPSpro Compilers: Version 7.3.1.1m
SGI_ABI = -n32

----------------------------------------------------------------------

Comment By: Robert Minsk (rminsk)
Date: 2001-06-22 17:48

Message:
Logged In: YES 
user_id=132786

After some more investigation it seems to be a CPU
pipelining bug in the optimizer.

#define CONVERT_TO_DOUBLE(obj, dbl)			\
	if (PyFloat_Check(obj))				\
		dbl = PyFloat_AS_DOUBLE(obj);		\
	else if (convert_to_double(&(obj), &(dbl)) < 0)	\
		return obj;

PyFloat_Check is a macro as well is PyFloat_AS_DOUBLE.  Due
to the CPU pipelining PyFloat_AS_DOUBLE (a cast to a double)
is always being called.  What happens is non-float objects
that are not 8-byte aligned are being cast to a double.
I am trying to figure out if I can reorder the code to not
cause this pipelining issue.  I will also see if I can
somehow force a nop after PyFloat_Check.  I will also open a
bug with SGI.

----------------------------------------------------------------------

Comment By: Robert Minsk (rminsk)
Date: 2001-06-21 20:42

Message:
Logged In: YES 
user_id=132786

Thank you tim_one for the hint... I still trying to track it
down but

changing Include/intobject.h PyIntObject to include memory
alignment pragmas seem to be the trick.  On the SGI I've
changed it to

#pragma pack(8)
typedef struct {
    PyObject_HEAD
    long ob_ival;
} PyIntObject;
#pragma pack(0)

This is only a hack until I find a way to get the proper
alignment.  I'm begining to wonder if anywhere in the float
code something is trying to cast a int object to a float
object.

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2001-06-21 19:52

Message:
Logged In: YES 
user_id=31435

Robert, let us know if you find it!  There's always *some* 
optimization bug on SGI boxes, but this one is particularly 
noxious.

Someone on c.l.py suggested it may be a problem with Python 
accessing a double at an unaligned (for the platform) 
memory address.  They didn't follow up, so I don't know 
whether that's the case, but if it is we would consider it 
a bug in Python (we try to stick to std C, so if there's an 
unaligned access it's a bug in our coding -- but I don't 
see anything like that by eyeball).


----------------------------------------------------------------------

Comment By: Robert Minsk (rminsk)
Date: 2001-06-21 19:41

Message:
Logged In: YES 
user_id=132786

Python 2.1 core dumps on any
<float> <operator> <int>
using the 7.3.1.2m compilers with -O2 or greater.  If  the
file Objects/floatobject.c is compiled with -O1 everything
seems fine.  It is core dumping in the macro
CONVERT_TO_DOUBLE.  It seems the call stack gets corrupted. 
I'm trying to find a workaround besides -O1.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=435026&group_id=5470