Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic support for builtins from compiler-rt #18734

Closed
wants to merge 3 commits into from
Closed

Conversation

vchuravy
Copy link
Member

@vchuravy vchuravy commented Sep 29, 2016

Compiler-rt is a support library for clang/llvm. It is used to support llvm intrinsics backend agnostic. Examples are soft-fp support on ARM and Float16 support.
A motivating use-case is #17344, related issues are #14818, #18287 (comment), and this will allow us to properly fix #4905.

Caveats

  • compiler-rt is often distributed alongside clang as a static library. In order to support JIT compilation we have to convert the static library into a shared object file.
  • libcompiler-rt.so is not used by anybody, but Julia so this PR currently installs it to usr/lib/julia.
  • Compiler-rt's build-system is coupled tightly to llvm and we would need to either build CLANG or switch to 3.8.1
  • This PR to allows to build compiler-rt standalone (currently without support for atomics) following https://github.com/ReservedField/arm-compiler-rt

I am not very experienced in writing Makefiles so I would like to have some critique and I will need some help for non-Linux systems and ARM.

TODO

  • Windows support
  • Building and linking under MacOSX
  • Power support
  • ARM support
  • ARM 32bit

@@ -228,6 +228,9 @@ LLVM_DEBUG := 0
#LLVM_USE_CMAKE: defined in deps/llvm-ver.mk as it depends on LLVM_VER_SHORT
# set to 1 to get clang and compiler-rt
BUILD_LLVM_CLANG := 0
# set to 0 to not build compiler-rt standalone.
# it will still be build if BUILD_LLVM_CLANG is set to 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will still be built

@@ -39,7 +39,7 @@ include $(SRCDIR)/tools/git-external.mk
# prevent installing libs into usr/lib64 on opensuse
unexport CONFIG_SITE

DEP_LIBS :=
DEP_LIBS := compiler-rt
Copy link
Contributor

@tkelman tkelman Sep 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only ifeq($(BUILD_COMPILER_RT), 1), right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is more complicated than that. As far as I can tell we will need to unconditionally build with compiler-rt (except for llvm-free builds).
BUILD_COMPILER_RT==1 means that we will try to build a standalone compiler-rt iff LLVM hasn't build one.

##
# In order to support fallbacks within llvm we need to support
# compiler-rt. This means linking sys.so against it and resolving
# symbols at during JIT. For the latter part we need to create
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"symbols during JIT" ? or missing word?

# There are several configurations to take into account.
# 1. USE_SYSTEM_LLVM == 1
# libclang_rt.builtins is distributed with clang and so
# we assume that USE_SYSTEM_LLVM == 1 means that clang is also
Copy link
Contributor

@tkelman tkelman Sep 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure this is a safe assumption to make

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this adds an implicit dependency on clang...
We could relax this a bit by using a standalone build for USE_SYSTEM_LLVM == 1 && BUILD_COMPILER_RT == 1, but for USE_SYSTEM_LLVM == 1 && BUILD_COMPILER_RT == 0, we need to fall back onto a system version of compiler-rt and that comes at least on Archlinux with clang.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least for Fedora RPMs, I need USE_SYSTEM_LLVM=1 and I also have to build LLVM with gcc. Is that a problem, or is installing clang enough?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Installing clang will be enough or you can set STANDALONE_COMPILER_RT:=1

# we assume that USE_SYSTEM_LLVM == 1 means that clang is also
# installed.
# 2. BUILD_LLVM_CLANG == 1
# libclang_rt.builtins is build with clang and we can pick that up.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is built with

# 3. BUILD_COMPILER_RT == 1
# Download and install compiler_rt independently of llvm/clang
#
# Since we need the shared opjectfile for JIT there is no USE_SYSTEM_COMPILER_RT
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there really no desire from upstream to fix this there?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can try and fix this upstream.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

worth a shot, I'd rather carry patches and maybe adjust the way we build LLVM if the long-term idea is we can upstream the patches, instead of needing extra makefile wrappers here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will still need the standalone buildscript, but you are right it is worth a shot.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, "opjectfile" -> "objectfile"

$(CC) $(LDFLAGS) -shared $(fPIC) -o $@ -nostdlib $(WHOLE_ARCHIVE) -L$(CRT_DIR) -l$(CRT_STATIC_NAME) $(WHOLE_NOARCHIVE)
else
# The standalone compiler-rt build is based on
# https://github.com/ReservedField/arm-compiler-rt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not reuse code, but I was inspired by the way they solved the build issue., but I can add the copyright notice

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm okay, "based on" is a bit ambiguous

