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

embree mis-identified a cpu as avx2 compliant instead of avx on default setting #112

Closed
luyatshimbalanga opened this issue Jan 19, 2017 · 13 comments

Comments

@luyatshimbalanga
Copy link

While working on debugging luxrender, I hit an issue below

[New Thread 0x7fffc4756700 (LWP 2831)]

Thread 1 "luxrender" received signal SIGILL, Illegal instruction.
0x00007ffff494cda8 in _GLOBAL__sub_I_bvh_intersector_stream_filters.cpp.avx2.cpp(void) ()
at /usr/src/debug/embree-2.13.0/kernels/bvh/bvh_intersector_stream_filters.cpp:431
431 };

The hardware used is an AMD chipset
model name : AMD A10-7400P Radeon R6, 10 Compute Cores 4C+6G
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc extd_apicid aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 popcnt aes xsave avx f16c lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs xop skinit wdt lwp fma4 tce nodeid_msr tbm topoext perfctr_core perfctr_nb bpext ptsc cpb hw_pstate vmmcall fsgsbase bmi1 xsaveopt arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold overflow_recov

embree should properly assign the support avx but went straight to avx2. Current workaround is to set the max_isa to avx as default.

You can view Fedora bug report related to luxrender using embree
https://bugzilla.redhat.com/show_bug.cgi?id=1414611

@cbenthin
Copy link
Contributor

Hi,

Which Embree version did you use? Could you pass "verbose=2" as configuration string to rtcNewDevice and send us the output? This will tell us what the CPU flags scanning step found out exactly.

Thanks.

@luyatshimbalanga
Copy link
Author

embree 2.13.0
Which line should I assign verbose=2?
Here is the spec file currently used on Fedora 25
https://src.fedoraproject.org/cgit/rpms/embree.git/tree/embree.spec?h=f25

@cbenthin
Copy link
Contributor

There should be a rtcNewDevice() call in luxrender source code. Just replace the line with rtcNewDevice("verbose=2").

@luyatshimbalanga
Copy link
Author

Unfortunately rtcNewDevice() is unlisted inside LuxRender source code i.e.
$ grep -inr "rtcNewDevice()" luxrender-lux-b3f85cf7742f

@johguenther
Copy link
Contributor

Alternatively you can create a file .embree2 containing the line verbose=2 and place it either in the home directory, or where luxrender is located.

@cbenthin
Copy link
Contributor

Maybe LuxRender is using the old deprecated interface, so instead of rtcNewDevice() is there a rtcInit()?

@luyatshimbalanga
Copy link
Author

Unfortunately no for rtcInit with the resulting command
$ grep -inr "rtcInit()" luxrender-lux-b3f85cf7742f

I created .embree2 with the line verbose=2 located on home directory. Do I need to type luxrender command or something else?

@cbenthin
Copy link
Contributor

I'm sorry but I'm not familiar with luxrender. How did you run it the last time when you encountered the illegal instruction?

@luyatshimbalanga
Copy link
Author

luyatshimbalanga commented Jan 19, 2017

I built embree 2.13.0 with default configuration on Fedora using attached spec file then use the dependency on luxrender. According to the reporters on bugzilla,
luxrender using embree runs fine with Intel CPUs even those without AVX2 support but encounters illegal instruction on non-Intel CPU notably AMD in my case. It is only by lowering the max_isa to AVX on embree luxrender will run fine. It looks like embree got confused when detecting non-Intel CPU and failed to properly assign the right ISA.

@cbenthin
Copy link
Contributor

I've looked at the CPU flags detection code and the AVX2 ISA support will only be enabled if the correct bit is set in the value returned by the cpuid instruction. The questions is why is this bit set on the AMD part or does the AMD part need a different detection mechanism? :) Could you reach out to the original reporter on bugzilla to contact us, directly as we don't have access the AMD HW to do some additional testing.

Thanks.

@luyatshimbalanga
Copy link
Author

luyatshimbalanga commented Jan 19, 2017

Sure. I will send the message. I am the only reporter with AMD device on the current bugzilla but I can ask other Fedora contributors for assistance.

@svenwoop
Copy link
Contributor

svenwoop commented Jan 27, 2017

This bug seems to occur in the initialization code of the rayStreamFilters global variable. Looks like the compiler issued AVX2 instructions in that code sequence. I added a fix for this to our devel branch (commit 7a9825c). It would be great if you could check if the following fixes the issue when applied to Embree v2.13.0:

git cherry-pick 7a9825c

@luyatshimbalanga
Copy link
Author

@svenwoop
I confirm the fix worked for embree 2.13.0 allowing LuxRender to run as normal. See the Fedora git repository of embree. Thank you for the work and also @cbenthin for the efforts.

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

No branches or pull requests

4 participants