File: ISPCDevice.ispc

package info (click to toggle)
ospray 3.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,048 kB
  • sloc: cpp: 80,569; ansic: 951; sh: 805; makefile: 170; python: 69
file content (52 lines) | stat: -rw-r--r-- 1,000 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright 2009 Intel Corporation
// SPDX-License-Identifier: Apache-2.0

OSPRAY_BEGIN_ISPC_NAMESPACE

#ifdef OSPRAY_TARGET_SYCL
int ISPCDevice_programCount()
{
  // TODO: This should query the GPU width for ISPC,
  // But for SYCL we're in a scalar context, so just 1 program wide
  return 1;
}

int ISPCDevice_isa()
{
  // TODO: GPU ISA/width detection
  // Not relevant for SYCL
  return 0;
}

#else
export uniform int ISPCDevice_programCount()
{
  return programCount;
}

export uniform int ISPCDevice_isa()
{
#if defined(ISPC_TARGET_SSE2)
  return 1;
#elif defined(ISPC_TARGET_SSE4)
  return 2;
#elif defined(ISPC_TARGET_AVX)
  return 3;
#elif defined(ISPC_TARGET_AVX2)
  return 4;
#elif defined(ISPC_TARGET_AVX512SKX)
  return 5;
#elif defined(ISPC_TARGET_NEON)
  return 6;
#else
  return 0;
#endif
}

export uniform float ISPCDevice_dummyCompute(const float *uniform fp)
{
  const float f = *((const varying float *uniform)fp);
  return reduce_add(f * f);
}
#endif
OSPRAY_END_ISPC_NAMESPACE