Skip to content

Commit a6f4910

Browse files
author
Dmitry Kozlov
committed
Make it compile on ROCm
1 parent 1ec10ef commit a6f4910

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

RadeonRays/src/kernels/CL/intersect_bvh2_lds.cl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ KERNEL void intersect_main(
7575
// Hit data
7676
GLOBAL Intersection *hits)
7777
{
78+
__local uint lds_stack[GROUP_SIZE * LDS_STACK_SIZE];
79+
7880
uint index = get_global_id(0);
7981
uint local_index = get_local_id(0);
8082

@@ -85,8 +87,6 @@ KERNEL void intersect_main(
8587

8688
if (ray_is_active(&my_ray))
8789
{
88-
__local uint lds_stack[GROUP_SIZE * LDS_STACK_SIZE];
89-
9090
const float3 invDir = safe_invdir(my_ray);
9191
const float3 oxInvDir = -my_ray.o.xyz * invDir;
9292

@@ -231,6 +231,8 @@ KERNEL void occluded_main(
231231
// Hit results: 1 for hit and -1 for miss
232232
GLOBAL int *hits)
233233
{
234+
__local uint lds_stack[GROUP_SIZE * LDS_STACK_SIZE];
235+
234236
uint index = get_global_id(0);
235237
uint local_index = get_local_id(0);
236238

@@ -241,8 +243,6 @@ KERNEL void occluded_main(
241243

242244
if (ray_is_active(&my_ray))
243245
{
244-
__local uint lds_stack[GROUP_SIZE * LDS_STACK_SIZE];
245-
246246
const float3 invDir = safe_invdir(my_ray);
247247
const float3 oxInvDir = -my_ray.o.xyz * invDir;
248248

RadeonRays/src/kernels/CL/intersect_bvh2_lds_fp16.cl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ KERNEL void intersect_main(
140140
// Hit data
141141
GLOBAL Intersection *hits)
142142
{
143+
__local uint lds_stack[GROUP_SIZE * LDS_STACK_SIZE];
144+
143145
uint index = get_global_id(0);
144146
uint local_index = get_local_id(0);
145147

@@ -150,8 +152,6 @@ KERNEL void intersect_main(
150152

151153
if (ray_is_active(&my_ray))
152154
{
153-
__local uint lds_stack[GROUP_SIZE * LDS_STACK_SIZE];
154-
155155
// Precompute inverse direction and origin / dir for bbox testing
156156
const float3 invDir32 = safe_invdir2(my_ray);
157157
const half3 invDir = convert_half3(invDir32);
@@ -319,6 +319,8 @@ KERNEL void occluded_main(
319319
// Hit results: 1 for hit and -1 for miss
320320
GLOBAL int *hits)
321321
{
322+
__local uint lds_stack[GROUP_SIZE * LDS_STACK_SIZE];
323+
322324
uint index = get_global_id(0);
323325
uint local_index = get_local_id(0);
324326

@@ -329,8 +331,6 @@ KERNEL void occluded_main(
329331

330332
if (ray_is_active(&my_ray))
331333
{
332-
__local uint lds_stack[GROUP_SIZE * LDS_STACK_SIZE];
333-
334334
// Precompute inverse direction and origin / dir for bbox testing
335335
const float3 invDir32 = safe_invdir2(my_ray);
336336
const half3 invDir = convert_half3(invDir32);

RadeonRays/src/kernels/CL/intersect_bvh2_short_stack.cl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ occluded_main(
142142
GLOBAL int* hits
143143
)
144144
{
145+
// Allocate stack in LDS
146+
__local int lds[SHORT_STACK_SIZE * WAVEFRONT_SIZE];
147+
145148
int global_id = get_global_id(0);
146149
int local_id = get_local_id(0);
147150
int group_id = get_group_id(0);
@@ -156,8 +159,7 @@ occluded_main(
156159
// Allocate stack in global memory
157160
__global int* gm_stack_base = stack + (group_id * WAVEFRONT_SIZE + local_id) * GLOBAL_STACK_SIZE;
158161
__global int* gm_stack = gm_stack_base;
159-
// Allocate stack in LDS
160-
__local int lds[SHORT_STACK_SIZE * WAVEFRONT_SIZE];
162+
161163
__local int* lm_stack_base = lds + local_id;
162164
__local int* lm_stack = lm_stack_base;
163165

@@ -293,6 +295,9 @@ KERNEL void intersect_main(
293295
// Hit data
294296
GLOBAL Intersection* hits)
295297
{
298+
// Allocate stack in LDS
299+
__local int lds[SHORT_STACK_SIZE * WAVEFRONT_SIZE];
300+
296301
int global_id = get_global_id(0);
297302
int local_id = get_local_id(0);
298303
int group_id = get_group_id(0);
@@ -307,8 +312,6 @@ KERNEL void intersect_main(
307312
// Allocate stack in global memory
308313
__global int* gm_stack_base = stack + (group_id * WAVEFRONT_SIZE + local_id) * GLOBAL_STACK_SIZE;
309314
__global int* gm_stack = gm_stack_base;
310-
// Allocate stack in LDS
311-
__local int lds[SHORT_STACK_SIZE * WAVEFRONT_SIZE];
312315
__local int* lm_stack_base = lds + local_id;
313316
__local int* lm_stack = lm_stack_base;
314317

0 commit comments

Comments
 (0)