Re: It Hurts When I Do This
- From: Steve Lionel <steve.lionel@xxxxxxxxxxxxx>
- Date: Tue, 22 Apr 2008 01:12:20 GMT
glen herrmannsfeldt wrote:
Certainly there is a test, which will presumably take a finite time. But
I don't see why the amount of time should be significant. Seems like it
ought to be a relatively fast test. I find it hard to image that being
very significant in the compared to an array assignment of even a
modest-sized array, much less a large one as might be most likely to use
allocatable.
I would say one to see that it is already allocated and one for
each dimension (rank). Conditional branches are considered expensive
these days, though, unless branch prediction works properly for them.
If the compiler doesn't know, it has to put the check in even for small
arrays that are inside deeply nested loops. If (:) is the official
"don't reallocate" operator then one can avoid that.
You have to check the upper and lower bounds of each dimension, and this is potentially a lot of conditional branches and a lot of intermediate language that makes life harder for the optimization phases. At least that's how it's currently implemented. Being an old libraries guy (I used to do compiler run-time libraries before working on compilers themselves), I'd have suggested moving this code to a library routine - just pass it the descriptors of the LHS and RHS. Indeed, we're starting to do that in similar cases and maybe will end up doing it here too.
But adding a library routine isn't without cost - it creates support headaches (see below) when users try to link objects with older libraries. This is an issue I have seen come up many times over the past 30 years. While we don't promise backward compatibility of objects, the reality is that such compatibility matters to many customers and we try not to break it without a really good reason.
In the interest of full disclosure, I no longer write compilers - I'm now on the support side. I was a compiler developer for 15 years (and a libraries developer for 10 before that). But I do still sit with the developers and we talk a lot about issues like this.
--
Steve Lionel
Developer Products Division
Intel Corporation
Nashua, NH
For email address, replace "invalid" with "com"
User communities for Intel Software Development Products
http://softwareforums.intel.com/
Intel Fortran Support
http://support.intel.com/support/performancetools/fortran
My Fortran blog
http://www.intel.com/software/drfortran
.
- Follow-Ups:
- Re: It Hurts When I Do This -- diversion...
- From: dpb
- Re: It Hurts When I Do This
- From: glen herrmannsfeldt
- Re: It Hurts When I Do This -- diversion...
- References:
- It Hurts When I Do This
- From: GaryScott
- Re: It Hurts When I Do This
- From: Beliavsky
- Re: It Hurts When I Do This
- From: Richard Maine
- Re: It Hurts When I Do This
- From: Arjen Markus
- Re: It Hurts When I Do This
- From: Beliavsky
- Re: It Hurts When I Do This
- From: Richard Maine
- Re: It Hurts When I Do This
- From: glen herrmannsfeldt
- It Hurts When I Do This
- Prev by Date: Re: OT retro-styled HP calculator
- Next by Date: comp.lang.fortran charter
- Previous by thread: Re: It Hurts When I Do This
- Next by thread: Re: It Hurts When I Do This
- Index(es):
Relevant Pages
|
Loading