language-c-quote
language-c-quote copied to clipboard
ISPC support
This PR adds support for ispc, which is Intel's data parallel C dialect. We've been using these changes to generate ISPC code for a new backend for the Futhark compiler. The PR does not add support for every language construct unique to ISPC, but for the large portion of them that were sufficient for our use case.
We've attempted to pattern match from the existing codebase, but couldn't quite figure out how the script for generating Syntax-instances.hs
works, so we added the relevant typeclasses instances manually. Hope that is fine.
The PR introduces one new shift-reduce error, which is the dangling else problem but for ISPC's own cif
construct. I've added a note.
Added:
- A new ISPC module which encompasses the added language constructs
-
uniform
andvarying
type qualifiers. -
foreach
,foreach_active
,foreach_unique
,foreach_tiled
loops. -
export
andunmasked
storage qualifiers. -
cif
,cfor
,cwhile
,cdo
/while
constructs for coherent control flow. - An antiquotation,
$foreachiters
, to parse iteration spaces forforeach
loops, such asi = 0 ... n
. - A new test suite exercising all the added functionality.
Notable missing language constructs:
-
new
anddelete
syntax for allocating arrays. -
launch
construct for multithreading. - Short vector notation, ie.
float<3>
. - Struct-of-array qualifiers, ie.
soa<8> Point pts[n];
- Reference syntax for interacting with C++, just typical
&
.
Most of these are either fairly niche, and not really necessary for writing idiomatic ISPC for most use cases, though.
@athas FYI
The CI failure seems to be a network issue