extract-compiler-rt: $(COMPILER_RT_SRCDIR)/source-extracted
endif
check-compiler-rt: #NONE
fast-check-compiler-rt: #NONE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fastcheck-compiler-rt

rm -rf $(COMPILER_RT_BUILDDIR)
compile-compiler-rt: $(COMPILER_RT_BUILDDIR)/$(COMPILER_RT_LIBFILE)
install-compiler-rt: $(COMPILER_RT_BUILDDIR)/$(COMPILER_RT_LIBFILE)
cp $(COMPILER_RT_BUILDDIR)/$(COMPILER_RT_LIBFILE) $(build_private_libdir)/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will need to use one of the confusing install macros to support uninstall. might also need a manifest file, however those are supposed to work

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not yet addressed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vtjnash When I discussed this with you, you mentioned that I might not need to use the macro since I only install two files?
I am also happy to use the staged-install mechanism, but I hadn't had time to understand it yet.

static const char *const prefix = "__";
if (!compiler_rt_hdl)
return 0;
if (strncmp(name, prefix, strlen(prefix) != 0))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this supposed to be if (strncmp(name, prefix, strlen(prefix)) != 0) ?

CRT_ARCH_SRCDIR := $(CRT_SRCDIR)/$(CRT_ARCH)
CRT_INCLUDES := -I$(CRT_SRCDIR) -I$(CRT_ARCH_SRCDIR)
CRT_CFLAGS := \
-std=gnu99 -fPIC -fno-builtin -fvisibility=hidden \
Copy link
Member

@vtjnash vtjnash Sep 30, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$(fPIC)
does -fvisibility=hidden do the same thing everywhere?
also might need to check on -ffreestanding

CRT_CFLAGS := \
-std=gnu99 -fPIC -fno-builtin -fvisibility=hidden \
-ffreestanding $(CRT_INCLUDES)\
$(if $(USE_CLANG), -Wno-unknown-attributes -Wno-macro-redefined)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our usual style for this has been to split it onto separate lines, but perhaps not universal:

ifeq ($(USE_CLANG),1)
CRT_CFLAGS += ...
endif

CRT_SRCDIR := $(COMPILER_RT_SRCDIR)/lib/builtins
CRT_ARCH_SRCDIR := $(CRT_SRCDIR)/$(CRT_ARCH)
CRT_INCLUDES := -I$(CRT_SRCDIR) -I$(CRT_ARCH_SRCDIR)
CRT_CFLAGS := \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add $(CPPFLAGS) $(CFLAGS) too

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this have -O2 also?

$(CC) $(CRT_CFLAGS) -c $< -o $@

$(COMPILER_RT_BUILDDIR)/$(COMPILER_RT_LIBFILE): $(CRT_OBJS)
$(CC) -shared -o $@ $^
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this need -fvisibility=hidden?

add $(LDFLAGS) here too

endif

$(COMPILER_RT_SRCDIR)/source-extracted: | $(COMPILER_RT_TAR)
ifneq ($(COMPILER_RT_TAR),)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this rule makes sense overall if COMPILER_RT_TAR is empty

LLVM_MFLAGS += OPTIONAL_PARALLEL_DIRS=
endif
else
ifeq ($(LLVM_VER_SHORT),$(filter $(LLVM_VER_SHORT),3.3 3.4 3.5 3.6 3.7))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

USE_LLVM_CMAKE?

@vchuravy vchuravy force-pushed the vc/compiler-rt branch 2 times, most recently from 37f9286 to 6a0940c Compare September 30, 2016 20:58
@vchuravy
Copy link
Member Author

Updated the PR to address the feedback given so far. I run into two major annoyances the first is that LLVM 3.9 can't build compiler-rt without clang and that the way I discover the files is problematic, because it relies on the source being already unpacked. @vtjnash suggested splitting the Makefiles, but I was hoping that somebody else might have a better solution.

# set to 1 to build compiler-rt standalone.
STANDALONE_COMPILER_RT := 0
# set to 0 to disable building compiler-rt standalone.
# Currently compiler-rt can only be build alongside clang
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can only be built

@vchuravy vchuravy force-pushed the vc/compiler-rt branch 2 times, most recently from 6fa6d5a to e78a328 Compare October 4, 2016 08:12
@vchuravy
Copy link
Member Author

vchuravy commented Oct 4, 2016

So travis for Linux is passing. Yeah! I will see if I can get my hand on a Mac.

@yuyichao If you have time would you mind taking a look at ARM? The build-script might need some adjustments to pick up the right Arch implementations and blacklist unnecessary ones.

@vchuravy
Copy link
Member Author

