1
+ // ===----------- usm_array.hpp - class representing an array -*-C++-*- ===//
2
+ //
3
+ // Data Parallel Control (dpctl)
4
+ //
5
+ // Copyright 2020-2021 Intel Corporation
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ // ===----------------------------------------------------------------------===//
20
+ // /
21
+ // / \file
22
+ // / This file defines classes for strided_array, and usm_array
23
+ // ===----------------------------------------------------------------------===//
24
+
1
25
#pragma once
2
26
3
27
#include " dpctl_sycl_types.h"
@@ -9,7 +33,16 @@ namespace usm_array
9
33
class strided_array
10
34
{
11
35
public:
12
- strided_array () {}
36
+ /* strided_array is data only class encapsulating information about
37
+ * type homogeneous nd-array.
38
+ * ptr : pointer to memory block storing array values
39
+ * nd : number of indices needed to reference an array element
40
+ * shape : pointer to C-array of length `nd` of array dimensions
41
+ * strides : pointer to C-array of length `nd` of memory displacements
42
+ * for unit increment of each index
43
+ * typenum : an integer (enum), encoding value type of array elements
44
+ * flags : field to encode additional array attributes
45
+ */
13
46
explicit strided_array (char *ptr, int nd, size_t *shape, int typenum)
14
47
: ptr_(ptr), nd_(nd), shape_(shape), typenum_(typenum){};
15
48
explicit strided_array (char *ptr,
@@ -27,9 +60,6 @@ class strided_array
27
60
int flags)
28
61
: ptr_(ptr), nd_(nd), shape_(shape), strides_(strides),
29
62
typenum_(typenum), flags_(flags){};
30
- strided_array (const strided_array &other) = default ;
31
- strided_array (strided_array &&other) = default ;
32
- ~strided_array () = default ;
33
63
34
64
// member access functions
35
65
char *get_data_ptr () const
@@ -78,6 +108,10 @@ class strided_array
78
108
class usm_array : public strided_array
79
109
{
80
110
public:
111
+ /*
112
+ * usm_array additionally carries DPCTLSyclQueueRef
113
+ * recording Sycl context the data USM pointer is bound to
114
+ */
81
115
explicit usm_array (char *data,
82
116
int nd,
83
117
size_t *shape,
@@ -87,10 +121,6 @@ class usm_array : public strided_array
87
121
DPCTLSyclQueueRef qref)
88
122
: strided_array(data, nd, shape, strides, typenum, flags), q_(qref){};
89
123
90
- usm_array (const usm_array &other) = default ;
91
- usm_array (usm_array &&other) = default ;
92
- ~usm_array () = default ;
93
-
94
124
DPCTLSyclQueueRef get_queue_ref () const
95
125
{
96
126
return q_;
0 commit comments