aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/compute/skc/platforms/cl_12/composition_cl_12.h
blob: a6368d2bad4dc128e751f92ed10bbf606b7d5e5a (plain)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
 * Copyright 2017 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can
 * be found in the LICENSE file.
 *
 */

#pragma once

//
//
//

#include <CL/opencl.h>

#include "composition.h"
#include "assert_state.h"
#include "grid.h"
#include "extent_cl_12.h"
#include "extent_ring.h"

//
// composition states
//

typedef enum skc_composition_state_e {

  SKC_COMPOSITION_STATE_UNSEALING,
  SKC_COMPOSITION_STATE_UNSEALED,
  SKC_COMPOSITION_STATE_SEALING,
  SKC_COMPOSITION_STATE_SEALED

} skc_composition_state_e;

//
// IMPL
//

struct skc_composition_impl
{
  struct skc_composition        * composition;
  struct skc_runtime            * runtime;

  SKC_ASSERT_STATE_DECLARE(skc_composition_state_e);

  skc_int                         lock_count; // wip renders

  struct {
    skc_grid_t                    place;
    skc_grid_t                    sort;
  } grids;

  cl_command_queue                cq;

  struct {
    cl_kernel                     place;
    cl_kernel                     segment;
  } kernels;

  // raster ids must be held until the composition is reset or
  // released and then their refcounts can be decremented
  struct {
    struct skc_extent_phrw        extent;
    skc_uint                      count;
  } saved;

  struct {
    struct skc_extent_ring        ring;   // how many slots left?
    struct skc_extent_phw1g_tdrNs extent; // wip command extent
  } cmds;

  // composition extent length
  struct skc_extent_phr_pdrw      atomics;

  // composition ttck extent
  struct skc_extent_pdrw          keys;

  // key offsets in sealed and sorted ttck extent
  struct skc_extent_pdrw          offsets;
};

//
// ATOMICS
//

struct skc_place_atomics
{
  skc_uint keys;
  skc_uint offsets;
};

//
// ONLY VISIBLE WITHIN THIS RUNTIME
//

void
skc_composition_retain_and_lock(struct skc_composition * const composition);

void
skc_composition_unlock_and_release(struct skc_composition * const composition);

//
//
//