ORC compiler is disabled on the iOS devices
Submitted by Denis
Link to original bug (#742843)
Description
Here’s the ORC output in log. Init stage:
ORC: INFO: orcdebug.c(70): void _orc_debug_init()(): orc-0.4.23.1 debug init
ORC: INFO: orcprogram-neon.c(129): void orc_neon_init()(): marking neon backend non-executable
and then there’s continuous warnings like this one during the pipeline execution:
ORC: WARNING: orccompiler.c(392): OrcCompileResult orc_program_compile_full(OrcProgram *, OrcTarget *, unsigned int)(): program orc_combine4_12xn_u8 failed to compile, reason: Compilation disabled, using emulation
There’s nothing more specific about why NEON is disabled but tracing with debugger shows that orc_arm_get_cpu_flags in orccpu-arm.c has practically no executable code for IOS (one branch is #if'd for linux only and one for Android-only) and will always return 0 (which means no NEON support).
Verified on iPad 3rd gen and iPad mini 1st gen.
If i apply a hack to orc_arm_get_cpu_flags to return NEON flag support ORC compiler is enabled and works well on the iPad mini 1st gen. On the iPad 3rd gen i’m getting segfaults from different gstreamer->orc bridges like video_orc_chroma_up_v2_u8 (videoscale plugin), video_test_src_orc_splat_u32 (videotestsrc) etc.
per hw info iPad 3rd get uses A5x chip while iPad mini (1st gen) uses A5 so that’s really strange why orc works ok with 2nd but not with 1st.
Example stack trace for the iPad 3 segfault:
#0 0x02ec8e90 in 0x02ec8e90 ()
#1 0x003d7138 in video_test_src_orc_splat_u32 at /Users/D/cerbero/sources/ios_universal/armv7/gst-plugins-base-1.0-static-1.5/gst/videotestsrc/tmp-orc.c:215
#2 0x003d71fc in gst_video_test_src_smpte at /Users/D/cerbero/sources/ios_universal/armv7/gst-plugins-base-1.0-static-1.5/gst/videotestsrc/videotestsrc.c:350
#3 0x003d6c9a in gst_video_test_src_fill at /Users/D/cerbero/sources/ios_universal/armv7/gst-plugins-base-1.0-static-1.5/gst/videotestsrc/gstvideotestsrc.c:951
#4 0x00a60a80 in gst_base_src_default_create at /Users/D/cerbero/sources/ios_universal/armv7/gstreamer-1.0-1.5/libs/gst/base/gstbasesrc.c:1482
#5 0x00a5d0ae in gst_base_src_get_range at /Users/D/cerbero/sources/ios_universal/armv7/gstreamer-1.0-1.5/libs/gst/base/gstbasesrc.c:2455
#6 0x00a5c8de in gst_base_src_loop at /Users/D/cerbero/sources/ios_universal/armv7/gstreamer-1.0-1.5/libs/gst/base/gstbasesrc.c:2731
#7 0x00acaeec in gst_task_func at /Users/D/cerbero/sources/ios_universal/armv7/gstreamer-1.0-1.5/gst/gsttask.c:316
#8 0x0093f26c in g_thread_pool_thread_proxy at /Users/D/cerbero/sources/ios_universal/armv7/glib-2.42.0/glib/gthreadpool.c:307
#9 0x00942156 in g_thread_proxy at /Users/D/cerbero/sources/ios_universal/armv7/glib-2.42.0/glib/gthread.c:764
#10 0x38502e66 in _pthread_body ()
#11 0x38502dda in _pthread_start ()
Variables for frame 1:
d1 guint8 * "" 0x03181000
p1 int -2139034625 -2139034625
n int 91 91
_ex OrcExecutor
program OrcProgram * NULL 0x00000000
n int 91 91
counter1 int 108279884 108279884
counter2 int 460800 460800
counter3 int 16 16
arrays void *[64]
params int [64]
accumulators int [4]
ex OrcExecutor * NULL 0x00000000
program OrcProgram * NULL
n int
counter1 int
counter2 int
counter3 int
arrays void [64]
params int [64]
accumulators int [4]
func void ()(OrcExecutor *) NULL
p OrcProgram * NULL
Code
void
video_test_src_orc_splat_u32 (guint8 * ORC_RESTRICT d1, int p1, int n)
{
OrcExecutor _ex, *ex = &_ex;
static volatile int p_inited = 0;
static OrcCode *c = 0;
void (*func) (OrcExecutor *);
if (!p_inited) {
orc_once_mutex_lock ();
if (!p_inited) {
OrcProgram *p;
#if 1
static const orc_uint8 bc[] = {
1, 9, 28, 118, 105, 100, 101, 111, 95, 116, 101, 115, 116, 95, 115, 114,
99, 95, 111, 114, 99, 95, 115, 112, 108, 97, 116, 95, 117, 51, 50, 11,
4, 4, 16, 4, 128, 0, 24, 2, 0,
};
p = orc_program_new_from_static_bytecode (bc);
orc_program_set_backup_function (p, _backup_video_test_src_orc_splat_u32);
#else
p = orc_program_new ();
orc_program_set_name (p, "video_test_src_orc_splat_u32");
orc_program_set_backup_function (p, _backup_video_test_src_orc_splat_u32);
orc_program_add_destination (p, 4, "d1");
orc_program_add_parameter (p, 4, "p1");
orc_program_append_2 (p, "storel", 0, ORC_VAR_D1, ORC_VAR_P1, ORC_VAR_D1, ORC_VAR_D1);
#endif
orc_program_compile (p);
c = orc_program_take_code (p);
orc_program_free (p);
}
p_inited = TRUE;
orc_once_mutex_unlock ();
}
ex->arrays[ORC_VAR_A2] = c;
ex->program = 0;
ex->n = n;
ex->arrays[ORC_VAR_D1] = d1;
ex->params[ORC_VAR_P1] = p1;
func = c->exec;
func (ex); <---------------- SEGFAUL HERE
}
Version: 1.4.5