vchuravy commented Oct 5, 2016

So I fixed ARM&Power + Mac. The remaining platform is windows (which I don't have access to at the moment)

@tkelman
Copy link
Contributor

tkelman commented Oct 5, 2016

Try cross-compiling?

@@ -481,10 +486,13 @@ OBJCOPY := $(CROSS_COMPILE)objcopy
# file extensions
ifeq ($(OS), WINNT)
SHLIB_EXT := dll
STATICLIB_EXT := lib
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only with msvc. where are you dealing with a lib file?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also under mingw64? ce33683 changed that we are now linking sys.so statically against compiler-rt.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, mingw static libraries are .a extension. compiler-rt's build system is probably full of wrong windows==msvc assumptions that should be fixed rather than worked around the wrong way here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I will fix this in the morning (It was my wrong assumption, not compiler-rts)

Is there a way of detecting the compiler from the Makefile?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's a USEMSVC or some flag like that but it's a hack, you probably shouldn't worry about it. if we ever support msvc properly it'll be via cmake anyway.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So just changing lib to a would be sufficient for now?

@vchuravy
Copy link
Member Author

vchuravy commented Oct 8, 2016

So with build support for Windows, Mac, ARM, Power this is ready for another round of reviews, before I squash and rebase.

@@ -486,7 +486,7 @@ OBJCOPY := $(CROSS_COMPILE)objcopy
# file extensions
ifeq ($(OS), WINNT)
SHLIB_EXT := dll
STATICLIB_EXT := lib
STATICLIB_EXT := .a # MSVC is .lib
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if comments are on the same line in a makefile variable, the value will include the trailing space - this might not break anything, but keep it in mind

@@ -486,7 +486,11 @@ OBJCOPY := $(CROSS_COMPILE)objcopy
# file extensions
ifeq ($(OS), WINNT)
SHLIB_EXT := dll
STATICLIB_EXT := a # MSVC is lib
ifeq ($(USE_MSVC),1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no underscore

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should really stop pushing commits late night. Thank you for catching this.

static uint64_t resolve_compiler_rt(const char *name)
{
#if defined(__APPLE__)
static const char *const compiler_rt_lib = "@rpath/julia/libcompiler-rt";
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vtjnash Is this the correct form for a rpath library? Or do I need to add .dylib?

@@ -374,7 +374,11 @@ endif
$(INSTALL_F) $(addprefix $(JULIAHOME)/,src/julia.h src/julia_threads.h src/support/*.h) $(DESTDIR)$(includedir)/julia
$(INSTALL_F) $(BUILDROOT)/src/julia_version.h $(DESTDIR)$(includedir)/julia
# Copy julia's copy of compiler-rt
ifeq ($(OS),WINNT)
$(INSTALL_M) $(build_private_libdir)/libcompiler-rt.$(SHLIB_EXT) $(DESTDIR)$(bindir)
else
$(INSTALL_M) $(build_private_libdir)/libcompiler-rt.$(SHLIB_EXT) $(DESTDIR)$(private_libdir)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why isn't this just using shlibdir then?

@vchuravy
Copy link
Member Author

Ok this is nearly done. Mac test just succeeded From worker 9: * llvmcall maxrss 199.11 MB.

I would squash this and remove the debug information (or does anybody want to keep the poetry and the history for reviewing?)

@vchuravy
Copy link
Member Author

vchuravy commented Oct 11, 2016

@tkelman
Copy link
Contributor

tkelman commented Oct 11, 2016

Can you move that to your fork? Would rather clean up no-longer-relevant branches from here.

This still doesn't support uninstall, does it?

@vchuravy
Copy link
Member Author

Uninstall? You mean clean-compiler-rt?

On Tue, 11 Oct 2016, 16:47 Tony Kelman, [email protected] wrote:

Can you move that to your fork? Would rather clean up no-longer-relevant
branches from here.

This still doesn't support uninstall, does it?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#18734 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAI3agWewdyu5rVQu9H6iGM7Y99YHeAJks5qyz8BgaJpZM4KKgMs
.

@tkelman
Copy link
Contributor

tkelman commented Oct 11, 2016

no, uninstall-compiler-rt - remove the installed files from the install prefix. clean removes them from the build location

@@ -324,7 +324,7 @@ static uint64_t resolve_compiler_rt(const char *name)
// jl_dlsym_e expects an unmangled 'C' symbol name,
// so iff we are on Darwin we strip the leading '_' off.
static const char *const mangled_prefix = "___";
if (strncmp(name, mangled_prefix, strlen(mangled_prefix)) != 0) {
if (strncmp(name, mangled_prefix, strlen(mangled_prefix)) == 0) {
++name;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent

@@ -135,12 +135,14 @@ fastcheck-compiler-rt: #NONE
configure-compiler-rt: $(COMPILER_RT_BUILDDIR)/build-configured
clean-compiler-rt:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think clean should depend on uninstall, most of the autogenerated ones do IIRC

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See L145.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makefiles are awful

@tkelman
Copy link
Contributor

tkelman commented Oct 11, 2016

Can I request that we hold off on merging anything LLVM build related until we're sure the buildbots are in good shape and will handle it? We haven't had nightlies in several weeks, and it looks like there are some new consistent failures within the last few days.

@vchuravy vchuravy added this to the 0.6.0 milestone Oct 11, 2016
@vchuravy
Copy link
Member Author

vchuravy commented Nov 12, 2016

I did not manage to reproduce the buildbot failure :(

Maybe the best course of actions is to wait on #19123 and the associated buildbot changes?

@tkelman
Copy link
Contributor

tkelman commented Dec 29, 2016

Rebased this for you to pick up llvm 3.9, ran it through the buildbots. 32 bit Linux still has issues, segfaults when trying to build the docs: https://build.julialang.org/builders/package_tarball32/builds/1140/steps/make%20binary-dist/logs/stdio

And on Windows, it's trying to use pthreads. We can't switch our compiler version on Windows to one that supports pthreads for as long as we need to be able to build Windows binaries against LLVM 3.7 on the same buildbots.

emutls.o:emutls.c:(.text+0x13): undefined reference to `pthread_key_create'
emutls.o:emutls.c:(.text+0x8d): undefined reference to `pthread_getspecific'
emutls.o:emutls.c:(.text+0xcf): undefined reference to `pthread_once'
emutls.o:emutls.c:(.text+0xdb): undefined reference to `pthread_mutex_lock'
emutls.o:emutls.c:(.text+0xf4): undefined reference to `pthread_mutex_unlock'
emutls.o:emutls.c:(.text+0x14f): undefined reference to `pthread_setspecific'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:81: libcompiler-rt.dll] Error 1

# Blacklist a few files we don't want to deal with
##
MAKEFLAGS := --no-builtin-rules
BLACKLIST := atomic.o atomic_flag_clear.o atomic_flag_clear_explicit.o \
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tkelman the emutls failure means we need to update the blacklist to contain the related files

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commit that and we could try throwing it at the buildbots again?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like that fixes the windows build (need to run tests locally, will see) but not whatever's wrong with the 32 bit linux buildbot

Compiler-rt is the runtime library of LLVM and sometimes we need to
resolve library calls to it. There are two moments were we need to
handle library calls to compiler-rt.

1. `sys.so` or any other Julia code compiled into shlibs.
  In this case we perform static linking, as with other runtime
  libraries.
2. JIT time. When we compile a Julia function that uses a libcall to crt
   we need to resolve that against a shlib copy of compiler-rt.
   Compiler-rt is usually only distributed as a static library, so we
   provide a step to turn the static library into a shared one.

The buildsystem of compiler-rt is tightly tied to LLVM. Because of this
we have a staged build-script that builds compiler-rt from source. This
standalone version should only be used for Julia.
LLVM intrinsics either map to instructions or to functions in
compiler-rt. If we can't find a symbol look into a shared version
of compiler-rt and resolve the functions there.

On Darwin we have to use a unmangled version of the function name.
One most systems (except modern mac) these tests will fail if
compiler-rt is not properly configured.
@staticfloat
Copy link
Member

Running on 32-bit linux (inside a Docker container) I get through bootstrap, but then I get a segfault when I try to run ./julia. Here's the backtrace:

(gdb) bt
#0  0xf7fe479d in elf_machine_rel (skip_ifunc=<optimized out>,
    reloc_addr_arg=<optimized out>, version=<optimized out>, sym=0xf30da45c,
    reloc=0xf313708c, map=0x805d320) at ../sysdeps/i386/dl-machine.h:312
#1  elf_dynamic_do_Rel (skip_ifunc=<optimized out>, lazy=<optimized out>,
    nrelative=<optimized out>, relsize=<optimized out>, reladdr=<optimized out>,
    map=<optimized out>) at do-rel.h:137
#2  _dl_relocate_object (scope=0x805d4d8, reloc_mode=0, consider_profiling=0)
    at dl-reloc.c:258
#3  0xf7fec6bf in dl_open_worker (a=0xffffce9c) at dl-open.c:435
#4  0xf7fe8204 in _dl_catch_error (objname=objname@entry=0xffffce94,
    errstring=errstring@entry=0xffffce98, mallocedp=mallocedp@entry=0xffffce93,
    operate=0xf7fec370 <dl_open_worker>, args=0xffffce9c) at dl-error.c:187
#5  0xf7febf02 in _dl_open (file=0xffffd160 "/src/julia/usr/lib/julia/sys.so",
    mode=-2147483646, caller_dlopen=0xf7d017da <jl_dlopen+119>, nsid=<optimized out>,
    argc=1, argv=0xffffd644, env=0xffffd64c) at dl-open.c:660
#6  0xf7cacbf5 in dlopen_doit (a=0xffffd050) at dlopen.c:66
#7  0xf7fe8204 in _dl_catch_error (objname=0x805d2ec, errstring=0x805d2f0,
    mallocedp=0x805d2e8, operate=0xf7cacb80 <dlopen_doit>, args=0xffffd050)
    at dl-error.c:187
#8  0xf7cad30d in _dlerror_run (operate=operate@entry=0xf7cacb80 <dlopen_doit>,
    args=args@entry=0xffffd050) at dlerror.c:163
#9  0xf7cacc9e in __dlopen (
    file=file@entry=0xffffd160 "/src/julia/usr/lib/julia/sys.so", mode=2) at dlopen.c:87
#10 0xf7d017da in jl_dlopen (
    filename=filename@entry=0xffffd160 "/src/julia/usr/lib/julia/sys.so",
    flags=flags@entry=9) at /src/julia/src/dlload.c:81
#11 0xf7d01a8b in jl_load_dynamic_library_ (
    modname=modname@entry=0xffffd390 "/src/julia/usr/lib/julia/sys",
    flags=flags@entry=9, throw_err=throw_err@entry=0) at /src/julia/src/dlload.c:179
#12 0xf7d01b8a in jl_load_dynamic_library_e (
    modname=0xffffd390 "/src/julia/usr/lib/julia/sys", flags=flags@entry=9)
    at /src/julia/src/dlload.c:204
#13 0xf7d11ddb in jl_preload_sysimg_so (fname=<optimized out>)
    at /src/julia/src/dump.c:2367
#14 0xf7d04558 in _julia_init (rel=<optimized out>, rel@entry=JL_IMAGE_JULIA_HOME)
    at /src/julia/src/init.c:532
#15 0xf7d0510c in julia_init (rel=JL_IMAGE_JULIA_HOME) at /src/julia/src/task.c:292
#16 0x08048f7c in main (argc=<optimized out>, argv=<optimized out>)
    at /src/julia/ui/repl.c:251

This was done through the following, you can do it too if you have docker installed:

$ docker run -ti staticfloat/julia_workerbase_ubuntu16_04:x86
# git clone -b vc/compiler-rt https://github.com/JuliaLang/julia /src/julia
# cd /src/julia; make -j8

@vchuravy
Copy link
Member Author

vchuravy commented Jan 1, 2017 via email

@staticfloat
Copy link
Member

staticfloat commented Jan 1, 2017

Yep, looks good to me. Using analyze-x86 shows:

./analyze-x86 /src/julia/usr/lib/julia/sys.so
instructions:
 cpuid: 0        nop: 1057       call: 109406    count: 1393634
 i486:   58
 i686:   5159
 mmx:    465
 sse:    1226
 sse2:   8087

Note that this output is from my fork of analyze-x86 which knows what AVX instructions look like.

@StefanKarpinski StefanKarpinski modified the milestones: 1.0, 0.6.0 Jan 5, 2017
@felixrehren
Copy link
Contributor

Ping (this is part of equal rights for Float16, right?)

@StefanKarpinski
Copy link
Member

It's good to have, but it was deemed not ready for 0.6, unfortunately.

@vchuravy
Copy link
Member Author

Yes this part of my julia runtime julep, that has the goal of adding first-class support for Float16 and Float128. This got slowed down by other commitments of mine. I still have hope to have some form of this for 1.0.

@StefanKarpinski
Copy link
Member

@vchuravy, what's the prospect for getting this done in the next couple of months?

@StefanKarpinski StefanKarpinski modified the milestones: 1.x, 1.0 Jul 20, 2017
@vchuravy
Copy link
Member Author

Everytime I start working on this I get into shaving another Yak. I think we can get this done in the next few months, but I will first focus on Float128 and then return to this.

@vchuravy
Copy link
Member Author

vchuravy commented Mar 9, 2018

superseded by #26381, while general compiler-rt support might be something we want in the long-term I rather go down the RTLIB approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LLVM checked arithmetic for 128-bit ints is broken
7 participants