Skip to content

Commit db6d324

Browse files
committed
addressed upstream comments-2
1 parent 64b9fcf commit db6d324

File tree

8 files changed

+12
-14
lines changed

8 files changed

+12
-14
lines changed

include/tvm/ir/memory_pools.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ class WorkspacePoolInfo : public PoolInfo {
234234

235235
/*
236236
* \brief The ConstantInfoNode contains numeric literal in RO pool
237-
* Used in initialisation of RO memory
237+
* Used to initialise RO memory in ConstantPoolInfo
238238
*/
239239
struct ConstantInfoNode : public Object {
240240
String name_hint;

include/tvm/runtime/metadata_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ struct TVMConstantInfo {
9696
const char* name_hint;
9797
/*! \brief Offset in bytes of the constant */
9898
int64_t byte_offset;
99-
/*! \brief lenght of the data_bytes field */
99+
/*! \brief length of the data_bytes field */
100100
int64_t data_len;
101101
/*! \brief data bytes of serialized NDArray */
102102
const void* data_bytes;

python/tvm/ir/memory_pools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def __init__(
217217
@register_object("ir.ConstantPoolInfo")
218218
class ConstantPoolInfo(PoolInfo):
219219
"""ConstantPoolInfo object holds information related to RO memory pools
220-
where the statically sized allocate nodes will pooled into.
220+
where the statically sized allocate nodes are pooled into.
221221
222222
Parameters
223223
----------

python/tvm/relay/build_module.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ def _make_executor(self, expr=None):
652652
# generated code.
653653
temp_so_dir = contrib_utils.TempDirectory()
654654
temp_so = temp_so_dir / "temp.so"
655-
mod.export_library(temp_so, cc="gcc", options=["-std=c++11"])
655+
mod.export_library(temp_so, cc="gcc", options=["-std=c11"])
656656

657657
mod = load_module(temp_so)
658658
aot_mod = mod["default"](self.device)

src/target/llvm/codegen_cpu.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,7 @@ class MetadataSerializerLLVM : public AttrVisitor {
11031103
llvm::ConstantInt::get(llvm_types_->t_uint8, value->lanes(), false /* isSigned */)}));
11041104
}
11051105

1106-
// Serialiding NDArray as tuple of len, data
1106+
// Serializing NDArray as tuple of len, data
11071107
void Visit(const char* key, runtime::NDArray* value) final {
11081108
std::string bytes;
11091109
dmlc::MemoryStringStream stream(&bytes);

src/tir/usmp/analysis/extract_buffer_info.cc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -574,9 +574,8 @@ BufferInfoAnalysis BufferInfoExtractor::operator()(const PrimFunc& main_func) {
574574
}
575575

576576
// All ConstantPoolInfo items should have conflicts with each other
577-
// as they will be placed in RO segment and pre-initialized
578-
579-
// split buffers to vars (WorkspacePoolInfo items) and constants (ConstantPoolInfo items)
577+
// as they will be placed in RO segment and pre-initialized. To achieve this
578+
// first, split buffers to vars (WorkspacePoolInfo items) and constants (ConstantPoolInfo items):
580579
Array<BufferInfo> buffer_info_vars;
581580
Array<BufferInfo> buffer_info_constants;
582581
for (const auto& kv : this->buffer_info_map_) {
@@ -591,7 +590,7 @@ BufferInfoAnalysis BufferInfoExtractor::operator()(const PrimFunc& main_func) {
591590
<< "missing value";
592591

593592
Map<ObjectRef, ObjectRef> srch;
594-
// intersect with each other, as all constants should exist at the same time
593+
// Then intersect constants with each other, as all constants should exist at the same time:
595594
for (const auto& buf : buffer_info_constants) {
596595
srch.Set(buf, buf);
597596
Array<ObjectRef> conflicts;
@@ -600,7 +599,7 @@ BufferInfoAnalysis BufferInfoExtractor::operator()(const PrimFunc& main_func) {
600599
buf->conflicts.Assign(conflicts.begin(), conflicts.end());
601600
}
602601

603-
// remove all conflicts with constants
602+
// And third, remove all conflicts between constants and vars:
604603
for (const auto& buf : buffer_info_vars) {
605604
Array<ObjectRef> conflicts;
606605
std::copy_if(buf->conflicts.begin(), buf->conflicts.end(), std::back_inserter(conflicts),

src/tir/usmp/transform/convert_pool_allocations_to_offsets.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class PoolAllocationToOffsetConverter : public StmtExprMutator {
6262
AllocateConst allocate_const_node = Downcast<AllocateConst>(kv.first);
6363
extent_size = CalculateExtentsSize(allocate_const_node.operator->());
6464
} else {
65-
LOG(FATAL) << "Not supported node type " << kv.first->GetTypeKey();
65+
ICHECK(false) << "Not supported node type " << kv.first->GetTypeKey();
6666
}
6767
PoolAllocation pool_allocation = kv.second;
6868
PoolInfo pool_info = pool_allocation->pool_info;

tests/python/relay/aot/test_cpp_aot.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def @main(%data : Tensor[(1, 3, 64, 64), uint8], %weight : Tensor[(3, 3, 5, 5),
108108
)
109109
temp_dir = tvm.contrib.utils.TempDirectory()
110110
test_so_path = temp_dir / "test.so"
111-
mod.export_library(test_so_path, cc="gcc", options=["-std=c++11", "-g3", "-O0"])
111+
mod.export_library(test_so_path, cc="gcc", options=["-std=c11", "-g3", "-O0"])
112112
loaded_mod = tvm.runtime.load_module(test_so_path)
113113
runner = tvm.runtime.executor.AotModule(loaded_mod["default"](tvm.cpu(0)))
114114
runner.set_input(**inputs)
@@ -190,8 +190,7 @@ def test_pass_wrong_device_arg():
190190

191191
temp_dir = tvm.contrib.utils.TempDirectory()
192192
test_so_path = temp_dir / "test.so"
193-
# gnu++14 is used due to '0x1p-0' issue
194-
mod.export_library(test_so_path, cc="c++", options=["-std=gnu++14", "-g3", "-O0"])
193+
mod.export_library(test_so_path, cc="gcc", options=["-std=c11", "-g3", "-O0"])
195194
loaded_mod = tvm.runtime.load_module(test_so_path)
196195

197196
with pytest.raises(tvm.TVMError) as error:

0 commit comments

Comments
 (0)