Implement runtime detection of SSEBRL-CAD
Status: ClosedTime to complete: 48 hrs Mentors: ErikTags: C, runtime, SSE

BRL-CAD will optionally leverage SSE instructions for some operations but SSE-support is set at compile-time. If you attempt to perform SSE instructions on non-SSE hardware, it'll basically halt the application with an illegal instruction exception. That's a fancy way of saying it crashes.

This task involves implementing a function (that will go into our LIBBU utility library) to reports whether SSE support is available at runtime. The most prevalent method for doing this is demonstrated by the Mesa folks where you set up an exception handler for SIGILL and attempt an SSE instruction. That's obviously a non-solution for Windows platforms, but is better than nothing and more useful than a Windows-only solution. Even better if you can handle both or implement a cross-platform solution. You'll implement a bu_sse_init() function that returns an error if SSE is not available at runtime.

Code:

  • include/bu.h
  • src/libbu/sse.c
Uploaded Work
File name/URLFile sizeDate submitted
foo.txt1 byteJanuary 14 2013 02:53 UTC
Comments
Silvrouson December 17 2012 15:47 UTCTask Claimed

I would like to work on this task.

Andrei Popescu on December 17 2012 15:48 UTCTask Assigned

This task has been assigned to Silvrous. You have 48 hours to complete this task, good luck!

Melange on December 19 2012 15:48 UTCInitial Deadline passed

Melange has detected that the initial deadline has passed and it has set the task status to ActionNeeded. The student has 24 hours to submit the work before the task is reopened and sent back to the pool for other students to claim.

Melange on December 20 2012 15:48 UTCTask Reopened

Melange has detected that the final deadline has passed and it has reopened the task.

Skriptkidon January 11 2013 20:16 UTCTask Claimed

I would like to work on this task.

Sean on January 11 2013 20:18 UTCTask Assigned

This task has been assigned to Skriptkid. You have 48 hours to complete this task, good luck!

Skriptkidon January 12 2013 04:02 UTCWhere should it be implemented?

libbu/simd.c already has a function for runtime detection of SSE. Where should this be implemented? Or rather, where is SSE being used?

Skriptkidon January 13 2013 18:07 UTCDynamic Loading?

Would dynamic loading be the right path here? I've done reasearch for 5 hours, but I've found nothing that can help in toggling headers.

Skriptkidon January 13 2013 19:42 UTCExtension

Need an extension. Please. Was not able to work on this yesteray and today. Started about 6 hours ago and still waiting for some help.

Melange on January 13 2013 20:18 UTCInitial Deadline passed

Melange has detected that the initial deadline has passed and it has set the task status to ActionNeeded. The student has 24 hours to submit the work before the task is reopened and sent back to the pool for other students to claim.

Sean on January 13 2013 22:39 UTCDeadline extended

The deadline of the task has been extended with 1 days and 0 hours.

Sean on January 13 2013 22:41 UTCdynamic loading

Dynamic loading would be a viable solution, but generally not desired.  Better to just compile both the sse and non-see interface and toggle on it (e.g., in dvec) based on sse availability instead of using inheritance.


 

Skriptkidon January 14 2013 02:00 UTCToggling

Should subclassing be done here? Since the definitions of members of dvec are different but prototypes are same, overloading is not possible. How else can they be toggled?

Skriptkidon January 14 2013 02:51 UTCDropping

I guess I'm dropping this. I don't know C++, especially OOP in it, so no point breaking my head over this when i can do some other task, since this is the last day.

Skriptkidon January 14 2013 02:53 UTCReady for review

The work on this task is ready to be reviewed.

Skriptkidon January 14 2013 02:54 UTCUnclaim?

How can I unclaim?! There's no "Unclaim" option!

Sean on January 14 2013 05:18 UTCTask Closed

Congratulations, this task has been completed successfully.

Sean on January 14 2013 05:23 UTCas you noted

As you noted, we technically have an implementation of runtime detection and you identifeid that feature available.  You've also researched the classes involved in using the runtime detection (for considerable time), reaffirming that this is a complex task that will undoubtedly take substantial time (beyond the scope of gci).  Thanks for your efforts.  If you have any insights to share about what you found, you're welcome to comment here or via IRC.


The Melange interface apparently has several bugs when the final 24 hours approaches.  The system seems to have stopped sending e-mails, tasks can't be published .. or claimed .. or unclaimed (yeah, wtf?) .. or edited.  Some sort of lame duck status instead of just letting everything proceed up to the deadline.

Skriptkidon January 14 2013 06:41 UTCSubclassing

Subclassing might be a good idea. You have the main(base) dvec class. Create two subclasses which inhert it. One for x86 and one for FPU. You have all the methods of dvec, but you're defining them seperately in each case and using them conditionally during runtime. But of course, this might need code changes in many places, and I don't know if derived classes can have multiple definitions for prototypes in parent class.(As I said, I dont know OOP in C++) But that's just one idea I have.


BTW, are you on IRC? I see no activity, considering there's only 10 hours left.