Skip to content

Commit 5c646a3

Browse files
committed
refdctor: Changed the hardcoded values to macros
Signed-off-by: Anurag Dixit <[email protected]>
1 parent da7569e commit 5c646a3

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

core/conversion/conversionctx/ConversionCtx.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,13 @@ ConversionCtx::ConversionCtx(BuilderSettings build_settings)
124124
settings.enabled_precisions.find(nvinfer1::DataType::kFLOAT) == settings.enabled_precisions.end(),
125125
"DLA supports only fp16 or int8 precision");
126126
cfg->setDLACore(settings.device.dla_core);
127-
if (settings.dla_sram_size != 1048576) {
127+
if (settings.dla_sram_size != DLA_SRAM_SIZE) {
128128
cfg->setMemoryPoolLimit(nvinfer1::MemoryPoolType::kDLA_MANAGED_SRAM, settings.dla_sram_size);
129129
}
130-
if (settings.dla_local_dram_size != 1073741824) {
130+
if (settings.dla_local_dram_size != DLA_LOCAL_DRAM_SIZE) {
131131
cfg->setMemoryPoolLimit(nvinfer1::MemoryPoolType::kDLA_LOCAL_DRAM, settings.dla_local_dram_size);
132132
}
133-
if (settings.dla_global_dram_size != 536870912) {
133+
if (settings.dla_global_dram_size != DLA_GLOBAL_DRAM_SIZE) {
134134
cfg->setMemoryPoolLimit(nvinfer1::MemoryPoolType::kDLA_GLOBAL_DRAM, settings.dla_global_dram_size);
135135
}
136136
}

core/conversion/conversionctx/ConversionCtx.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
#include <cuda_runtime.h>
1212
#include "core/util/prelude.h"
1313

14+
#define DLA_SRAM_SIZE 1048576
15+
#define DLA_LOCAL_DRAM_SIZE 1073741824
16+
#define DLA_GLOBAL_DRAM_SIZE 536870912
17+
1418
namespace torch_tensorrt {
1519
namespace core {
1620
namespace conversion {
@@ -35,9 +39,9 @@ struct BuilderSettings {
3539
nvinfer1::IInt8Calibrator* calibrator = nullptr;
3640
uint64_t num_avg_timing_iters = 1;
3741
uint64_t workspace_size = 0;
38-
uint64_t dla_sram_size = 1048576;
39-
uint64_t dla_local_dram_size = 1073741824;
40-
uint64_t dla_global_dram_size = 536870912;
42+
uint64_t dla_sram_size = DLA_SRAM_SIZE;
43+
uint64_t dla_local_dram_size = DLA_LOCAL_DRAM_SIZE;
44+
uint64_t dla_global_dram_size = DLA_GLOBAL_DRAM_SIZE;
4145

4246
BuilderSettings() = default;
4347
BuilderSettings(const BuilderSettings& other) = default;

0 commit comments

Comments
 (0)