Skip to content

Commit b3bec66

Browse files
committed
various cleanups
1 parent e468347 commit b3bec66

2 files changed

Lines changed: 4 additions & 43 deletions

File tree

cuBQL/builder/omp/refit.h

Lines changed: 4 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace cuBQL {
1010
namespace omp {
1111

1212
template<typename T, int D> inline
13-
void refit_init_x(Kernel kernel,
13+
void refit_init(Kernel kernel,
1414
typename BinaryBVH<T,D>::Node *nodes,
1515
uint32_t *refitData,
1616
int numNodes)
@@ -23,17 +23,12 @@ namespace cuBQL {
2323
node.bounds = box_t<T,D>();
2424
if (node.admin.count) return;
2525

26-
// if (node.admin.offset < 0)
27-
// { printf("BAD OFFSET IN INIT(1)\n"); return; }
28-
// if (node.admin.offset+1 >= numNodes)
29-
// { printf("BAD OFFSET IN INIT(2)\n"); return; }
3026
refitData[node.admin.offset+0] = nodeID << 2;
3127
refitData[node.admin.offset+1] = nodeID << 2;
3228
}
3329

3430
template<typename T, int D> inline
35-
void refit_run_x(Kernel kernel,
36-
// BinaryBVH<T,D> bvh,
31+
void refit_run(Kernel kernel,
3732
uint32_t *bvh_primIDs,
3833
typename BinaryBVH<T,D>::Node *bvh_nodes,
3934
uint32_t *refitData,
@@ -45,12 +40,10 @@ namespace cuBQL {
4540

4641
typename BinaryBVH<T,D>::Node *node = bvh_nodes+nodeID;
4742

48-
// printf("begin nodeID %i\n",nodeID);
4943
if (node->admin.count == 0)
5044
// this is a inner node - exit
5145
return;
5246

53-
// printf(" -> leaf %i cnt %i ofs %i\n",nodeID,node->admin.count,node->admin.offset);
5447
box_t<T,D> bounds; bounds.set_empty();
5548
for (int i=0;i<node->admin.count;i++) {
5649
const box_t<T,D> primBox = boxes[bvh_primIDs[node->admin.offset+i]];
@@ -61,9 +54,7 @@ namespace cuBQL {
6154

6255
int parentID = (refitData[nodeID] >> 2);
6356
while (true) {
64-
// printf("parentID %i\n",parentID);
6557
atomic_grow(*(AtomicBox<box_t<T,D>> *)&node->bounds,bounds);
66-
// node->bounds = bounds;
6758

6859
if (node == bvh_nodes)
6960
break;
@@ -98,49 +89,20 @@ namespace cuBQL {
9889
= (uint32_t*)ctx->alloc(numNodes*sizeof(uint32_t));
9990
auto bvh_nodes = bvh.nodes;
10091
auto bvh_primIDs = bvh.primIDs;
101-
PING;
102-
PRINT(numNodes);
103-
PRINT(bvh.numNodes);
10492
{
10593
#pragma omp target device(ctx->gpuID) is_device_ptr(refitData) is_device_ptr(bvh_nodes)
10694
#pragma omp teams distribute parallel for
10795
for (int i=0;i<numNodes;i++)
108-
refit_init_x<T,D>(Kernel{i},bvh_nodes,refitData,numNodes);
96+
refit_init<T,D>(Kernel{i},bvh_nodes,refitData,numNodes);
10997
}
110-
PING;
11198

112-
113-
#pragma omp target device(ctx->gpuID) is_device_ptr(bvh_nodes)
114-
for (int i=0;i<numNodes;i++)
115-
if (bvh_nodes[i].admin.count != 0 && bvh_nodes[i].admin.offset < 0)
116-
printf("REFIT INVALID OFFSET IN FINAL NODE %i\n",i);
117-
118-
119-
PING;
12099
{
121-
#if 0
122-
int nb = 1;//128;
123-
#pragma omp target teams num_teams(nb) device(ctx->gpuID) is_device_ptr(bvh_primIDs) is_device_ptr(bvh_nodes) is_device_ptr(refitData) is_device_ptr(boxes)
124-
{
125-
int team = omp_get_team_num();
126-
int nteams = omp_get_num_teams();
127-
int beg = ((team+0)*numNodes)/nteams;
128-
int end = ((team+1)*numNodes)/nteams;
129-
for (int i=beg;i<end;i++)
130-
refit_run_x(Kernel{i},//bvh,
131-
bvh_primIDs,bvh_nodes,refitData,boxes,numNodes);
132-
}
133-
nb = nb;
134-
}
135-
#else
136100
#pragma omp target device(ctx->gpuID) is_device_ptr(bvh_primIDs) is_device_ptr(bvh_nodes) is_device_ptr(refitData) is_device_ptr(boxes)
137101
#pragma omp teams distribute parallel for
138102
for (int i=0;i<numNodes;i++)
139-
refit_run_x(Kernel{i},//bvh,
103+
refit_run(Kernel{i},bvh,
140104
bvh_primIDs,bvh_nodes,refitData,boxes,numNodes);
141105
}
142-
#endif
143-
PING;
144106
ctx->free((void*)refitData);
145107
}
146108

cuBQL/builder/omp/spatialMedian.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,6 @@ namespace cuBQL {
410410
// ==================================================================
411411
bvh.numNodes = numNodes;
412412
ctx->alloc(bvh.nodes,numNodes);
413-
PING; PRINT(numNodes);
414413
auto bvh_nodes = bvh.nodes;
415414
#pragma omp target device(ctx->gpuID) is_device_ptr(bvh_nodes) is_device_ptr(tempNodes)
416415
#pragma omp teams distribute parallel for

0 commit comments

Comments
 (0)