1/**
2 * Copyright (c) Glow Contributors. See CONTRIBUTORS file.
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_LLVMIRCODEGEN_LIBJIT_LIBJIT_DIM_T_H
17#define GLOW_LLVMIRCODEGEN_LIBJIT_LIBJIT_DIM_T_H
18
19/// \file libjit_dim_t.h
20/// This file is directly copied from glow/Base/DimType.h to simplify the build
21/// system.
22
23#include <cinttypes>
24#include <cstddef>
25#include <cstdint>
26
27#ifdef DIM_T_32
28// The dimensions of Tensors are stored with this type. Note: The same
29// fixed width type is used both in the host and the possible co-processors
30// handling tensor data. The bit width should be chosen carefully for maximum
31// data level parallel execution.
32using dim_t = uint32_t;
33using sdim_t = int32_t;
34
35#define PRIdDIM PRId32
36#define PRIuDIM PRIu32
37
38#else // DIM_T_32
39using dim_t = uint64_t;
40using sdim_t = int64_t;
41
42#define PRIdDIM PRId64
43#define PRIuDIM PRIu64
44
45#endif // DIM_T_32
46
47constexpr unsigned DIM_T_BITWIDTH = sizeof(dim_t) * 8;
48constexpr unsigned SDIM_T_BITWIDTH = sizeof(sdim_t) * 8;
49
50#endif // GLOW_LLVMIRCODEGEN_LIBJIT_LIBJIT_DIM_T_H
51