Skip to content

Commit 85e4e78

Browse files
Code requirement fixes for RenderKit 05ispc
Signed-off-by: Michael R Carroll <[email protected]>
1 parent 3659819 commit 85e4e78

File tree

5 files changed

+55
-44
lines changed

5 files changed

+55
-44
lines changed

.repo-tools/Docs_Automation/guids.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1162,6 +1162,6 @@
11621162
"BDC6B80E-E764-409D-966B-662CF7EFB072": {
11631163
"guid": "BDC6B80E-E764-409D-966B-662CF7EFB072",
11641164
"ver": "2022.1.0",
1165-
"name": "Intel oneAPI Rendering Toolkit ISPC Getting Started"
1165+
"name": "Intel oneAPI Rendering Toolkit ISPC Getting Started: 05_ispc_gsg"
11661166
}
11671167
}

RenderingToolkit/GettingStarted/05_ispc_gsg/README.md

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ Intel Implicit SPMD Program Compiler (ISPC) optimizes single program multiple da
66
| Minimum Requirements | Description
77
|:--- |:---
88
| OS | Linux* Ubuntu* 18.04, CentOS* 8 (or compatible); Windows* 10; MacOS* 10.15+
9-
| Hardware | Intel 64 Penryn or newer with SSE4.1 extensions or an ARM64 with NEON extensions
9+
| Hardware | Intel 64 Penryn or newer with SSE4.1 extensions; or an ARM64 with NEON extensions
1010
| Compiler Toolchain | Windows* OS: MSVS 2019 installed with Windows* SDK and CMake*; Other platforms: C++11 compiler and CMake*
1111
| Libraries | Install Render Kit including Intel Implicit SPMD Program Compiler
1212

1313
| Optimized Requirements | Description
1414
| :--- | :---
15-
| Hardware | Intel 64 Skylake or newer with AVX512 extentions or ARM64 with NEON extensions
15+
| Hardware | Intel 64 Skylake or newer with AVX512 extensions; or ARM64 with NEON extensions
1616

1717
| Objective | Description
1818
|:--- |:---
@@ -22,27 +22,40 @@ Intel Implicit SPMD Program Compiler (ISPC) optimizes single program multiple da
2222

2323
## Purpose
2424

25-
This getting started sample program, `simple`, performs an element wise operation on an input float array. The output is written to stdout.
26-
The sample builds two programs with Intel IPSC. The programs exhibit the same output behavior.
27-
The first program is targeted to x86_64 systems with SSE2 extensions (introduced in the early 2000s).
28-
The second program is multitargeted for systems with SSE2, SSE4, AVX (AVX1), AVX2, and AVX512SKX extensions. The program will runtime detect the highest target extension capability. The program will then run the codepath associated with that capability on the target system.
29-
This initial sample demonstrates Intel ISPC usage with an introductory program running on CPU only. Other Intel Embree and Intel Open VKL sample programs demonstrate usage of ISPC in conjuction with those libraries.
30-
See more about programming with ISPC with the [documentation](https://ispc.github.io/documentation.html).
25+
This getting started sample highlights three key basic parts to using Intel ISPC.
26+
1) the Intel ISPC kernel, `simple`.
27+
2) kernel linking into a final program
28+
3) vector hardware extension targeting capability
29+
30+
31+
The `simple` kernel, defined in `simple.ispc`, performs an element wise operation on an input float array. The output is written to stdout.
3132

3233

3334
## Key Implementation Details
3435

35-
- Our c++ program has the typical main entry point defined in simple.cpp. The final program is linked to the compiled ISPC kernel function defined in simple.ispc.
36-
- The function prototype for the kernel is introduced by way of this preprocessor code:
36+
### The Kernel and Linking (1 and 2)
37+
38+
- Our sample programs have the main entry point defined in `simple.cpp`. We compile this source to an object with a C++ compiler.
39+
- `simple.ispc` contains the implementation of the kernel function. This source is compiled to an object by the Intel ISPC compiler driver `ispc`.
40+
- The final program is links the C++ object to the Intel ISPC object.
41+
- Within the C++ source, the function prototype for the kernel is introduced by way of this preprocessor code:
3742
```
3843
#include "simple_ispc.h"
3944
```
40-
- simple.ispc contains the implementation of the kernel function.
41-
- The simple_ispc.h header file is generated by the `ispc` compiler driver when it compiles simple.ispc.
42-
- The first program builds the kernel targeted to SSE2 (Streaming SIMD Extensions 2) ISA extensions introduced on CPUs in the early 2000's.
43-
- Compiling the second program will create an object per ISA extension target, as well as a primary kernel linking object. All objects are linked to generate the final binary. The program will runtime detect the appropriate codepath for the target platform.
4445

