1/**
2 * Copyright (c) 2017-present, Facebook, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#ifndef GLOW_DIMENSION_TYPE_H
17#define GLOW_DIMENSION_TYPE_H
18
19#include <cinttypes>
20#include <cstddef>
21#include <cstdint>
22
23namespace glow {
24
25#ifdef DIM_T_32
26// The dimensions of Tensors are stored with this type. Note: The same
27// fixed width type is used both in the host and the possible co-processors
28// handling tensor data. The bit width should be chosen carefully for maximum
29// data level parallel execution.
30using dim_t = uint32_t;
31using sdim_t = int32_t;
32
33#define PRIdDIM PRId32
34#define PRIuDIM PRIu32
35
36#else // DIM_T_32
37using dim_t = uint64_t;
38using sdim_t = int64_t;
39
40#define PRIdDIM PRId64
41#define PRIuDIM PRIu64
42
43#endif // DIM_T_32
44
45constexpr unsigned DIM_T_BITWIDTH = sizeof(dim_t) * 8;
46constexpr unsigned SDIM_T_BITWIDTH = sizeof(sdim_t) * 8;
47
48} // namespace glow
49
50#endif
51