River Trail enables new web usages with positive impact on performances using high-level parallel patterns, bounds checked array accesses, automatic heap management and familiar JavaScript libraries.
1. “River Trail: A Path to Parallelism in JavaScript”
by S. Herhut, R.L. Hudson, T. Shpeisman, J. Sreeram
Intel Labs, Santa Clara, CA
https://dl.acm.org/doi/pdf/10.1145/2544173.2509516
Course of
Seminars in Advanced Topics
in Computer Science
Engineering
Roberto Falconi
Sapienza – University of Rome
M.Sc. Engineering in Computer Science, a.y. 2019/2020
2. Summary
• Abstract: problem and solution
• Introduction: an overview on JavaScript
• Language design: Concurrency Model,
ParallelArray, API Methods and extension
• Implementation: the prototype architecture
and what is missing and why
• Experimental evaluation: parallel speedup
with and without River Trail on CPU or GPU
and hybrid configurations
• Related works
• Conclusions
Intel Labs logo
3. Abstract: problem and
solution
We will see how River Trail enables new web
usages with positive impact on performances
• Problem: web apps are predominantly
sequential and do not use hw parallelism
• Solution: River Trail provides HPC parallel
programming model for JavaScript
JavaScript logo
Intel multi-core CPU render
4. Introduction: an
overview on JavaScript
JavaScript difficulties:
• Security and safety, due to users'
control on browser
• Web dev community demanding
for familiar tools
• Compatibility and performance
In the image, we can see XML3D Museum
which is a 3D virtual room
XML3D Museum, a 3D virtual room
5. Language design:
Concurrency Model
River Trail uses:
• High-level parallel patterns
• Rejection of pointers, bounds
checked array accesses and
automatic heap management
• Familiar JavaScript libraries
The dev community refused complicated
artifacts such as complex memory
models, data races, deadlocks, etc.
Temporal immutability: siblings’ task are
free to allocate and mutate their local
heap but cannot communicate with each
other; while children are running parents
are stopped
6. Language Design:
ParallelArray API
River Trail provides ParallelArray data structure:
• Can be cast from JavaScript array-like
objects or with its own constructor
• Is immutable
• Can encapsulate different objects
(including others ParallelArray)
• Uses index vectors instead of scalar
indices
7. Language Design: API Methods
ParallelArray is a basic abstraction for
parallel computation with:
• Only six methods, returning a
ParallelArray (exception made for
reduce which returns a scalar)
• A minimalistic approach in order to
minimize the compiler implementation
size
8. Language Design: API
Methods extension
Focusing the language’s design on the
fundamental issues, authors minimized
the length of the re-design development
cycle
Other methods can be easily designed
and implemented using the existing ones
9. Implementation: the prototype architecture
Prototype consists in:
• JavaScript Engine with its kernel and
River Trail’s library and compiler
• OpenCL Binding with its kernel
• OpenCL Runtime
10. Implementation: what
is missing and why
The prototype does not implement:
• Closure bound variables, avoiding deeper
integration into the JavaScript engine
• User thrown exceptions, aborting concurrent
execution and switching to a sequential one
• Value polymorphism, not required for elemental
function
11. Experimental evaluation
The authors made three types of experiments
on an Intel i7-3770 (and an integrated Intel HD
Graphics 4000 GPU) using Firefox:
• Performance and scaling on a CPU with
sequential JavaScript
• Performance impact of optimization
only on a CPU with River Trail
• Performance of optimization with both
CPU and GPU (hybrid configurations)
12. Experimental
evaluation: parallel
speedup with CPU
The first chart shows the impact of the number of hardware
threads on parallel speedups without optimizations
The second chart shows the impact of the optimizations
13. Experimental evaluation:
parallel speedup with both
CPU and GPU
The River Trail runtime supports execution of kernels on GPU
devices transparently to the programmer and the compiler
14. Related works
Most of existing approaches (Lime for Java, TBB for C++, TPL
for C#) use ahead-of-time compilation instead of JIT
WebCL embeds OpenCL into JavaScript too but it retrofits
web security and it is not so minimalistic and lightweight
15. Conclusions
River Trail gives developers parallel programming tools for
JavaScript
It is safe and secure, builds on existing developer knowledge
and offers performance improvement, portability and
compatibility