What does SkJumper do? (and customizing it)

138 views
Skip to first unread message

Matthew Leibowitz

unread,
May 6, 2017, 7:20:43 PM5/6/17
to skia-discuss
Hi there... I was wondering what exactly SkJumper is meant to do?

I see it was added in this commit, and then improved/tweaked over the next few commits:
https://github.com/google/skia/commit/e1caee1ad884def91b8afb50e5672f1f0ee278f1

After updating our fork to chrome/m58, I noticed that I was getting some build warnings and errors. I believe that it has to do just with the mismatch of C flags.

For example, when building for macOS and iOS, I am getting SDK version mismatches:

Right now, I am building with support for macOS 10.9: "-mmacosx-version-min=10.9" and iOS 8.0: "-mios-version-min=8.0". 
How would I go about adding this conditional to the "build_stages.py" script (if that is where it should go)?

And for tvOS, I need to be able to enable bitcode support as well: "-mtvos-version-min=9.0 -fembed-bitcode"

For cases like these, where I need to add custom flags depending on what platform I am building for - how and where do I add them?

Mike Klein

unread,
May 6, 2017, 9:58:01 PM5/6/17
to skia-discuss
SkJumper is a system we use to accelerate CPU-bound work inside Skia lately, most notable color-space conversions and color-correct drawing.  We run build_stages.py offline and check in the platform-specific assembly that it generates into SkJumper_generated.S (most platforms) and SkJumper_generated_win.S (x86-64 Windows).

There's a also portable backup compiled into Skia like normal code.  That should be what you want on platforms that require bitcode like tvOS.  But we don't build or test tvOS, so I wouldn't be surprised if it's not configured correctly.  If you send me how you're building, I'll see if I can reproduce your problems.  We also might be able to make build_stages.py generate bitcode, but it doesn't today.

It's shouldn't be hard to disable the platform specific parts of SkJumper manually if you'd like.  If you replace each "#if __has_feature(memory_sanitizer)" with "#if 1" in SkJumper.cpp, you'll force it through that portable path that's compiled normally.  There's no way for you to change anything about SkJumper assembly files, but for all other source extra_cflags is as always a good way to customize your build.

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To post to this group, send email to skia-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/d/optout.

Matthew Leibowitz

unread,
May 9, 2017, 4:19:40 PM5/9/17
to skia-discuss
Hi Mike, thanks for the explanation. I also found this which was also helpful: https://github.com/google/skia/blob/master/site/dev/contrib/jumper.md

As I need to get bitcode, and a few other parameters passed during the build, I tried to run build_stages.py. 
I downloaded clang from (http://releases.llvm.org/4.0.0/clang+llvm-4.0.0-x86_64-apple-darwin.tar.xz) so that I don't depend on the current OS.

But, sadly I am probably doing it wrong. I get this error:

$ brew install llvm binutils ccache
$ python src/jumper/build_stages.py ../clang/clang+llvm-4.0.0-x86_64-apple-darwin/bin/clang-4.0 

In file included from src/jumper/SkJumper_stages.cpp:8:
In file included from src/jumper/SkJumper.h:40:
/Users/matthew/Projects/SkiaSharp/externals/clang/clang+llvm-4.0.0-x86_64-apple-darwin/bin/../include/c++/v1/string.h:61:15: fatal error: 'string.h' file not found
#include_next <string.h>
              ^~~~~~~~~~
1 error generated.
Traceback (most recent call last):
  File "src/jumper/build_stages.py", line 29, in <module>
    ['-o', 'sse2.o'])
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ccache', '../clang/clang+llvm-4.0.0-x86_64-apple-darwin/bin/clang-4.0', '-x', 'c++', '-std=c++11', '-Os', '-DJUMPER', '-fomit-frame-pointer', '-ffp-contract=fast', '-fno-exceptions', '-fno-rtti', '-fno-unwind-tables', '-msse2', '-mno-sse3', '-mno-ssse3', '-mno-sse4.1', '-c', 'src/jumper/SkJumper_stages.cpp', '-o', 'sse2.o']' returned non-zero exit status 1

Should I be doing something else?

Mike Klein

unread,
May 9, 2017, 4:36:46 PM5/9/17
to skia-discuss
...trying is going....

On Tue, May 9, 2017 at 4:35 PM Mike Klein <mtk...@google.com> wrote:
You'll need /usr/include to exist, I think.  Usually running xcode-select --install has fixed that for me.

It's great that you're playing around with this, but I don't think what you're trying going to just work.  I don't think there's any way to include bitcode in an .S file, and if there is, we're certainly not doing it in build_stages.py.  It's going to take some real work there.

Mike Klein

unread,
May 9, 2017, 4:36:47 PM5/9/17
to skia-discuss
You'll need /usr/include to exist, I think.  Usually running xcode-select --install has fixed that for me.

It's great that you're playing around with this, but I don't think what you're trying going to just work.  I don't think there's any way to include bitcode in an .S file, and if there is, we're certainly not doing it in build_stages.py.  It's going to take some real work there.

Reply all
Reply to author
Forward
0 new messages