MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / enableDLA

Function enableDLA

samples/common/common.h:593–617  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

591}
592
593inline void enableDLA(
594 nvinfer1::IBuilder* builder, nvinfer1::IBuilderConfig* config, int useDLACore, bool allowGPUFallback = true)
595{
596 if (useDLACore >= 0)
597 {
598 if (builder->getNbDLACores() == 0)
599 {
600 std::cerr << "Trying to use DLA core " << useDLACore << " on a platform that doesn't have any DLA cores"
601 << std::endl;
602 assert("Error: use DLA core on a platfrom that doesn't have any DLA cores" && false);
603 }
604 if (allowGPUFallback)
605 {
606 config->setFlag(nvinfer1::BuilderFlag::kGPU_FALLBACK);
607 }
608 if (!config->getFlag(nvinfer1::BuilderFlag::kINT8))
609 {
610 // User has not requested INT8 Mode.
611 // By default run in FP16 mode. FP32 mode is not permitted.
612 config->setFlag(nvinfer1::BuilderFlag::kFP16);
613 }
614 config->setDefaultDeviceType(nvinfer1::DeviceType::kDLA);
615 config->setDLACore(useDLACore);
616 }
617}
618
619inline int32_t parseDLA(int32_t argc, char** argv)
620{

Callers 5

constructNetworkMethod · 0.85
constructNetworkMethod · 0.85
buildMethod · 0.85
constructNetworkMethod · 0.85
constructNetworkMethod · 0.85

Calls 5

setFlagMethod · 0.80
getFlagMethod · 0.80
setDefaultDeviceTypeMethod · 0.80
getNbDLACoresMethod · 0.45
setDLACoreMethod · 0.45

Tested by

no test coverage detected