@@ -749,7 +749,7 @@ <h2>Compiling and Running a Simple ISPC Program</h2>
749749</ div >
750750< div class ="section " id ="using-the-ispc-compiler ">
751751< h1 > Using The ISPC Compiler</ h1 >
752- < p > To go from a < tt class ="docutils literal "> ispc</ tt > source file to an object file that can be linked
752+ < p > To go from an < tt class ="docutils literal "> ispc</ tt > source file to an object file that can be linked
753753with application code, enter the following command</ p >
754754< pre class ="literal-block ">
755755ispc foo.ispc -o foo.o
@@ -1247,7 +1247,7 @@ <h1>The ISPC Parallel Execution Model</h1>
12471247Language</ a > section for details on language syntax.</ p >
12481248< div class ="section " id ="basic-concepts-program-instances-and-gangs-of-program-instances ">
12491249< h2 > Basic Concepts: Program Instances and Gangs of Program Instances</ h2 >
1250- < p > Upon entry to a < tt class ="docutils literal "> ispc</ tt > function called from C/C++ code, the execution
1250+ < p > Upon entry to an < tt class ="docutils literal "> ispc</ tt > function called from C/C++ code, the execution
12511251model switches from the application's serial model to < tt class ="docutils literal "> ispc</ tt > 's execution
12521252model. Conceptually, a number of < tt class ="docutils literal "> ispc</ tt > < em > program instances</ em > start
12531253running concurrently. The group of running program instances is a
@@ -2342,25 +2342,20 @@ <h2>Short Vector Types</h2>
23422342< pre class ="literal-block ">
23432343typedef float<3> float3;
23442344</ pre >
2345- < p > < tt class ="docutils literal "> ispc</ tt > doesn't support templates in general. In particular,
2346- not only must the vector length be a compile-time constant, but it's
2347- also not possible to write functions that are parameterized by vector
2348- length.</ p >
2345+ < p > The vector length must be a compile-time constant.</ p >
23492346< pre class ="literal-block ">
23502347uniform int i = foo();
2351- // ERROR: length must be compile-time constant
2352- float<i> vec;
2353- // ERROR: can't write functions parameterized by vector length
2354- float<N> func(float<N> val);
2348+ float<i> vec; // ERROR: length must be compile-time constant
23552349</ pre >
23562350< p > Arithmetic on these short vector types works as one would expect; the
2357- operation is applied component-wise to the values in the vector. Here is a
2358- short example:</ p >
2351+ operation is applied component-wise to the values in the vector. The vector
2352+ length can be a template parameter. Here is a short example:</ p >
23592353< pre class ="literal-block ">
2360- float<3> func(float<3> a, float<3> b) {
2354+ template <int N>
2355+ float<N> func(float<N> a, float<N> b) {
23612356 a += b; // add individual elements of a and b
23622357 a *= 2.; // multiply all elements of a by 2
2363- bool<3 > test = a < b; // component-wise comparison
2358+ bool<N > test = a < b; // component-wise comparison
23642359 return test ? a : b; // return each minimum component
23652360}
23662361</ pre >
@@ -2703,7 +2698,7 @@ <h2>noescape</h2>
27032698
27042699void escaping(__attribute__((noescape)) uniform int * uniform ptr) {
27052700 // Not OK, because ptr escapes the function
2706- uniform int *uniform global_ptr = ptr;
2701+ global_ptr = ptr;
27072702}
27082703</ pre >
27092704</ div >
@@ -2739,7 +2734,7 @@ <h2>unmangled</h2>
27392734< div class ="section " id ="external-only ">
27402735< h2 > external_only</ h2 >
27412736< p > < tt class ="docutils literal "> < span class ="pre "> __attribute__((external_only))</ span > </ tt > can be applied to a function with
2742- < tt class ="docutils literal "> export</ tt > qualifier. It informs the compiler that it should not generate a
2737+ < tt class ="docutils literal "> export</ tt > qualifier. It informs the compiler that it should not generate an
27432738ISPC version of the function. This is useful for functions that are only called
27442739from C/C++ in case when the user wants to reduce the size of the generated
27452740code. Same effect can be achieved by using < tt class ="docutils literal "> < span class ="pre "> -ffunction-sections</ span > </ tt > compiler
@@ -3981,7 +3976,7 @@ <h2>Basic Math Functions</h2>
39813976float rcp(float v)
39823977uniform float rcp(uniform float v)
39833978</ pre >
3984- < p > ispc also provides a version of < tt class ="docutils literal "> rcp()</ tt > for float with less precision which doesn't
3979+ < p > ISPC also provides a version of < tt class ="docutils literal "> rcp()</ tt > for float with less precision which doesn't
39853980use Newton-Raphson.</ p >
39863981< pre class ="literal-block ">
39873982float rcp_fast(float v)
@@ -4067,7 +4062,7 @@ <h2>Transcendental Functions</h2>
40674062float rsqrt(float v)
40684063uniform float rsqrt(uniform float v)
40694064</ pre >
4070- < p > ispc also provides a version of < tt class ="docutils literal "> rsqrt()</ tt > for float with less precision which doesn't
4065+ < p > ISPC also provides a version of < tt class ="docutils literal "> rsqrt()</ tt > for float with less precision which doesn't
40714066use Newton-Raphson.</ p >
40724067< pre class ="literal-block ">
40734068float rsqrt_fast(float v)
@@ -5473,7 +5468,7 @@ <h2>Data Alignment and Aliasing</h2>
54735468< p > The first is that it is required that it be valid to read memory at the
54745469first element of any array that is passed to < tt class ="docutils literal "> ispc</ tt > . In practice, this
54755470should just happen naturally, but it does mean that it is illegal to pass a
5476- < tt class ="docutils literal "> NULL</ tt > pointer as a parameter to a < tt class ="docutils literal "> ispc</ tt > function called from the
5471+ < tt class ="docutils literal "> NULL</ tt > pointer as a parameter to an < tt class ="docutils literal "> ispc</ tt > function called from the
54775472application.</ p >
54785473< p > The second constraint is that pointers and references in < tt class ="docutils literal "> ispc</ tt > programs
54795474must not alias. The < tt class ="docutils literal "> ispc</ tt > compiler assumes that different pointers
0 commit comments