POV-Ray

The Persistence of Vision Raytracer (POV-Ray).

This is the legacy Bug Tracking System for the POV-Ray project. Bugs listed here are being migrated to our github issue tracker. Please refer to that for new reports or updates to existing ones on this system.

Tasklist

FS#294 - Thread safety issue in functions using splines. 3.7.0.RC7.

Attached to Project: POV-Ray
Opened by William F Pokorny (wfpokorny) - Wednesday, 05 June 2013, 10:25 GMT
Last edited by William F Pokorny (wfpokorny) - Tuesday, 11 October 2016, 13:25 GMT
Task Type Definite Bug
Category Backend → Geometric Primitives
Status Closed
Assigned To Grimbert Jérôme (Le_Forgeron)
Operating System All
Severity High
Priority Normal
Reported Version 3.70 RC7
Due in Version 3.70 release
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Thread safety issue in functions using splines. 3.7.0.RC7.

First vetting in p.bugreports where several users were able to reproduce the fail on the following systems:

1) Ubuntu 12.1 i7 920 using 3.7.0.RC7
2) Ubuntu 12.04, AMD 2431 CPU, Linux 3.2.0-45 kernel using 3.7.0.RC7 (g++ 4.6 @x86_64-unknown-linux-gnu)
3) POV-Ray 3.7.0.RC7 (icpc 13.1.0 @x86_64-unknown-linux-gnu)

 Intel(R) Xeon(R) CPU E5-2680 0 @ 2.70GHz
 uname -or
 2.6.32-279.14.1.el6.x86_64 GNU/Linux
 lsb_release -irc
 Distributor ID: CentOS
 Release:        6.3
 Codename:       Final

4) Confirmed with openSUSE 12.2.
5) Just to add to the system list: with Windows and a core i7 one yields the same result.
6) “Le_Forgeron” ran under Intel Inspector (XE 2013) and provided this feedback :

 ...
  that might be less than 60 seconds, but with Intel Inspector (XE 2013),
 it becomes 42:50 (just 14 data races, oh well, that's just so friendly).
 ID  Type Sources Modules State
 P1  Data race isosurf.cpp; mutex.hpp povray New
 P2  Data race mutex.hpp; povms.cpp povray New
 P3  Data race povray.cpp povray New
 P4  Data race povray.cpp povray New
 P5  Data race mutex.hpp; pov_mem.cpp; splines.cpp povray New
 P6  Data race mutex.hpp; pov_mem.cpp; splines.cpp povray New
 P7  Data race mutex.hpp; pov_mem.cpp; splines.cpp povray New
 P8  Data race recursive_mutex.hpp; scene.cpp; task.cpp; taskqueue.cpp;
 view.cpp povray New
 P9  Data race condition_variable.hpp; vfe.cpp; vfesession.cpp povray New
 P10  Data race condition_variable.hpp; unixconsole.cpp; vfesession.cpp
 povray New
 P11  Data race condition_variable.hpp; unixconsole.cpp; vfesession.cpp
 povray New
 P12  Data race unixconsole.cpp; vfesession.cpp; vfesession.h povray New
 P13  Data race unixconsole.cpp; vfesession.cpp povray New
 P14  Data race [Unknown]; unixconsole.cpp; vfesession.cpp
 libboost_thread.so.1.49.0; povray New
 Numbers 2, 3, 4, 8, 9, 10, 11, 12, 13 & 14 are related to the handling
 of session (and occur once or twice only, excepted #8, four times).
 Number 1 is about isosurface (adjusting gradient at isosurf.cpp:1099 vs
 1098 (testing its value), and copying the isosurface) (IMHO, rendering
 threads updating the object... not the best move without some
 atomic/protection (and not sure a DBL is/can be atomic)) (occurs 2505
 times).
 Number 5, 6 and 7 are about splines
 * sp->Cache_Type & Cache_Point, splines.cpp :803 vs :814/815 (2024 times)
 * sp->Cache_Valid, :805 vs :813 vs :904 (1770 times)
 * sp->Cache_Data, :807 vs :903 (5025 times)
 Only my 0.02¢ (yes, very cheap), but it seems to confirm

For test code see attached files or SplineThreadSafety.pov attachment to
p.bugreports and images were posted to p.b.images.

Issue shows up any time more than one thread is used. Use of AA tends to hide
the problem so do not use it if using the output image for testing.

Thanks.
Bill P.

This task depends upon

Closed by  William F Pokorny (wfpokorny)
Tuesday, 11 October 2016, 13:25 GMT
Reason for closing:  Fixed
Additional comments about closing:  Verified fixed in 3.7.0 and our current 3.7.1 master branch. Also looks to me like the cache code was removed and not just disabled.
Comment by Grimbert Jérôme (Le_Forgeron) - Saturday, 08 June 2013, 10:00 GMT

Missing magic from description:

  • povray +ISplineThreadSafety.pov -A -D +THfs +WT8 +AM2 +MB5 +H800 +W800
  • povray +ISplineThreadSafety.pov -A -D +THfs +WT1 +AM2 +MB5 +H800 +W800


Comment by Grimbert Jérôme (Le_Forgeron) - Saturday, 08 June 2013, 11:10 GMT

Experimenting with the code of spline, 1 thread, gcc compiler:


3.7RC7 code (instrumented with 2 extra size_t):

  • cache used for 50.1434%, (198018254 / 394904150)
  • render time: 175 s (175.085 CPU-seconds total, 175.617 seconds)

Cachectomised spline code (no caching, smaller structure)

  • render time: 152 s (151.727 CPU-seconds total, 152.188 seconds)

Despite being useful to avoid computation of the spline again, the cache is slower than the direct computation (at least on this scene).

I would vote for removing that cache of the spline.

Comment by Grimbert Jérôme (Le_Forgeron) - Sunday, 09 June 2013, 09:19 GMT

Fixed with change 5907.

Loading...