45-
###Targeting
46+
- Key: The simple_ispc.h header file is generated by the `ispc` compiler driver when it compiles simple.ispc.
47+
48+
### Single and Multitargeting (3)
49+
50+
In this sample, we demonstrate both single and automatic multiple device targeting. Two output programs are built respectively they emit the same output.
51+
52+
- The first build target program, `simple`, builds with the simple.ispc kernel targeted to SSE2 (Streaming SIMD Extensions 2) ISA extensions. These extensions were introduced on CPUs in the early 2000's.
53+
- The second build target program, `simple_multi`, will create an object per ISA extension target, as well as a primary kernel linking object. All objects are then linked to generate the final binary. The program will runtime detect the appropriate codepath for the target platform.
54+
55+
This initial sample demonstrates Intel ISPC usage with an introductory program running on CPU only. Other Intel Embree and Intel Open VKL sample programs demonstrate usage of ISPC in conjuction with those libraries.
56+
See more about programming with Intel ISPC with the [documentation](https://ispc.github.io/documentation.html).
57+
58+
### Targeting Documentation
4659

4760
- To target ISA extension capability introduced in newer x86_64 processors, see the [targeting table](https://ispc.github.io/ispc.html#selecting-the-compilation-target) in the release notes.
4861
- For targeting ARM64 with NEON extensions. See the [target selection](https://ispc.github.io/ispc.html#selecting-the-compilation-target) in the release notes. Edit the CMakeLists.txt file accordingly for the build step.

RenderingToolkit/GettingStarted/05_ispc_gsg/sample.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"guid": "BDC6B80E-E764-409D-966B-662CF7EFB072",
3-
"name": "Intel Implicit SIMD Program Compiler (Intel ISPC) Getting Started",
3+
"name": "Intel Implicit SPMD Program Compiler (Intel ISPC) Getting Started: 05_ispc_gsg",
44
"categories": ["Toolkit/oneAPI Libraries/ISPC"],
5-
"description": "This introductory rendering toolkit sample demonstrates how to compile basic programs with Intel ISPC and the system compiler. Use this sample to further explore developing accelerated applications with Intel Embree and Intel Open VKL.",
5+
"description": "This introductory rendering toolkit sample demonstrates how to compile basic programs with Intel ISPC and the system C++ compiler. Use this sample to further explore developing accelerated applications with Intel Embree and Intel Open VKL.",
66
"builder": ["cli"],
7-
"languages": [{"c":{}}],
7+
"languages": [{"cpp":{}}],
88
"os":["linux", "windows", "darwin"],
99
"targetDevice": ["CPU"],
1010
"ciTests": {

RenderingToolkit/GettingStarted/05_ispc_gsg/src/simple.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,17 @@
3939
using namespace ispc;
4040

4141
int main() {
42-
float vin[16], vout[16];
42+
float vin[16], vout[16];
4343

44-
// Initialize input buffer
45-
for (int i = 0; i < 16; ++i)
46-
vin[i] = (float)i;
44+
// Initialize input buffer
45+
for (int i = 0; i < 16; ++i) vin[i] = (float)i;
4746

48-
// Call simple() function from simple.ispc file
49-
simple(vin, vout, 16);
47+
// Call simple() function from simple.ispc file
48+
simple(vin, vout, 16);
5049

51-
// Print results
52-
for (int i = 0; i < 16; ++i)
53-
printf("%d: simple(%f) = %f\n", i, vin[i], vout[i]);
50+
// Print results
51+
for (int i = 0; i < 16; ++i)
52+
printf("%d: simple(%f) = %f\n", i, vin[i], vout[i]);
5453

55-
return 0;
54+
return 0;
5655
}

RenderingToolkit/GettingStarted/05_ispc_gsg/src/simple.ispc

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,20 @@
3131
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3232
*/
3333

34-
3534
export void simple(uniform float vin[], uniform float vout[],
3635
uniform int count) {
37-
foreach (index = 0 ... count) {
38-
// Load the appropriate input value for this program instance.
39-
float v = vin[index];
40-
41-
// Do an arbitrary little computation, but at least make the
42-
// computation dependent on the value being processed
43-
if (v < 3.)
44-
v = v * v;
45-
else
46-
v = sqrt(v);
47-
48-
// And write the result to the output array.
49-
vout[index] = v;
50-
}
36+
foreach (index = 0 ... count) {
37+
// Load the appropriate input value for this program instance.
38+
float v = vin[index];
39+
40+
// Do an arbitrary little computation, but at least make the
41+
// computation dependent on the value being processed
42+
if (v < 3.)
43+
v = v * v;
44+
else
45+
v = sqrt(v);
46+
47+
// And write the result to the output array.
48+
vout[index] = v;
49+
}
5150
}

0 commit comments

Comments
 (0)