Closed Bug 1173722 Opened 9 years ago Closed 8 years ago

SIMD: keep up with spec, implement recently added functions and missing functions for new types

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: bbouvier, Assigned: bbouvier)

References

Details

(Keywords: dev-doc-complete)

Attachments

(1 file)

This includes, but is not limited to:
- {int16x8,int8x16}.{add,sub}Saturate
- extractLaneAsBool for integer types
- toLocaleString (?)
- valueOf
- int8x16.sumOfAbsoluteDifferences
- some cleanup in the TypedObject.h/.cpp/.js files
- renaming all types so that they start with capital letters

I'll take care of this.
Cool! There has been a lot of churn at the spec level lately, but it does feel like the bulk of it is ready to settle down again for a while. Note that the int8x16.sumOfAbsoluteDifferences API is not yet settled yet [0], and extractLaneAsBool was recently dropped in favor of boolean vector types [1].

[0] https://github.com/johnmccutchan/ecmascript_simd/issues/135
[1] https://github.com/johnmccutchan/ecmascript_simd/pull/189
This patch capitalizes the SIMD types names, as it changed in the spec recently (for consistency with Number, String, etc.). So basically, it's a big search-and-replace s/int32x4/Int32x4, and ditto for the other types. Don't be afraid by the size of the patch, it's mostly renaming in all the .js files (and i've added a few guards on "typeof SIMD" there as well).

Note that although the types functions have been capitalized, the toString() function keeps on returning the lowercase name (that's in the spec, and it makes sense as the SIMD vectors should be value types). So SIMD.Int32x4(1,2,3,4) in the JS shell yields 'int32x4(1, 2, 3, 4)', as before.
Attachment #8629258 - Flags: review?(nicolas.b.pierron)
(In reply to Benjamin Bouvier [:bbouvier] from comment #2)
> Note that although the types functions have been capitalized, the toString()
> function keeps on returning the lowercase name (that's in the spec, and it
> makes sense as the SIMD vectors should be value types). So
> SIMD.Int32x4(1,2,3,4) in the JS shell yields 'int32x4(1, 2, 3, 4)', as
> before.

Doesn't that break the uneval(eval(x)) logic?
Comment on attachment 8629258 [details] [diff] [review]
1. Capitalization

Review of attachment 8629258 [details] [diff] [review]:
-----------------------------------------------------------------

Nit: Avoid confusion caused by the use of the same capitalization for variable names:

  s/var Int32x4 = /var i32x4 =/

and rename all the variable uses as well.
and identically for Float32x4 and Float64x2.
Attachment #8629258 - Flags: review?(nicolas.b.pierron) → review+
(In reply to Nicolas B. Pierron [:nbp] from comment #3)
> (In reply to Benjamin Bouvier [:bbouvier] from comment #2)
> > Note that although the types functions have been capitalized, the toString()
> > function keeps on returning the lowercase name (that's in the spec, and it
> > makes sense as the SIMD vectors should be value types). So
> > SIMD.Int32x4(1,2,3,4) in the JS shell yields 'int32x4(1, 2, 3, 4)', as
> > before.
> 
> Doesn't that break the uneval(eval(x)) logic?

The SIMD.js spec hasn't finalized its choices about the string format of the toString() representation (see also [0]). I'll make an argument in favor of homoiconicity (to make eval(uneval(x)) work) in a spec issue.

[0] http://bnjbvr.github.io/ecmascript_simd/tc39/simd.html#to-string
Actually, the Bool vector implementation needs much more work, in the interpreter and in the JITs. I am trying to think of a way to have Boolx4 encoded as an Int32x4 (that is, spare ourselves new MIR and LIR types), but that might rise issues for bailouts...

A try run with the capitalization patch + patches from bug 1155211:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=05e947274acd
Depends on: 1183188
Depends on: 1160971
I think that with Jakob's work recently done on SIMD, we should be almost on par with spec. All items mentioned in comment 0 are either invalid or resolved, so let's close this meta-bug.
Status: NEW → RESOLVED
Closed: 8 years ago
Keywords: leave-open
Resolution: --- → FIXED
Docs have been updated to use capital SIMD types a while ago. Taking a note to check the things mentioned in comment 0.
No longer depends on: 1250195
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: