Closed Bug 1133565 Opened 10 years ago Closed 10 years ago

SIMD: Factor template objects within a compartment

Categories

(Core :: JavaScript Engine: JIT, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla38
Tracking Status
firefox38 --- fixed

People

(Reporter: bbouvier, Assigned: bbouvier)

References

Details

Attachments

(2 files)

Each time Baseline sees a SIMD call site, it will create a template object of the right kind. This is inefficient, as each SIMD operation has its own call site. We can spare some memory by factoring the template objects.
How does this look? Sorry if I am misusing any function here, I'm fairly new to all this compartment world... I've looked on the SIMD mandelbrot demo, it prevents creation from ~10 template objects. All these objects are inlined, so not sure it's a big win, we might want to look at real world SIMD kernels compiled from Emscripten.
Attachment #8565131 - Flags: feedback?(jdemooij)
Comment on attachment 8565131 [details] [diff] [review] simd-templates.patch Review of attachment 8565131 [details] [diff] [review]: ----------------------------------------------------------------- Nice! ::: js/src/builtin/TypedObject.h @@ +333,5 @@ > enum Type { > TYPE_INT32 = JS_SIMDTYPEREPR_INT32, > TYPE_FLOAT32 = JS_SIMDTYPEREPR_FLOAT32, > + TYPE_FLOAT64 = JS_SIMDTYPEREPR_FLOAT64, > + LAST_TYPE This name is a bit confusing; I think it'd be clearer as LAST_TYPE = TYPE_FLOAT64 and then use +1 when you use it. Or call it NUM_TYPES. ::: js/src/jit/JitCompartment.h @@ +433,5 @@ > JitCode *stringConcatStub_; > JitCode *regExpExecStub_; > JitCode *regExpTestStub_; > > + JSObject *simdTemplateObjects_[SimdTypeDescr::LAST_TYPE]; Use mozilla::Array so that we get bounds checks automatically. @@ +442,5 @@ > > public: > + JSObject *getSimdTemplateObjectFor(JSContext *cx, Handle<SimdTypeDescr*> descr) { > + MOZ_ASSERT(descr->type() < SimdTypeDescr::LAST_TYPE); > + JSObject **tpl = &simdTemplateObjects_[descr->type()]; I think the array should use ReadBarrieredObject instead of JSObject*, this is necessary for incremental GC. I thought we had to access these pointers during Ion compilation, but we don't so it should be fine.
Attachment #8565131 - Flags: feedback?(jdemooij) → feedback+
Attachment #8565445 - Flags: review?(jdemooij)
Attachment #8565445 - Flags: review?(jcoppeard)
Comment on attachment 8565445 [details] [diff] [review] Factor SIMD templates within a compartment Review of attachment 8565445 [details] [diff] [review]: ----------------------------------------------------------------- Looks good!
Attachment #8565445 - Flags: review?(jcoppeard) → review+
Comment on attachment 8565445 [details] [diff] [review] Factor SIMD templates within a compartment Review of attachment 8565445 [details] [diff] [review]: ----------------------------------------------------------------- nit: Remove the comment from MSimdBox::congruentTo.
Comment on attachment 8565445 [details] [diff] [review] Factor SIMD templates within a compartment Review of attachment 8565445 [details] [diff] [review]: ----------------------------------------------------------------- Beautiful.
Attachment #8565445 - Flags: review?(jdemooij) → review+
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: