Skip to content

Commit 69986fe

Browse files
Removed all default constructors, added license, comments
1 parent 2475a90 commit 69986fe

File tree

1 file changed

+38
-8
lines changed

1 file changed

+38
-8
lines changed

libtensor/include/usm_array.hpp

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
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+
125
#pragma once
226

327
#include "dpctl_sycl_types.h"
@@ -9,7 +33,16 @@ namespace usm_array
933
class strided_array
1034
{
1135
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+
*/
1346
explicit strided_array(char *ptr, int nd, size_t *shape, int typenum)
1447
: ptr_(ptr), nd_(nd), shape_(shape), typenum_(typenum){};
1548
explicit strided_array(char *ptr,
@@ -27,9 +60,6 @@ class strided_array
2760
int flags)
2861
: ptr_(ptr), nd_(nd), shape_(shape), strides_(strides),
2962
typenum_(typenum), flags_(flags){};
30-
strided_array(const strided_array &other) = default;
31-
strided_array(strided_array &&other) = default;
32-
~strided_array() = default;
3363

3464
// member access functions
3565
char *get_data_ptr() const
@@ -78,6 +108,10 @@ class strided_array
78108
class usm_array : public strided_array
79109
{
80110
public:
111+
/*
112+
* usm_array additionally carries DPCTLSyclQueueRef
113+
* recording Sycl context the data USM pointer is bound to
114+
*/
81115
explicit usm_array(char *data,
82116
int nd,
83117
size_t *shape,
@@ -87,10 +121,6 @@ class usm_array : public strided_array
87121
DPCTLSyclQueueRef qref)
88122
: strided_array(data, nd, shape, strides, typenum, flags), q_(qref){};
89123

90-
usm_array(const usm_array &other) = default;
91-
usm_array(usm_array &&other) = default;
92-
~usm_array() = default;
93-
94124
DPCTLSyclQueueRef get_queue_ref() const
95125
{
96126
return q_;

0 commit comments

Comments
 (0)