-
Notifications
You must be signed in to change notification settings - Fork 0
/
sycl_misc.cpp
54 lines (47 loc) · 1020 Bytes
/
sycl_misc.cpp
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
53
54
#include "sycl_misc.hpp"
#define queue_case(x) \
case x: \
if (nsub == 0) \
return getQueue<x, 0>(); \
else \
return getQueue<x, 1>();
sycl::queue currentQueue(int ndev, int nsub) {
switch(ndev) {
queue_case(0);
queue_case(1);
queue_case(2);
queue_case(3);
queue_case(4);
queue_case(5);
queue_case(6);
queue_case(7);
}
throw std::exception();
}
#define subdev_case(x) \
case x: \
if (nsub == 0) \
return getSubDevice<x, 0>(); \
else \
return getSubDevice<x, 1>();
sycl::device currentSubDevice(int ndev, int nsub) {
switch(ndev) {
subdev_case(0);
subdev_case(1);
subdev_case(2);
subdev_case(3);
subdev_case(4);
subdev_case(5);
subdev_case(6);
subdev_case(7);
}
throw std::exception();
}
static uint32_t g_dev_num = 1;
static uint32_t g_part_num = 0;
sycl::device currentSubDevice() {
return currentSubDevice(g_dev_num, g_part_num);
}
sycl::queue currentQueue() {
return currentQueue(g_dev_num, g_part_num);
}