|
| 1 | +/* |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | + * or more contributor license agreements. See the NOTICE file |
| 4 | + * distributed with this work for additional information |
| 5 | + * regarding copyright ownership. The ASF licenses this file |
| 6 | + * to you under the Apache License, Version 2.0 (the |
| 7 | + * "License"); you may not use this file except in compliance |
| 8 | + * with the License. You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, |
| 13 | + * software distributed under the License is distributed on an |
| 14 | + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | + * KIND, either express or implied. See the License for the |
| 16 | + * specific language governing permissions and limitations |
| 17 | + * under the License. |
| 18 | + */ |
| 19 | + |
| 20 | +/*! |
| 21 | + * \file tvm/relax/attrs/memory.h |
| 22 | + * \brief Attributes for memory operators. |
| 23 | + */ |
| 24 | +#ifndef TVM_RELAX_ATTRS_MEMORY_H_ |
| 25 | +#define TVM_RELAX_ATTRS_MEMORY_H_ |
| 26 | + |
| 27 | +#include <tvm/ir/attrs.h> |
| 28 | + |
| 29 | +namespace tvm { |
| 30 | +namespace relax { |
| 31 | +/*! |
| 32 | + * \brief Options for allocating storage. |
| 33 | + */ |
| 34 | +struct AllocStorageAttrs : public tvm::AttrsNode<AllocStorageAttrs> { |
| 35 | + DataType dtype; |
| 36 | + int device_id; |
| 37 | + int device_type; |
| 38 | + |
| 39 | + TVM_DECLARE_ATTRS(AllocStorageAttrs, "relax.attrs.AllocStorageAttrs") { |
| 40 | + TVM_ATTR_FIELD(dtype) |
| 41 | + .describe("The dtype of the tensor to allocate.") |
| 42 | + .set_default(DataType::Float(32, 1)); |
| 43 | + TVM_ATTR_FIELD(device_id).describe("The device id on which to allocate memory."); |
| 44 | + TVM_ATTR_FIELD(device_type).describe("The device type on which to allocate memory."); |
| 45 | + } |
| 46 | +}; |
| 47 | + |
| 48 | +/*! |
| 49 | + * \brief Options for allocating tensors. |
| 50 | + */ |
| 51 | +struct AllocTensorAttrs : public tvm::AttrsNode<AllocTensorAttrs> { |
| 52 | + DataType dtype; |
| 53 | + |
| 54 | + TVM_DECLARE_ATTRS(AllocTensorAttrs, "relax.attrs.AllocTensorAttrs") { |
| 55 | + TVM_ATTR_FIELD(dtype) |
| 56 | + .describe("The dtype of the tensor to allocate.") |
| 57 | + .set_default(DataType::Float(32, 1)); |
| 58 | + } |
| 59 | +}; |
| 60 | + |
| 61 | +} // namespace relax |
| 62 | +} // namespace tvm |
| 63 | +#endif // TVM_RELAX_ATTRS_MEMORY_H_ |
0 commit comments