Space Sim
Loading...
Searching...
No Matches
radix_global.comp
Go to the documentation of this file.
1#version 440
7#define WORKGROUP_SIZE 128
8#define RADIX_SORT_BINS 128
9#define SUBGROUP_SIZE 32
10#define ITERATIONS 8
11
12#define BODY_COUNT 15000
13#define MAX_NODES 45000
14uniform int workgroup_count;
15layout (local_size_x = WORKGROUP_SIZE) in;
16struct MortonEntry
17{
18 uint pid;
19 uint morton;
20};
21layout(std430, binding=2) buffer MortonData {
22
23 MortonEntry entry[];
24};
25layout(std430, binding=3) buffer MortonPingData {
26
27 MortonEntry exit[];
28};
29
30layout(std430, binding=7) buffer RadixData {
31
32 uint local_prefix[5000 * WORKGROUP_SIZE];
33 uint local_offsets[BODY_COUNT];
34 uint block_bin_count[5000 *RADIX_SORT_BINS];
35 uint global_offsets[5000 * RADIX_SORT_BINS];
36 uint local_bin_count[5000*RADIX_SORT_BINS];
37};
38
39shared uint temp[RADIX_SORT_BINS];
42
43void main()
44{
45
46 uint id = gl_GlobalInvocationID.x;
47 int a = 0;
48
49 if (id >= RADIX_SORT_BINS) return;
50 uint sum = 0;
51 if (id < RADIX_SORT_BINS)
52 {
53
54 for (int wg = 0; wg < workgroup_count; wg++) {
55 global_offsets[wg * RADIX_SORT_BINS + id] = sum;
56 sum += block_bin_count[wg * RADIX_SORT_BINS + id];
57 }
58 bin_total[id] = sum;
59 }
60 memoryBarrier();
61 barrier();
62 if (id == 0 && id < RADIX_SORT_BINS)
63 {
64 uint running = 0;
65
66 for (int b = 0; b < RADIX_SORT_BINS; b++)
67 {
69 running += bin_total[b];
70 }
71 }
72 memoryBarrier();
73 barrier();
74 if (id < RADIX_SORT_BINS)
75 {
76 for (int wg = 0; wg < workgroup_count; wg++) {
77 global_offsets[wg * RADIX_SORT_BINS + id] += bin_offset[id];
78 }
79
80 }
81
82
83}
layout(local_size_x=16, local_size_y=16, local_size_z=1) in
#define RADIX_SORT_BINS
Definition com22.comp:9
int main(int argc, char *argv[])
Definition main.c:1726
int running
Definition main.c:219
Definition bounds.comp:30
uint morton(uint x, uint y, uint z)
Definition morton.comp:68
uniform int workgroup_count
shared uint temp[RADIX_SORT_BINS]
shared uint bin_offset[RADIX_SORT_BINS]
shared uint bin_total[RADIX_SORT_BINS]
#define WORKGROUP_SIZE
Definition types.h:171
#define BODY_COUNT
Definition types.h:39