[erlang-questions] [PATCH] Fix R15B02 cross-compilation for TileraMDE-22.214.171.124620
Thu Oct 11 12:10:39 CEST 2012
On 2012-10-11 08:45, Motiejus Jakštys wrote:
> On Wed, Oct 10, 2012 at 05:09:10PM +0200, Björn-Egil Dahlberg wrote:
>> On 2012-10-10 16:08, Motiejus Jaks(tys wrote:
>>> Applying the patch below let me cross-compile and run R15B02 on Tilera64
>>> using TileraMDE-126.96.36.199620.
>>> In order to prepare a clean patch, I have to know what do the options
>>> -OPT:Olimit=0 -WOPT:lpre=off:spre=off:epre=off do on the machines that
>>> support it? Also, what is the meaning of -MALLOC_USE_HASH(1)?
>> I am quoting from Tilera here:
> Is documentation open? Would it be possible to get a link/reference?
> Maybe there is any documentation on this feature in "compatibility
> notes" or "migration guide" of some kind? I could ask Tilera for this.
I'm sorry. It's not possible to make that specific information public. I
was quoting from a private
mail discussion I had with people at Tilera in 2008.
>> "'malloc_use_hash' only affects malloc (specifically, it affects the
>> flags it passes to 'mmap' when it allocates more memory from Linux).
>> You can also explicitly malloc memory with various caching attributes
>> using custom mspaces.
>> The 'hash_default' argument in the .hvconfig file affects 'mmap' calls
>> that do not specify homing information. Because malloc*does* specify
>> homing information, at least when you are pthreaded, 'hash_default' is
>> ignored and malloc_use_hash is required to get hash-for-home."
>> This was something included in TileraMDE 2.0 beta (perhaps removed
>> since then).
>> I found it in TileraMDE-2.1.2/tile64/tile/usr/include/malloc.h though.
> All right. So it was there, and was removed.
> I think it would make sense to conditionalize it during configuration
> phase. But how to test for its existence/absence?
How about doing this instead?
diff --git a/erts/emulator/sys/unix/sys.c b/erts/emulator/sys/unix/sys.c
index 37dfcb1..176a5af 100644
@@ -408,8 +408,10 @@ void sys_tty_reset(int exit_code)
/* Direct malloc to spread memory around the caches of multiple tiles. */
>> I guess it would be safe to remove "-OPT:Olimit=0
>> -WOPT:lpre=off:spre=off:epre=off ".
>> It is an optimization for tile-cc when compiling on target machine.
>> An earlier comment in Makefile.in seems to have been removed, it said:
>> +ifneq ($(filter tile-%,$(TARGET)),)
>> +# Some tile-cc optimizations take pathologically long for beam_emu.c,
>> +# so disable them.
>> +$(OBJDIR)/beam_emu.o: beam/beam_emu.c
>> + $(CC) $(subst -O2, $(GEN_OPT_FLGS), $(CFLAGS)) \
>> + -OPT:Olimit=0 -WOPT:lpre=off:spre=off:epre=off \
>> + $(INCLUDES) -c $< -o $@
> Can you verify that it compiles in "reasonable time" on your system with
> these flags turned off?
Actually, no. =)
This was a problem Tilera had when they compiled in their environment,
i.e. uploading all code to the card and compiling it there (With their
specific cards). Here at OTP we cross-compiled everything and did not
see this problem. Hopefully this was a problem that has been remedied
since then though.
Also, tag - you’re it!
It would be greatly appreciated if you could summarize problems and
solution you have found for building and using Erlang on the Tilera card
or if you find something we can change to make anyones experience just a
bit easier. I don't know exactly where we should put this documentation
but my suggestion would either be in the documentation for cross
compiling or as a specific page on the GitHub Wiki. If the information
arrives, we will surely find a place to put it. =)
More information about the erlang-questions